|
|
|
@ -4,8 +4,11 @@
|
|
|
|
|
<el-row :hidden="!search" style="padding:6px 18px"> |
|
|
|
|
<!-- 查询模块 --> |
|
|
|
|
<el-form :inline="true" :model="query"> |
|
|
|
|
<el-form-item label="归属部门:"> |
|
|
|
|
<el-input v-model="query.department" placeholder="请输入归属部门"></el-input> |
|
|
|
|
<el-form-item label="仓库名称:"> |
|
|
|
|
<el-input v-model="query.warehouseName" placeholder="请输入仓库名称"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="班组名称:"> |
|
|
|
|
<el-input v-model="query.groupName" placeholder="请输入班组名称"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<!-- 查询按钮 --> |
|
|
|
|
<el-form-item> |
|
|
|
@ -77,24 +80,41 @@
|
|
|
|
|
<!-- 表单模块 --> |
|
|
|
|
<el-dialog :title="title" |
|
|
|
|
v-model="box" |
|
|
|
|
width="50%" |
|
|
|
|
width="40%" |
|
|
|
|
:before-close="beforeClose" |
|
|
|
|
append-to-body> |
|
|
|
|
<el-form :disabled="view" ref="form" :model="form" label-width="80px"> |
|
|
|
|
<el-form :disabled="view" ref="form" :model="form" :rules="rules" label-width="80px"> |
|
|
|
|
<!-- 表单字段 --> |
|
|
|
|
<!-- <el-form-item label="归属部门" prop="department">--> |
|
|
|
|
<!-- <el-select v-model="form.department" clearable placeholder="请选择归属部门" @change="clickDept($event)">--> |
|
|
|
|
<!-- <el-option--> |
|
|
|
|
<!-- v-for="item in departmentData"--> |
|
|
|
|
<!-- :key="item.id"--> |
|
|
|
|
<!-- :label="item.deptName"--> |
|
|
|
|
<!-- :value="item.id">--> |
|
|
|
|
<!-- </el-option>--> |
|
|
|
|
<!-- </el-select>--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<el-form-item label="组名" prop="groupName"> |
|
|
|
|
<el-input v-model="form.groupName" placeholder="请输入组名"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="仓库" prop="belongTo"> |
|
|
|
|
<el-input v-model="form.belongTo" placeholder="请输入仓库"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="班组类型" prop="groupType"> |
|
|
|
|
<el-input v-model="form.groupType" placeholder="请输入班组类型"/> |
|
|
|
|
<!-- <el-input v-model="form.belongTo" placeholder="请输入仓库"/>--> |
|
|
|
|
<el-select v-model="form.belongTo" clearable placeholder="请选择仓库" style="width: 80%" @change="clickWarehouse($event)"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in warehouseList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="归属部门" prop="department"> |
|
|
|
|
<el-select v-model="form.department" clearable placeholder="请选择归属部门"> |
|
|
|
|
<el-form-item label="班组类型" prop="groupTypes"> |
|
|
|
|
<!-- <el-input v-model="form.groupType" placeholder="请输入班组类型"/>--> |
|
|
|
|
<el-select v-model="form.groupTypes" multiple clearable placeholder="请选择班组类型" style="width: 80%"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in departmentData" |
|
|
|
|
v-for="item in teamType" |
|
|
|
|
:key="item.dictKey" |
|
|
|
|
:label="item.dictValue" |
|
|
|
|
:value="item.dictKey"> |
|
|
|
@ -105,7 +125,7 @@
|
|
|
|
|
<!-- 表单按钮 --> |
|
|
|
|
<template #footer> |
|
|
|
|
<span v-if="!view" class="dialog-footer"> |
|
|
|
|
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit">提 交</el-button> |
|
|
|
|
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')">提 交</el-button> |
|
|
|
|
<el-button icon="el-icon-circle-close" @click="box = false">取 消</el-button> |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
@ -118,6 +138,11 @@
|
|
|
|
|
import { getList, getDetail, add, update, remove } from "@/api/basicdata/basicdataTeamGroup"; |
|
|
|
|
import option from "@/option/basicdata/basicdataTeamGroup"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import { getDictionaryBiz } from '@/api/system/dict'; |
|
|
|
|
import { getListUser } from '@/api/distribution/distributionStockup'; |
|
|
|
|
import { getDept,getLazyList } from '@/api/system/dept'; |
|
|
|
|
import { getDeptWarehouse } from '@/api/basicdata/basicdataWarehouse'; |
|
|
|
|
import { getUserDetail } from '@/api/system/user'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data () { |
|
|
|
@ -143,12 +168,31 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
// 表单数据 |
|
|
|
|
form: {}, |
|
|
|
|
groupType: [], |
|
|
|
|
// 选择行 |
|
|
|
|
selectionList: [], |
|
|
|
|
teamType: [], //班组类型 |
|
|
|
|
departmentData: [], //归属部门 |
|
|
|
|
warehouseList: [], |
|
|
|
|
// 表单配置 |
|
|
|
|
option: option, |
|
|
|
|
// 表单列表 |
|
|
|
|
data: [], |
|
|
|
|
rules: { |
|
|
|
|
groupName: [ |
|
|
|
|
{ required: true, message: '请输入班组名称', trigger: 'blur' }, |
|
|
|
|
], |
|
|
|
|
groupTypes: [ |
|
|
|
|
{ required: true, message: '请选择班组类型', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
department: [ |
|
|
|
|
{ required: true, message: '请选择班组', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
belongTo: [ |
|
|
|
|
{ required: true, message: '请选择仓库', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
@ -166,8 +210,35 @@ export default {
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//点击仓库 |
|
|
|
|
clickWarehouse(row){ |
|
|
|
|
// console.log("进发了仓库",row); |
|
|
|
|
let a = this.warehouseList.find(i => i.id == row); |
|
|
|
|
if(!!a){ |
|
|
|
|
this.form.warehouseName = a.name; |
|
|
|
|
this.form.belongTo = a.id; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//点击部门 |
|
|
|
|
clickDept(row){ |
|
|
|
|
// console.log("进发了部门",row); |
|
|
|
|
let a = this.departmentData.find(i => i.id == row); |
|
|
|
|
if(!!a){ |
|
|
|
|
this.form.departmentName = a.deptName; |
|
|
|
|
this.form.department = a.id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
init () { |
|
|
|
|
this.height = this.setPx(document.body.clientHeight - 340); |
|
|
|
|
getDictionaryBiz('team_type').then(res => { |
|
|
|
|
this.teamType = res.data.data; |
|
|
|
|
// this.checkcColumnList("typeServerName", this.columnList).checkarr=res.data.data.map(item=>{ |
|
|
|
|
// item.value=item.dictKey |
|
|
|
|
// item.label=item.dictValue |
|
|
|
|
// return item |
|
|
|
|
// }); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
searchHide () { |
|
|
|
|
this.search = !this.search; |
|
|
|
@ -180,45 +251,106 @@ export default {
|
|
|
|
|
this.page.currentPage = 1; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
}, |
|
|
|
|
handleSubmit () { |
|
|
|
|
if (!this.form.id) { |
|
|
|
|
add(this.form).then(() => { |
|
|
|
|
this.box = false; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
update(this.form).then(() => { |
|
|
|
|
this.box = false; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handleSubmit (formName) { |
|
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (!this.form.id) { |
|
|
|
|
console.log(">><><<>",this.form); |
|
|
|
|
this.form.groupType = this.form.groupTypes.join(','); |
|
|
|
|
|
|
|
|
|
add(this.form).then(() => { |
|
|
|
|
this.box = false; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
console.log("修改《《《《",this.form); |
|
|
|
|
this.form.groupType = this.form.groupTypes.join(','); |
|
|
|
|
update(this.form).then(() => { |
|
|
|
|
this.box = false; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
console.log('error submit!!'); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
handleAdd () { |
|
|
|
|
this.title = '新增' |
|
|
|
|
this.form = {} |
|
|
|
|
this.box = true |
|
|
|
|
this.box = true; |
|
|
|
|
//查询仓库信息 |
|
|
|
|
this.getWarehouseList(); |
|
|
|
|
}, |
|
|
|
|
async getWarehouseList(){ |
|
|
|
|
let userDept = await getListUser(); |
|
|
|
|
console.log("<><><>",userDept.data.data); |
|
|
|
|
let sole = await getUserDetail(userDept.data.data.userId); |
|
|
|
|
console.log(",....t=用户信息s",sole); |
|
|
|
|
if(sole.data.data.roleName == '管理员'){ |
|
|
|
|
// let dept = await getDept(); |
|
|
|
|
let parentId = 0; |
|
|
|
|
|
|
|
|
|
let lis = await getLazyList(parentId); |
|
|
|
|
console.log("全部部门",lis); |
|
|
|
|
this.departmentData = lis.data.data; |
|
|
|
|
//总部门 |
|
|
|
|
let deptW = await getDeptWarehouse({tenantId: userDept.data.data.tenantId}); |
|
|
|
|
console.log("仓库数据",deptW.data.data); |
|
|
|
|
this.warehouseList = deptW.data.data; |
|
|
|
|
}else{ |
|
|
|
|
//有部门 |
|
|
|
|
let dept = await getDept(userDept.data.data.deptId); |
|
|
|
|
console.log("<><><>",dept.data.data); |
|
|
|
|
// let a = { |
|
|
|
|
// id:dept.data.data.id, |
|
|
|
|
// deptName: dept.data.data.deptName |
|
|
|
|
// } |
|
|
|
|
/* this.departmentData = []; |
|
|
|
|
this.form.department = a.id; |
|
|
|
|
this.form.departmentName = a.deptName; |
|
|
|
|
this.departmentData.push(a);*/ |
|
|
|
|
const da = dept.data.data; |
|
|
|
|
if(!!da.parentId && da.parentId != '0'){ |
|
|
|
|
//有部门的信息 查询仓库 |
|
|
|
|
let deptW = await getDeptWarehouse({department: da.id}); |
|
|
|
|
this.warehouseList = deptW.data.data; |
|
|
|
|
console.log("123123123123",deptW); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
handleEdit (row) { |
|
|
|
|
async handleEdit (row) { |
|
|
|
|
//查询仓库信息 |
|
|
|
|
await this.getWarehouseList(); |
|
|
|
|
this.title = '编辑' |
|
|
|
|
this.box = true |
|
|
|
|
getDetail(row.id).then(res => { |
|
|
|
|
console.log("编码》》》",res.data.data.groupType); |
|
|
|
|
this.form = res.data.data; |
|
|
|
|
this.form.groupTypes = this.form.groupType.split(","); |
|
|
|
|
console.log("<><><>",this.form); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleView (row) { |
|
|
|
|
this.title = '查看' |
|
|
|
|
this.view = true; |
|
|
|
|
this.box = true; |
|
|
|
|
//查询仓库信息 |
|
|
|
|
this.getWarehouseList(); |
|
|
|
|
getDetail(row.id).then(res => { |
|
|
|
|
this.form = res.data.data; |
|
|
|
|
this.form.groupTypes = this.form.groupType.split(","); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleDelete () { |
|
|
|
@ -286,6 +418,30 @@ export default {
|
|
|
|
|
const data = res.data.data; |
|
|
|
|
this.page.total = data.total; |
|
|
|
|
this.data = data.records; |
|
|
|
|
|
|
|
|
|
// this.data = this.data.forEach(e =>{ |
|
|
|
|
// let a = e.groupType.split(','); |
|
|
|
|
// let f = null; |
|
|
|
|
// a.map((i,index) =>{ |
|
|
|
|
// let s = this.teamType.find( l => l.dictKey == i); |
|
|
|
|
// if(!!f){ |
|
|
|
|
// f += s.dictValue + a.length == index ? null : " | "; |
|
|
|
|
// }else{ |
|
|
|
|
// f = s.dictValue+ a.length > 0 ? " | " : null; |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// i.groupTypeName = f; |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
this.data.forEach(e => { |
|
|
|
|
let a = e.groupType.split(','); |
|
|
|
|
let f = a.map((i, index) => { |
|
|
|
|
let s = this.teamType.find(l => l.dictKey === i); |
|
|
|
|
return s ? s.dictValue : ''; |
|
|
|
|
}).filter(Boolean).join(' | '); |
|
|
|
|
e.groupTypeName = f; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.loading = false; |
|
|
|
|
this.selectionClear(); |
|
|
|
|
}); |
|
|
|
|