Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
58628893dc
9 changed files with 138 additions and 328 deletions
  1. +6
    -0
      src/components/Template/BaseInfoFormPackage.vue
  2. +26
    -138
      src/components/Template/CustomTable.vue
  3. +37
    -10
      src/components/Template/HandleFormItem.vue
  4. +1
    -113
      src/components/Template/mixins/formPackageMixins.js
  5. +6
    -0
      src/utils/index.js
  6. +33
    -61
      src/views/business/comps/template/comps/sp/SP00456.vue
  7. +8
    -1
      src/views/business/comps/template/comps/sp/SP007.vue
  8. +5
    -5
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
  9. +16
    -0
      src/views/business/comps/template/formConfig/sp/SP007.js

+ 6
- 0
src/components/Template/BaseInfoFormPackage.vue View File

@ -104,6 +104,7 @@
</div> </div>
<div v-else-if="isRegent(sItem)" class="flex1"> <div v-else-if="isRegent(sItem)" class="flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" :type="sItem.type" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" :type="sItem.type"
sourceFrom = "baseInfoFormPackage"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)" @onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
:item="sItem" :value="formFields[key]" /> :item="sItem" :value="formFields[key]" />
@ -156,6 +157,7 @@
:value="formFields[sItem.subKey]" /> :value="formFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="isRegent(sItem,'subType')" :type="sItem.subType" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="isRegent(sItem,'subType')" :type="sItem.subType"
:item="getRegentItem(sItem,'subType')" :item="getRegentItem(sItem,'subType')"
sourceFrom = "baseInfoFormPackage"
@onRegentSubmit="(data)=>onRegentSubmit(data,sItem.subKey,sItem)" @onRegentSubmit="(data)=>onRegentSubmit(data,sItem.subKey,sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false" :error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:value="formFields[sItem.subKey]" /> :value="formFields[sItem.subKey]" />
@ -190,6 +192,7 @@
@resetRecord="resetRecord(sItem.subKey)" @resetRecord="resetRecord(sItem.subKey)"
:item="getClickableItem(sItem)" :value="formFields[sItem.subKey]" /> :item="getClickableItem(sItem)" :value="formFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="isRegent(sItem,'subType')" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="isRegent(sItem,'subType')"
sourceFrom = "baseInfoFormPackage"
:error="errors[sItem.subKey]" :type="sItem.subType" :error="errors[sItem.subKey]" :type="sItem.subType"
@onRegentSubmit="(data)=>onRegentSubmit(data,sItem.subKey,sItem)" @onRegentSubmit="(data)=>onRegentSubmit(data,sItem.subKey,sItem)"
:item="getRegentItem(sItem,'subType')" :value="formFields[sItem.subKey]" /> :item="getRegentItem(sItem,'subType')" :value="formFields[sItem.subKey]" />
@ -204,6 +207,7 @@
<div v-else-if="isRegent(sItem)" <div v-else-if="isRegent(sItem)"
class="flex flex1"> class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" <HandleFormItem :field-item-label="fieldItemLabel"
sourceFrom = "baseInfoFormPackage"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)" @onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
:field-key="prefixKey+'_'+key" :type="sItem.type" :field-key="prefixKey+'_'+key" :type="sItem.type"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
@ -221,6 +225,7 @@
import HandleFormItem from "./HandleFormItem.vue"; import HandleFormItem from "./HandleFormItem.vue";
import LineLabel from "./LineLabel.vue"; import LineLabel from "./LineLabel.vue";
import { isShowOther } from "@/utils/formPackageCommon.js"; import { isShowOther } from "@/utils/formPackageCommon.js";
import { isRegent } from "@/utils/index.js";
import formPackageMixins from '@/components/Template/mixins/formPackageMixins.js' import formPackageMixins from '@/components/Template/mixins/formPackageMixins.js'
export default { export default {
@ -262,6 +267,7 @@ export default {
orangeBgFields: {},// orangeBgFields: {},//
oldFormFields: {},// oldFormFields: {},//
isShowOther, isShowOther,
isRegent
}; };
}, },
} }

