Browse Source

feat:[模板管理][update]

luojie
luojie 1 week ago
parent
commit
457a2e179b
9 changed files with 96 additions and 36 deletions
  1. +1
    -1
      src/components/Template/StepComponents/ry/bdzl.vue
  2. +7
    -5
      src/components/Template/StepComponents/ry/tpjydd.vue
  3. +13
    -6
      src/components/Template/StepComponents/ry/tpjysd.vue
  4. +11
    -6
      src/components/Template/StepFormPackage.vue
  5. +19
    -2
      src/components/Template/mixins/formPackageMixins.js
  6. +33
    -3
      src/components/Template/mixins/stepMixins.js
  7. +10
    -11
      src/views/business/comps/template/comps/sp/comps/LadderConfig.vue
  8. +1
    -1
      src/views/business/comps/template/dialog/SelectInstrumentDialog.vue
  9. +1
    -1
      src/views/business/comps/template/mixins/templateMixin.js

+ 1
- 1
src/components/Template/StepComponents/ry/bdzl.vue View File

@ -1,6 +1,6 @@
<!-- 标定(质量) -->
<template>
<StepFormPackage @clickButton="onHandleClickButton" :fieldItemLabel = "fieldItemLabel" ref = "stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_bdzl'" @resetRecord = "resetRecord" :form-config="formConfig" :formData = "formData" />
<StepFormPackage @clickButton="onHandleClickButton" @beforeSaveRecord="onBeforeSaveRecord" :fieldItemLabel = "fieldItemLabel" ref = "stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_bdzl'" @resetRecord = "resetRecord" :form-config="formConfig" :formData = "formData" />
</template>
<script>

+ 7
- 5
src/components/Template/StepComponents/ry/tpjydd.vue View File

@ -3,6 +3,7 @@
<StepFormPackage :fieldItemLabel = "fieldItemLabel"
ref = "stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_tpjydd'" @resetRecord = "resetRecord"
@clickButton="handleClickButton"
@beforeSaveRecord="onBeforeSaveRecord"
:form-config="formConfig" :formData = "formData" />
</template>
@ -38,6 +39,9 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
},
button1:{
type:"button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"pz",//
buttonName:"获取值",
},
text3:{
@ -85,6 +89,9 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
},
button2:{
type:"button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"fmz",//
buttonName:"获取值",
},
text7:{
@ -117,11 +124,6 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
}]
}
},
methods: {
handleClickButton(key){
console.log(key)
}
}
}
</script>

+ 13
- 6
src/components/Template/StepComponents/ry/tpjysd.vue View File

