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) {
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',
params: query
})

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

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

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

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

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

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

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

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

Loading…
Cancel
Save