This commit is contained in:
zds
2022-10-17 16:34:18 +08:00
parent 2108c56109
commit 32ded42385
8 changed files with 231 additions and 5 deletions

View File

@@ -29,6 +29,15 @@
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="使用班组">
<treeselect
v-model="query.use_groupid"
:load-options="loadDepts"
:options="depts"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="设备">
<el-input
v-model="query.device_code"
@@ -206,7 +215,8 @@ import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import PicDialog from '@/views/wms/sb/repair/devicerepairrequest/PicDialog'
import DeviceDialog from '@/views/wms/sb/repair/devicevprs/DeviceDialog'
import FaultDialog from '@/views/wms/sb/repair/devicevprs/FaultDialog'
import { getDepts } from '@/api/system/dept'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
const defaultForm = { material_type_id: null, product_person_name: null, device_faultclass_name: null, device_code: null, request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null }
export default {
@@ -266,6 +276,11 @@ export default {
}
}
},
computed: {
...mapGetters({
user: 'user'
})
},
created() {
const param = {
'materOpt_code': this.materOpt_code
@@ -277,6 +292,9 @@ export default {
this.queryClassId()
})
this.getDepts()
this.query.use_groupid = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -401,6 +419,25 @@ export default {
return obj
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}

View File

@@ -29,6 +29,15 @@
@keyup.enter.native="crud.toQuery"
/>
</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-select
v-model="query.maintenancecycle"
@@ -160,6 +169,8 @@ import DateRangePicker from '@/components/DateRangePicker'
import AddDialog from '@/views/wms/sb/upkeep/devicemaintenancegrid/AddDialog'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
import { mapGetters } from 'vuex'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
export default {
name: 'Devicemaintenancegrid',
@@ -185,12 +196,18 @@ export default {
data() {
return {
classes: [],
depts: [],
class_idStr: null,
materOpt_code: '23',
permission: {
}
}
},
computed: {
...mapGetters({
user: 'user'
})
},
created() {
const param = {
'materOpt_code': this.materOpt_code
@@ -201,6 +218,10 @@ export default {
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
this.query.dept_id = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -266,6 +287,51 @@ export default {
this.crud.toQuery()
downloadFile(result, name, 'xlsx')
})
},
// 获取弹窗内部门数据
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
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}

View File

@@ -29,6 +29,15 @@
@keyup.enter.native="crud.toQuery"
/>
</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-select
v-model="query.maintenancecycle"
@@ -184,6 +193,8 @@ import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import DateRangePicker from '@/components/DateRangePicker'
import ExecuteDialog from '@/views/wms/sb/upkeep/devicemaintenancepagrid/ExecuteDialog'
import StartDialog from '@/views/wms/sb/upkeep/devicemaintenancepagrid/StartDialog'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
name: 'Devicemaintenancepagrid',
@@ -213,6 +224,7 @@ export default {
end_flag: true,
confirm_flag: true,
classes: [],
depts: [],
class_idStr: null,
materOpt_code: '23',
openParam: null,
@@ -222,6 +234,11 @@ export default {
}
}
},
computed: {
...mapGetters({
user: 'user'
})
},
created() {
const param = {
'materOpt_code': this.materOpt_code
@@ -232,6 +249,10 @@ export default {
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
this.query.dept_id = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -369,6 +390,51 @@ export default {
this.execu_flag = true
this.end_flag = true
this.confirm_flag = true
},
// 获取弹窗内部门数据
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
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}

View File

@@ -95,7 +95,8 @@ import pagination from '@crud/Pagination'
import crudDevicemaintenanceplanmst from '@/api/wms/sb/devicemaintenanceplanmst'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getDepts } from '@/api/system/dept'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
name: 'Device',
@@ -135,8 +136,16 @@ export default {
}
}
},
computed: {
...mapGetters({
user: 'user'
})
},
created() {
this.getDepts()
this.query.use_id = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
clickChange(item) {
@@ -209,6 +218,25 @@ export default {
return obj
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}