Browse Source

feat:[模板管理][烦人的提交记录]

lkf
luojie 2 months ago
parent
commit
da9714825b
13 changed files with 189 additions and 115 deletions
  1. +4
    -4
      src/components/Template/BaseInfoFormPackage.vue
  2. +56
    -45
      src/components/Template/CustomTable.vue
  3. +4
    -1
      src/components/Template/HandleFormItem.vue
  4. +4
    -4
      src/components/Template/Step.vue
  5. +9
    -2
      src/components/Template/mixins/formPackageMixins.js
  6. +55
    -30
      src/views/business/comps/template/TemplateTable.vue
  7. +8
    -1
      src/views/business/comps/template/comps/sp/SP001.vue
  8. +16
    -9
      src/views/business/comps/template/comps/sp/SP003.vue
  9. +11
    -7
      src/views/business/comps/template/comps/sp/SP00456.vue
  10. +2
    -1
      src/views/business/comps/template/dialog/SelectMixReagentDialog.vue
  11. +2
    -1
      src/views/business/comps/template/dialog/SubPackageDialog.vue
  12. +2
    -1
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
  13. +16
    -9
      src/views/business/comps/template/mixins/templateMixin.js

+ 4
- 4
src/components/Template/BaseInfoFormPackage.vue View File

@ -81,7 +81,7 @@
@update:error="errors[key] = false" :orange-bg="orangeBgFields[key]" /> @update:error="errors[key] = false" :orange-bg="orangeBgFields[key]" />
</div> </div>
<div v-else-if="sItem.type === 'clickable'" class="flex1"> <div v-else-if="sItem.type === 'clickable'" class="flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" type="clickable" @clickable="handleClickable(sItem, $event)"
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" type="clickable" @clickable="handleClickable(sItem, key)"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
@resetRecord="resetRecord(key)" @resetRecord="resetRecord(key)"
:item="sItem" :value="formFields[key]" /> :item="sItem" :value="formFields[key]" />
@ -128,7 +128,7 @@
:orange-bg="orangeBgFields[sItem.subKey]" /> :orange-bg="orangeBgFields[sItem.subKey]" />
<div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'" type="clickable" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'" type="clickable"
@clickable="handleClickable(sItem, $event)" :item="getClickableItem(sItem)"
@clickable="handleClickable(sItem, sItem.subKey)" :item="getClickableItem(sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false" :error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
@resetRecord="resetRecord(sItem.subKey)" @resetRecord="resetRecord(sItem.subKey)"
:value="formFields[sItem.subKey]" /> :value="formFields[sItem.subKey]" />
@ -158,14 +158,14 @@
:orange-bg="orangeBgFields[sItem.subKey]" /> :orange-bg="orangeBgFields[sItem.subKey]" />
<div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'"
@clickable="handleClickable(sItem, $event)" :error="errors[sItem.subKey]" type="clickable"
@clickable="handleClickable(sItem, sItem.subKey)" :error="errors[sItem.subKey]" type="clickable"
@update:error="errors[sItem.subKey] = false" @update:error="errors[sItem.subKey] = false"
@resetRecord="resetRecord(sItem.subKey)" @resetRecord="resetRecord(sItem.subKey)"
:item="getClickableItem(sItem)" :value="formFields[sItem.subKey]" /> :item="getClickableItem(sItem)" :value="formFields[sItem.subKey]" />
</div> </div>
<div v-else-if="sItem.type === 'clickable'" class="flex flex1"> <div v-else-if="sItem.type === 'clickable'" class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" <HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey+'_'+key" type="clickable" @clickable="handleClickable(sItem, $event)"
:field-key="prefixKey+'_'+key" type="clickable" @clickable="handleClickable(sItem,key)"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
@resetRecord="resetRecord(key)" @resetRecord="resetRecord(key)"
:item="sItem" :value="formFields[key]" /> :item="sItem" :value="formFields[key]" />

+ 56
- 45
src/components/Template/CustomTable.vue View File