@ -1,7 +1,7 @@
<!-- 天平校验(双点) -->
<template>
<StepFormPackage :fieldItemLabel="fieldItemLabel" ref="stepFormPackageRef" :prefixKey="stepIndex + '_' + 'ry_tpjysd'"
@resetRecord="resetRecord" @clickButton="handleClickButton" :form-config="formConfig" :formData="formData" />
@resetRecord="resetRecord" @clickButton="onHandleClickButton" @beforeSaveRecord="onBeforeSaveRecord" :form-config="formConfig" :formData="formData" />
</template>
<script>
@ -45,6 +45,9 @@ export default {
},
dfmbutton1: {
type: "button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"dfmpz",//
buttonName: "获取值",
},
dfmtext3: {
@ -92,6 +95,9 @@ export default {
},
dfmbutton2: {
type: "button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"dfmfmz",//
buttonName: "获取值",
},
dfmtext7: {
@ -136,6 +142,9 @@ export default {
},
button1: {
type: "button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"pz",//
buttonName: "获取值",
},
text3: {
@ -183,6 +192,9 @@ export default {
},
button2: {
type: "button",
dataSource:"tp",//
yqCode:"ddsys",//
fillField:"fmz",//
buttonName: "获取值",
},
text7: {
@ -217,11 +229,6 @@ export default {
]
}
},
methods: {
handleClickButton(key) {
console.log(key)
}
}
}
</script>

+ 11
- 6
src/components/Template/StepFormPackage.vue View File

@ -5,35 +5,37 @@
<template v-if="sItem.type === 'input'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" @blur="onBlur(key, $event)"
:item="sItem" v-model="formFields[key]" :field-key="prefixKey+'_' + key"
:ref="key"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'inputNumber'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+'_' + key"
type="inputNumber" @blur="onBlur(key, $event)" :item="sItem"
type="inputNumber" @blur="onBlur(key, $event)" :item="sItem" :ref="key"
@input="onInputNumberChange(key, $event)" v-model="formFields[key]" @copy="onCopy(sItem, key)"
:error="errors[key]" @update:error="errors[key] = false" :orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'select'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+'_' + key"
type="select" @blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
@change="onSelectChange(key, $event, sItem.type)"
@change="onSelectChange(key, $event, sItem.type)" :ref="key"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'checkbox' || sItem.type === 'radio'">
<HandleFormItem :class="sItem.type === 'checkbox' ? 'step-row' : ''" :field-item-label="fieldItemLabel" :field-key="prefixKey+'_' + key"
:type="sItem.type" :item="sItem" v-model="formFields[key]"
@change="onSelectChange(key, $event, sItem.type)"
@change="onSelectChange(key, $event, sItem.type)" :ref="key"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'button'">
<HandleFormItem
type="button"
@beforeSaveRecord="(data, callback)=>onBeforeSaveRecord(data, callback,sItem)"
:field-key="prefixKey+'_' + key"
:item="getButtonItem(sItem)"
@clickButton="(e)=>handleClickButton(e,item,key)" />
@clickButton="(e,v,data)=>handleClickButton(e,item,key,data)" />
</template>
<!-- 仪器instrumentsj(药剂) gsp(供试品) mix药剂/供试品/给药制剂 -->
<template v-else-if="isRegent(sItem)">
@ -151,6 +153,9 @@ export default {
this.allFieldsConfig[key].sjSelectType = data.selectType;
}
this.formFields[`selectInfo_${key}`] = data.selectInfo;
if(data.type === "yq"){
this.formFields[`yqInfo_${key}`] = data.row;
}
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
},
getRegentItem(item,fieldCode="type"){
@ -262,7 +267,7 @@ export default {
}
},
//
handleClickButton(e,item,key){
handleClickButton(e,item,key,data){
const {buttonName = ""} = e;
const {config} = item;
if(buttonName === '开始' && config.hasOwnProperty("startDate")){
@ -270,7 +275,7 @@ export default {
}else if(buttonName === '结束' && config.hasOwnProperty("endDate")){
this.updateFormData("endDate",moment().format('YYYY-MM-DD HH:mm'))
}
this.$emit("clickButton",e,item,key)
this.$emit("clickButton",e,item,key,data)
},
//
getButtonItem(sItem) {

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

@ -20,7 +20,6 @@ export default {
deep: true, // 深度监听,以便检测嵌套对象变化
handler(v) {
if (v) {
console.log(v, 'fieldItemLabel')
}
}
},
@ -79,6 +78,9 @@ export default {
onRegentSubmit(data, inputValue, key, item) {
this.updateFormData(key, inputValue)
this.formFields[`selectInfo_${key}`] = data.selectInfo;
if(data.type === "yq"){
this.formFields[`yqInfo_${key}`] = data.row;
}
this.$emit('onRegentSubmit', {
selectInfo: data,
inputValue,
@ -394,11 +396,14 @@ export default {
})
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
// 优先使用this.formFields中以selectInfo_开头的字段
let selectInfoKeys = []
let selectInfoKeys = [],yqInfoKeys = [];
if (this.formFields) {
selectInfoKeys = Object.keys(this.formFields).filter((key) =>
key.startsWith('selectInfo_')
)
yqInfoKeys = Object.keys(this.formFields).filter((key) =>
key.startsWith('yqInfo_')
)
}
// 如果this.formFields中没有,则使用formData中的
if (selectInfoKeys.length === 0 && formData) {
@ -406,9 +411,17 @@ export default {
key.startsWith('selectInfo_')
)
}
if (yqInfoKeys.length === 0 && formData) {
yqInfoKeys = Object.keys(formData).filter((key) =>
key.startsWith('yqInfo_')
)
}
selectInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || ''
})
yqInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || ''
})
// 更新表单字段
this.formFields = { ...result }
this.allFieldsConfig = config
@ -615,6 +628,7 @@ export default {
errors: errors
}
},
// 校验表单数据
getFormData() {
// 同时执行数据校验和子组件校验
const validateResult = this.validateFormData()
@ -647,6 +661,9 @@ export default {
getFormDataByKey(key) {
return this.formFields[key]
},
onBeforeSaveRecord(data, callback, item){
this.$emit('beforeSaveRecord', {data, callback,item})
},
onBlur(key, val) {
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
this.onValueChangeCompareTo(key, val)

+ 33
- 3
src/components/Template/mixins/stepMixins.js View File

@ -1,6 +1,7 @@
import { getuuid, justUpdateFilledFormData } from '@/utils/index.js'
import { EventBus } from '@/utils/eventBus'
import { getLatestSn, getLatestSnArr } from '@/api/template'
import { getBalance } from '@/utils/tpph.js';
export default {
inject: {
templateFillType: { default: 'preFill' },
@ -150,8 +151,23 @@ export default {
this.justUpdateFilledFormData();
}
},
onBeforeSaveRecord(params) {
const { callback, item } = params
const { buttonName } = item;
if (buttonName === '获取值') {
const { dataSource, yqCode } = item;
if (dataSource === "tp") {//电子天平
const stepFormData = this.getFilledFormData()
const yq = stepFormData[yqCode] || "";
if (!yq) {
callback.prevent("请选择电子天平")
}
}
}
},
// 点击按钮
onHandleClickButton(e, item, key) {
async onHandleClickButton(e, item, key,signData) {
const {
buttonName = '',
myCodeFields = [],
@ -201,8 +217,22 @@ export default {
maxVolumeUnit,
uuid: this.uuid,
})
}else if(buttonName === '获取值'){
console.log(e,"iii")
} else if (buttonName === '获取值') {
const { dataSource, dwField = "", fillField, yqCode } = e;
if (dataSource === "tp") {//电子天平
const stepFormData = this.getFilledFormData()
const yqInfo = stepFormData[`yqInfo_${yqCode}`] || {};
const dw = stepFormData[dwField] || "";
const result = await getBalance({ yq: yqInfo, dw });
if (result.success) {
const value = dw?result.value:`${result.value}${result.unit}`
this.$refs.stepFormPackageRef.updateFormData(fillField, value,{isUpdateRecord:true,signData})
} else {
this.$message.error(result.message || "获取值失败");
}
}
}
},

+ 10
- 11
src/views/business/comps/template/comps/sp/comps/LadderConfig.vue View File

@ -54,6 +54,7 @@ export default {
TableOpertaion,
BaseInfoFormPackage,
},
inject:["templateData"],
name: "LadderConfig",
mixins: [templateMixin],
props: {
@ -342,9 +343,9 @@ export default {
const { rowData } = val;
let postData = {
bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode,
studySubjectId: this.currentFormData.studySubjectId,
studyId: this.currentFormData.studyId,
studyFormId: this.currentFormData.id,
studySubjectId: this.templateData.studySubjectId,
studyId: this.templateData.studyId,
studyFormId: this.templateData.id,
}
this.startConfigRequest(postData);
},
@ -358,9 +359,9 @@ export default {
bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode,
nd: rowData.actSolutionConcentration,//
nddw: headerSelectFields.actSolutionConcentrationUnit,
studySubjectId: this.currentFormData.studySubjectId,
studyId: this.currentFormData.studyId,
studyFormId: this.currentFormData.id,
studySubjectId: this.templateData.studySubjectId,
studyId: this.templateData.studyId,
studyFormId: this.templateData.id,
kc: total,
kcdw: unit,
}
@ -379,14 +380,12 @@ export default {
}
})
let postData = {
studyId: this.currentFormData.studyId,
studyFormId: this.currentFormData.id,
studyId: this.templateData.studyId,
studyFormId: this.templateData.id,
bh: mybh,
nd: rowData.actSolutionConcentration || 0,
nddw: headerSelectFields.actSolutionConcentrationUnit,
studySubjectId: this.currentFormData.studySubjectId,
studyId: this.currentFormData.studyId,
studyFormId: this.currentFormData.id,
studySubjectId: this.templateData.studySubjectId,
list: list
}
this.subPackageRequest(postData);

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

@ -121,7 +121,7 @@ export default {
jzrq: row.jzrq,
}
// eventBus
EventBus.$emit("onInstrumentSubmit",{selectInfo,uuid:this.uuid,selectedId:this.selectedId,row});
EventBus.$emit("onInstrumentSubmit",{selectInfo,uuid:this.uuid,selectedId:this.selectedId,row,type:"yq"});
this.visible = false;
},
handleSelect(code,row) {

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

@ -294,7 +294,7 @@ export default {
//试剂弹窗确认前
onBeforeReagentSubmit(data) {
const { selectData, callback, key, formFields } = data
const { subTargetStartSolution, targetStartSolution } = formFields
const { subTargetStartSolution = "", targetStartSolution = "" } = formFields
const { nd } = selectData.row
const sjndArr = nd.split('/')
const ytndArr = targetStartSolution.split('/')

Loading…
Cancel
Save