This commit is contained in:
shilixia 2021-08-13 10:46:12 +08:00
parent 63320da683
commit c181b375ed
1 changed files with 22 additions and 2 deletions

View File

@ -50,9 +50,12 @@
</el-table-column>
<el-table-column label="购置日期">
<template slot-scope="scope">{{ scope.row.buy_date }}</template>
</el-table-column>
<el-table-column label="所属部门">
<template slot-scope="scope" v-if="scope.row.belong_dept_">{{ scope.row.belong_dept_.name }}</template>
</el-table-column>
<el-table-column label="保管人">
<template slot-scope="scope">{{ scope.row.keeper_.username }}</template>
<template slot-scope="scope" v-if="scope.row.keeper_">{{ scope.row.keeper_.username }}</template>
</el-table-column>
<el-table-column label="存放位置">
<template slot-scope="scope">{{ scope.row.place }}</template>
@ -153,7 +156,10 @@
<el-form-item label="存放位置" prop="place">
<el-input v-model="equipment.place" placeholder="存放位置" />
</el-form-item>
<el-form-item label="所属部门" prop="belong_dept">
<el-cascader :options="depOptions" :props="{ checkStrictly: true,emitPath:false }" ref="demoCascader" style="width:100%" v-model="equipment.belong_dept"></el-cascader>
</el-form-item>
<el-form-item label="保管人" prop="keeper">
<el-select
@ -173,6 +179,7 @@
</el-form-item>
<el-form-item label="设备备注" prop="description">
<el-input
type="textarea"
@ -192,8 +199,10 @@
<script>
import { getpEquipmentList, createEquipment,updateEquipment,deleteEquipment } from "@/api/equipment";
import { getUserList } from "@/api/user";
import { getOrgList } from "@/api/org";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultequipment = {
@ -223,6 +232,7 @@ export default {
page_size: 20,
},
keeperOptions:[],
depOptions:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
@ -231,6 +241,7 @@ export default {
number: [{ required: true, message: "请输入", trigger: "blur" }],
model: [{ required: true, message: "请输入", trigger: "blur" }],
state: [{ required: true, message: "请选择", trigger: "blur" }],
belong_dept:[{ required: true, message: "请选择", trigger: "blur" }]
},
};
},
@ -239,6 +250,7 @@ export default {
created() {
this.getList();
this.getUserList();
this.getOrgList();
},
methods: {
checkPermission,
@ -258,6 +270,14 @@ export default {
this.keeperOptions = genTree(res.data.results);
});
},
//部门列表
getOrgList() {
getOrgList({pageoff:true}).then((res) => {
this.depOptions = genTree(res.data);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();