|
|
|
@ -482,14 +482,14 @@
|
|
|
|
|
</div> |
|
|
|
|
<div style="display: flex"> |
|
|
|
|
<div class="el_cwBtn"> |
|
|
|
|
<el-button |
|
|
|
|
<!-- <el-button |
|
|
|
|
type="primary" |
|
|
|
|
v-if="item.state == 0 && UserPermissions != '职能客服' && item.accounting!='1'" |
|
|
|
|
@click="accountingBtn(item)" |
|
|
|
|
> |
|
|
|
|
财务处理 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="primary" @click="payremove(item.state, index)"> |
|
|
|
|
</el-button> --> |
|
|
|
|
<el-button type="primary" v-if="item.button" @click="payremove(item, index)"> |
|
|
|
|
移除 |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
@ -987,8 +987,9 @@ const CompensationParty = ref([
|
|
|
|
|
num: 0, |
|
|
|
|
reason: '', |
|
|
|
|
cld: 1, |
|
|
|
|
warehouseId: null, |
|
|
|
|
warehouseId: '', |
|
|
|
|
compensationPersonnel: '', |
|
|
|
|
button:false, |
|
|
|
|
}, //赔款方 |
|
|
|
|
// explains: '' |
|
|
|
|
{ |
|
|
|
@ -997,8 +998,9 @@ const CompensationParty = ref([
|
|
|
|
|
num: 0, |
|
|
|
|
reason: '', |
|
|
|
|
cld: 1, |
|
|
|
|
warehouseId: null, |
|
|
|
|
warehouseId: '', |
|
|
|
|
compensationPersonnel: '', |
|
|
|
|
button:false, |
|
|
|
|
}, //受款方 |
|
|
|
|
// explains: '' |
|
|
|
|
]); //收/赔 |
|
|
|
@ -1701,79 +1703,98 @@ const Clickviod = () => {
|
|
|
|
|
}; |
|
|
|
|
// 添加赔款方 |
|
|
|
|
const AddCompensation = () => { |
|
|
|
|
console.log('添加赔款方'); |
|
|
|
|
let som = 1; |
|
|
|
|
CompensationParty.value.forEach(item => { |
|
|
|
|
if (item.state == 0) { |
|
|
|
|
som++; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let lastIndex = -1; |
|
|
|
|
|
|
|
|
|
for (let i = CompensationParty.value.length - 1; i >= 0; i--) { |
|
|
|
|
if (CompensationParty.value[i].state == 0) { |
|
|
|
|
lastIndex = i; |
|
|
|
|
break; // 找到匹配元素后中断循环 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (lastIndex !== -1) { |
|
|
|
|
CompensationParty.value.splice(lastIndex + 1, 0, { |
|
|
|
|
name: '', |
|
|
|
|
state: 0, |
|
|
|
|
num: 0, |
|
|
|
|
reason: '', |
|
|
|
|
cld: som, |
|
|
|
|
compensationPersonnel: '', |
|
|
|
|
warehouseId: '', |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// CompensationParty.value.push({ |
|
|
|
|
// name: '', |
|
|
|
|
// state: 0, |
|
|
|
|
// num: 0, |
|
|
|
|
// reason: '', |
|
|
|
|
// cld: som, |
|
|
|
|
// compensationPersonnel: '', |
|
|
|
|
// warehouseId: '', |
|
|
|
|
// }); |
|
|
|
|
} else { |
|
|
|
|
console.log(`在数组中未找到 ${elementToFind}。`); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// explains: '' |
|
|
|
|
let data = { |
|
|
|
|
state: 0, //赔款方 |
|
|
|
|
warehouseId: '', //仓库 |
|
|
|
|
reason: '', //原因 |
|
|
|
|
num: 0, //金额 |
|
|
|
|
compensationPersonnel: '', //责任人 |
|
|
|
|
button: true, //按钮可移除 |
|
|
|
|
}; |
|
|
|
|
CompensationParty.value.splice( |
|
|
|
|
CompensationParty.value.map(item => item.state).lastIndexOf(0) + 1, |
|
|
|
|
0, |
|
|
|
|
data |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
// 添加受款方 |
|
|
|
|
const AddPayee = () => { |
|
|
|
|
let som = 1; |
|
|
|
|
CompensationParty.value.forEach(item => { |
|
|
|
|
if (item.state == 1) { |
|
|
|
|
som++; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let lastIndex = -1; |
|
|
|
|
const AddPayee=()=>{ |
|
|
|
|
console.log(warehouseData.value,'warehouseData'); |
|
|
|
|
let data = { |
|
|
|
|
state: 1, //赔款方 |
|
|
|
|
warehouseId: '', //仓库 |
|
|
|
|
reason: '', //原因 |
|
|
|
|
num: 0, //金额 |
|
|
|
|
compensationPersonnel: '', //责任人 |
|
|
|
|
button: true, //按钮可移除 |
|
|
|
|
}; |
|
|
|
|
CompensationParty.value.splice( |
|
|
|
|
CompensationParty.value.map(item => item.state).lastIndexOf(1) + 1, |
|
|
|
|
0, |
|
|
|
|
data |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
// 添加赔款方 |
|
|
|
|
// const AddCompensation = () => { |
|
|
|
|
// console.log('添加赔款方'); |
|
|
|
|
// let som = 1; |
|
|
|
|
// CompensationParty.value.forEach(item => { |
|
|
|
|
// if (item.state == 0) { |
|
|
|
|
// som++; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// let lastIndex = -1; |
|
|
|
|
|
|
|
|
|
// for (let i = CompensationParty.value.length - 1; i >= 0; i--) { |
|
|
|
|
// if (CompensationParty.value[i].state == 0) { |
|
|
|
|
// lastIndex = i; |
|
|
|
|
// break; // 找到匹配元素后中断循环 |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
for (let i = CompensationParty.value.length - 1; i >= 0; i--) { |
|
|
|
|
if (CompensationParty.value[i].state == 0) { |
|
|
|
|
lastIndex = i; |
|
|
|
|
break; // 找到匹配元素后中断循环 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// if (lastIndex !== -1) { |
|
|
|
|
// CompensationParty.value.splice(lastIndex + 1, 0, { |
|
|
|
|
// name: '', |
|
|
|
|
// state: 0, |
|
|
|
|
// num: 0, |
|
|
|
|
// reason: '', |
|
|
|
|
// cld: som, |
|
|
|
|
// compensationPersonnel: '', |
|
|
|
|
// warehouseId: '', |
|
|
|
|
// }); |
|
|
|
|
// } |
|
|
|
|
// }; |
|
|
|
|
// 添加受款方 |
|
|
|
|
// const AddPayee = () => { |
|
|
|
|
// let som = 1; |
|
|
|
|
// CompensationParty.value.forEach(item => { |
|
|
|
|
// if (item.state == 1) { |
|
|
|
|
// som++; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// let lastIndex = -1; |
|
|
|
|
|
|
|
|
|
// for (let i = CompensationParty.value.length - 1; i >= 0; i--) { |
|
|
|
|
// if (CompensationParty.value[i].state == 0) { |
|
|
|
|
// lastIndex = i; |
|
|
|
|
// break; // 找到匹配元素后中断循环 |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
if (lastIndex !== -1) { |
|
|
|
|
CompensationParty.value.splice(lastIndex + 1, 0, { |
|
|
|
|
name: '', |
|
|
|
|
state: 1, |
|
|
|
|
num: 0, |
|
|
|
|
reason: '', |
|
|
|
|
cld: som, |
|
|
|
|
compensationPersonnel: '', |
|
|
|
|
warehouseId: '', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// if (lastIndex !== -1) { |
|
|
|
|
// CompensationParty.value.splice(lastIndex + 1, 0, { |
|
|
|
|
// name: '', |
|
|
|
|
// state: 1, |
|
|
|
|
// num: 0, |
|
|
|
|
// reason: '', |
|
|
|
|
// cld: som, |
|
|
|
|
// compensationPersonnel: '', |
|
|
|
|
// warehouseId: '', |
|
|
|
|
// }); |
|
|
|
|
// } |
|
|
|
|
// }; |
|
|
|
|
// 表单校验 |
|
|
|
|
const ruleForm = reactive({ |
|
|
|
|
// warehouseId: [{ required: true, message: '请选择仓库', trigger: ['bulr', 'change'] }], |
|
|
|
@ -1789,7 +1810,30 @@ const Totalamount = () => {
|
|
|
|
|
.reduce((accumulator, currentValue) => accumulator + currentValue, 0); |
|
|
|
|
}; |
|
|
|
|
// 移除按钮 |
|
|
|
|
const payremove = (state, val) => { |
|
|
|
|
const payremove =async (item, index) => { |
|
|
|
|
console.log(item, 'item'); |
|
|
|
|
console.log(index, 'index'); |
|
|
|
|
const cleanedItem = item.state ? '受款方' : '赔款方'; |
|
|
|
|
// 尝试使用 HTML 字符串 |
|
|
|
|
const message = `是否移除当前<span style="color: red; font-weight: bold">${cleanedItem}</span>?`; |
|
|
|
|
await ElMessageBox.confirm(message, '提示', { |
|
|
|
|
dangerouslyUseHTMLString: true, // 如果组件支持,启用此选项以解析 HTML |
|
|
|
|
confirmButtonText: '确认', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
|
|
|
|
|
if (item.state) { |
|
|
|
|
Totalamountreceived.value -= item.num; //受款总金额 |
|
|
|
|
} else { |
|
|
|
|
Totalamountcompensation.value -= item.num; //赔款总金额 |
|
|
|
|
} |
|
|
|
|
CompensationParty.value.splice(index, 1); |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}); |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
// 判断赔付方,至少保留一条数据 |
|
|
|
|
|
|
|
|
|
if (CompensationParty.value.map(res => res.state == 0).length == 1) { |
|
|
|
|