diff --git a/src/api/ma/base.js b/src/api/ma/base.js index 9c3e40ce..b27a734f 100644 --- a/src/api/ma/base.js +++ b/src/api/ma/base.js @@ -12,7 +12,7 @@ export function getMaTypeList(query) { //机具类型管理列表信息 export function getListByMaType(query) { return request({ - url: '/material/ma_type/list', + url: '/material/ma_type/getListByMaType', method: 'get', params: query, }) diff --git a/src/api/ma/typeConfig.js b/src/api/ma/typeConfig.js index d5cc10c9..9106fe45 100644 --- a/src/api/ma/typeConfig.js +++ b/src/api/ma/typeConfig.js @@ -3,7 +3,7 @@ import request from '@/utils/request' //组织人员树类型管理 export function getMatConfigList(query) { return request({ - url: '/material/ma_type_config/getDeptUserTree', + url: '/system/user/deptUserTree', method: 'get', params: query, }) @@ -12,7 +12,7 @@ export function getMatConfigList(query) { //组织人员树类型管理列表 export function getListByMatConfig(query) { return request({ - url: '/material/ma_type_config/getMaTypeConfigList', + url: '/material/ma_type/getMaTypeConfigList', method: 'get', params: query, }) diff --git a/src/views/material/basic/bmUnit/people.vue b/src/views/material/basic/bmUnit/people.vue index c61155ef..db404af7 100644 --- a/src/views/material/basic/bmUnit/people.vue +++ b/src/views/material/basic/bmUnit/people.vue @@ -530,8 +530,6 @@ export default { getUserList({ userName: this.userName ,deptId:0}).then(response => { console.log('response',response) this.deptOptions = response.data - // this.total = response.total; - console.log('response',response) } ); }, diff --git a/src/views/material/ma/supplier/index.vue b/src/views/material/ma/supplier/index.vue index 707c6bb1..09b34740 100644 --- a/src/views/material/ma/supplier/index.vue +++ b/src/views/material/ma/supplier/index.vue @@ -179,7 +179,7 @@ - + - - - - - - - - - @@ -211,7 +189,7 @@ size="mini" type="text" icon="el-icon-edit" - @click="handleUpdate(scope.row)" + @click="handleView(scope.row)" v-hasPermi="['machinery:type:config']" > 查看 @@ -252,7 +230,7 @@ @@ -260,7 +238,7 @@ ref="form" :model="form" :rules="rules" - label-width="100px" + label-width="120px" > @@ -272,7 +250,6 @@ placeholder="请选择仓库信息" style="width: 100%" :disabled="isLevel1Disabled" - @change="keeperDataChange" > - - - + /> - - - + /> - - - + /> - + @@ -372,42 +325,46 @@ - + - + - + - + @@ -415,9 +372,9 @@ - + - + - + - + - + - + @@ -495,9 +452,6 @@ 数量管理 - - - @@ -525,17 +479,18 @@ v-model="form.testCycle" placeholder="请输入" maxlength="20" - style="width: 110px;" + style="width: 150px;" /> - + - + @@ -548,17 +503,17 @@ v-model="form.ratedLoad" placeholder="请输入" maxlength="20" - style="width: 120px;" + style="width: 160px;" /> - + @@ -568,7 +523,7 @@ v-model="form.holdingTime" placeholder="请输入" maxlength="20" - style="width: 120px;" + style="width: 170px;" /> @@ -625,69 +580,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' -import { getUserByRoleList, getMaUserList } from '@/api/system/user' -import { getProLists,getMaTypeList,getListByMaType,getMaType,queryKeeperDataApi,queryKeeperProApi,queryKeeperMatApi,queryKeeperNameApi, +import { getMaTypeList,getListByMaType,getMaType,queryKeeperDataApi,queryKeeperProApi,queryKeeperMatApi,queryKeeperNameApi, delMaType,addMaType,updateMaType } from '@/api/ma/base' -import { imgUpLoad, fileUpLoad } from '@/api/system/upload' -import { getInfo } from '@/api/login' -import { downloadFile } from '@/utils/download' +import { imgUpLoad, } from '@/api/system/upload' + export default { name: 'ToolsType', - // dicts: ['sys_normal_disable', 'sys_user_sex'], components: { Treeselect }, data() { return { @@ -770,9 +659,6 @@ export default { // 库管员用户数据 keeperList: null, keeperDataRange: [], - keeperProRange: [], - keeperMatRange: [], - keeperNameRange: [], //维修员用户数据 repairUserList: null, //资产类型数据 @@ -807,9 +693,12 @@ export default { imageName: '', fileList: [], field101fileList: [], + levelTemp:undefined, + idTemp:undefined, level2Temp:undefined, + level2TempName:undefined, + level1TempName:undefined, level1Temp:undefined, - level3Temp:undefined, uploadUrl: process.env.VUE_APP_BASE_API + '/system', // 上传的图片服务器地址 defaultProps: { children: 'children', @@ -829,72 +718,14 @@ export default { // 表单校验 rules: { - typeName: [ - { - required: true, - message: '设备名称不能为空', - trigger: 'blur', - }, - { - min: 2, - max: 20, - message: '设备名称长度必须介于 2 和 20 之间', - trigger: 'blur', - }, - ], - parentId: [ - { - required: true, - message: '所属上级不能为空', - trigger: 'blur', - }, - ], - manageType: [ - { - required: true, - message: '请选择管理模式', - trigger: 'change', - }, - ], leasePrice: [ { required: true, - message: '内部租赁价格不能为空', + message: '规格型号不能为空', trigger: 'blur', }, ], - buyPrice: [ - { - required: true, - message: '原值不能为空', - trigger: 'blur', - }, - ], - keeperUserId: [ - { - required: true, - message: '库管员不能为空', - trigger: 'change', - }, - ], - // password: [ - // {required: true, message: "用户密码不能为空", trigger: "blur"}, - // {min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur'} - // ], - // email: [ - // { - // type: "email", - // message: "请输入正确的邮箱地址", - // trigger: ["blur", "change"] - // } - // ], - // phonenumber: [ - // { - // pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, - // message: "请输入正确的手机号码", - // trigger: "blur" - // } - // ] + }, companyId: undefined, dialogImageUrl: '', @@ -905,19 +736,6 @@ export default { afterPrice: '', useDate: '', }, - crules: { - leasePrice: [ - { - required: true, - message: '调整后价格不能为空', - trigger: 'blur', - }, - // { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' } - ], - // effTime: [ - // {required: true, message: "开始日期不能为空", trigger: "blur"} - // ], - }, /* 新增弹框等数据源定义 */ addTitleVisible: false, @@ -951,85 +769,11 @@ export default { }, }, created() { - // this.getInfo() this.getList() this.getTreeData() - this.getKeeperDataList() - // this.getUserList() - // this.getPropData() }, methods: { - // getInfo() { - // getInfo().then((res) => { - // console.log(res, 'companyId----') - // this.companyId = res.user.companyId - // }) - // }, - keeperDataChange(e) { - this.keeperDataRange.forEach((item) => { - if (e === item.value) { - this.form.keeperDataPro=undefined - this.form.keeperDataMat=undefined - this.form.keeperDataName=undefined - // 获取工程下拉选 - let keeper = queryKeeperProApi({ - houseId:e, - }).then(projRes =>{ - this.keeperProRange = projRes.data.map((item) => { - return { - label: item.typeName, - value: item.typeId, - }; - }); - }) - } - }); - this.$forceUpdate() - }, - keeperDataProChange(e) { - this.keeperProRange.forEach((item) => { - if (e === item.value) { - this.form.keeperDataMat=undefined - this.form.keeperDataName=undefined - // 获取工程下拉选 - let keeper = queryKeeperMatApi({ - typeId:e, - }).then(projRes =>{ - this.keeperMatRange = projRes.data.map((item) => { - return { - label: item.typeName, - value: item.typeId, - }; - }); - }) - } - }); - this.$forceUpdate() - }, - - keeperDataMatChange(e) { - this.keeperMatRange.forEach((item) => { - if (e === item.value) { - this.form.keeperDataName=undefined - // 获取工程下拉选 - let keeper = queryKeeperNameApi({ - typeId:e, - }).then(projRes =>{ - this.keeperNameRange = projRes.data.map((item) => { - return { - label: item.typeName, - value: item.typeId, - }; - }); - }) - } - }); - this.$forceUpdate() - }, - keeperDataNameChange(e) { - this.$forceUpdate() - }, /** 查询物资类型 */ async getKeeperDataList(data) { let keepdataRes = await queryKeeperDataApi({ @@ -1044,48 +788,18 @@ export default { this.form.keeperData = this.keeperDataRange.value }, - async getKeeperDataListTemp(data) { - let keepdataRes = await queryKeeperDataApi({ - // typeId:data.keeperData - }); - this.keeperDataRange = keepdataRes.data.map((item) => { - return { - label: item.houseName, - value: item.houseId, - }; - }); - // this.form.keeperData = this.keeperDataRange.value - - let keepproRes = await queryKeeperProApi({ - houseId:data.keeperDataPro - }); - this.keeperProRange = keepproRes.data.map((item) => { - return { - label: item.typeName, - value: item.typeId, - }; - }); - this.form.keeperDataPro = this.keeperProRange.value - - }, /** 查询新增页面-上级类型下拉树结构 */ getTreeData() { getMaTypeList().then((response) => { this.treeOptions = response.data }) }, - /** 查询资产属性下拉 */ - getPropData() { - getProLists().then((response) => { - this.propList = response.rows - }) - }, /** 查询列表 */ getList() { this.loading = true getListByMaType(this.queryParams).then((response) => { - this.typeList = response.rows - this.total = response.total + this.typeList = response.data.rows + this.total = response.data.total this.loading = false }) }, @@ -1171,12 +885,38 @@ export default { this.open = true this.title = '新增' }, + //查看 + handleView(row) { + this.reset() + const typeId = row.typeId + getMaType(typeId).then((response) => { + this.form = response.data; + this.form.isCharging = this.form.isCharging + '' + this.form.itemType = row.itemType + this.form.materialType = row.materialType + this.form.materialName = row.materialName + this.isLevel1Disabled=true + this.isLevel2Disabled=true + this.isLevel3Disabled=true + this.isLevel4Disabled=true + this.open = true + this.title = '查看' + }) + }, /** 修改按钮操作 */ handleUpdate(row) { this.reset() const typeId = row.typeId getMaType(typeId).then((response) => { this.form = response.data; + this.form.isCharging = this.form.isCharging + '' + this.form.itemType = row.itemType + this.form.materialType = row.materialType + this.form.materialName = row.materialName + this.isLevel1Disabled=true + this.isLevel2Disabled=true + this.isLevel3Disabled=true + this.isLevel4Disabled=true this.open = true this.title = '修改' }) @@ -1207,11 +947,11 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - const typeIds = row.typeId + const typeId = row.typeId this.$modal .confirm('是否确认删除数据项?') .then(function () { - return delMaType(typeIds) + return delMaType(typeId) }) .then(() => { this.$modal.msgSuccess('删除成功') @@ -1220,107 +960,16 @@ export default { }) .catch(() => {}) }, - // //配置操作 - // handleConfig(row) { - // this.resetForm('cform') - // this.chosenTypeId = row.typeId - // this.leasePrice = row.leasePrice - // // this.cform.leasePrice = row.leasePrice; - // this.$set(this.cform, 'leasePrice', row.leasePrice) - // this.open = true - // this.title = '查看' - // }, - submitConfig() { - let param = { - typeId: this.chosenTypeId, - effTime: this.cform.effTime, - leasePrice: this.cform.leasePrice, - } - console.log(param) - this.$refs['cform'].validate((valid) => { - if (valid) { - updateMaType(param).then((response) => { - this.$modal.msgSuccess('调整成功') - this.configOpen = false - this.getList() - this.getTreeData() - }) - } - }) - // this.configOpen = false; - }, - cancelConfig() { - this.configOpen = false - }, - // 图片上传 - imgUpLoad(param, name, index) { - console.log(param, 'image') - param.type = 'ma' - imgUpLoad(param) - .then((res) => { - if (res.code == 200) { - this.form.photoUrl = res.data.fileUrl - this.form.photoName = res.data.fileName - this.imageUrl = res.data.fileUrl - this.imageName = res.data.fileName - } else { - // this.$msgError(res.msg) - this.$modal.msgError(res.msg) - } - }) - .catch((error) => { - // this.$msgError(error) - this.$modal.msgError(error) - }) - }, - handleAvatarSuccess(res, file) { - console.log('success') - }, + handleRemove(file, fileList) { console.log(file, fileList) this.imageUrl = '' this.form.photoUrl = '' this.form.photoName = '' }, - //图片点击查看 - handlePictureCardPreview(file) { - console.log(file) - this.dialogImageUrl = file.url - this.dialogVisible = true - }, - //图片查看 - openImg(url) { - this.dialogImageUrl = this.uploadUrl + url - this.dialogVisible = true - }, - //文件上传 - fileUpLoad(param, name, index) { - console.log(param, 'fileUpLoad') - param.type = 'ma' - imgUpLoad(param) - .then((res) => { - if (res.code == 200) { - this.form.documentUrl = res.data.fileUrl - this.form.documentName = res.data.fileName - this.field101fileList[0] = param.file - console.log(this.field101fileList) - } else { - // this.$msgError(res.msg) - this.$modal.msgError(res.msg) - } - }) - .catch((error) => { - // this.$msgError(error) - this.$modal.msgError(error) - }) - }, - exceedFile(files, fileList) { - this.$message.warning( - `只能选择 1 个文件导入,共选择了 ${ - files.length + fileList.length - } 个文件`, - ) - }, + + + /** 导出按钮操作 */ // handleExport() { @@ -1346,29 +995,36 @@ export default { /* 树节点增加 */ appendTreeNode(data) { + this.levelTemp = data.level; + this.idTemp = data.id; + console.log('dataAdd',data) if (data.level === 3) { - console.log('data',data) this.reset() Object.assign(this.form, data) - console.log(this.treeOptions) this.treeTemp=this.treeOptions[0].children, this.treeTemp.forEach(item=>{ item.children.forEach(itemTemp=>{ if(itemTemp.level==2 && itemTemp.id==data.parentId){ this.level2Temp=itemTemp.id + this.level2TempName=itemTemp.label this.level1Temp=itemTemp.parentId } }) }) // console.log('treeTemp',this.treeTemp) - // this.treeTemp.forEach(item=>{ - // if(item.level==1 && item.id==this.level2Temp){ - // this.level1Temp=item.id - // } - // }) + this.treeTemp.forEach(item=>{ + if(item.level==1 && item.id==this.level1Temp){ + this.level1TempName=item.label + } + }) + this.isLevel1Disabled=true + this.isLevel2Disabled=true + this.isLevel3Disabled=true + this.isLevel4Disabled=true this.form.parentId = data.id - this.form.keeperProData = this.level1Temp - this.form.keeperMatData = this.level2Temp + this.form.itemType = this.level1TempName + this.form.materialType = this.level2TempName + this.form.materialName = data.label this.open = true this.title = '新增' } else { @@ -1382,10 +1038,11 @@ export default { removeTreeNode(data) { // this.$message.success('删除--') console.log(data, '删除时的数据源--') + const typeId = data.id this.$modal .confirm('是否确认删除数据项?') .then(function () { - return delMaType(data.id) + return delMaType(typeId) }) .then(() => { this.$modal.msgSuccess('删除成功') @@ -1395,7 +1052,9 @@ export default { }, /* 树节点修改 */ editTreeNode(data) { - console.log(data, '修改') + this.levelTemp = data.level; + this.idTemp = data.id; + console.log('data',data) Object.assign(this.addFormParams, data) this.addTitle = '修改' this.addFormParams.typeName = data.label @@ -1404,13 +1063,17 @@ export default { /* 确定 */ onSubmit() { const { id, typeName } = this.addFormParams + console.log('level',this.levelTemp) + console.log('idTemp',this.idTemp) const addParams = { - parentId: id, + parentId: this.idTemp, typeName, + level:this.levelTemp, } const editParams = { - typeId: id, + typeId: this.idTemp, typeName, + level:this.levelTemp, } this.$refs['addFormParamsRef'].validate(async (valid) => { @@ -1420,6 +1083,7 @@ export default { if (res.code === 200) { this.$message.success('新增成功!') this.addTitleVisible = false + this.getList() this.getTreeData() } } else { @@ -1427,6 +1091,7 @@ export default { if (res.code === 200) { this.$message.success('修改成功!') this.addTitleVisible = false + this.getList() this.getTreeData() } } diff --git a/src/views/material/ma/typeConfig/index.vue b/src/views/material/ma/typeConfig/index.vue index c133827a..57944026 100644 --- a/src/views/material/ma/typeConfig/index.vue +++ b/src/views/material/ma/typeConfig/index.vue @@ -112,9 +112,9 @@ default-expand-all :tree-props="{ children: 'children' }" border - @selection-change="handleSelectionChange" - @select="handleSelect" + @select="selectTr" @select-all="handleSelectAll" + @selection-change="handleSelectionChange" > { this.typeList = response.data; - response.data.forEach(item=>{ - if(item.children.length!=0){ - this.totalTemp=this.totalTemp+item.children.length - } - }) - this.totalTemp = this.totalTemp + response.data.length + // response.data.forEach(item=>{ + // if(item.children.length!=0){ + // this.totalTemp=this.totalTemp+item.children.length + // } + // }) + // this.totalTemp = this.totalTemp + response.data.length this.loading = false; }); @@ -493,6 +495,7 @@ export default { handleNodeClick(data, node) { // this.queryParams.level = data.level this.handleQuery(); + this.$refs.multipleTable.clearSelection(); (this.userIdTemp = data.id), (this.queryParams.userId = data.id); }, // 取消按钮 @@ -514,6 +517,7 @@ export default { /** 搜索按钮操作 */ handleQuery() { // this.queryParams.pageNum = 1; + this.$refs.multipleTable.clearSelection(); this.getList(); }, /** 重置按钮操作 */ @@ -528,76 +532,73 @@ export default { this.handleQuery(); }, + // 多选框选中数据 handleSelectionChange(selection) { + this.selectionRows = selection, this.ids = selection.map((item) =>item.typeId); - console.log('ids----',this.ids) this.single = selection.length != 1; this.multiple = !selection.length; + console.log('ids---------',this.ids) }, handleSelect(selection, row) { this.toggleSelection(selection, row); }, handleSelectAll(selection) { - // this.countTemp++; - console.log('selectionThree',selection) - if (this.countTemp == 1 && selection.length == this.typeList.length) { - this.typeList.forEach((row) => { - this.toggleSelection([row], row); - }); - this.countTemp=2 - } else if ( - this.countTemp == 2 && - selection.length == this.totalTemp - this.typeList.length - ) { - this.typeList.forEach((row) => { - this.toggleSelectionFalse([row], row); - }); - this.countTemp=1 - } - }, - // else if ( - // this.countTemp != 1 && - // this.countTemp != 2 && - // selection.length == this.totalTemp - // ) { - // this.typeList.forEach((row) => { - // this.toggleSelection([row], row); - // }); - // } else if ( - // this.countTemp != 1 && - // this.countTemp != 2 && - // selection.length == this.totalTemp - this.typeList.length - // ) { - // this.typeList.forEach((row) => { - // this.toggleSelectionFalse([row], row); - // }); - // } - // }, - toggleSelection(selection, row) { - if (row.children && row.children.length) { - row.children.forEach((child) => { - this.$refs.multipleTable.toggleRowSelection( - child, - selection.includes(row) - ); - this.toggleSelection(selection, child); - }); - } - }, - toggleSelectionFalse(selection, row) { - if (row.children && row.children.length) { - row.children.forEach((child) => { - this.$refs.multipleTable.toggleRowSelection( - child, - !selection.includes(row) - ); - this.toggleSelectionFalse(selection, child); - }); - } + this.isAllSelect = !this.isAllSelect; + let data = this.typeList; + this.toggleSelect(data,this.isAllSelect,'all'); + }, + + //选择某行 + selectTr(selection,row){ + this.$set(row,'isChecked',!row.isChecked); + this.$nextTick(()=>{ + this.isAllSelect = row.isChecked; + this.toggleSelect(row,row.isChecked,'tr'); + }); + }, + + //递归子级 + toggleSelect(data,flag,type){ + if(type === 'all'){ + if(data.length > 0){ + data.forEach(item=>{ + this.toggleSelection(item, flag); + if(item.children && item.children.length > 0){ + this.toggleSelect(item.children,flag,type) + } + }) + } + }else { + if(data.children && data.children.length > 0){ + data.children.forEach(item =>{ + item.isChecked = !item.isChecked; + this.$refs.multipleTable.toggleRowSelection(item, flag); + this.toggleSelect(item,flag,type); + }) + } + } + }, + + + //改变选中 + toggleSelection(row, flag) { + this.$set(row,'isChecked',flag); + this.$nextTick(()=>{ + if (flag) { + this.$refs.multipleTable.toggleRowSelection(row, flag); + } else { + this.$refs.multipleTable.clearSelection(); + } + }); + }, + + /** 绑定按钮操作 */ handleBind() { + console.log('ids----',this.ids) if (this.userIdTemp == -1) { this.$alert("未勾选绑定人,无法绑定", "提示", { type: "warning", @@ -605,24 +606,26 @@ export default { }); return; } - // if (this.ids.length == 0) { - // this.$alert("未进行勾选,无法绑定", "提示", { - // type: "warning", - // confirmButtonText: "确定", - // }); - // return; - // } else { - // const ids = this.ids.join(","); - // } - console.log(this.typeIdTemp); + if (this.ids.length == 0) { + this.$alert("未进行勾选相关物资,无法绑定", "提示", { + type: "warning", + confirmButtonText: "确定", + }); + return; + } else { + const ids = this.ids.join(","); + } bindRepair({ - typeId: this.typeIdTemp, + typeId: 3, userId: this.userIdTemp, bindFlag: 1, bindRoleType: 1, }).then((response) => { this.$modal.msgSuccess("绑定成功"); + this.ids = null; + this.getTreeData(); this.getList(); + this.$refs.multipleTable.clearSelection(); }); },