@ -165,7 +165,7 @@ import { getuuid } from "@/utils/index.js";
import moment from "moment"; import moment from "moment";
import _ from "lodash"; import _ from "lodash";
export default { export default {
inject: ['templateFillType', 'getZdxgjl'],
inject: ['templateFillType', 'getZdxgjl', 'updateZdxgjl'],
name: 'CustomTable', name: 'CustomTable',
components: { components: {
HandleFormItem HandleFormItem
@ -246,15 +246,15 @@ export default {
} }
} }
}, },
mounted() {
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
},
unmounted() {
mounted() {
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
},
unmounted() {
this.oldLocalDataSource = []; this.oldLocalDataSource = [];
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
},
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
},
methods: { methods: {
handleEditSignCancel(data) { handleEditSignCancel(data) {
if (data.uuid === this.uuid) { if (data.uuid === this.uuid) {
@ -263,7 +263,7 @@ export default {
}, },
handleEditSignCallback(data) { handleEditSignCallback(data) {
if (data.uuid === this.uuid) { if (data.uuid === this.uuid) {
this.updateRecord();
this.updateRecords();
} }
}, },
getRecords() { getRecords() {
@ -295,8 +295,9 @@ export default {
title: oldValue ? "修改" : "提交", title: oldValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"), time: moment().format("YYYY-MM-DD HH:mm:ss"),
}; };
this.getZdxgjl().unshift(record);
this.updateZdxgjl(record);
records.push(record); records.push(record);
} }
if (col.bodySubKey) { if (col.bodySubKey) {
@ -317,7 +318,7 @@ export default {
title: oldSubValue ? "修改" : "提交", title: oldSubValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"), time: moment().format("YYYY-MM-DD HH:mm:ss"),
}; };
this.getZdxgjl().unshift(record);
this.updateZdxgjl(record);
records.push(record); records.push(record);
} }
} }
@ -342,7 +343,7 @@ export default {
title: oldOtherValue ? "修改" : "提交", title: oldOtherValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"), time: moment().format("YYYY-MM-DD HH:mm:ss"),
}; };
this.getZdxgjl().unshift(record);
this.updateZdxgjl(record);
records.push(record); records.push(record);
} }
} }
@ -351,21 +352,27 @@ export default {
return records; return records;
}, },
updateRecord() {
const records = this.getRecords();
const params = {
type: "fieldChanged",
newRecord: records,
resourceList: this.getZdxgjl(),
}
setTimeout(() => {
updateRecords() {
this.$nextTick(() => {
const records = this.getRecords();
const params = {
type: "fieldChanged",
newRecord: records,
resourceList: this.getZdxgjl(),
source: "customTable",
}
if (records.length == 0) {
return;
}
console.log(records, "records")
EventBus.$emit('onModifyRecord', params); EventBus.$emit('onModifyRecord', params);
}, 0);
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource));
this.oldLocalDataSource = [];
})
}, },
// //
resetRecord(rowIndex, colIndex,) { resetRecord(rowIndex, colIndex,) {
if(this.localDataSource.length){
if (this.localDataSource.length) {
this.localDataSource = [...this.oldLocalDataSource]; this.localDataSource = [...this.oldLocalDataSource];
this.oldLocalDataSource = []; this.oldLocalDataSource = [];
} }
@ -561,7 +568,7 @@ export default {
}, },
// //
onHeaderSelectChange(col, value) { onHeaderSelectChange(col, value) {
if(col.headerSelectTo){
if (col.headerSelectTo) {
this.headerSelectFields[col.headerSelectTo] = value; this.headerSelectFields[col.headerSelectTo] = value;
} }
this.headerSelectFields[col.headerSelectKey] = value; this.headerSelectFields[col.headerSelectKey] = value;
@ -719,50 +726,54 @@ export default {
this.localDataSource = JSON.parse(JSON.stringify(dataSource || [])); this.localDataSource = JSON.parse(JSON.stringify(dataSource || []));
}, },
// autoUpdateRecord // autoUpdateRecord
updateDataSourceByRowIndex(rowIndex, data,autoUpdateRecord = true) {
updateDataSourceByRowIndex(rowIndex, data, type) {
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource));
if(autoUpdateRecord){//formpackagetable
this.showEditSignDialog(rowIndex,data);
}
if (type === "clickable") {//customclickable
this.showEditSignDialog(rowIndex,data);
}else if(type === "blur"){
this.updateRecords();
}
this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data };
this.localDataSource = [...this.localDataSource]; this.localDataSource = [...this.localDataSource];
}, },
showEditSignDialog: _.debounce(function(rowIndex,data){
showEditSignDialog: _.debounce(function (rowIndex, data) {
const oldData = this.oldLocalDataSource[rowIndex]; const oldData = this.oldLocalDataSource[rowIndex];
let isFirst = false;//, let isFirst = false;//,
const isSame = this.compareOldAndCurrentFormFields(data,oldData);
const isSame = this.compareOldAndCurrentFormFields(data, oldData);
// dataoldDatadatakeyoldData // dataoldDatadatakeyoldData
for(const key in data) {
if(!oldData[key]&&oldData[key]!=0){
for (const key in data) {
if (!oldData[key] && oldData[key] != 0) {
isFirst = true; isFirst = true;
break; break;
} }
} }
if(!isFirst &&!isSame && this.templateFillType === "actFill"){
if (!isFirst && !isSame && this.templateFillType === "actFill") {
console.log("showww") console.log("showww")
setTimeout(() => { setTimeout(() => {
EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
}, 100); }, 100);
}else{
this.updateRecord(rowIndex,data);
} else {
console.log("not show")
this.updateRecords();
} }
}, 100), }, 100),
// newDataoldDatafalse
compareOldAndCurrentFormFields(newData,oldData) {
for (const key in newData) {
// newDataoldDatafalse
compareOldAndCurrentFormFields(newData, oldData) {
for (const key in newData) {
const oldValue = newData[key]; const oldValue = newData[key];
const currentValue = oldData[key]; const currentValue = oldData[key];
if (JSON.stringify(oldValue) !== JSON.stringify(currentValue)) { if (JSON.stringify(oldValue) !== JSON.stringify(currentValue)) {
return false; return false;
} else { } else {
return false;
return false;
} }
}
}
return true;
},
return true;
},
onAddRow() { onAddRow() {
this.addRow({ this.addRow({
actSolutionVolumePrecision: 3,//3 actSolutionVolumePrecision: 3,//3
@ -778,7 +789,7 @@ export default {
getDataSource() { getDataSource() {
return this.localDataSource; return this.localDataSource;
}, },
// //
hasError(rowIndex, colIndex, field) { hasError(rowIndex, colIndex, field) {
return this.formErrors.some(error => return this.formErrors.some(error =>

+ 4
- 1
src/components/Template/HandleFormItem.vue View File

@ -443,7 +443,7 @@ export default {
// //
this.inputValue = this.oldValue; this.inputValue = this.oldValue;
this.$emit('input', this.inputValue); // v-model this.$emit('input', this.inputValue); // v-model
this.$emit("blur", this.oldValue);
// this.$emit("blur", this.oldValue);
this.$emit("change", this.oldValue,"cancel"); this.$emit("change", this.oldValue,"cancel");
if(this.item.type === "clickable"){ if(this.item.type === "clickable"){
this.$emit("resetRecord"); this.$emit("resetRecord");
@ -475,6 +475,9 @@ export default {
this.$emit("blur", this.inputValue); this.$emit("blur", this.inputValue);
this.$emit('input', this.inputValue); this.$emit('input', this.inputValue);
this.$emit("change", this.inputValue,data?"save":""); this.$emit("change", this.inputValue,data?"save":"");
if(this.item.type === "clickable"){//clickable
return;
}
if(this.templateFillType === "actFill"){// if(this.templateFillType === "actFill"){//
this.updateZdxgjl(record); this.updateZdxgjl(record);
} }

+ 4
- 4
src/components/Template/Step.vue View File

@ -389,13 +389,13 @@ export default {
console.log(existingItem,"existingItem") console.log(existingItem,"existingItem")
// //
let currentItemYlInBaseUnit, existingItemYlInBaseUnit; let currentItemYlInBaseUnit, existingItemYlInBaseUnit;
if(item.type === 'sj') {
if(item.type === '1') {
// //
const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl); const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl);
const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl); const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl);
currentItemYlInBaseUnit = currentItemYl * volumeUnits[item.dw] || 0; currentItemYlInBaseUnit = currentItemYl * volumeUnits[item.dw] || 0;
existingItemYlInBaseUnit = existingItemYl * volumeUnits[existingItem.dw] || 0; existingItemYlInBaseUnit = existingItemYl * volumeUnits[existingItem.dw] || 0;
} else if(item.type === 'gsp') {
} else if(item.type === '7') {
// //
const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl); const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl);
const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl); const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl);
@ -413,9 +413,9 @@ export default {
const totalYlInBaseUnit = currentItemYlInBaseUnit + existingItemYlInBaseUnit; const totalYlInBaseUnit = currentItemYlInBaseUnit + existingItemYlInBaseUnit;
// existingItemyl使 // existingItemyl使
if(item.type === 'sj') {
if(item.type === '1') {
existingItem.yl = (totalYlInBaseUnit / volumeUnits[existingItem.dw]).toString(); existingItem.yl = (totalYlInBaseUnit / volumeUnits[existingItem.dw]).toString();
} else if(item.type === 'gsp') {
} else if(item.type === '7') {
existingItem.yl = (totalYlInBaseUnit / massUnits[existingItem.dw]).toString(); existingItem.yl = (totalYlInBaseUnit / massUnits[existingItem.dw]).toString();
} else { } else {
existingItem.yl = totalYlInBaseUnit.toString(); existingItem.yl = totalYlInBaseUnit.toString();

+ 9
- 2
src/components/Template/mixins/formPackageMixins.js View File

@ -35,6 +35,7 @@ export default {
return { return {
uuid: getuuid(), uuid: getuuid(),
oldFormFields: {}, oldFormFields: {},
clickableKey: "",
} }
}, },
mounted() { mounted() {
@ -120,7 +121,7 @@ export default {
}, },
//更新表单数据 //更新表单数据
updateFormData(key, value,autoUpdateRecord = true) {
updateFormData(key, value) {
// 深拷贝当前表单数据,避免直接修改原数据 // 深拷贝当前表单数据,避免直接修改原数据
const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); const cloneFormFields = JSON.parse(JSON.stringify(this.formFields));
@ -139,6 +140,11 @@ export default {
newRecord: records, newRecord: records,
resourceList: this.getZdxgjl(), resourceList: this.getZdxgjl(),
} }
//只要有更新就触发更新记录
if(this.templateFillType === "actFill" && this.clickableKey){
this.$emit("onSureModifyRecord", this.clickableKey)
this.clickableKey = "";
}
setTimeout(() => { setTimeout(() => {
EventBus.$emit('onModifyRecord', params,) EventBus.$emit('onModifyRecord', params,)
}, 0); }, 0);
@ -189,10 +195,11 @@ export default {
return true; return true;
}, },
handleClickable(sItem, event) {
handleClickable(sItem, key) {
if (this.templateFillType !== 'actFill') { if (this.templateFillType !== 'actFill') {
return return
} }
this.clickableKey = key;
this.$emit("clickable", sItem) this.$emit("clickable", sItem)
}, },
//根据span判断一行显示几列 //根据span判断一行显示几列

+ 55
- 30
src/views/business/comps/template/TemplateTable.vue View File

@ -1,19 +1,20 @@
<template> <template>
<div class="template-table"> <div class="template-table">
<component ref="templateComponent" :sn = "sn" :is="getTemplateComponent()" :templateData="templateData" :fillType="fillType">
<component ref="templateComponent" :sn="sn" :is="getTemplateComponent()" :templateData="templateData"
:fillType="fillType">
</component> </component>
<SubPackageDialog ref = "subPackageDialogRef"></SubPackageDialog>
<TagPrintDialog ref = "tagPrintDialogRef"></TagPrintDialog>
<SelectReagentDialog ref="selectReagentDialogRef"/>
<SelectInstrumentDialog ref="selectInstrumentDialogRef"/>
<SelectMixReagentDialog ref="selectMixReagentDialogRef"/>
<SubPackageDialog ref="subPackageDialogRef"></SubPackageDialog>
<TagPrintDialog ref="tagPrintDialogRef"></TagPrintDialog>
<SelectReagentDialog ref="selectReagentDialogRef" />
<SelectInstrumentDialog ref="selectInstrumentDialogRef" />
<SelectMixReagentDialog ref="selectMixReagentDialogRef" />
<EditSign ref="editSignRef" @cancel="handleEditSignCancel" @callback="handleEditSignCallback" /> <EditSign ref="editSignRef" @cancel="handleEditSignCancel" @callback="handleEditSignCallback" />
</div> </div>
</template> </template>
<script> <script>
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import { debounce } from 'lodash-es'
import SubPackageDialog from "./dialog/SubPackageDialog.vue";// import SubPackageDialog from "./dialog/SubPackageDialog.vue";//
import TagPrintDialog from "./dialog/PrintTagDialog.vue";// import TagPrintDialog from "./dialog/PrintTagDialog.vue";//
import SelectReagentDialog from "./dialog/SelectReagentDialog.vue";// import SelectReagentDialog from "./dialog/SelectReagentDialog.vue";//
@ -49,11 +50,11 @@ export default {
name: "TemplateTable", name: "TemplateTable",
components: { components: {
Demo, Demo,
SubPackageDialog,TagPrintDialog,SelectReagentDialog,SelectInstrumentDialog,SelectMixReagentDialog,EditSign,
SubPackageDialog, TagPrintDialog, SelectReagentDialog, SelectInstrumentDialog, SelectMixReagentDialog, EditSign,
// //
MJYLQSQD, SYWZPZJHB, MJYLQSQD, SYWZPZJHB,
// //
SP001, SP002, SP003, SP00456,ZQDYJMD,QXWDX,CBYHGZYWDX,Recovery,RXJZXY,JZXY,XZXHTYX,ZDYBS,XSKKX,CBYDB,SWYPFXFFXZKPZB
SP001, SP002, SP003, SP00456, ZQDYJMD, QXWDX, CBYHGZYWDX, Recovery, RXJZXY, JZXY, XZXHTYX, ZDYBS, XSKKX, CBYDB, SWYPFXFFXZKPZB
}, },
props: { props: {
sn: { sn: {
@ -81,10 +82,10 @@ export default {
// //
'SP001': 'SP001', 'SP001': 'SP001',
'SP002': 'SP002', 'SP002': 'SP002',
'SP003': 'SWYPBQGZYZBB',
'SP004': 'SWYPNBGZYZBB',
'SP005': 'SWYPNBGZYZBB',
'SP006': 'SWYPNBGZYZBB',
'SP003': 'SP003',
'SP004': 'SP00456',
'SP005': 'SP00456',
'SP006': 'SP00456',
'SP008': 'ZQDYJMD', 'SP008': 'ZQDYJMD',
'SP009': 'Recovery', 'SP009': 'Recovery',
'SP010': 'QXWDX', 'SP010': 'QXWDX',
@ -134,7 +135,7 @@ export default {
//fillType //fillType
templateData: this.templateData, templateData: this.templateData,
templateFillType: this.fillType, templateFillType: this.fillType,
getZdxgjl: () => this.zdxgjl ,
getZdxgjl: () => this.zdxgjl,
getFhyjjl: () => this.fhyjjl, getFhyjjl: () => this.fhyjjl,
getFieldCheckObj: () => this.fieldCheckObj, getFieldCheckObj: () => this.fieldCheckObj,
// //
@ -163,34 +164,37 @@ export default {
fhyjjl: [], fhyjjl: [],
fieldCheckObj: {}, fieldCheckObj: {},
currentEditSignUuid: null, // EditSignHandleFormItemuuid currentEditSignUuid: null, // EditSignHandleFormItemuuid
latestParams: {},//params
hasCustomTable: false,//
}; };
}, },
created() {
this.debouncedEmit = debounce(this.emitToParent, 100)
},
mounted() { mounted() {
EventBus.$on('onModifyRecord', (data) => {
this.$emit(this.emitName, data)
});
EventBus.$on('onModifyRecord', this.handleModyfyRecord);
// //
EventBus.$on("showSubPackageDialog",(data)=>{
EventBus.$on("showSubPackageDialog", (data) => {
this.$refs.subPackageDialogRef.show(data) this.$refs.subPackageDialogRef.show(data)
}) })
// //
EventBus.$on("showTagPrintDialog",(data)=>{
EventBus.$on("showTagPrintDialog", (data) => {
this.$refs.tagPrintDialogRef.show(data) this.$refs.tagPrintDialogRef.show(data)
}) })
// //
EventBus.$on("showSelectInstrumentDialog",(data)=>{
this.$refs.selectInstrumentDialogRef.show(data.studyFormId,data)
EventBus.$on("showSelectInstrumentDialog", (data) => {
this.$refs.selectInstrumentDialogRef.show(data.studyFormId, data)
}) })
// //
EventBus.$on("showSelectReagentDialog",(data)=>{
this.$refs.selectReagentDialogRef.show(data.studyFormId,data)
EventBus.$on("showSelectReagentDialog", (data) => {
this.$refs.selectReagentDialogRef.show(data.studyFormId, data)
}) })
//// ////
EventBus.$on("showSelectMixReagentDialog",(data)=>{
this.$refs.selectMixReagentDialogRef.show(data.studyFormId,data)
EventBus.$on("showSelectMixReagentDialog", (data) => {
this.$refs.selectMixReagentDialogRef.show(data.studyFormId, data)
}) })
// //
EventBus.$on("showEditSignDialog",(data)=>{
EventBus.$on("showEditSignDialog", (data) => {
this.currentEditSignUuid = data.uuid; this.currentEditSignUuid = data.uuid;
this.$refs.editSignRef.show(); this.$refs.editSignRef.show();
}) })
@ -204,8 +208,29 @@ export default {
EventBus.$off("showSelectInstrumentDialog"); EventBus.$off("showSelectInstrumentDialog");
EventBus.$off("showSelectMixReagentDialog"); EventBus.$off("showSelectMixReagentDialog");
EventBus.$off("showEditSignDialog"); EventBus.$off("showEditSignDialog");
this.debouncedEmit.cancel()
}, },
methods: { methods: {
handleModyfyRecord(data) {
const { source } = data;
if (source === "customTable") {
this.latestParams = data;
// delete this.latestParams.source
this.hasCustomTable = true
//
this.debouncedEmit.cancel()
this.emitToParent()
}else if(!source && !this.hasCustomTable){
this.latestParams = data
this.debouncedEmit()
}
},
emitToParent() {
if (this.latestParams) {
console.log(this.latestParams,"this.latestParams")
this.$emit(this.emitName, this.latestParams)
}
},
// //
handleEditSignCancel() { handleEditSignCancel() {
if (this.currentEditSignUuid) { if (this.currentEditSignUuid) {
@ -222,11 +247,11 @@ export default {
} }
}, },
async getFormData() { async getFormData() {
if(this.fillType === "actFill"){
if (this.fillType === "actFill") {
// //
const flag = this.fhyjjl.every((item)=>!!item.content && !!item.reply)
console.log(this.fhyjjl,flag,"flag")
if(!flag){
const flag = this.fhyjjl.every((item) => !!item.content && !!item.reply)
console.log(this.fhyjjl, flag, "flag")
if (!flag) {
this.$message.error("疑问项还未回复,请回复后再提交"); this.$message.error("疑问项还未回复,请回复后再提交");
return; return;
} }

+ 8
- 1
src/views/business/comps/template/comps/sp/SP001.vue View File

@ -27,6 +27,7 @@
</div> </div>
</div> </div>
</div> </div>
<button @click="onSave">保存</button>
</div> </div>
</template> </template>
@ -315,7 +316,13 @@ export default {
this.resourceTmp =uniqeResource(tmpResource,stepResource.sjResource||[]) this.resourceTmp =uniqeResource(tmpResource,stepResource.sjResource||[])
this.yqResourceTmp = stepResource.yqResource||[] this.yqResourceTmp = stepResource.yqResource||[]
return content; return content;
}
},
//
async onSave() {
let content = this.$refs.stepRef.getStepResource();
console.log(content);
},
} }
}; };
</script> </script>

+ 16
- 9
src/views/business/comps/template/comps/sp/SP003.vue View File

@ -16,7 +16,9 @@
<div class="template-form-item"> <div class="template-form-item">
<BaseInfoFormPackage @clickable="handleClickable" ref="stepFormPackageRef" <BaseInfoFormPackage @clickable="handleClickable" ref="stepFormPackageRef"
fieldItemLabel="template.common.operationSteps" fieldItemLabel="template.common.operationSteps"
@resetRecord="resetRecord" :formConfig="stepFormConfig" @blur="onHandleBlur"
@resetRecord="resetRecord"
@onSureModifyRecord="onSureModifyRecord"
:formConfig="stepFormConfig" @blur="onHandleBlur"
:formData="formData" /> :formData="formData" />
<CustomTable fieldItemLabel="template.common.operationSteps" @blur="onHandleTableBlur" <CustomTable fieldItemLabel="template.common.operationSteps" @blur="onHandleTableBlur"
:showAddRow="false" :showOperation="fillType === 'actFill'" ref="stepTableRef" :showAddRow="false" :showOperation="fillType === 'actFill'" ref="stepTableRef"
@ -421,6 +423,13 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
//
onSureModifyRecord(key) {
if(key === "subStartSolution"){//table
this.$refs.stepTableRef.updateRecords();
}
},
resetRecord() { resetRecord() {
this.$refs.stepTableRef.resetRecord(); this.$refs.stepTableRef.resetRecord();
}, },
@ -484,7 +493,8 @@ export default {
if (hasAnyWithValue) { if (hasAnyWithValue) {
return; return;
} }
const snList = await this.getLatestSn(stepTableFormData.length);
const codes = stepTableFormData.map((item) => ({prex:item.targetSolutionCode,type:1}));
const snList = await this.getLatestSnArr(codes);
stepTableFormData.forEach((item, index) => { stepTableFormData.forEach((item, index) => {
this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: snList[index] }); this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: snList[index] });
}) })
@ -543,14 +553,11 @@ export default {
newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode; newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode;
} }
const { actVol, actNd } = this.updateSjmbrynd(item, row.nd); const { actVol, actNd } = this.updateSjmbrynd(item, row.nd);
var o = {
actSolutionVolume: actVol,
actSolutionConcentration: actNd,
actSolutionExpire: row.sxr,
}
this.$refs.stepTableRef.updateDataSourceByRowIndex(i, o);
item.actSolutionVolume = actVol;
item.actSolutionConcentration = actNd;
item.actSolutionExpire = row.sxr;
} }
this.$refs.stepTableRef.updateDataSource(newStepTableData);
// stepTableRef // stepTableRef
}, },
async getFormData() { async getFormData() {

+ 11
- 7
src/views/business/comps/template/comps/sp/SP00456.vue View File

@ -30,6 +30,7 @@
</div> </div>
<BaseInfoFormPackage @clickable="(e) => handleClickable('ladder', ladderIndex, e)" <BaseInfoFormPackage @clickable="(e) => handleClickable('ladder', ladderIndex, e)"
@resetRecord="(e) => resetRecord('ladder', ladderIndex, e)" @resetRecord="(e) => resetRecord('ladder', ladderIndex, e)"
@onSureModifyRecord="(e) => onSureModifyRecord('ladder', ladderIndex, e)"
:ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig" :ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig"
@blur="onHandleBlur" :formData="ladderConfig" fieldItemLabel="阶梯配制" @blur="onHandleBlur" :formData="ladderConfig" fieldItemLabel="阶梯配制"
:prefixKey="'ladder_' + ladderIndex" /> :prefixKey="'ladder_' + ladderIndex" />
@ -187,6 +188,9 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
onSureModifyRecord(type, index, e) {
this.$refs[`ladderStepTableRef_${index}`][0].updateRecords();
},
resetRecord(type, index, e) { resetRecord(type, index, e) {
this.$refs[`ladderStepTableRef_${index}`][0].resetRecord(); this.$refs[`ladderStepTableRef_${index}`][0].resetRecord();
}, },
@ -286,8 +290,8 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// //
if (!hasAnyWithValue) { if (!hasAnyWithValue) {
const length = tableDataArray.length;
const snList = await this.getLatestSn(length);
const codes = stepTableFormData.map((item) => ({prex:item.targetSolutionCode,type:1}));
const snList = await this.getLatestSnArr(codes);
tableDataArray.forEach((row, idx) => { tableDataArray.forEach((row, idx) => {
let expDate = {}; let expDate = {};
if (config === "paralleConfigs" && !row.targetSolutionExpirationDate) { if (config === "paralleConfigs" && !row.targetSolutionExpirationDate) {
@ -401,7 +405,7 @@ export default {
this.$refs[`ladderStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, { this.$refs[`ladderStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, {
actSolutionVolume: actVol, actSolutionVolume: actVol,
actSolutionConcentration: actNd, actSolutionConcentration: actNd,
});
},"blur");
} }
} else if (type === "paralle") { } else if (type === "paralle") {
const targetAcSolution = item.targetAcSolution || 0;// const targetAcSolution = item.targetAcSolution || 0;//
@ -411,7 +415,7 @@ export default {
this.$refs[`paralleStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, { this.$refs[`paralleStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, {
actSolutionVolume: actVol, actSolutionVolume: actVol,
actSolutionConcentration: actNd, actSolutionConcentration: actNd,
});
},"blur");
} }
} }
@ -464,8 +468,7 @@ export default {
targetAcSolution: row.nd, targetAcSolution: row.nd,
actSolutionVolume: actVol, actSolutionVolume: actVol,
actSolutionConcentration: actNd, actSolutionConcentration: actNd,
})
},"clickable")
} }
} }
this.$refs.selectReagentDialogRef.onCancel(); this.$refs.selectReagentDialogRef.onCancel();
@ -494,8 +497,9 @@ export default {
actSolutionConcentration: actNd, actSolutionConcentration: actNd,
} }
// stepTableRef // stepTableRef
this.$refs[`ladderStepTableRef_${this.currentRowIndex}`][0].updateDataSourceByRowIndex(index, o);
}) })
this.$refs[`ladderStepTableRef_${this.currentRowIndex}`][0].updateDataSource(newData);
}, },
// //
async validFields() { async validFields() {

+ 2
- 1
src/views/business/comps/template/dialog/SelectMixReagentDialog.vue View File

@ -146,7 +146,8 @@ export default {
nd: row.nd, nd: row.nd,
ly: row.ly, ly: row.ly,
nddw: row.nddw, nddw: row.nddw,
sxrq: row.sxrq,
sxrq: row.sxr,
ndz: (row.nd||"")+(row.nddw||""),
type: Number(this.selectType), type: Number(this.selectType),
} }
this.$emit('submit', selectedValue, row); this.$emit('submit', selectedValue, row);

+ 2
- 1
src/views/business/comps/template/dialog/SubPackageDialog.vue View File

@ -221,8 +221,9 @@ export default {
this.fzList = []; this.fzList = [];
this.fzListErrors = []; this.fzListErrors = [];
const result = await getLatestSn({ const result = await getLatestSn({
my: this.formData.mybh,
pre: this.formData.mybh,
count: e, count: e,
type: 2,
}) })
if(result.code === 200){ if(result.code === 200){
const codes = result.data; const codes = result.data;

+ 2
- 1
src/views/business/comps/template/formConfig/paralleAndLadderConfig.js View File

@ -81,7 +81,7 @@ export const getLadderColumnsConfig = ($this) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom: 'targetDiluentVolume', //复制哪个字段
// copyFrom: 'targetDiluentVolume', //复制哪个字段
compareTo: 'targetDiluentVolume', //比较哪个字段 compareTo: 'targetDiluentVolume', //比较哪个字段
}, },
{ {
@ -351,6 +351,7 @@ export const getParallelColumnsConfig = ($this) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyMaxlength: 10, bodyMaxlength: 10,
copyFrom:"targetDiluentVolume",
compareTo: 'targetDiluentVolume' //比较哪个字段 compareTo: 'targetDiluentVolume' //比较哪个字段
} }
] ]

