diff --git a/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue b/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue
index 4fe79fe..0bc6add 100644
--- a/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue
+++ b/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue
@@ -58,7 +58,23 @@
-
+
+
+
+
{
- let selectList = []
- this.leaseApplyDetails.forEach((e) => {
- selectList.push(this.getParentsById(this.deviceTypeTree, e.typeId))
- })
- this.$nextTick(() => {
- this.deviceType = selectList
- this.propsKey++
- })
+ console.log("xxxxxxxxxxxxxxxxxxxxx")
+ // Promise.all([this.GetTaskDetail(this.taskId), this.GetDeviceTypeTree()]).then(() => {
+ // let selectList = []
+ // this.leaseApplyDetails.forEach((e) => {
+ // selectList.push(this.getParentsById(this.deviceTypeTree, e.typeId))
+ // })
+ // console.log("222222222222",selectList)
+ // this.$nextTick(() => {
+ // this.deviceType = selectList
+ // this.propsKey++
+
+ // })
+ // console.log("1111111111111",this.deviceType)
+ // })
+ await this.GetDeviceTypeTree().then(() => {
+ this.GetTaskDetail(this.taskId)
})
+
} else {
this.GetDeviceTypeTree()
}
@@ -612,7 +639,7 @@ export default {
// 获取 设备树结构数据
async GetDeviceTypeTree() {
const params = {
- level: 3,
+ level: 4,
}
getDeviceTypeTree(params).then((res) => {
this.deviceTypeTree = res.data
@@ -706,6 +733,12 @@ export default {
this.leaseApplyDetails = data.leaseApplyDetails.map((item) => {
return this.handelEchoData(item)
})
+ let selectList = []
+ this.leaseApplyDetails.forEach((e) => {
+ selectList.push(this.getParentsById(this.deviceTypeTree, e.typeId))
+ })
+ this.deviceType = selectList
+ this.propsKey++
if (data.ctLeaseApplyDetails) {
this.getCtFileList(data.ctLeaseApplyDetails)
@@ -987,12 +1020,12 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
- // this.deviceType.forEach((e, index) => {
- // if (e[3] === row.typeId) {
- // this.deviceType.splice(index, 1)
- // this.propsKey++
- // }
- // })
+ this.deviceType.forEach((e, index) => {
+ if (e[3] === row.typeId) {
+ this.deviceType.splice(index, 1)
+ this.propsKey++
+ }
+ })
this.leaseApplyDetails.splice(row.index, 1)
},
/** 导出按钮操作 */
@@ -1012,51 +1045,76 @@ export default {
},
/////// 设备类型树 切换
deviceTypeChange(val) {
- console.log('🚀 ~ deviceTypeChange ~ val:', val)
this.queryParams.typeId = ''
this.typeListDev = []
- // console.log('🚀 ~ deviceTypeChange ~ val:', val)
- this.$nextTick(() => {
+
+ // this.$nextTick(() => {
const deviceTypeList = this.$refs.deviceTypeCascader.getCheckedNodes()
- console.log('🚀 ~ deviceTypeChange ~ deviceTypeList:', deviceTypeList[0])
- this.selectParams = {
- createBy: this.user.name,
- companyId: deviceTypeList[0].data.companyId,
- // num: deviceTypeList[0].data.num,
- typeCn: deviceTypeList[0].data.label,
- }
- console.log('🚀 ~ deviceTypeChange ~ this.selectParams:', this.selectParams)
- this.getMaTypeDataByIdFun(val[val.length - 1])
- })
+ // this.selectParams = {
+ // createBy: this.user.name,
+ // companyId: deviceTypeList[0].data.companyId,
+ // // num: deviceTypeList[0].data.num,
+ // typeCn: deviceTypeList[0].data.label,
+ // }
+ // console.log('🚀 ~ deviceTypeChange ~ this.selectParams:', this.selectParams)
+ // this.getMaTypeDataByIdFun(val[val.length - 1])
+ // })
+ let tempList = []
+ if (val.length > 0) {
+ const items = val.map((e) => {
+ return e[3]
+ })
+ for (let i in items) {
+ for (let z in deviceTypeList) {
+ if (items[i]===deviceTypeList[z].data.id) {
+ let { num, companyId, id, unitName } = deviceTypeList[z].data
- // if (val.length > 0) {
- // const items = val.map((e) => {
- // return e[3]
- // })
- // for (let i in items) {
- // for (let z in deviceTypeList) {
- // if (deviceTypeList[z].data.id === items[i]) {
- // let { num, companyId, id, unitName } = deviceTypeList[z].data
-
- // const isRepeat = this.leaseApplyDetails.some((e) => e.typeId === id)
- // if (!isRepeat) {
- // this.leaseApplyDetails.push({
- // createBy: this.user.name,
- // typeId: id,
- // num,
- // companyId,
- // unitCn: unitName,
- // typeCn: deviceTypeList[z].pathLabels[2],
- // guigeCn: deviceTypeList[z].pathLabels[3],
- // })
- // }
- // }
- // }
- // }
- // console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails)
- // } else {
- // this.leaseApplyDetails = []
- // }
+ const isRepeat = this.leaseApplyDetails.some((e) => e.typeId === id)
+ if (!isRepeat) {
+ this.leaseApplyDetails.unshift({
+ createBy: this.user.name,
+ typeId: id,
+ num,
+ companyId,
+ unitCn: unitName,
+ typeCn: deviceTypeList[z].pathLabels[2],
+ guigeCn: deviceTypeList[z].pathLabels[3],
+ })
+ let obj = {
+ createBy: this.user.name,
+ typeId: id,
+ num,
+ companyId,
+ unitCn: unitName,
+ typeCn: deviceTypeList[z].pathLabels[2],
+ guigeCn: deviceTypeList[z].pathLabels[3],
+ }
+ tempList.unshift(obj);
+ }
+ }
+ }
+ }
+ const newDataListNew = [...this.leaseApplyDetails, ...tempList]
+ const map = new Map()
+ for (let item of newDataListNew) {
+ if (!map.has(item.typeId)) {
+ map.set(item.typeId, item)
+ }
+ }
+ const newArray = [...map.values()]
+ let newArray_array = []
+ newArray.forEach((e) => {
+ items.forEach((j) => {
+ if (e.typeId==j) {
+ newArray_array.push(e)
+ }
+ })
+ })
+ this.leaseApplyDetails = newArray_array
+ } else {
+ console.log("yyyyyyyyyyyyy")
+ this.leaseApplyDetails = []
+ }
},
//// 将数据处理成 表格中需要的数据
handelTableItemData(node) {
@@ -1156,27 +1214,27 @@ export default {
console.log('🚀 ~ getMaTypeDataByIdFun ~ res:', res)
},
// 选择规格型号
- changeType(e) {
- // console.log('🚀 ~ changeType ~ e:', e)
- if (!e) return
- // 获取选中的规格型号
- const selectType = this.typeListDev.find((item) => item.id == e)
- console.log('🚀 ~ changeType ~ selectType:', selectType)
- this.selectParams.typeId = selectType.id
- this.selectParams.guigeCn = selectType.name
- this.selectParams.unitCn = selectType.unit
- this.selectParams.num = selectType.num
- console.log('🚀 ~ changeType ~ this.selectParams:', this.selectParams)
- // 判断是否重复
- const isRepeat = this.leaseApplyDetails.find((item) => item.typeId == selectType.id)
- // console.log('🚀 ~ changeType ~ isRepeat:', isRepeat)
- if (isRepeat) {
- this.$message.error('当前设备已添加,不可重复添加!')
- return
- }
- this.leaseApplyDetails.unshift({ ...this.selectParams })
- console.log('🚀 ~ changeType ~ this.leaseApplyDetails:', this.leaseApplyDetails)
- },
+ // changeType(e) {
+ // // console.log('🚀 ~ changeType ~ e:', e)
+ // if (!e) return
+ // // 获取选中的规格型号
+ // const selectType = this.typeListDev.find((item) => item.id == e)
+ // console.log('🚀 ~ changeType ~ selectType:', selectType)
+ // this.selectParams.typeId = selectType.id
+ // this.selectParams.guigeCn = selectType.name
+ // this.selectParams.unitCn = selectType.unit
+ // this.selectParams.num = selectType.num
+ // console.log('🚀 ~ changeType ~ this.selectParams:', this.selectParams)
+ // // 判断是否重复
+ // const isRepeat = this.leaseApplyDetails.find((item) => item.typeId == selectType.id)
+ // // console.log('🚀 ~ changeType ~ isRepeat:', isRepeat)
+ // if (isRepeat) {
+ // this.$message.error('当前设备已添加,不可重复添加!')
+ // return
+ // }
+ // this.leaseApplyDetails.unshift({ ...this.selectParams })
+ // console.log('🚀 ~ changeType ~ this.leaseApplyDetails:', this.leaseApplyDetails)
+ // },
},
}
diff --git a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue
index 90e0146..2d6299b 100644
--- a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue
+++ b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue
@@ -159,10 +159,10 @@
保存
- 模板下载
+ 模板下载
- 模板上传
+ 模板上传
@@ -295,6 +295,31 @@
取 消
+
+
+
+
+
+ 将文件拖到此处,或点击上传
+ 只能上传xlsx文件
+
+
+
@@ -330,7 +355,10 @@ export default {
},
data() {
return {
- actionUrl: process.env.VUE_APP_BASE_API + '/system/sys/file/upload',
+ actionUrl: process.env.VUE_APP_BASE_API + '/material/purchaseCheckInfo/importData',
+ headers: {
+ Authorization: 'Bearer ' + localStorage.getItem('token'),
+ },
aform: {
checkUrl: '',
checkUrlName: '',
@@ -456,6 +484,7 @@ export default {
propsKey: 1000,
fileUploadDialog: false,
currentIndex: 0,
+ dialogUpload: false,
}
},
computed: {
@@ -877,6 +906,58 @@ export default {
item.purveyorId = val
})
},
+ /** 模板下载 */
+ downloadModel() {
+ const params = {params:JSON.stringify(this.queryParams)}
+ this.download(
+ 'material/purchaseCheckInfo/downLoadTypeModel',
+ {...params,},
+ `模板下载_${new Date().getTime()}.xlsx`,
+ )
+
+ },
+ uploadModel() {
+ this.dialogUpload = true
+ },
+ beforeUpload(file) {
+ const fileType = file.name.split('.').pop().toLowerCase();
+ if (fileType!== 'xls' && fileType!== 'xlsx') {
+ this.$message.error('只能上传 Excel 文件(.xls 或 .xlsx)');
+ return false;
+ }
+ return true;
+ },
+ handleUploadSuccess(response, file, fileList) {
+ if (response.code == 200) {
+ this.$message.success('文件上传成功');
+ this.dialogUpload = false; // 上传成功后关闭弹窗
+ response.data.forEach((item) => {
+ this.equipmentList.push({
+ machineTypeName: item.typeName,
+ specificationType: item.modelName,
+ typeId: item.typeId,
+ unitName: item.unitName,
+ supplierId: this.queryParams.supplierId? this.queryParams.supplierId : '',
+ createTime: null,
+ productionTime: this.queryParams.productionTime? this.queryParams.productionTime : '',
+ purchasePrice: 0,
+ purchaseNum: '',
+ purveyorId: this.queryParams.purveyorId? this.queryParams.purveyorId : '',
+ checkUrl: '',
+ checkUrlName: '',
+ fileList: [],
+ })
+ // 获取新增项的层级路径
+ const path = this.getParentsById(this.equipmentTypeList, item.typeId);
+ if (path) {
+ this.deviceType.push(path);
+ }
+ })
+
+ } else {
+ this.$message.error('文件上传失败');
+ }
+ },
},
}