代码更新

This commit is contained in:
2022-09-30 15:19:09 +08:00
parent c96a961af3
commit 38b68fd258
7 changed files with 194 additions and 18 deletions

View File

@@ -20,6 +20,15 @@
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="使用班组">
<treeselect
v-model="query.dept_id"
:load-options="loadDepts"
:options="depts"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="设备">
<el-input
v-model="query.device_code"
@@ -142,6 +151,7 @@ import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import AddDialog from '@/views/wms/sb/repair/devicerepair/AddDialog'
import { getDepts } from '@/api/system/dept'
export default {
name: 'Devicegridcheck',
@@ -167,6 +177,7 @@ export default {
data() {
return {
classes: [],
depts: [],
class_idStr: null,
materOpt_code: '23',
permission: {
@@ -183,6 +194,7 @@ export default {
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -240,6 +252,32 @@ export default {
this.crud.toQuery()
})
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
}
}
}
</script>