Browse Source

feat:[模板管理][update]

zhangteng
luojie 4 days ago
parent
commit
9749f23a51
10 changed files with 112 additions and 94 deletions
  1. +4
    -1
      src/components/Template/Step.vue
  2. +2
    -0
      src/components/Template/StepFormPackage.vue
  3. +41
    -41
      src/components/Template/mixins/formPackageMixins.js
  4. +1
    -0
      src/lang/en/template/commonTemplate.js
  5. +1
    -0
      src/lang/zh/template/commonTemplate.js
  6. +0
    -1
      src/utils/calUnitTools.js
  7. +2
    -2
      src/views/business/comps/template/comps/bl/BL002.vue
  8. +8
    -8
      src/views/business/comps/template/comps/sp/SP003.vue
  9. +52
    -41
      src/views/business/comps/template/dialog/SubPackageDialog.vue
  10. +1
    -0
      src/views/business/comps/template/mixins/templateMixin.js

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

@ -10,7 +10,7 @@
<HandleFormItem type="select" placeholder="请选择" class="step-type-select" :item="stepSelectConfig"
v-model="step.type" @change="onTypeChange(index)" />
<!-- 根据步骤类型显示对应的表单 -->
<component class="flex1" :sn="step.type" :is="getStepComponent(step.type)" :formData="step.formData" :formIndex="formIndex" :formType="formType"
<component class="flex1 w-0" :sn="step.type" :is="getStepComponent(step.type)" :formData="step.formData" :formIndex="formIndex" :formType="formType"
:fieldItemLabel="stepNameConfig[step.type]"
@update="onFormUpdate(index, $event)" :stepIndex = "prefixKey + index" :ref="'stepCompRef_' + index">
</component>
@ -1196,4 +1196,7 @@ export default {
}
}
}
.w-0{
width: 0;
}
</style>

+ 2
- 0
src/components/Template/StepFormPackage.vue View File