+ 16
- 9
src/views/business/comps/template/mixins/templateMixin.js View File

@ -1,5 +1,5 @@
import moment from 'moment' import moment from 'moment'
import { getLatestSn } from '@/api/template';
import { getLatestSn,getLatestSnArr } from '@/api/template';
import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from '@/api/business/sj/sj'; import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from '@/api/business/sj/sj';
export default { export default {
dicts: [ dicts: [
@ -209,7 +209,15 @@ export default {
if (res.code === 200) { if (res.code === 200) {
return res.data return res.data
} }
return null
return []
},
//获取最新的多个编号
async getLatestSnArr(params) {
const res = await getLatestSnArr(params)
if (res.code === 200) {
return res.data
}
return []
}, },
getResource() { getResource() {
return this.resourceTmp return this.resourceTmp
@ -353,8 +361,7 @@ export default {
0 //获取实际起始溶液浓度 0 //获取实际起始溶液浓度
if (targetAcSolution) { if (targetAcSolution) {
const { actVol, actNd } = this.updateSjmbrynd(item, targetAcSolution); const { actVol, actNd } = this.updateSjmbrynd(item, targetAcSolution);
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { actSolutionVolume: actVol })
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { actSolutionConcentration: actNd })
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { actSolutionVolume: actVol,actSolutionConcentration: actNd},"blur")
} }
} }
}, },
@ -379,11 +386,11 @@ export default {
actStartSolutionVolume / actStartSolutionVolume /
actVol actVol
).toFixed(precision) ).toFixed(precision)
const nd = actNd === 'Infinity' ? 0 : actNd
const nd = actNd === 'Infinity' ? 0 : Number(actNd)
console.log(actNd, targetAcSolution, actStartSolutionVolume, actVol, "actNd") console.log(actNd, targetAcSolution, actStartSolutionVolume, actVol, "actNd")
// item.actSolutionConcentration = actNd === 'Infinity' ? 0 : actNd // item.actSolutionConcentration = actNd === 'Infinity' ? 0 : actNd
return { actVol, actNd: nd }
return { actVol:Number(actVol), actNd: nd }
}, },
//更新起始溶液体积时,计算目标溶液预计浓度 //更新起始溶液体积时,计算目标溶液预计浓度
updateTargetStartSolutionVolume(item, volume) { updateTargetStartSolutionVolume(item, volume) {
@ -391,16 +398,16 @@ export default {
const concentration = item.targetSolutionConcentration || 0 const concentration = item.targetSolutionConcentration || 0
const targetVolume = item.targetSolutionVolume || 0 const targetVolume = item.targetSolutionVolume || 0
//目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积 //目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积
const result = ((concentration * targetVolume) / volume).toFixed(
const result = Number(((concentration * targetVolume) / volume).toFixed(
precision precision
)
))
item.targetStartSolutionVolume = result item.targetStartSolutionVolume = result
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result });
if (targetVolume) { if (targetVolume) {
//预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积; //预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积;
const precision1 = item.targetDiluentVolumePrecision || 0 const precision1 = item.targetDiluentVolumePrecision || 0
const result1 = (targetVolume - result).toFixed(precision1) const result1 = (targetVolume - result).toFixed(precision1)
item.targetDiluentVolume = result1
item.targetDiluentVolume = Number(result1)
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 });
} }
} }

Loading…
Cancel
Save