|
@@ -32,7 +32,8 @@
|
|
|
addIceRaft,
|
|
|
putIceRaft,
|
|
|
delIceRaft,
|
|
|
- bindCoolerBox
|
|
|
+ bindCoolerBox,
|
|
|
+ UnbindCoolerBox
|
|
|
} from '@/api/freezer'
|
|
|
import {
|
|
|
getCoolerBox
|
|
@@ -104,7 +105,7 @@
|
|
|
freezeClaim: [],
|
|
|
coolerBoxId: [],
|
|
|
label: '',
|
|
|
- suitableForCold: null,
|
|
|
+ suitableForCold: '',
|
|
|
forColdTime: null,
|
|
|
iceColdAddress: '',
|
|
|
sort: null,
|
|
@@ -153,6 +154,12 @@
|
|
|
getIceRaft(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.tableData = res.data.list
|
|
|
+ this.tableData.forEach(item => {
|
|
|
+ if (item.coolerBoxName) {
|
|
|
+ item.coolerBoxData = item.coolerBoxName
|
|
|
+ item.coolerBoxName = item.coolerBoxName.join(',')
|
|
|
+ }
|
|
|
+ })
|
|
|
this.Total = res.data.count
|
|
|
}
|
|
|
})
|
|
@@ -179,7 +186,7 @@
|
|
|
status: this.ruleForm.status,
|
|
|
freezeClaim: turnNum(this.ruleForm.freezeClaim),
|
|
|
label: this.ruleForm.label,
|
|
|
- suitableForCold: Number(this.ruleForm.suitableForCold),
|
|
|
+ suitableForCold: this.ruleForm.suitableForCold,
|
|
|
forColdTime: Number(this.ruleForm.forColdTime),
|
|
|
iceColdAddress: this.ruleForm.iceColdAddress,
|
|
|
sort: Number(this.ruleForm.sort),
|
|
@@ -205,7 +212,7 @@
|
|
|
status: this.ruleForm.status,
|
|
|
freezeClaim: turnNum(this.ruleForm.freezeClaim),
|
|
|
label: this.ruleForm.label,
|
|
|
- suitableForCold: Number(this.ruleForm.suitableForCold),
|
|
|
+ suitableForCold: this.ruleForm.suitableForCold,
|
|
|
forColdTime: Number(this.ruleForm.forColdTime),
|
|
|
iceColdAddress: this.ruleForm.iceColdAddress,
|
|
|
sort: Number(this.ruleForm.sort),
|
|
@@ -224,9 +231,11 @@
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
|
} else if (this.operationType == 'binding') {
|
|
|
+ this.confirmLoading = true
|
|
|
+ var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
|
|
|
var params = {
|
|
|
code: this.iceCode,
|
|
|
- coolerBoxId: Number(this.ruleForm.coolerBoxId),
|
|
|
+ coolerBoxId: arrBoxId,
|
|
|
}
|
|
|
bindCoolerBox(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
@@ -241,6 +250,25 @@
|
|
|
}).catch(() => {
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
|
+ } else if (this.operationType == 'unbind') {
|
|
|
+ this.confirmLoading = true
|
|
|
+ var arrBoxId = this.ruleForm.coolerBoxId.map(Number)
|
|
|
+ UnbindCoolerBox({
|
|
|
+ code: this.selectingData.code,
|
|
|
+ coolerBoxId: arrBoxId,
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg || '操作成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ this.staffDialogVisible = false
|
|
|
+ }
|
|
|
+ this.confirmLoading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error('表单信息不完整,请继续填写完整');
|
|
@@ -288,6 +316,31 @@
|
|
|
})
|
|
|
} else if (type == 'del') {
|
|
|
this.deleteUser(row.id)
|
|
|
+ } else if (type == 'unbind') {
|
|
|
+ let coolerID = []
|
|
|
+ if (row.bindCoolerBox) {
|
|
|
+ this.ruleForm.coolerBoxId = row.bindCoolerBox.map(String)
|
|
|
+ coolerID = zipToObjects(row.bindCoolerBox, row.coolerBoxData)
|
|
|
+
|
|
|
+ function zipToObjects(keys, values) {
|
|
|
+ return keys.map((key, index) => ({
|
|
|
+ label: values[index],
|
|
|
+ value: key
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.staffDialogVisible = true
|
|
|
+ this.staffTitle = '修改绑定保温箱'
|
|
|
+ this.formRuleList = bindingIncubator()
|
|
|
+ this.formRuleList.forEach(item => {
|
|
|
+ if (item.type == 'searchSelect') {
|
|
|
+ item.options = coolerID
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.page = 1
|
|
|
+ this.limitNoil = true
|
|
|
+ this.getIncubator()
|
|
|
+ // this.remoteMethod()
|
|
|
}
|
|
|
},
|
|
|
openModel(type) {
|
|
@@ -313,7 +366,7 @@
|
|
|
this.staffDialogVisible = true
|
|
|
this.staffTitle = '绑定保温箱'
|
|
|
this.formRuleList = bindingIncubator()
|
|
|
- this.getIncubator()
|
|
|
+ this.remoteMethod()
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: '请先选择需要批量操作的冰排',
|
|
@@ -362,7 +415,24 @@
|
|
|
if (this.limitNoil == true) {
|
|
|
this.formRuleList.forEach(item => {
|
|
|
if (item.type == 'searchSelect') {
|
|
|
- item.options = item.options.concat(arrList)
|
|
|
+ let arrIce = item.options.concat(arrList)
|
|
|
+ const uniqueObjectsArray = uniqueObjectArray(arrIce);
|
|
|
+ item.options = uniqueObjectsArray
|
|
|
+
|
|
|
+ function uniqueObjectArray(arr) {
|
|
|
+ const uniqueArray = [];
|
|
|
+ const uniqueSet = new Set();
|
|
|
+
|
|
|
+ for (const item of arr) {
|
|
|
+ const uniqueId = JSON.stringify(item);
|
|
|
+ if (!uniqueSet.has(uniqueId)) {
|
|
|
+ uniqueSet.add(uniqueId);
|
|
|
+ uniqueArray.push(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return uniqueArray;
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
// this.thermostat.options = this.thermostat.options.concat(arrList)
|