Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
eba58797de
5 changed files with 64 additions and 14 deletions
  1. +9
    -1
      src/api/business/public/public.js
  2. +24
    -10
      src/components/Template/HandleFormItem.vue
  3. +1
    -1
      src/components/Template/StepFormPackage.vue
  4. +6
    -1
      src/components/Template/mixins/formPackageMixins.js
  5. +24
    -1
      src/views/business/comps/template/TemplateTable.vue

+ 9
- 1
src/api/business/public/public.js View File

@ -102,7 +102,15 @@ export function public_gspList(query) {
// 细胞列表 // 细胞列表
export function public_xbList(query) { export function public_xbList(query) {
return request({ return request({
url: '/system/business/public/xbList',
url: '/system/business/public/cellList',
method: 'get',
params: query
})
}
// 细菌列表
export function public_xjList(query) {
return request({
url: '/system/business/public/bacteriaList',
method: 'get', method: 'get',
params: query params: query
}) })

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

@ -109,7 +109,6 @@
<el-button type="primary" @click="onReplyConfirm"> </el-button> <el-button type="primary" @click="onReplyConfirm"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<EditSign @cancel="resetRecord" ref="editSignRef" @callback="onEditSignSave" />
</div> </div>
</template> </template>
@ -119,13 +118,12 @@ import DecimalInput from "./DecimalInput.vue";
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import moment from "moment"; import moment from "moment";
import { deepClone } from "@/utils/index"; import { deepClone } from "@/utils/index";
import EditSign from "@/views/business/comps/template/dialog/EditSign.vue";
import { getuuid } from "@/utils/index.js";
export default { export default {
inject: ['templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], inject: ['templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
components: { components: {
Question, Question,
DecimalInput, DecimalInput,
EditSign,
}, },
props: { props: {
type: {//form input/select type: {//form input/select
@ -185,6 +183,7 @@ export default {
replyContent: '', // replyContent: '', //
visible: false,// visible: false,//
checkboxValue: this.getChecked(),// checkboxValue: this.getChecked(),//
uuid: getuuid(), // EventBus
} }
}, },
watch: { watch: {
@ -203,6 +202,14 @@ export default {
}, },
mounted() { mounted() {
EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate);
EventBus.$on('onEditSignCancel', this.handleEditSignCancel);
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
},
unmounted() {
EventBus.$off('onExternalFieldUpdate', this.handleExternalFieldUpdate);
EventBus.$off('onEditSignCancel', this.handleEditSignCancel);
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
}, },
methods: { methods: {
// //
@ -221,6 +228,18 @@ export default {
} }
return record.userNameEn; return record.userNameEn;
}, },
//
handleEditSignCancel(data) {
if (data.uuid === this.uuid) {
this.resetRecord();
}
},
//
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
this.onEditSignSave(data.data);
}
},
onEditSignSave(data) { onEditSignSave(data) {
this.handleUpdateRecord(data) this.handleUpdateRecord(data)
}, },
@ -412,9 +431,8 @@ export default {
return; return;
} }
if (this.oldValue && !isSame && this.templateFillType === "actFill") { if (this.oldValue && !isSame && this.templateFillType === "actFill") {
this.$refs.editSignRef.show()
// this.handleUpdateRecord();
// EventBus
EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
}else{// }else{//
this.handleUpdateRecord() this.handleUpdateRecord()
} }
@ -457,9 +475,6 @@ 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.isFieldsRecord){//
return;
}
if(this.templateFillType === "actFill"){// if(this.templateFillType === "actFill"){//
this.updateZdxgjl(record); this.updateZdxgjl(record);
} }
@ -483,7 +498,6 @@ export default {
getCommonRecordInfo() { getCommonRecordInfo() {
const { nickName, name } = this.$store.getters; const { nickName, name } = this.$store.getters;
//locale:zh-CN en-US //locale:zh-CN en-US
const lang = this.$i18n.locale === "zh_CN" ? "cn" : "en";
const { label, parentLabel } = this.item; const { label, parentLabel } = this.item;
let fieldLabelCn = this.$i18n.t(label,"zh_CN"),fieldLabelEn = this.$i18n.t(label,"en_US"); let fieldLabelCn = this.$i18n.t(label,"zh_CN"),fieldLabelEn = this.$i18n.t(label,"en_US");
if (label === "template.common.other") { if (label === "template.common.other") {

+ 1
- 1
src/components/Template/StepFormPackage.vue View File

@ -115,7 +115,7 @@ export default {
} }
}, },
methods: { methods: {
//
//
handleClickButton(e,item){ handleClickButton(e,item){
const {buttonName = ""} = e; const {buttonName = ""} = e;
const {config} = item; const {config} = item;

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

@ -1,4 +1,5 @@
import { isEqual } from "@/utils/index.js"; import { isEqual } from "@/utils/index.js";
import _ from "lodash";
export default { export default {
watch: { watch: {
formData: { formData: {
@ -54,10 +55,11 @@ export default {
} }
}, },
//更新表单数据 //更新表单数据
updateFormData(key, value,oldKeys = []) {
updateFormData(key, value) {
// 深拷贝当前表单数据,避免直接修改原数据 // 深拷贝当前表单数据,避免直接修改原数据
const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); const cloneFormFields = JSON.parse(JSON.stringify(this.formFields));
this.oldFormFields[key] = cloneFormFields[key]; this.oldFormFields[key] = cloneFormFields[key];
this.updateRecord();
this.formFields[key] = value; this.formFields[key] = value;
// 清除该表单项的错误状态 // 清除该表单项的错误状态
@ -65,6 +67,9 @@ export default {
this.$set(this.errors, key, false); this.$set(this.errors, key, false);
} }
}, },
updateRecord:_.debounce(function(){
console.log(this.oldFormFields,"oldFormFields")
}, 100),
//批量更新表单数据 //批量更新表单数据
batchUpdateFormData(data) { batchUpdateFormData(data) {
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {

+ 24
- 1
src/views/business/comps/template/TemplateTable.vue View File

@ -7,6 +7,7 @@
<SelectReagentDialog ref="selectReagentDialogRef"/> <SelectReagentDialog ref="selectReagentDialogRef"/>
<SelectInstrumentDialog ref="selectInstrumentDialogRef"/> <SelectInstrumentDialog ref="selectInstrumentDialogRef"/>
<SelectMixReagentDialog ref="selectMixReagentDialogRef"/> <SelectMixReagentDialog ref="selectMixReagentDialogRef"/>
<EditSign ref="editSignRef" @cancel="handleEditSignCancel" @callback="handleEditSignCallback" />
</div> </div>
</template> </template>
@ -18,6 +19,7 @@ import TagPrintDialog from "./dialog/PrintTagDialog.vue";//标签打印弹窗
import SelectReagentDialog from "./dialog/SelectReagentDialog.vue";// import SelectReagentDialog from "./dialog/SelectReagentDialog.vue";//
import SelectInstrumentDialog from "./dialog/SelectInstrumentDialog.vue";// import SelectInstrumentDialog from "./dialog/SelectInstrumentDialog.vue";//
import SelectMixReagentDialog from "./dialog/SelectMixReagentDialog.vue";//// import SelectMixReagentDialog from "./dialog/SelectMixReagentDialog.vue";////
import EditSign from "./dialog/EditSign.vue";//
// //
import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue"; import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
@ -46,7 +48,7 @@ import MJYLQSQD from "./comps/gsp/MJYLQSQD.vue";
export default { export default {
name: "TemplateTable", name: "TemplateTable",
components: { components: {
SubPackageDialog,TagPrintDialog,SelectReagentDialog,SelectInstrumentDialog,SelectMixReagentDialog,
SubPackageDialog,TagPrintDialog,SelectReagentDialog,SelectInstrumentDialog,SelectMixReagentDialog,EditSign,
// //
MJYLQSQD, SYWZPZJHB, MJYLQSQD, SYWZPZJHB,
// //
@ -159,6 +161,7 @@ export default {
zdxgjl: [], zdxgjl: [],
fhyjjl: [], fhyjjl: [],
fieldCheckObj: {}, fieldCheckObj: {},
currentEditSignUuid: null, // EditSignHandleFormItemuuid
}; };
}, },
mounted() { mounted() {
@ -185,6 +188,11 @@ export default {
EventBus.$on("showSelectMixReagentDialog",(data)=>{ EventBus.$on("showSelectMixReagentDialog",(data)=>{
this.$refs.selectMixReagentDialogRef.show(data.studyFormId,data) this.$refs.selectMixReagentDialogRef.show(data.studyFormId,data)
}) })
//
EventBus.$on("showEditSignDialog",(data)=>{
this.currentEditSignUuid = data.uuid;
this.$refs.editSignRef.show();
})
}, },
beforeDestroy() { beforeDestroy() {
// //
@ -194,8 +202,23 @@ export default {
EventBus.$off("showSelectReagentDialog"); EventBus.$off("showSelectReagentDialog");
EventBus.$off("showSelectInstrumentDialog"); EventBus.$off("showSelectInstrumentDialog");
EventBus.$off("showSelectMixReagentDialog"); EventBus.$off("showSelectMixReagentDialog");
EventBus.$off("showEditSignDialog");
}, },
methods: { methods: {
//
handleEditSignCancel() {
if (this.currentEditSignUuid) {
EventBus.$emit('onEditSignCancel', { uuid: this.currentEditSignUuid });
this.currentEditSignUuid = null;
}
},
//
handleEditSignCallback(data) {
if (this.currentEditSignUuid) {
EventBus.$emit('onEditSignCallback', { uuid: this.currentEditSignUuid, data });
this.currentEditSignUuid = null;
}
},
async getFormData() { async getFormData() {
if(this.fillType === "actFill"){ if(this.fillType === "actFill"){
// //

Loading…
Cancel
Save