Browse Source

feat:[模板管理][update]

luojie
luojie 3 weeks ago
parent
commit
487d0be906
8 changed files with 113 additions and 54 deletions
  1. +1
    -1
      src/components/Template/HandleFormItem.vue
  2. +31
    -28
      src/components/Template/StepComponents/JcbComp.vue
  3. +12
    -2
      src/components/Template/StepFormPackage.vue
  4. +6
    -3
      src/components/Template/mixins/stepMixins.js
  5. +1
    -1
      src/components/Template/operation/TableOpertaion.vue
  6. +30
    -14
      src/views/business/comps/template/comps/dl/DL012.vue
  7. +7
    -1
      src/views/business/comps/template/dialog/SelectMixReagentDialog.vue
  8. +25
    -4
      src/views/business/comps/template/dialog/SubPackageDialog.vue

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

@ -1152,7 +1152,7 @@ export default {
if (!this.isFieldsRecord) {// if (!this.isFieldsRecord) {//
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);
this.$emit("change", this.inputValue,"change");
return; return;
} }
// //

+ 31
- 28
src/components/Template/StepComponents/JcbComp.vue View File

@ -1,10 +1,7 @@
<template> <template>
<div class="jcb-table-container"> <div class="jcb-table-container">
<CustomTable :ref="`tableRef`" :columns="jcbColumns" :formData="formData" :prefixKey="prefixKey" <CustomTable :ref="`tableRef`" :columns="jcbColumns" :formData="formData" :prefixKey="prefixKey"
class="jcb-table"
operationWidth = "120px"
@clickable="handleClickable"
@clickButton = "handleClickButton"
class="jcb-table" operationWidth="120px" @clickButton="handleClickButton"
fieldItemLabel="template.common.operationSteps" :showOperation="templateFillType === 'preFill'"> fieldItemLabel="template.common.operationSteps" :showOperation="templateFillType === 'preFill'">
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow"> <TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow">
@ -16,6 +13,7 @@
<script> <script>
import CustomTable from '../CustomTable.vue'; import CustomTable from '../CustomTable.vue';
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue" import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"
import moment from "moment"
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
@ -41,21 +39,21 @@ export default {
label: '处理批', label: '处理批',
prop: 'clp', prop: 'clp',
width: '200px', width: '200px',
bodyType:"clickable",
bodyKey:"clpClick",
bodyFillType:"preFill",
bodyType: "jcb",
bodyKey: "clpClick",
bodyFillType: "preFill",
}, },
{ {
label: '时间', label: '时间',
prop: 'time', prop: 'time',
width: '200px', width: '200px',
bodyType:"input",
bodyDisabled:true,
bodyFillType:"preFill",
bodySubType:"button",
bodySubButtonName:"取出",
bodySubKey:"timeClick",
bodySubFillType:"preFill",
bodyType: "input",
bodyDisabled: true,
bodyFillType: "actFill",
bodySubType: "button",
bodySubButtonName: "取出",
bodySubKey: "timeClick",
bodySubFillType: "actFill",
}, },
] ]
@ -69,20 +67,24 @@ export default {
tableRef.deleteRow(rowIndex); tableRef.deleteRow(rowIndex);
} }
}, },
//
handleClickable(col, rowIndex, row) {
console.log(col, rowIndex, row,"rowIndex")
if (col.bodyKey === 'clpClick') {
console.log(col, rowIndex, row,"rowIndex")
// this.$refs['tableRef'].updateDataSourceByRowIndex(rowIndex, { clp: row.clp + '1' })
getFilledFormData() {
const tableData = this.$refs.tableRef?.getFilledFormData();
return {
jcbInfo:tableData,
} }
}, },
// getFormData
async getFormData() {
const result = await this.$refs.tableRef?.getFormData()
if(result){
result.jcbInfo = result.jcbInfo || []
}
return result;
},
// //
handleClickButton(col, rowIndex, row) {
console.log(col, rowIndex, row,"rowIndex")
if (col.bodySubKey === 'timeClick') {
console.log(col, rowIndex, row,"rowIndex")
// this.$refs['tableRef'].updateDataSourceByRowIndex(rowIndex, { time: row.time + '1' })
handleClickButton(key, rowIndex, row) {
if (key === 'timeClick') {
this.$refs['tableRef'].updateDataSourceByRowIndex(rowIndex, { time: moment().format("YYYY-MM-DD HH:mm:ss") })
} }
}, },
} }
@ -90,11 +92,12 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.jcb-table-container{
.jcb-table-container {
width: 600px; width: 600px;
} }
.jcb-table{
.custom-table-wrapper{
.jcb-table {
.custom-table-wrapper {
margin-top: 0; margin-top: 0;
} }
} }

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

