Browse Source

feat:[模板管理][update]

luojie
luojie 3 weeks ago
parent
commit
7edc9128b4
10 changed files with 216 additions and 170 deletions
  1. +6
    -1
      src/components/Template/BaseInfoFormPackage.vue
  2. +4
    -0
      src/components/Template/HandleFormItem.vue
  3. +1
    -0
      src/components/Template/StepComponents/ZLSubPackage.vue
  4. +1
    -0
      src/components/Template/StepComponents/pcr/hsypfz.vue
  5. +1
    -0
      src/components/Template/StepComponents/pcrfxyp/cdnsypfz.vue
  6. +9
    -4
      src/components/Template/StepComponents/ry/fz.vue
  7. +172
    -160
      src/components/Template/mixins/stepMixins.js
  8. +9
    -1
      src/views/business/comps/template/comps/dl/DL011.vue
  9. +11
    -2
      src/views/business/comps/template/comps/dl/DL012.vue
  10. +2
    -2
      src/views/business/comps/template/dialog/SubPackageDialog.vue

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

@ -183,7 +183,7 @@
:style="{ 'width': sItem.labelWidth ? sItem.labelWidth + 'px' : '150px' }" :style="{ 'width': sItem.labelWidth ? sItem.labelWidth + 'px' : '150px' }"
v-if="sItem.label"> v-if="sItem.label">
{{ $t(sItem.label) }}</div> {{ $t(sItem.label) }}</div>
<div v-if="sItem.type === 'span'" class="flex1">
<div v-if="sItem.type === 'span'" class="flex1 span-text">
{{ formFields[key] }} {{ formFields[key] }}
</div> </div>
<div v-if="sItem.type === 'dateTime'" class="flex1"> <div v-if="sItem.type === 'dateTime'" class="flex1">
@ -691,4 +691,9 @@ export default {
width: 120px; width: 120px;
text-align: center; text-align: center;
} }
.span-text {
font-size: 14px;
font-weight: normal;
color: #606266;
}
</style> </style>

+ 4
- 0
src/components/Template/HandleFormItem.vue View File