@ -250,6 +250,7 @@ export default {
o.syldw = formFields[item.dwCode];//
}
sjResource.push(o);
}
}else if(item.type === "yq"){
if(formFields[key]){
@ -261,6 +262,7 @@ export default {
}
}
}
console.log(sjResource,yqResource,allFieldsConfig,formFields,"sjResource")
return {
sjResource,
yqResource,

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

@ -1,5 +1,5 @@
import _ from 'lodash'
import { getuuid, isEqual, isValueEmpty,isRegent } from '@/utils/index.js'
import { getuuid, isEqual, isValueEmpty, isRegent } from '@/utils/index.js'
import { isShowOtherByCheckboxTree } from '@/utils/formPackageCommon.js'
import moment from 'moment'
@ -63,8 +63,8 @@ export default {
this.$set(this.errors, key, false)
}
},
getOrangeBg(key,sItem) {
if(sItem.compareText){
getOrangeBg(key, sItem) {
if (sItem.compareText) {
return sItem.compareText == this.formFields[key]
}
return this.orangeBgFields[key]
@ -82,8 +82,8 @@ export default {
},
//试剂/仪器等弹窗提交
onRegentSubmit(data, inputValue, key, item) {
if(data.selectInfo){
this.formFields[`selectInfo_${key}`] = JSON.parse(JSON.stringify(data.selectInfo));
if (data.selectInfo) {
this.formFields[`selectInfo_${key}`] = JSON.parse(JSON.stringify(data.selectInfo));
}
if (data.type === "yq") {
this.formFields[`yqInfo_${key}`] = JSON.parse(JSON.stringify(data.row));
@ -391,45 +391,46 @@ export default {
currentConfig.otherCode
)
}
})
// 处理可能存在的直接otherCode字段
if (item.config?.otherCode) {
config[item.config?.otherCode] = item.config?.otherCode
}
if (item.config?.thirdOtherCode) {
config[item.config?.thirdOtherCode] = item.config?.thirdOtherCode
}
if (isRegent(item.config) || isRegent(item.config,"subType")) {
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
// 优先使用this.formFields中以selectInfo_开头的字段
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_')
)
// 处理可能存在的直接otherCode字段
if (currentConfig.otherCode) {
config[currentConfig.otherCode] = currentConfig.otherCode
}
// 如果this.formFields中没有,则使用formData中的
if (selectInfoKeys.length === 0 && formData) {
selectInfoKeys = Object.keys(formData).filter((key) =>
key.startsWith('selectInfo_')
)
if (currentConfig.thirdOtherCode) {
config[currentConfig.thirdOtherCode] = currentConfig.thirdOtherCode
}
if (yqInfoKeys.length === 0 && formData) {
yqInfoKeys = Object.keys(formData).filter((key) =>
key.startsWith('yqInfo_')
)
if (isRegent(currentConfig) || isRegent(currentConfig, "subType")) {
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
// 优先使用this.formFields中以selectInfo_开头的字段
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) {
selectInfoKeys = Object.keys(formData).filter((key) =>
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] || ''
})
}
selectInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || ''
})
yqInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || ''
})
}
})
}
})
@ -649,7 +650,6 @@ export default {
return new Promise((resolve, reject) => {
if (validateResult.valid && subComponentValidateResult.valid) {
console.log(this.formFields, 'this.formFields')
resolve(this.formFields)
} else if (!validateResult.valid) {
// this.$message.error("表单内容未填完,请填写后再提交");

+ 1
- 0
src/lang/en/template/commonTemplate.js View File

@ -9,6 +9,7 @@ export default {
instrumentInfo: 'Instrument Usage',
storageCondition: 'Storage Conditions',
operationSteps: 'Operation Workflow',
bzgzypz: '标曲工作液配制',
remark: 'Comments',
step: 'Step',
bqdy: 'Label Print',

+ 1
- 0
src/lang/zh/template/commonTemplate.js View File

@ -15,6 +15,7 @@ export default {
instrumentInfo: '仪器使用信息',
storageCondition: '存储条件',
operationSteps: '操作步骤',
bzgzypz: '标曲工作液配制',
step: '步骤',
remark: '备注',
bqdy: '标签打印',

+ 0
- 1
src/utils/calUnitTools.js View File

@ -8,7 +8,6 @@ export function addTj(valueArr, unitArr) {
let thisIndex = unit.indexOf(unitArr[i])
mixIndex = thisIndex < mixIndex ? thisIndex : mixIndex
}
let total = 0
for (let i = 0; i < unitArr.length; i++) {
let thisIndex = unit.indexOf(unitArr[i])

+ 2
- 2
src/views/business/comps/template/comps/bl/BL002.vue View File

@ -221,10 +221,10 @@ export default {
if( stepTableFormData && stepTableFormData.length >0 ){
stepTableFormData.map((item,index)=>{
if(!item.smryqrxx && item.smryqrxx !== false){
this.$refs.yqsyTableRef.updateDataSourceByRowIndex(index, {...item,smryqrxx:false})
this.$refs.dwybTableRef.updateDataSourceByRowIndex(index, {...item,smryqrxx:false})
}
if(!item.ztblxjqrxx && item.ztblxjqrxx !== false){
this.$refs.yqsyTableRef.updateDataSourceByRowIndex(index, {...item,ztblxjqrxx:false})
this.$refs.dwybTableRef.updateDataSourceByRowIndex(index, {...item,ztblxjqrxx:false})
}
})
}

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

@ -12,9 +12,9 @@
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<!-- <BaseInfoFormPackage label="存储条件" ref="storageConditionRef" :formConfig="storageFormConfig"
:formData="formData" /> -->
<LineLabel label="template.common.operationSteps" />
<LineLabel label="template.common.bzgzypz" />
<div class="template-form-item">
<BaseInfoFormPackage ref="stepFormPackageRef" fieldItemLabel="template.common.operationSteps"
<BaseInfoFormPackage ref="stepFormPackageRef" fieldItemLabel="template.common.bzgzypz"
@onRegentSubmit="onRegentSubmit"
@beforeReagentSubmit="onBeforeReagentSubmit"
@select = "onFormSelect"
@ -22,7 +22,7 @@
:formData="formData" />
<CustomTable
@headerSelectChange="onHeaderSelectChange"
fieldItemLabel="template.common.operationSteps" @blur="onHandleTableBlur"
fieldItemLabel="template.common.bzgzypz" @blur="onHandleTableBlur"
@beforeSaveRecord = "beforeSaveRecord"
:showAddRow="false" :showOperation="fillType === 'actFill'"
ref="stepTableRef" :columns="stepColumns" :formData="formData">
@ -287,7 +287,7 @@ export default {
{
label: "template.sp.sp003.qsrybh",
prop: "startSolutionCode",
width: 180,
width: 200,
bodyType: "input",
bodyFillType: "actFill",
bodyMaxlength: 10,
@ -296,7 +296,7 @@ export default {
{
label: "template.sp.sp003.ysqsrytj",
prop: "targetStartSolutionVolume",
width: 180,
width: 200,
showWidth: 90,
headerSelectKey: "targetStartSolutionVolumeUnit",
fillType: "preFill",
@ -317,7 +317,7 @@ export default {
{
label: "template.sp.sp003.sjqsrytj",
prop: "actStartSolutionVolume",
width: 180,
width: 200,
showWidth: 90,
headerSelectKey: "actStartSolutionVolumeUnit",
fillType: "preFill",
@ -331,7 +331,7 @@ export default {
{
label: "template.sp.sp003.ysxsytj",
prop: "targetDiluentVolume",
width: 180,
width: 200,
showWidth: 90,
headerSelectKey: "targetDiluentVolumeUnit",
fillType: "preFill",
@ -352,7 +352,7 @@ export default {
{
label: "template.sp.sp003.sjxsytj",
prop: "actDiluentVolume",
width: 180,
width: 200,
showWidth: 90,
headerSelectKey: "actDiluentVolumeUnit",
fillType: "preFill",

+ 52
- 41
src/views/business/comps/template/dialog/SubPackageDialog.vue View File

@ -5,18 +5,18 @@
<div class="header-container">
<div class="header-item">
<div class="header-title">包装编号</div>
<HandleFormItem :fieldKey="formData.mybh +id+ '_mybh'" :isFieldsRecord="false" :item="inputItem"
:type = "mybhOptions.length ? 'select' : 'input'"
@change="onChangeMybh"
:error="formErrors.mybh" v-model="formData.mybh" />
<HandleFormItem :fieldKey="formData.mybh + id + '_mybh'" :isFieldsRecord="false" :item="inputItem"
:type="mybhOptions.length ? 'select' : 'input'" @change="onChangeMybh" :error="formErrors.mybh"
v-model="formData.mybh" />
</div>
<div class="header-item">
<div class="header-title">分装数量</div>
<div class="item-center">
<HandleFormItem :isFieldsRecord="false" :fieldKey="formData.mybh +id+ '_fzsl'"
:item="integerInputNumberItem" type="inputNumber" :error="formErrors.fzsl"
v-model="formData.fzsl" />
<el-button class="ml-5" type="primary" :disabled="!formData.fzsl" plain @click="onBlurFzsl(formData.fzsl)">确定</el-button>
<HandleFormItem :isFieldsRecord="false" :fieldKey="formData.mybh + id + '_fzsl'"
:item="integerInputNumberItem" type="inputNumber" :error="formErrors.fzsl"
v-model="formData.fzsl" />
<el-button class="ml-5" type="primary" :disabled="!formData.fzsl" plain
@click="onBlurFzsl(formData.fzsl)">确定</el-button>
</div>
</div>
</div>
@ -25,13 +25,13 @@
<span>分装编号</span>
<span class="ml-20">单位</span>
<div class="unit-select">
<HandleFormItem :fieldKey="formData.mybh +id+ '_dw'" :isFieldsRecord="false" :item="unitItem"
<HandleFormItem :fieldKey="formData.mybh + id + '_dw'" :isFieldsRecord="false" :item="unitItem"
type="select" :error="formErrors.dw" @blur="(e) => onCommonBlur(e, 'dw')"
v-model="formData.dw" />
</div>
<span class="ml-20">每份包装量</span>
<div class="unit-select">
<HandleFormItem :fieldKey="formData.mybh +id+ '_mfbzl'" type="inputNumber"
<HandleFormItem :fieldKey="formData.mybh + id + '_mfbzl'" type="inputNumber"
:error="formErrors.mfbzl" :isFieldsRecord="false" :item="inputNumberItem"
v-model="formData.mfbzl" />
</div>
@ -164,12 +164,12 @@ export default {
this.fzListErrors = new Array(this.fzList.length).fill(false);
delete cloneData.fzList;
}
const { mybhOptions=[] } = cloneData;
if(mybhOptions.length){
const { mybhOptions = [] } = cloneData;
if (mybhOptions.length) {
this.mybhOptions = mybhOptions
this.inputItem.options = mybhOptions;
this.inputItem.disabled = false;
}else{
} else {
this.inputItem.disabled = true;
}
this.id = data.id;
@ -376,39 +376,48 @@ export default {
//
async onBlurFzsl(e) {
console.log(e, "失去焦点时的数量")
//
if (e) {
this.formErrors.fzsl = false;
}
//
this.fzList = [];
this.fzListErrors = [];
const result = await getLatestSn({
pre: this.formData.mybh,
count: e,
type: 2,
})
if (result.code === 200) {
const codes = result.data;
//
for (let i = 0; i < e; i++) {
this.fzList.push({
num: "",
subCode: codes[i],
preCode: `${this.formData.mybh}-set${codes[i]}`
});
//
this.fzListErrors.push(false);
this.$modal.confirm("分装数量确认后会永久占用分装流水号,且事后无法修改", '提示', {
confirmButtonText: this.$t('form.saveConfirm'),
cancelButtonText: this.$t('form.cancel'),
type: 'warning'
}).then(async () => {
//
if (e) {
this.formErrors.fzsl = false;
}
}
//
this.fzList = [];
this.fzListErrors = [];
const result = await getLatestSn({
pre: this.formData.mybh,
count: e,
type: 2,
})
if (result.code === 200) {
const codes = result.data;
//
for (let i = 0; i < e; i++) {
this.fzList.push({
num: "",
subCode: codes[i],
preCode: `${this.formData.mybh}-set${codes[i]}`
});
//
this.fzListErrors.push(false);
}
}
}).catch(() => {
//
});
},
//
onChangeMybh(e,type) {
if(type === "change" && this.formData.fzsl){
onChangeMybh(e, type) {
if (type === "change" && this.formData.fzsl) {
this.onBlurFzsl(this.formData.fzsl)
}
},
onAverage() {
const { mfbzl } = this.formData;
@ -483,10 +492,12 @@ export default {
border-radius: 4px;
padding: 20px;
}
.item-center{
.item-center {
display: flex;
align-items: center;
}
.header-title {
margin-bottom: 10px;
}

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

@ -169,6 +169,7 @@ export default {
id
}
}
console.log(this.formData,"templateData")
const { effectivePeriod, effectivePeriodUnit, expireDate } =
this.formData
//实际填报的时候,如果有了开始时间,并且有有效周期,但是没有失效日,就计算失效日为开始时间+有效周期

Loading…
Cancel
Save