@ -54,7 +54,7 @@
:stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @update="(data)=>onSubPackageUpdate(data,key)" :subData = "formFields[key]" :ref="'zlSubPackageRef_'+key" /> :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @update="(data)=>onSubPackageUpdate(data,key)" :subData = "formFields[key]" :ref="'zlSubPackageRef_'+key" />
</template> </template>
<template v-else-if="sItem.type === 'qb'"> <template v-else-if="sItem.type === 'qb'">
<JcbComp ref="jcbCompRef" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @resetRecord = "resetRecord" :form-config="formConfig" :formData="formData" />
<JcbComp :ref="'jcbComp_'+key" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @resetRecord = "resetRecord" :form-config="formConfig" :formData="formData" />
</template> </template>
<div v-show="isShowOther(formFields[key])" class="flex flex1"> <div v-show="isShowOther(formFields[key])" class="flex flex1">
@ -161,7 +161,7 @@ export default {
}, },
// ZLSubPackage // ZLSubPackage
validateSubComponents() { validateSubComponents() {
const refs = [];
const refs = [],qbRefs = [];
// formConfigtypezlfz // formConfigtypezlfz
for (const item of this.formConfig) { for (const item of this.formConfig) {
if (item.config) { if (item.config) {
@ -176,12 +176,22 @@ export default {
refs.push(zlSubPackageRef); refs.push(zlSubPackageRef);
} }
}else if(sItem.type === 'qb'){
const refName = `jcbComp_${key}`;
const jcbCompRef = this.$refs[refName];
console.log(jcbCompRef,"jcbCompRef")
// ZLSubPackage
if (jcbCompRef) {
qbRefs.push(jcbCompRef);
}
} }
} }
} }
} }
if(refs.length === 0){ if(refs.length === 0){
return {valid: true, error: ''}; return {valid: true, error: ''};
}else if(qbRefs.length > 0){
return qbRefs[0][0].getFormData();
}else{// }else{//
return refs[0][0].validateFormData(); return refs[0][0].validateFormData();
} }

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

