diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 4028574..a11a224 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -343,6 +343,7 @@ export default { }] }, allowedTypes: ["zip","rar","doc","docx","pdf","jpg"], + signData: null,//签名数据 } }, watch: { @@ -699,6 +700,7 @@ export default { } }, onEditSignSave(data) { + this.signData = data; // 检查是否有待上传的文件 if (this.pendingUploadFile) { // 签名验证通过,将文件添加到列表并上传 @@ -1286,8 +1288,8 @@ export default { const oldAttList = JSON.parse(recordOldVlaue || "[]"); recordValue = attList.map(item => item.name).join(";"); recordOldVlaue = oldAttList.map(item => item.name).join(";"); - oldUrl = oldAttList.map(item => item.url).join(";"); - url = attList.map(item => item.url).join(";"); + oldUrl = oldAttList.map(item => item.url).join("|"); + url = attList.map(item => item.url).join("|"); } const record = { @@ -1304,6 +1306,9 @@ export default { if (data) { record.reason = data.remark } + if(this.type === "attachment" && this.signData){ + record.reason = this.signData.remark; + } const params = { type: "fieldChanged", diff --git a/src/components/Template/StepComponents/ZLSubPackage.vue b/src/components/Template/StepComponents/ZLSubPackage.vue index 264812f..9d262f1 100644 --- a/src/components/Template/StepComponents/ZLSubPackage.vue +++ b/src/components/Template/StepComponents/ZLSubPackage.vue @@ -5,30 +5,41 @@
{{ item.label }}
- {{ item.unit }} + 确定
分装单位
- +
预设每份容量
-
- +
- 平均分配 - 重置 - + 平均分配 + 重置 + +
+
+
电子天平
+
+ +
+
+
分装编号
@@ -38,20 +49,29 @@
{{ formData.mybh }}-set{{ item.subCode }}
- - - 获取值 - 打印 + + + + + + 打印
- +
- 确定 + 确定
@@ -62,7 +82,8 @@ import HandleFormItem from '@/components/Template/HandleFormItem.vue'; import { EventBus } from '@/utils/eventBus'; import { getLatestSn } from '@/api/template'; -import { isValueEmpty,justUpdateFilledFormData } from '@/utils/index.js'; +import { isValueEmpty, justUpdateFilledFormData } from '@/utils/index.js'; +import { getBalance } from '@/utils/tpph.js'; export default { inject: ['templateFillType'], dicts: [ @@ -87,6 +108,10 @@ export default { }, data() { return { + yqItem: { + type: "yq", + fillType: "actFill", + }, inputItem: { type: "input", fillType: "actFill", @@ -99,7 +124,8 @@ export default { inputNumberItem: { type: "inputNumber", fillType: "actFill", - label:"实际称量" + label: "实际称量", + disabled: true, }, preInputNumberItem: { type: "inputNumber", @@ -109,24 +135,27 @@ export default { mybh: "",//母液编号 fzsl: "",//分装数量 dw: "",//单位 + dztp: "",//电子天平 + dztpInfo: {},//电子天平信息 }, fzList: [],//分装列表 // 错误状态字段 formErrors: { fzsl: false, dw: false, + dztp: false, }, fzListErrors: [], // 分装列表错误状态 - uuid:"",//事件id + uuid: "",//事件id } }, watch: { - subData:{ + subData: { handler(newVal) { - if(newVal.formData){ + if (newVal.formData) { this.formData = newVal.formData; } - if(newVal.fzList){ + if (newVal.fzList) { this.fzList = newVal.fzList; } }, @@ -156,25 +185,25 @@ export default { options: this.dict.type.business_zldw } }, - subConfig(){ - return[ + subConfig() { + return [ { - fieldKey:"clfz_mybh", - key:"mybh", - label:"包装编号", - type:"input", + fieldKey: "clfz_mybh", + key: "mybh", + label: "包装编号", + type: "input", disabled: true, fillType: "actFill", }, { - fieldKey:"clfz_fzsl", - key:"fzsl", - label:"分装数量", - type:"inputNumber", + fieldKey: "clfz_fzsl", + key: "fzsl", + label: "分装数量", + type: "inputNumber", fillType: "preFill", precision: 0, maxlength: 3, - unit:"份", + unit: "份", }, // {//占位 // fieldKey:"clfz_dw1", @@ -184,22 +213,22 @@ export default { }, }, methods: { - onSure(){ + onSure() { this.$emit("onSubPackageSubmit"); }, - onPrint(item){ - console.log(item,"打印"); + onPrint(item) { + console.log(item, "打印"); }, - updateFormData(data){ - this.formData = {...this.formData,...data}; - if(data.mybh){ + updateFormData(data) { + this.formData = { ...this.formData, ...data }; + if (data.mybh) { this.updateCode(data.mybh); } }, // 更新分装列表 - async updateCode(mybh){ + async updateCode(mybh) { const { fzList } = this; - if(isValueEmpty(mybh) || isValueEmpty(fzList)){ + if (isValueEmpty(mybh) || isValueEmpty(fzList)) { return; } const result = await getLatestSn({ @@ -207,7 +236,7 @@ export default { count: fzList.length, type: 2, }) - if(result.code === 200){ + if (result.code === 200) { const codes = result.data; // 根据输入的数量生成新列表 for (let i = 0; i < fzList.length; i++) { @@ -221,24 +250,24 @@ export default { getButtonItem() { return { fillType: "actFill", - buttonName:"获取值", - key:"hqz", + buttonName: "获取值", + key: "hqz", } }, // 获取按钮项 getPrintButtonItem() { return { fillType: "actFill", - buttonName:"打印", - key:"print", + buttonName: "打印", + key: "print", } }, // 获取确认项 getSureButtonItem() { return { fillType: "actFill", - buttonName:"确定", - key:"sure", + buttonName: "确定", + key: "sure", } }, close() { @@ -276,12 +305,25 @@ export default { let isValid = true; // 定义需要验证的基础字段配制 - const baseFieldConfigs = this.subConfig; + const baseFieldConfigs = JSON.parse(JSON.stringify(this.subConfig)); + baseFieldConfigs.push( + { + key: "dztp", + label: "电子天平", + type: "yq", + fillType: "actFill", + }, + { + key: "dw", + label: "分装单位", + fillType: "preFill", + } + ) // 验证基础字段 baseFieldConfigs.forEach(config => { if (config.fillType === this.templateFillType) { - if (isValueEmpty(this.formData[config.key]) && !config.disabled) { + if (isValueEmpty(this.formData[config.key])) { this.formErrors[config.key] = true; isValid = false; } @@ -319,7 +361,7 @@ export default { } } } - return {valid: isValid,error:"质量分装数据没填完"}; + return { valid: isValid, error: "质量分装数据没填完" }; }, resetErrors() { // 重置表单错误状态 @@ -339,29 +381,48 @@ export default { // 清空现有列表 this.fzList = []; this.fzListErrors = []; - for (let i = 0; i < e; i++) { - this.fzList.push({ - prenum: "", - actnum: "", - subCode: "", - }); - } + for (let i = 0; i < e; i++) { + this.fzList.push({ + prenum: "", + actnum: "", + subCode: "", + }); + } justUpdateFilledFormData() - - + + + }, + onRegentSubmit(data, field) { + const { selectedId } = data; + this.formData[field] = selectedId; + this.formData.dztpInfo = data.row; + }, + async onGetValue(signData, item, index) { + const { dztp,dztpInfo,dw } = this.formData; + if (isValueEmpty(dztp)) { + this.$message.error("请选择电子天平"); + return; + } + const oldItem = JSON.parse(JSON.stringify(item)); + const result = await getBalance({yq:dztpInfo,dw}); + if(result.success){ + item.actnum = result.value; + this.fzList = [...this.fzList]; + this.$refs[this.prefixKey + this.stepIndex + '_actnum'+index][0].handleUpdateRecord(signData,{ + oldValue: oldItem.actnum, + inputValue: result.value + }) + }else{ + this.$message.error(result.message || "获取值失败"); + } }, - onGetValue(item) { - item.actnum = 123; - console.log(item,"获取值") - this.fzList = [...this.fzList] - }, - onCommonBlur(e,field) { + onCommonBlur(e, field) { if (this.formData[field]) { this.formErrors[field] = false; } - if(field === 'fzsl'){ - this.onBlurFzsl(e); - } + }, + onConfirm(field) { + this.onBlurFzsl(this.formData[field]); }, onBlurFzNum(index, field) { if (this.fzList[index]) { @@ -397,9 +458,9 @@ export default { !(item.rowIndex === index && item.field === field) ); }, - + hasError(index, field) { - const o = this.fzListErrors.find((item)=>{ + const o = this.fzListErrors.find((item) => { // 检查 item 是否存在且为对象类型 if (!item || typeof item !== 'object') { return false; // 忽略布尔值、null、undefined等无效值 @@ -422,18 +483,21 @@ export default { \ No newline at end of file diff --git a/src/components/Template/StepComponents/ry/bdzl.vue b/src/components/Template/StepComponents/ry/bdzl.vue index fff483b..aafa222 100644 --- a/src/components/Template/StepComponents/ry/bdzl.vue +++ b/src/components/Template/StepComponents/ry/bdzl.vue @@ -1,6 +1,6 @@ diff --git a/src/components/Template/StepComponents/ry/tpjysd.vue b/src/components/Template/StepComponents/ry/tpjysd.vue index 6b827d6..adb41ca 100644 --- a/src/components/Template/StepComponents/ry/tpjysd.vue +++ b/src/components/Template/StepComponents/ry/tpjysd.vue @@ -1,7 +1,7 @@ diff --git a/src/components/Template/StepFormPackage.vue b/src/components/Template/StepFormPackage.vue index 17bbb39..9bdd619 100644 --- a/src/components/Template/StepFormPackage.vue +++ b/src/components/Template/StepFormPackage.vue @@ -5,35 +5,37 @@