+ 26
- 138
src/components/Template/CustomTable.vue View File

@ -82,6 +82,16 @@
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" /> :orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div> </div>
<div class="flex flex1" v-else-if="isRegent(col,'bodyType')">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" :type="col.bodyType" class="body-clickable"
sourceFrom = "customTable"
:item="getBodyItem(col, rowIndex)" :value="row[col.prop]"
:error="hasError(rowIndex, colIndex, col.prop)"
@onRegentSubmit="(data)=>onRegentSubmit(data,col, rowIndex, colIndex, row)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div>
<template v-else-if="col.bodyType === 'span'"> <template v-else-if="col.bodyType === 'span'">
<div class="body-span"> <div class="body-span">
{{ row[col.prop] }} {{ row[col.prop] }}
@ -162,6 +172,7 @@ import { isEqual } from "@/utils/index.js";
import { isShowOther } from "@/utils/formPackageCommon.js"; import { isShowOther } from "@/utils/formPackageCommon.js";
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import { getuuid } from "@/utils/index.js"; import { getuuid } from "@/utils/index.js";
import { isRegent } from "@/utils/index.js";
import moment from "moment"; import moment from "moment";
import _ from "lodash"; import _ from "lodash";
export default { export default {
@ -222,6 +233,7 @@ export default {
isShowOther, isShowOther,
oldLocalDataSource: [], oldLocalDataSource: [],
uuid: getuuid(), uuid: getuuid(),
isRegent,
} }
}, },
watch: { watch: {
@ -247,144 +259,14 @@ export default {
} }
}, },
mounted() { mounted() {
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
}, },
unmounted() { unmounted() {
this.oldLocalDataSource = []; this.oldLocalDataSource = [];
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
}, },
methods: { methods: {
handleEditSignCancel(data) {
if (data.uuid === this.uuid) {
this.resetRecord();
}
},
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
this.updateRecords(data);
}
},
getRecords(data) {
const records = [];
const { nickName, name } = this.$store.getters;
const { oldLocalDataSource, localDataSource, columns, prefixKey, fieldItemLabel } = this;
localDataSource.forEach((row, rowIndex) => {
const oldRow = oldLocalDataSource[rowIndex];
if (!oldRow) {
return;
}
columns.forEach((col, colIndex) => {
const oldValue = oldRow[col.prop];
const newValue = row[col.prop];
//
if(this.isValueEmpty(newValue) && this.isValueEmpty(oldValue)){
return
}
if (!isEqual(oldValue, newValue)) {
const fieldLabelCn = this.$i18n.t(col.label, "zh_CN");
const fieldLabelEn = this.$i18n.t(col.label, "en_US");
const record = {
userNameCn: nickName,
userNameEn: name,
key: prefixKey + '_' + col.prop + '_' + rowIndex,
fieldCn: `${this.$i18n.t(fieldItemLabel, "zh_CN")}-${fieldLabelCn}`,
fieldEn: `${this.$i18n.t(fieldItemLabel, "en_US")}-${fieldLabelEn}`,
oldValue: oldValue,
value: newValue,
title: oldValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
if (col.bodySubKey) {
const oldSubValue = oldRow[col.bodySubKey];
const newSubValue = row[col.bodySubKey];
if(this.isValueEmpty(newSubValue) && this.isValueEmpty(oldSubValue)){
return
}
if (!isEqual(oldSubValue, newSubValue)) {
const fieldLabelCn = this.$i18n.t(col.label, "zh_CN");
const fieldLabelEn = this.$i18n.t(col.label, "en_US");
const record = {
userNameCn: nickName,
userNameEn: name,
key: prefixKey + '_' + col.bodySubKey + '_' + rowIndex,
fieldCn: `${this.$i18n.t(fieldItemLabel, "zh_CN")}-${fieldLabelCn}单位`,
fieldEn: `${this.$i18n.t(fieldItemLabel, "en_US")}-${fieldLabelEn}单位`,
oldValue: oldSubValue,
value: newSubValue,
title: oldSubValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
}
if (col.otherCode) {
const oldOtherValue = oldRow[col.otherCode];
const newOtherValue = row[col.otherCode];
if (!isEqual(oldOtherValue, newOtherValue)) {
const fieldLabelCn = this.$i18n.t(col.label, "zh_CN");
const fieldLabelEn = this.$i18n.t(col.label, "en_US");
const otherLabelCn = col.otherLabel ? this.$i18n.t(col.otherLabel, "zh_CN") : this.$i18n.t("template.common.other", "zh_CN");
const otherLabelEn = col.otherLabel ? this.$i18n.t(col.otherLabel, "en_US") : this.$i18n.t("template.common.other", "en_US");
const record = {
userNameCn: nickName,
userNameEn: name,
key: prefixKey + '_' + col.otherCode + '_' + rowIndex,
fieldCn: `${this.$i18n.t(fieldItemLabel, "zh_CN")}-${fieldLabelCn}${otherLabelCn}`,
fieldEn: `${this.$i18n.t(fieldItemLabel, "en_US")}-${fieldLabelEn}${otherLabelEn}`,
oldValue: oldOtherValue,
value: newOtherValue,
title: oldOtherValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
}
});
});
return records;
},
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);
this.oldLocalDataSource = [];
})
},
// //
resetRecord(rowIndex, colIndex,) { resetRecord(rowIndex, colIndex,) {
if (this.localDataSource.length) { if (this.localDataSource.length) {
@ -422,6 +304,12 @@ export default {
} }
this.$emit("clickable", col, rowIndex, row) this.$emit("clickable", col, rowIndex, row)
}, },
onRegentSubmit(data, col, rowIndex, colIndex, row){
if (this.templateFillType !== 'actFill') {
return
}
this.$emit("onRegentSubmit", {selectInfo:data,key:col.prop, col, rowIndex, colIndex, rowData:row})
},
isShowAddRos() { isShowAddRos() {
if (this.showAddRow !== undefined) { if (this.showAddRow !== undefined) {
return this.showAddRow return this.showAddRow
@ -744,11 +632,11 @@ export default {
// autoUpdateRecord // autoUpdateRecord
updateDataSourceByRowIndex(rowIndex, data, type) { updateDataSourceByRowIndex(rowIndex, data, type) {
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource));
if (type === "clickable") {//customclickable
this.showEditSignDialog(rowIndex,data);
}else if(type === "blur"){
this.updateRecords();
}
// 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];
this.checkCompareToOnDataLoad(); this.checkCompareToOnDataLoad();

+ 37
- 10
src/components/Template/HandleFormItem.vue View File

@ -47,11 +47,20 @@
</div> </div>
<div class="clickable" <div class="clickable"
:class="getFillTypeStyle() + (getDisabled() ? ' disabled' : '') + (orangeBg ? ' orange-bg' : '')" :class="getFillTypeStyle() + (getDisabled() ? ' disabled' : '') + (orangeBg ? ' orange-bg' : '')"
v-else-if="regentType.includes(item.type)"
@click="onCommonHandleRegent(item, item.type)">
v-else-if="regentType.includes(item.type)" @click="onCommonHandleRegent(item, item.type)">
<span v-if="inputValue">{{ inputValue }}</span> <span v-if="inputValue">{{ inputValue }}</span>
<span v-else class="default-placeholder-text">{{ getPlaceholder() }}</span> <span v-else class="default-placeholder-text">{{ getPlaceholder() }}</span>
</div> </div>
<template>
<el-upload class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview"
:headers="headers"
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="10"
:on-exceed="handleExceed" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
</template>
</div> </div>
<div class="handle-row" v-if="isShowHandle()"> <div class="handle-row" v-if="isShowHandle()">
<el-checkbox v-model="checkboxValue" v-if="getIsShowCheckboxIcon()" :disabled="getCheckboxDisabled()" <el-checkbox v-model="checkboxValue" v-if="getIsShowCheckboxIcon()" :disabled="getCheckboxDisabled()"
@ -122,6 +131,7 @@ import { EventBus } from "@/utils/eventBus";
import moment from "moment"; import moment from "moment";
import { deepClone } from "@/utils/index"; import { deepClone } from "@/utils/index";
import { getuuid } from "@/utils/index.js"; import { getuuid } from "@/utils/index.js";
import { getToken } from "@/utils/auth"
export default { export default {
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
components: { components: {
@ -191,8 +201,13 @@ export default {
visible: false,// visible: false,//
checkboxValue: this.getChecked(),// checkboxValue: this.getChecked(),//
uuid: getuuid(), // EventBus uuid: getuuid(), // EventBus
regentType:['sj','gsp','mix','xj','xb','gyzj','mjy','yq'], ////
selectRegentInfo:{},////
regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq'], ////
selectRegentInfo: {},////
fileList: [],//
uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload",
headers: {
Authorization: "Bearer " + getToken(),
},
} }
}, },
watch: { watch: {
@ -230,9 +245,21 @@ export default {
EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit) EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit)
}, },
methods: { methods: {
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
// //
onMixReagentSubmit(data){
if(data.uuid !== this.uuid) return;
onMixReagentSubmit(data) {
if (data.uuid !== this.uuid) return;
this.inputValue = data.selectedId; this.inputValue = data.selectedId;
this.selectRegentInfo = data; this.selectRegentInfo = data;
this.onCommonHandleSaveRecord(); this.onCommonHandleSaveRecord();
@ -241,9 +268,9 @@ export default {
/// ///
onCommonHandleRegent(item, type) { onCommonHandleRegent(item, type) {
let params = { let params = {
studyFormId:this.templateData.id,
uuid:this.uuid,
sourceFrom:this.sourceFrom,
studyFormId: this.templateData.id,
uuid: this.uuid,
sourceFrom: this.sourceFrom,
} }
if (type !== "yq") { if (type !== "yq") {
const sjType = { const sjType = {
@ -535,7 +562,7 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
EventBus.$emit('onModifyRecord', params,) EventBus.$emit('onModifyRecord', params,)
if(this.regentType.includes(this.item.type)){
if (this.regentType.includes(this.item.type)) {
this.$emit("onRegentSubmit", this.selectRegentInfo); this.$emit("onRegentSubmit", this.selectRegentInfo);
} }
}, 10); }, 10);

+ 1
- 113
src/components/Template/mixins/formPackageMixins.js View File

@ -40,13 +40,9 @@ export default {
}, },
mounted() { mounted() {
this.handleFormField(); this.handleFormField();
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
}, },
unmounted() { unmounted() {
this.formFields = {};//清空当前填写的数据 this.formFields = {};//清空当前填写的数据
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
}, },
methods: { methods: {
@ -54,12 +50,6 @@ export default {
onRegentSubmit(data,key,item){ onRegentSubmit(data,key,item){
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item}); this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
}, },
//是不是试剂/仪器等弹窗类型
isRegent(item,fieldCode="type"){
const type = item[fieldCode] ;
const typeList = ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq']
return typeList.includes(type);
},
getRegentItem(item,fieldCode="type"){ getRegentItem(item,fieldCode="type"){
const type = item[fieldCode] ; const type = item[fieldCode] ;
return { return {
@ -69,48 +59,7 @@ export default {
parentLabel: item.label, parentLabel: item.label,
} }
}, },
getRecords(data) {
const records = [];
const { nickName, name } = this.$store.getters;
const { oldFormFields, formFields, allFieldsConfig, prefixKey, fieldItemLabel } = this;
Object.keys(oldFormFields).forEach(key => {
const item = allFieldsConfig[key];
const { label } = item;
const oldValue = oldFormFields[key];;
const newValue = formFields[key];
let fieldLabelCn = this.$i18n.t(label, "zh_CN"), fieldLabelEn = this.$i18n.t(label, "en_US");
if (!isEqual(oldValue, newValue)) {
const record = {
userNameCn: nickName,
userNameEn: name,
key: prefixKey + "_" + key,
fieldCn: `${this.$i18n.t(fieldItemLabel, "zh_CN")}` + (fieldLabelCn ? ("-" + fieldLabelCn) : ""),
fieldEn: `${this.$i18n.t(fieldItemLabel, "en_US")}` + (fieldLabelEn ? ("-" + fieldLabelEn) : ""),
oldValue: oldValue,
value: newValue,
title: oldValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
}
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
})
return records;
},
handleEditSignCancel(data) {
if (data.uuid === this.uuid) {
this.resetRecord();
this.$emit("resetRecord");
}
},
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
this.updateRecord(data);
}
},
handleClickButton(key) { handleClickButton(key) {
this.$emit("clickButton", key) this.$emit("clickButton", key)
}, },
@ -140,7 +89,6 @@ export default {
this.$set(this.errors, key, false); this.$set(this.errors, key, false);
} }
}) })
this.showEditSignDialog();
}, },
//更新表单数据 //更新表单数据
@ -156,67 +104,7 @@ export default {
this.$set(this.errors, key, false); this.$set(this.errors, key, false);
} }
}, },
updateRecord(data) {
const records = this.getRecords(data);
const params = {
type: "fieldChanged",
newRecord: records,
resourceList: this.getZdxgjl(),
}
//只要有更新就触发更新记录
if(this.templateFillType === "actFill" && this.clickableKey){
this.$emit("onSureModifyRecord", this.clickableKey)
this.clickableKey = "";
}
setTimeout(() => {
EventBus.$emit('onModifyRecord', params,)
}, 0);
},
//更新记录
showEditSignDialog: _.debounce(function () {
//如果oldFormFields中存在空值,说明是第一次填写,直接更新记录
const flag = Object.values(this.oldFormFields).every((val)=>{
// 0 算有值
if (val === 0) return true;
if (val === "0") return true;
// 其他情况:非 null、非 undefined、非空字符串
return val != null && val != undefined && val != "";
});
const diff = this.compareOldAndCurrentFormFields();
if (!diff && this.templateFillType === "actFill" && flag) {
setTimeout(() => {//延迟200ms打开弹窗,避免弹窗打开时,会有闪烁
EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
}, 200);
}else{
this.updateRecord();
}
}, 100),
// 比较oldFormFields和formFields的值是否相等,只要有一对不相等就返回false
compareOldAndCurrentFormFields() {
// 遍历oldFormFields,检查每个键值对
for (const key in this.oldFormFields) {
if (this.oldFormFields.hasOwnProperty(key)) {
const oldValue = this.oldFormFields[key];
const currentValue = this.formFields[key];
// 检查当前formFields中是否也包含此key,且值是否相等
if (this.formFields.hasOwnProperty(key)) {
// 比较值是否相等
if (JSON.stringify(oldValue) !== JSON.stringify(currentValue)) {
return false;
}
} else {
// 如果formFields中没有此key,说明不相等
return false;
}
}
}
return true;
},
handleClickable(sItem, key) { handleClickable(sItem, key) {
if (this.templateFillType !== 'actFill') { if (this.templateFillType !== 'actFill') {

+ 6
- 0
src/utils/index.js View File

@ -520,4 +520,10 @@ export function duplicateResource(sj, yq) {
self.findIndex(obj => obj.value === item.value) === index self.findIndex(obj => obj.value === item.value) === index
); );
return {sj,yq} return {sj,yq}
}
//是不是试剂/仪器等弹窗类型
export function isRegent(item,fieldCode="type"){
const type = item[fieldCode] ;
const typeList = ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq']
return typeList.includes(type);
} }

+ 33
- 61
src/views/business/comps/template/comps/sp/SP00456.vue View File

@ -28,9 +28,8 @@
<el-button v-if="fillType === 'preFill'" type="text" icon="el-icon-delete" <el-button v-if="fillType === 'preFill'" type="text" icon="el-icon-delete"
@click="deleteLadderConfig(ladderIndex)">{{ $t('template.common.deleteBtn') }}</el-button> @click="deleteLadderConfig(ladderIndex)">{{ $t('template.common.deleteBtn') }}</el-button>
</div> </div>
<BaseInfoFormPackage @clickable="(e) => handleClickable('ladder', ladderIndex, e)"
@resetRecord="(e) => resetRecord('ladder', ladderIndex, e)"
@onSureModifyRecord="(e) => onSureModifyRecord('ladder', ladderIndex, e)"
<BaseInfoFormPackage
@onRegentSubmit="(e) => onRegentSubmit('ladder', ladderIndex, e)"
:ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig" :ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig"
:formData="ladderConfig" :fieldItemLabel="$t('template.common.jtpz')" :prefixKey="'ladder_' + ladderIndex" /> :formData="ladderConfig" :fieldItemLabel="$t('template.common.jtpz')" :prefixKey="'ladder_' + ladderIndex" />
<CustomTable @blur="(e) => onHandleTableBlur('ladder', ladderIndex, e)" <CustomTable @blur="(e) => onHandleTableBlur('ladder', ladderIndex, e)"
@ -68,7 +67,7 @@
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" :fieldItemLabel="$t('template.common.pxpz')" /> :formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" :fieldItemLabel="$t('template.common.pxpz')" />
<CustomTable @blur="(e) => onHandleTableBlur('paralle', paralleIndex, e)" <CustomTable @blur="(e) => onHandleTableBlur('paralle', paralleIndex, e)"
:ref="`paralleStepTableRef_${paralleIndex}`" :showOperation="fillType === 'actFill'" :columns="paralleStepColumns" :ref="`paralleStepTableRef_${paralleIndex}`" :showOperation="fillType === 'actFill'" :columns="paralleStepColumns"
@clickable="(e, tableRowIndex, rowData) => handleTableClickable('paralle', paralleIndex, e, tableRowIndex, rowData)"
@onRegentSubmit="(data) => onTableRegentSubmit('paralle', paralleIndex, data)"
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" :fieldItemLabel="$t('template.common.pxpz')"> :formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" :fieldItemLabel="$t('template.common.pxpz')">
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaion @printTag="(e) => printTag(e, 'paralleConfigs', paralleIndex)" <TableOpertaion @printTag="(e) => printTag(e, 'paralleConfigs', paralleIndex)"
@ -93,8 +92,6 @@
</div> </div>
<!-- <button @click="onSave">保存</button> --> <!-- <button @click="onSave">保存</button> -->
</div> </div>
<SelectReagentDialog @submit="onSelectReagentSubmit" ref="selectReagentDialogRef">
</SelectReagentDialog>
</div> </div>
</template> </template>
@ -184,12 +181,7 @@ export default {
} }
}, },
methods: { methods: {
onSureModifyRecord(type, index, e) {
this.$refs[`ladderStepTableRef_${index}`][0].updateRecords();
},
resetRecord(type, index, e) {
this.$refs[`ladderStepTableRef_${index}`][0].resetRecord();
},
// //
subPackageSubmit(data, configType, index) { subPackageSubmit(data, configType, index) {
const { fzsj, rowData, headerSelectFields } = data; const { fzsj, rowData, headerSelectFields } = data;
@ -398,7 +390,6 @@ export default {
const targetAcSolution = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetAcSolution") || 0;// const targetAcSolution = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetAcSolution") || 0;//
if (targetAcSolution) { if (targetAcSolution) {
const volResult = this.updateSjmbrynd(item, targetAcSolution); const volResult = this.updateSjmbrynd(item, targetAcSolution);
debugger
if (!volResult) { if (!volResult) {
return return
} }
@ -423,60 +414,41 @@ export default {
} }
}, },
//
handleTableClickable(type, rowIndex, col, tableRowIndex, rowData) {
if (col.prop === "actStartSolutionCode") {//
this.currentTableKey = col.prop;
this.currentType = type;
this.currentRowIndex = rowIndex;
this.currentTableIndex = tableRowIndex;
this.currentRowData = rowData;
this.$refs.selectReagentDialogRef.show(this.formData.id);
}
},
//form
handleClickable(type, rowIndex, item) {
if (this.fillType === "preFill") {
return;
}
console.log(type, rowIndex, item, "handle")
const { subKey = "" } = item;
if (subKey === "subStartSolution" || subKey === "subSolution") {//
this.$refs.selectReagentDialogRef.show(this.formData.id)
this.currentSubKey = subKey;
this.currentType = type;
this.currentRowIndex = rowIndex;
}
},
//
onSelectReagentSubmit(code, row) {
const { currentSubKey, currentTableKey, currentRowIndex, currentTableIndex } = this;
if (currentSubKey) {
const ref = this.currentType === "ladder" ? "ladderStepFormPackageRef_" : "paralleStepFormPackageRef_"
const packageRef = this.$refs[`${ref}${this.currentRowIndex}`][0];
if (currentSubKey === "subStartSolution") {
packageRef.updateFormData("targetAcSolution", row.nd);
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution");
this.updateTableNd(row);
}
packageRef.updateFormData(currentSubKey, code);
this.currentSubKey = "";
} else if (currentTableKey === "actStartSolutionCode") {//
const tableRef = this.$refs[`paralleStepTableRef_${currentRowIndex}`][0];
// table
onTableRegentSubmit(type, configIndex, data){
const { selectInfo,rowIndex,key,rowData } = data;
const { row,selectedId } = selectInfo;
if (key === "actStartSolutionCode") {//
const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`][0];
if (tableRef) { if (tableRef) {
const volResult = this.updateSjmbrynd(this.currentRowData, row.nd);
const volResult = this.updateSjmbrynd(rowData, row.nd);
if (!volResult) { if (!volResult) {
return return
} }
tableRef.updateDataSourceByRowIndex(currentTableIndex, {
actStartSolutionCode: code,
tableRef.updateDataSourceByRowIndex(rowIndex, {
actStartSolutionCode: selectedId,
targetAcSolution: row.nd, targetAcSolution: row.nd,
actSolutionVolume: volResult.actVol, actSolutionVolume: volResult.actVol,
actSolutionConcentration: volResult.actNd, actSolutionConcentration: volResult.actNd,
}, "clickable")
})
} }
} }
this.$refs.selectReagentDialogRef.onCancel();
},
//
onRegentSubmit(type,rowIndex,data) {
const { selectInfo,key} = data;
const { row } = selectInfo;
if (key) {
const ref = type === "ladder" ? "ladderStepFormPackageRef_" : "paralleStepFormPackageRef_"
const packageRef = this.$refs[`${ref}${rowIndex}`][0];
if (key === "subStartSolution") {
packageRef.updateFormData("targetAcSolution", row.nd);
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution");
this.updateTableNd(row,rowIndex);
}
}
}, },
updateRecord() { updateRecord() {
this.$nextTick(() => { this.$nextTick(() => {
@ -488,8 +460,8 @@ export default {
}) })
}, },
//table //table
updateTableNd(row) {
const { stepTableFormData = [] } = this.$refs[`ladderStepTableRef_${this.currentRowIndex}`][0].getFilledFormData();
updateTableNd(row,rowIndex) {
const { stepTableFormData = [] } = this.$refs[`ladderStepTableRef_${rowIndex}`][0].getFilledFormData();
const newData = JSON.parse(JSON.stringify(stepTableFormData)); const newData = JSON.parse(JSON.stringify(stepTableFormData));
// //
newData.forEach((item, index) => { newData.forEach((item, index) => {
@ -509,7 +481,7 @@ export default {
item.actSolutionConcentration = volResult.actNd; item.actSolutionConcentration = volResult.actNd;
// stepTableRef // stepTableRef
}) })
this.$refs[`ladderStepTableRef_${this.currentRowIndex}`][0].updateDataSource(newData);
this.$refs[`ladderStepTableRef_${rowIndex}`][0].updateDataSource(newData);
}, },
// //

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

@ -16,9 +16,12 @@
:formConfig="storageFormConfig" :formData="formData" /> :formConfig="storageFormConfig" :formData="formData" />
<BaseInfoFormPackage fieldItemLabel="样本说明" label="样本说明" <BaseInfoFormPackage fieldItemLabel="样本说明" label="样本说明"
ref="ybRef" :formConfig="ybFormConfig" :formData="formData" /> ref="ybRef" :formConfig="ybFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" />
<Step ref="stepRef" :formData="formData.stepData"></Step> <Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark" <BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
<BaseInfoFormPackage fieldItemLabel="附件" label="附件"
ref="fjRef" :formConfig="getFjFormConfig" :formData="formData" />
</div> </div>
</div> </div>
@ -38,7 +41,7 @@ import { getLatestSn } from '@/api/template';
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools"; import { uniqeResource } from "@/utils/calUnitTools";
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
import {getBaseInfoFormConfig, getRemarkFormConfig,getStorageFormConfig,getYbFormConfig} from "../../formConfig/sp/SP007";
import {getBaseInfoFormConfig, getRemarkFormConfig,getStorageFormConfig,getYbFormConfig,getfjFormConfig} from "../../formConfig/sp/SP007";
export default { export default {
name: "SP007", name: "SP007",
@ -67,6 +70,10 @@ export default {
baseInfoFormConfig() { baseInfoFormConfig() {
return getBaseInfoFormConfig(this); return getBaseInfoFormConfig(this);
}, },
//
getFjFormConfig() {
return getfjFormConfig(this);
},
}, },
data() { data() {

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

@ -281,7 +281,7 @@ export const getParallelColumnsConfig = ($this) => {
prop: 'actStartSolutionCode', prop: 'actStartSolutionCode',
width: 280, width: 280,
showWidth: 180, showWidth: 180,
bodyType: 'clickable',
bodyType: 'sj',
bodyFillType: 'actFill', bodyFillType: 'actFill',
compareTo: 'startSolutionCode', //比较哪个字段 compareTo: 'startSolutionCode', //比较哪个字段
}, },
@ -392,7 +392,7 @@ export const getLadderFormConfig = ($this) => {
label: 'template.sp.sp00456.qsyry', label: 'template.sp.sp00456.qsyry',
type: 'input', type: 'input',
fillType: 'preFill', fillType: 'preFill',
subType: 'clickable',
subType: 'sj',
subKey: 'subStartSolution', subKey: 'subStartSolution',
subFillType: 'actFill', subFillType: 'actFill',
maxlength: 20 maxlength: 20
@ -418,7 +418,7 @@ export const getLadderFormConfig = ($this) => {
label: 'template.sp.sp00456.xsy', label: 'template.sp.sp00456.xsy',
type: 'input', type: 'input',
fillType: 'preFill', fillType: 'preFill',
subType: 'clickable',
subType: 'sj',
subKey: 'subSolution', subKey: 'subSolution',
subFillType: 'actFill', subFillType: 'actFill',
maxlength: 20 maxlength: 20
@ -571,7 +571,7 @@ export const getStorageConditionFormConfig = ($this) => {
] ]
} }
//行步骤配置
//行步骤配置
export const getParalleStepFormConfig = ($this) => { export const getParalleStepFormConfig = ($this) => {
return [ return [
{ {
@ -581,7 +581,7 @@ export const getParalleStepFormConfig = ($this) => {
label: 'template.sp.sp00456.xsy', label: 'template.sp.sp00456.xsy',
type: 'input', type: 'input',
fillType: 'preFill', fillType: 'preFill',
subType: 'clickable',
subType: 'sj',
subKey: 'subSolution', subKey: 'subSolution',
subFillType: 'actFill', subFillType: 'actFill',
maxlength: 20 maxlength: 20

+ 16
- 0
src/views/business/comps/template/formConfig/sp/SP007.js View File

@ -141,4 +141,20 @@ export const getStorageFormConfig = ($this) => {
} }
} }
] ]
}
//存储条件
export const getfjFormConfig = () => {
return [
{
type: "attachment",
config: {
storageCondition: {
label: '标题',
type: "attachment",
fillType: "preFill",
},
}
}
]
} }

Loading…
Cancel
Save