@ -113,14 +113,15 @@ export default {
if (buttonName === '分装') { if (buttonName === '分装') {
const stepFormData = this.getFilledFormData() const stepFormData = this.getFilledFormData()
const fzInfo = stepFormData.fzInfo || this.formData.fzInfo; const fzInfo = stepFormData.fzInfo || this.formData.fzInfo;
let fields = []
let fields = [],options = []
let maxVolume, maxVolumeUnit; let maxVolume, maxVolumeUnit;
if (this.getMybh) { if (this.getMybh) {
const { mybh, maxVolume:max, maxVolumeUnit:unit } = this.getMybh()
if(!mybh || !max || !unit){
const { mybh,mybhOptions=[], maxVolume:max, maxVolumeUnit:unit } = this.getMybh()
if((!mybh &&!mybhOptions.length) || !max || !unit){
this.$message.warning('请先填写分装数据') this.$message.warning('请先填写分装数据')
return return
} }
options = mybhOptions
fields.push(mybh) fields.push(mybh)
maxVolume = max || '' maxVolume = max || ''
maxVolumeUnit = unit || '' maxVolumeUnit = unit || ''
@ -137,9 +138,11 @@ export default {
} }
EventBus.$emit('showSubPackageDialog', { EventBus.$emit('showSubPackageDialog', {
mybh: fields.join(''), mybh: fields.join(''),
id: this.stepIndex,
fzType: 'step', fzType: 'step',
...fzInfo, ...fzInfo,
maxVolume, maxVolume,
mybhOptions:options,
maxVolumeUnit, maxVolumeUnit,
uuid: this.uuid, uuid: this.uuid,
}) })

+ 1
- 1
src/components/Template/operation/TableOpertaion.vue View File

@ -163,7 +163,7 @@ export default {
}) })
const {total,unit} = addTj(cols,units) const {total,unit} = addTj(cols,units)
let defaultData = { mybh: fields.join(""), maxVolume: total, maxVolumeUnit: unit, rowIndex: this.rowIndex }
let defaultData = { mybh: fields.join(""), maxVolume: total,id: innerRow.id, maxVolumeUnit: unit, rowIndex: this.rowIndex }
if (innerRow.fzsj) { if (innerRow.fzsj) {
defaultData = {...innerRow.fzsj,...defaultData} defaultData = {...innerRow.fzsj,...defaultData}
} }

+ 30
- 14
src/views/business/comps/template/comps/dl/DL012.vue View File

@ -52,6 +52,7 @@ import moment from 'moment'
import { getLatestSn } from '@/api/template' import { getLatestSn } from '@/api/template'
import { uniqeYqOne, uniqeResource } from "@/utils/calUnitTools"; import { uniqeYqOne, uniqeResource } from "@/utils/calUnitTools";
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import { justUpdateFilledFormData } from "@/utils/index";
const refConf = { const refConf = {
base: 'baseInfoRef', base: 'baseInfoRef',
@ -75,10 +76,10 @@ export default {
mixins: [templateMixin], mixins: [templateMixin],
provide() { provide() {
return { 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}
getMybh: () => {
const data = this.$refs[refConf.xbxx].getFilledFormData();
const mybhs = this.transformMybh(data);
return { mybhOptions:mybhs, maxVolume: data.zbhxbsjtj, maxVolumeUnit: data.zbhxbsjtjUnit }
} }
} }
}, },
@ -199,7 +200,7 @@ export default {
xbzbqbh: { xbzbqbh: {
label: 'template.dl.dl012.xbzbqbh', label: 'template.dl.dl012.xbzbqbh',
type: 'xb', type: 'xb',
checkType:"checkbox",
checkType: "checkbox",
fillType: 'actFill' fillType: 'actFill'
}, },
zbxbs: { zbxbs: {
@ -290,6 +291,26 @@ export default {
} }
}, },
methods: { methods: {
transformMybh(obj) {
const result = [];
// zbhxbbh_ key
const bhKeys = Object.keys(obj).filter(key => key.startsWith('zbhxbbh_'));
bhKeys.forEach(bhKey => {
const index = bhKey.split('_')[1];
const codeSnKey = `zbhxbbhCodeSn_${index}`;
if (obj[codeSnKey]) {
result.push({
label: `${obj[bhKey]}${obj[codeSnKey]}`,
value: `${obj[bhKey]}${obj[codeSnKey]}`
});
}
});
return result;
},
// zbxbs // zbxbs
async generateZbhxbbhFields() { async generateZbhxbbhFields() {
const data = this.getFilledFormDataByRefs([refConf.xbxx]) const data = this.getFilledFormDataByRefs([refConf.xbxx])
@ -302,7 +323,6 @@ export default {
const allExist = Array.from({ length: count }, (_, i) => `zbhxbbhCodeSn_${i + 1}`) const allExist = Array.from({ length: count }, (_, i) => `zbhxbbhCodeSn_${i + 1}`)
.every(key => !!data[key]) .every(key => !!data[key])
if (allExist) return if (allExist) return
try { try {
const res = await getLatestSn({ pre: zbhxbbh_1, type: 1, count }) const res = await getLatestSn({ pre: zbhxbbh_1, type: 1, count })
if (res.code !== 200) return if (res.code !== 200) return
@ -328,7 +348,8 @@ export default {
if (Object.keys(updateData).length > 0) { if (Object.keys(updateData).length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[refConf.xbxx]?.batchUpdateFormData(updateData)
this.$refs[refConf.xbxx]?.batchUpdateFormData(updateData);
justUpdateFilledFormData();
}) })
} }
} catch (e) { } catch (e) {
@ -348,13 +369,7 @@ export default {
this.$refs.pyxxRef.updateFormData('pyxbh_xh', row.xh) this.$refs.pyxxRef.updateFormData('pyxbh_xh', row.xh)
this.$refs.pyxxRef.updateFormData('pyxbh_jzrq', row.jzrq) this.$refs.pyxxRef.updateFormData('pyxbh_jzrq', row.jzrq)
} }
//
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params);
justUpdateFilledFormData();
}, },
handleClickButton(e, signData) { handleClickButton(e, signData) {
console.log(e) console.log(e)
@ -365,6 +380,7 @@ export default {
moment().format('YYYY/MM/DD HH:mm'), moment().format('YYYY/MM/DD HH:mm'),
{ isUpdateRecord: true, signData } { isUpdateRecord: true, signData }
) )
justUpdateFilledFormData();
} }
}, },
// //

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

