Commit 092bcaf2 by wangzhihui

```

fix(DeliverList): 修复签名对话框代码格式问题

- 修复图片类名对象语法格式
- 修复按钮禁用状态样式问题
- 优化默认值函数返回空对象格式
- 修复三元运算符优先级问题
- 简化表单验证规则数组格式
- 格式化API调用链式语法,提升可读性
- 添加必要的日志输出和加载状态重置逻辑
```
1 parent 1eba8f40
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="title">已有签名预设</div> <div class="title">已有签名预设</div>
<div v-if="signList.length" class="sign-img-box"> <div v-if="signList.length" class="sign-img-box">
<div v-for="(item, index) in signList" :key="index"> <div v-for="(item, index) in signList" :key="index">
<img :src="item.signFileUrl" @click="handleSignClick(item, index)" :class="{'active': activeSignIdx == index, 'sign-img': true}" alt="" /> <img :src="item.signFileUrl" @click="handleSignClick(item, index)" :class="{ active: activeSignIdx == index, 'sign-img': true }" alt="" />
</div> </div>
</div> </div>
<div class="emptyCom" v-else> <div class="emptyCom" v-else>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<template slot="footer"> <template slot="footer">
<span class="dialog-footer"> <span class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="clear" :disabled="loading || btnLoading">重写</el-button> <el-button plain size="small" class="btn-three" @click="clear" :disabled="loading || btnLoading">重写</el-button>
<el-button v-show="activeSignIdx == -1" plain size="small" class="btn-three" style="margin-left: 10px;" @click="undo" :disabled="loading ||btnLoading">撤销</el-button> <el-button v-show="activeSignIdx == -1" plain size="small" class="btn-three" style="margin-left: 10px;" @click="undo" :disabled="loading || btnLoading">撤销</el-button>
<el-button type="primary" size="small" style="margin-left: 10px;" @click="save" v-loading="loading || btnLoading">确定</el-button> <el-button type="primary" size="small" style="margin-left: 10px;" @click="save" v-loading="loading || btnLoading">确定</el-button>
</span> </span>
</template> </template>
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
}, },
info: { info: {
type: Object, type: Object,
default: () => { } default: () => {}
} }
}, },
computed: { computed: {
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
label: '发货数量', label: '发货数量',
prop: '', prop: '',
formatter: cellValue => { formatter: cellValue => {
return membraneTypeList.includes(cellValue.goodsType) ? this.detailInfo.orderType == 1 ? `${cellValue.purchaseNumber}米` : `${cellValue.purchaseNumber}卷` : `${cellValue.purchaseNumber}件` return membraneTypeList.includes(cellValue.goodsType) ? (this.detailInfo.orderType == 1 ? `${cellValue.purchaseNumber}米` : `${cellValue.purchaseNumber}卷`) : `${cellValue.purchaseNumber}件`
} }
}, },
{ {
...@@ -154,9 +154,7 @@ export default { ...@@ -154,9 +154,7 @@ export default {
files: [] files: []
}, },
uploadRules: { uploadRules: {
files: [ files: [{ required: true, validator: this.validateFiles, trigger: 'change' }]
{ required: true, validator: this.validateFiles, trigger: 'change' }
]
} }
} }
}, },
...@@ -193,11 +191,14 @@ export default { ...@@ -193,11 +191,14 @@ export default {
reader.onload = () => { reader.onload = () => {
const extension = file.name.split('.').pop() const extension = file.name.split('.').pop()
const base64 = extension + '@' + reader.result.split(',')[1] const base64 = extension + '@' + reader.result.split(',')[1]
this.$apis.sysBase.uploadImg({ file: base64, fileType: 'image' }).then(res => { this.$apis.sysBase
param.onSuccess(res) .uploadImg({ file: base64, fileType: 'image' })
}).catch(err => { .then(res => {
param.onError(err) param.onSuccess(res)
}) })
.catch(err => {
param.onError(err)
})
} }
}, },
beforeUpload(file) { beforeUpload(file) {
...@@ -276,16 +277,19 @@ export default { ...@@ -276,16 +277,19 @@ export default {
} else { } else {
const base64 = 'png@' + data.split('base64,')[1] const base64 = 'png@' + data.split('base64,')[1]
this.loading = true this.loading = true
this.$apis.sysBase.uploadImg({ file: base64, fileType: 'image' }).then(res => { this.$apis.sysBase
console.log(res, 'res----') .uploadImg({ file: base64, fileType: 'image' })
this.deliverySign(res, uploadFileUrl) .then(res => {
}).catch(() => { console.log(res, 'res----')
this.loading = false this.deliverySign(res, uploadFileUrl)
}) })
.catch(() => {
this.loading = false
})
} }
} else { } else {
console.log('error submit!!'); console.log('error submit!!')
return false; return false
} }
}) })
}, },
...@@ -311,8 +315,10 @@ export default { ...@@ -311,8 +315,10 @@ export default {
} }
this.btnLoading = true this.btnLoading = true
console.log(params, 'params----') console.log(params, 'params----')
this.$apis.delivery.deliverySign(params) this.$apis.delivery
.deliverySign(params)
.then(res => { .then(res => {
console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.$message({ this.$message({
message: '签收成功', message: '签收成功',
...@@ -321,6 +327,8 @@ export default { ...@@ -321,6 +327,8 @@ export default {
}) })
this.$emit('handleConfirm') this.$emit('handleConfirm')
} else { } else {
this.btnLoading = false
this.loading = false
this.$message({ this.$message({
type: 'error', type: 'error',
message: res.message, message: res.message,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!