@ -657,6 +657,10 @@ export default {
// //
handleClickButton(item) { handleClickButton(item) {
this.inputValue = `button-${new Date().getTime()}`; this.inputValue = `button-${new Date().getTime()}`;
if(item.noSign){//emit
this.$emit("clickButton", item);
return;
}
this.onCommonHandleSaveRecord(this.inputValue); this.onCommonHandleSaveRecord(this.inputValue);
}, },
onDateChange(val, format) { onDateChange(val, format) {

+ 1
- 0
src/components/Template/StepComponents/ZLSubPackage.vue View File

@ -210,6 +210,7 @@ export default {
// //
for (let i = 0; i < fzList.length; i++) { for (let i = 0; i < fzList.length; i++) {
fzList[i].subCode = codes[i]; fzList[i].subCode = codes[i];
fzList[i].preCode = `${mybh}-set${codes[i]}`
} }
justUpdateFilledFormData() justUpdateFilledFormData()
} }

+ 1
- 0
src/components/Template/StepComponents/pcr/hsypfz.vue View File

@ -102,6 +102,7 @@ export default {
fillType: "actFill", fillType: "actFill",
fzType: "step", fzType: "step",
buttonName: "分装", buttonName: "分装",
noSign: true,
maxVolumeField: "sjtj", maxVolumeField: "sjtj",
maxVolumeUnitField: "sjtjdw", maxVolumeUnitField: "sjtjdw",
myCodeFields: ["lbbh", "lbbhCode"], myCodeFields: ["lbbh", "lbbhCode"],

+ 1
- 0
src/components/Template/StepComponents/pcrfxyp/cdnsypfz.vue View File

@ -97,6 +97,7 @@ export default {
type:"button", type:"button",
buttonName:"分装", buttonName:"分装",
fzType: "step", fzType: "step",
noSign: true,
maxVolumeField: "sjtj", maxVolumeField: "sjtj",
maxVolumeUnitField: "sjtjdw", maxVolumeUnitField: "sjtjdw",
myCodeFields: ["lbbh", "lbbhCode"], myCodeFields: ["lbbh", "lbbhCode"],

+ 9
- 4
src/components/Template/StepComponents/ry/fz.vue View File

@ -1,6 +1,6 @@
<!-- 分装 --> <!-- 分装 -->
<template> <template>
<StepFormPackage ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_fz'" @resetRecord = "resetRecord" :form-config="formConfig" :formData="formData" />
<StepFormPackage @clickButton="onHandleClickButton" ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_fz'" @resetRecord = "resetRecord" :form-config="formConfig" :formData="formData" />
</template> </template>
<script> <script>
@ -22,15 +22,20 @@ export default {
formConfig() { formConfig() {
let config = [{ let config = [{
config: { config: {
text1: {
label: "待处理。。。。",
type: "text",
fz: {
type: "button",
buttonName:"分装",
fillType:"actFill",
noSign: true,
}, },
} }
}] }]
return config return config
} }
}, },
methods: {
}
} }
</script> </script>

+ 172
- 160
src/components/Template/mixins/stepMixins.js View File

@ -1,167 +1,179 @@
import { getuuid ,justUpdateFilledFormData} from '@/utils/index.js'
import { getuuid, justUpdateFilledFormData } from '@/utils/index.js'
import { EventBus } from '@/utils/eventBus' import { EventBus } from '@/utils/eventBus'
import { getLatestSn, getLatestSnArr } from '@/api/template' import { getLatestSn, getLatestSnArr } from '@/api/template'
export default { export default {
inject: ['templateFillType'],
dicts: [
'business_tjdw',
'business_czhj',
'business_rqcz',
'business_zldw',
'business_yqscdw',
'business_zsdw',
'business_wddw',
'business_ccwz',
'business_ggdw',
'business_hjxx',
'business_zzzc',
'business_step_pcr',
'business_fycx',
'business_step_pcrfxyp',
'business_cctj'
],
props: {
formData: {
type: Object,
default: () => ({})
},
stepIndex: {
type: String,
default: ''
}
},
data() {
return {
uuid: getuuid(),
fzInfo:{},
}
},
mounted() {
EventBus.$on('dialogSubPackageSubmit', (data) => {
this.onSubPackageSubmit(data)
})
EventBus.$on('subPackageDialogPrintTag', (data) => {
this.onPrintTag(data)
})
},
destroyed() {
EventBus.$off('dialogSubPackageSubmit')
EventBus.$off('subPackageDialogPrintTag')
},
inject: ['templateFillType', 'getMybh'],
dicts: [
'business_tjdw',
'business_czhj',
'business_rqcz',
'business_zldw',
'business_yqscdw',
'business_zsdw',
'business_wddw',
'business_ccwz',
'business_ggdw',
'business_hjxx',
'business_zzzc',
'business_step_pcr',
'business_fycx',
'business_step_pcrfxyp',
'business_cctj'
],
props: {
formData: {
type: Object,
default: () => ({})
},
stepIndex: {
type: String,
default: ''
}
},
data() {
return {
uuid: getuuid(),
fzInfo: {},
}
},
mounted() {
EventBus.$on('dialogSubPackageSubmit', (data) => {
this.onSubPackageSubmit(data)
})
EventBus.$on('subPackageDialogPrintTag', (data) => {
this.onPrintTag(data)
})
},
destroyed() {
EventBus.$off('dialogSubPackageSubmit')
EventBus.$off('subPackageDialogPrintTag')
},
methods: {
//回填编号 preField 前缀 updateField 需要更新的字段
async handleBackfillCode(preField,updateField){
const updateValue = this.formData[updateField];
if (this.templateFillType === 'actFill' && !updateValue) {
const stepFormData = this.getFilledFormData();
const preValue = stepFormData[preField];
const result = await this.getLatestSn({
pre: preValue,
})
this.$refs.stepFormPackageRef.updateFormData(updateField,result[0])
this.justUpdateFilledFormData();
}
},
justUpdateFilledFormData(){
justUpdateFilledFormData();
},
//获取最新的多个编号
async getLatestSnArr(params) {
const res = await getLatestSnArr(params)
if (res.code === 200) {
return res.data
}
return []
},
async getLatestSn(params) {
const defaultParams = {
count: 1,
type: 1,
pre: ''
}
const finalParams = { ...defaultParams, ...params }
const res = await getLatestSn(finalParams)
if (res.code === 200) {
return res.data
}
return []
},
// 打印标签
onPrintTag(data) {
this.$emit('printTag')
},
onSubPackageSubmit(data) {
if (data.uuid === this.uuid) {
delete data.uuid //删除uuid字段,不然会导致下次匹配的时候匹配到错误的uuid
this.$refs.stepFormPackageRef.updateFormData('fzInfo',data)
this.justUpdateFilledFormData();
}
},
// 点击按钮
onHandleClickButton(e, item, key) {
const {
buttonName = '',
myCodeFields = [],
maxVolumeField = '',
maxVolumeUnitField = ''
} = e
methods: {
//回填编号 preField 前缀 updateField 需要更新的字段
async handleBackfillCode(preField, updateField) {
const updateValue = this.formData[updateField];
if (this.templateFillType === 'actFill' && !updateValue) {
const stepFormData = this.getFilledFormData();
const preValue = stepFormData[preField];
const result = await this.getLatestSn({
pre: preValue,
})
this.$refs.stepFormPackageRef.updateFormData(updateField, result[0])
this.justUpdateFilledFormData();
}
},
justUpdateFilledFormData() {
justUpdateFilledFormData();
},
//获取最新的多个编号
async getLatestSnArr(params) {
const res = await getLatestSnArr(params)
if (res.code === 200) {
return res.data
}
return []
},
async getLatestSn(params) {
const defaultParams = {
count: 1,
type: 1,
pre: ''
}
const finalParams = { ...defaultParams, ...params }
const res = await getLatestSn(finalParams)
if (res.code === 200) {
return res.data
}
return []
},
// 打印标签
onPrintTag(data) {
this.$emit('printTag')
},
onSubPackageSubmit(data) {
if (data.uuid === this.uuid) {
delete data.uuid //删除uuid字段,不然会导致下次匹配的时候匹配到错误的uuid
this.$refs.stepFormPackageRef.updateFormData('fzInfo', data)
this.justUpdateFilledFormData();
}
},
// 点击按钮
onHandleClickButton(e, item, key) {
const {
buttonName = '',
myCodeFields = [],
maxVolumeField = '',
maxVolumeUnitField = ''
} = e
if (buttonName === '分装') {
const fields = []
const stepFormData = this.getFilledFormData()
if (!myCodeFields.length || !maxVolumeField || !maxVolumeUnitField) {
console.warn('请配制分装参数')
return
}
const fzInfo = stepFormData.fzInfo || this.formData.fzInfo;
const maxVolume = stepFormData[maxVolumeField]
const maxVolumeUnit = stepFormData[maxVolumeUnitField]
myCodeFields.forEach((key) => {
fields.push(stepFormData[key])
})
EventBus.$emit('showSubPackageDialog', {
mybh: fields.join(''),
fzType: 'step',
...fzInfo,
maxVolume,
maxVolumeUnit,
uuid: this.uuid,
})
}
},
if (buttonName === '分装') {
const stepFormData = this.getFilledFormData()
const fzInfo = stepFormData.fzInfo || this.formData.fzInfo;
let fields = []
let maxVolume, maxVolumeUnit;
if (this.getMybh) {
const { mybh, maxVolume:max, maxVolumeUnit:unit } = this.getMybh()
if(!mybh || !max || !unit){
this.$message.warning('请先填写分装数据')
return
}
fields.push(mybh)
maxVolume = max || ''
maxVolumeUnit = unit || ''
} else {
if (!myCodeFields.length || !maxVolumeField || !maxVolumeUnitField) {
this.$message.warning('请配制分装参数')
return
}
maxVolume = stepFormData[maxVolumeField]
maxVolumeUnit = stepFormData[maxVolumeUnitField]
myCodeFields.forEach((key) => {
fields.push(stepFormData[key])
})
}
EventBus.$emit('showSubPackageDialog', {
mybh: fields.join(''),
fzType: 'step',
...fzInfo,
maxVolume,
maxVolumeUnit,
uuid: this.uuid,
})
}
},
async getFormData() {
const data = await this.$refs.stepFormPackageRef.getFormData();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
getFilledFormData() {
const data = this.$refs.stepFormPackageRef?.getFilledFormData();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
getSjResource() {
const data = this.$refs.stepFormPackageRef?.getSjResource();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
//试验配制条件options
getDictOptions(dictType) {
return this.dict.type[dictType] || []
},
resetRecord() {
this.$refs.stepFormPackageRef.resetRecord()
},
//更新温层数据
updateWcData(key, value) {
const options = this.getDictOptions('business_ccwz')
const selectedOption = options.find((item) => item.value === value)
if (selectedOption) {
this.$refs.stepFormPackageRef.updateFormData(key, [
selectedOption.raw.remark
])
}
}
}
async getFormData() {
const data = await this.$refs.stepFormPackageRef.getFormData();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
getFilledFormData() {
const data = this.$refs.stepFormPackageRef?.getFilledFormData();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
getSjResource() {
const data = this.$refs.stepFormPackageRef?.getSjResource();
data.fzInfo = data.fzInfo || this.formData.fzInfo;
return data
},
//试验配制条件options
getDictOptions(dictType) {
return this.dict.type[dictType] || []
},
resetRecord() {
this.$refs.stepFormPackageRef.resetRecord()
},
//更新温层数据
updateWcData(key, value) {
const options = this.getDictOptions('business_ccwz')
const selectedOption = options.find((item) => item.value === value)
if (selectedOption) {
this.$refs.stepFormPackageRef.updateFormData(key, [
selectedOption.raw.remark
])
}
}
}
} }

+ 9
- 1
src/views/business/comps/template/comps/dl/DL011.vue View File

@ -107,6 +107,14 @@ export default {
TableOpertaionDelete TableOpertaionDelete
}, },
mixins: [templateMixin], mixins: [templateMixin],
provide() {
return {
getMybh: ()=>{
const data = this.$refs[refConf.xbxx].getFilledFormData()
return {mybh:data.fshxbbh+data.fshxbbhCodeSn,maxVolume:data.fshxbsjtj,maxVolumeUnit:data.fshxbsjtjUnit}
}
}
},
props: { props: {
fillType: { fillType: {
type: String, type: String,
@ -261,7 +269,7 @@ export default {
fillType: 'actFill', fillType: 'actFill',
copyFrom: 'fshxbyjtj', copyFrom: 'fshxbyjtj',
compareTo: 'fshxbyjtj', compareTo: 'fshxbyjtj',
subOptions: this.getDictOptions('business_nddw'),
subOptions: this.getDictOptions('business_tjdw'),
maxlength: 10 maxlength: 10
} }
} }

+ 11
- 2
src/views/business/comps/template/comps/dl/DL012.vue View File

@ -72,6 +72,15 @@ export default {
TableOpertaionDelete TableOpertaionDelete
}, },
mixins: [templateMixin], mixins: [templateMixin],
provide() {
return {
getMybh: ()=>{
const data = this.$refs[refConf.xbxx].getFilledFormData()
console.log(data,"ddd")
return {mybh:data.fshxbbh+data.fshxbbhCodeSn,maxVolume:data.fshxbsjtj,maxVolumeUnit:data.fshxbsjtjUnit}
}
}
},
props: { props: {
fillType: { fillType: {
type: String, type: String,
@ -229,7 +238,7 @@ export default {
subType: 'select', subType: 'select',
subKey: 'fshxbyjtjUnit', subKey: 'fshxbyjtjUnit',
fillType: 'preFill', fillType: 'preFill',
subOptions: this.getDictOptions('business_nddw'),
subOptions: this.getDictOptions('business_tjdw'),
maxlength: 10, maxlength: 10,
// selectTo: 'zbhxbsjtjUnit' // selectTo: 'zbhxbsjtjUnit'
}, },
@ -239,7 +248,7 @@ export default {
subType: 'select', subType: 'select',
subKey: 'zbhxbsjtjUnit', subKey: 'zbhxbsjtjUnit',
fillType: 'actFill', fillType: 'actFill',
subOptions: this.getDictOptions('business_nddw'),
subOptions: this.getDictOptions('business_tjdw'),
maxlength: 10, maxlength: 10,
compareTo: 'zbhxbyjtj', compareTo: 'zbhxbyjtj',
copyFrom: 'zbhxbyjtj' copyFrom: 'zbhxbyjtj'

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

@ -109,7 +109,7 @@ export default {
unitItem() { unitItem() {
return { return {
type: "select", type: "select",
fillType: "preFill",
fillType: "actFill",
options: this.dict.type.business_tjdw options: this.dict.type.business_tjdw
} }
} }
@ -378,7 +378,7 @@ export default {
this.fzList.push({ this.fzList.push({
num: "", num: "",
subCode: codes[i], subCode: codes[i],
preCode: `-set${codes[i]}`
preCode: `${this.formData.mybh}-set${codes[i]}`
}); });
// //
this.fzListErrors.push(false); this.fzListErrors.push(false);

Loading…
Cancel
Save