@ -206,10 +206,16 @@ export default {
this.$emit('submit', selectedValue, row); this.$emit('submit', selectedValue, row);
let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType,checkType }; let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType,checkType };
if(this.checkType === "checkbox"){ if(this.checkType === "checkbox"){
let selectedInfo = "";
if(this.otherChecked && this.otherReagent){
selectedInfo = this.otherReagent;
}else{
selectedInfo = row.map((item)=>(item.bdbh||item.bh)).join(",");
}
callbackData = { callbackData = {
uuid: this.uuid, uuid: this.uuid,
selectedRows: row, selectedRows: row,
selectedId:row.map((item)=>item.bdbh).join(","),
selectedId:selectedInfo,
checkType checkType
} }
} }

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

@ -5,12 +5,14 @@
<div class="header-container"> <div class="header-container">
<div class="header-item"> <div class="header-item">
<div class="header-title">包装编号</div> <div class="header-title">包装编号</div>
<HandleFormItem :fieldKey="formData.mybh + '_mybh'" :isFieldsRecord="false" :item="inputItem"
<HandleFormItem :fieldKey="formData.mybh +id+ '_mybh'" :isFieldsRecord="false" :item="inputItem"
:type = "mybhOptions.length ? 'select' : 'input'"
@change="onChangeMybh"
:error="formErrors.mybh" v-model="formData.mybh" /> :error="formErrors.mybh" v-model="formData.mybh" />
</div> </div>
<div class="header-item"> <div class="header-item">
<div class="header-title">分装数量</div> <div class="header-title">分装数量</div>
<HandleFormItem :isFieldsRecord="false" :fieldKey="formData.mybh + '_fzsl'" @blur="onBlurFzsl"
<HandleFormItem :isFieldsRecord="false" :fieldKey="formData.mybh +id+ '_fzsl'" @blur="onBlurFzsl"
:item="integerInputNumberItem" type="inputNumber" :error="formErrors.fzsl" :item="integerInputNumberItem" type="inputNumber" :error="formErrors.fzsl"
v-model="formData.fzsl" /> v-model="formData.fzsl" />
</div> </div>
@ -20,13 +22,13 @@
<span>分装编号</span> <span>分装编号</span>
<span class="ml-20">单位</span> <span class="ml-20">单位</span>
<div class="unit-select"> <div class="unit-select">
<HandleFormItem :fieldKey="formData.mybh + '_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')" type="select" :error="formErrors.dw" @blur="(e) => onCommonBlur(e, 'dw')"
v-model="formData.dw" /> v-model="formData.dw" />
</div> </div>
<span class="ml-20">每份包装量</span> <span class="ml-20">每份包装量</span>
<div class="unit-select"> <div class="unit-select">
<HandleFormItem :fieldKey="formData.mybh + '_mfbzl'" type="inputNumber"
<HandleFormItem :fieldKey="formData.mybh +id+ '_mfbzl'" type="inputNumber"
:error="formErrors.mfbzl" :isFieldsRecord="false" :item="inputNumberItem" :error="formErrors.mfbzl" :isFieldsRecord="false" :item="inputNumberItem"
v-model="formData.mfbzl" /> v-model="formData.mfbzl" />
</div> </div>
@ -103,6 +105,8 @@ export default {
uuid: "",//id uuid: "",//id
originalData: {},// originalData: {},//
uuid: getuuid(),//id uuid: getuuid(),//id
mybhOptions: [],//
id: "",//id
} }
}, },
computed: { computed: {
@ -157,6 +161,16 @@ export default {
this.fzListErrors = new Array(this.fzList.length).fill(false); this.fzListErrors = new Array(this.fzList.length).fill(false);
delete cloneData.fzList; delete cloneData.fzList;
} }
const { mybhOptions=[] } = cloneData;
if(mybhOptions.length){
this.mybhOptions = mybhOptions
this.inputItem.options = mybhOptions;
this.inputItem.disabled = false;
}else{
this.inputItem.disabled = true;
}
this.id = data.id;
this.formData = cloneData; this.formData = cloneData;
// //
@ -386,6 +400,13 @@ export default {
} }
}, },
//
onChangeMybh(e,type) {
if(type === "change" && this.formData.fzsl){
this.onBlurFzsl(this.formData.fzsl)
}
},
onAverage() { onAverage() {
const { mfbzl } = this.formData; const { mfbzl } = this.formData;
this.fzList.forEach((item, index) => { this.fzList.forEach((item, index) => {

Loading…
Cancel
Save