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) {//
this.$emit("blur", this.inputValue);
this.$emit('input', this.inputValue);
this.$emit("change", this.inputValue);
this.$emit("change", this.inputValue,"change");
return;
}
//

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

@ -1,10 +1,7 @@
<template>
<div class="jcb-table-container">
<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'">
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow">
@ -16,6 +13,7 @@
<script>
import CustomTable from '../CustomTable.vue';
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"
import moment from "moment"
export default {
inject: ['templateFillType'],
@ -41,21 +39,21 @@ export default {
label: '处理批',
prop: 'clp',
width: '200px',
bodyType:"clickable",
bodyKey:"clpClick",
bodyFillType:"preFill",
bodyType: "jcb",
bodyKey: "clpClick",
bodyFillType: "preFill",
},
{
label: '时间',
prop: 'time',
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);
}
},
//
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>
<style lang="scss">
.jcb-table-container{
.jcb-table-container {
width: 600px;
}
.jcb-table{
.custom-table-wrapper{
.jcb-table {
.custom-table-wrapper {
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" />
</template>
<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>
<div v-show="isShowOther(formFields[key])" class="flex flex1">
@ -161,7 +161,7 @@ export default {
},
// ZLSubPackage
validateSubComponents() {
const refs = [];
const refs = [],qbRefs = [];
// formConfigtypezlfz
for (const item of this.formConfig) {
if (item.config) {
@ -176,12 +176,22 @@ export default {
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){
return {valid: true, error: ''};
}else if(qbRefs.length > 0){
return qbRefs[0][0].getFormData();
}else{//
return refs[0][0].validateFormData();
}

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

@ -113,14 +113,15 @@ export default {
if (buttonName === '分装') {
const stepFormData = this.getFilledFormData()
const fzInfo = stepFormData.fzInfo || this.formData.fzInfo;
let fields = []
let fields = [],options = []
let maxVolume, maxVolumeUnit;
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('请先填写分装数据')
return
}
options = mybhOptions
fields.push(mybh)
maxVolume = max || ''
maxVolumeUnit = unit || ''
@ -137,9 +138,11 @@ export default {
}
EventBus.$emit('showSubPackageDialog', {
mybh: fields.join(''),
id: this.stepIndex,
fzType: 'step',
...fzInfo,
maxVolume,
mybhOptions:options,
maxVolumeUnit,
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)
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) {
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 { uniqeYqOne, uniqeResource } from "@/utils/calUnitTools";
import { EventBus } from "@/utils/eventBus";
import { justUpdateFilledFormData } from "@/utils/index";
const refConf = {
base: 'baseInfoRef',
@ -75,10 +76,10 @@ export default {
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}
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: {
label: 'template.dl.dl012.xbzbqbh',
type: 'xb',
checkType:"checkbox",
checkType: "checkbox",
fillType: 'actFill'
},
zbxbs: {
@ -290,6 +291,26 @@ export default {
}
},
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
async generateZbhxbbhFields() {
const data = this.getFilledFormDataByRefs([refConf.xbxx])
@ -302,7 +323,6 @@ export default {
const allExist = Array.from({ length: count }, (_, i) => `zbhxbbhCodeSn_${i + 1}`)
.every(key => !!data[key])
if (allExist) return
try {
const res = await getLatestSn({ pre: zbhxbbh_1, type: 1, count })
if (res.code !== 200) return
@ -328,7 +348,8 @@ export default {
if (Object.keys(updateData).length > 0) {
this.$nextTick(() => {
this.$refs[refConf.xbxx]?.batchUpdateFormData(updateData)
this.$refs[refConf.xbxx]?.batchUpdateFormData(updateData);
justUpdateFilledFormData();
})
}
} catch (e) {
@ -348,13 +369,7 @@ export default {
this.$refs.pyxxRef.updateFormData('pyxbh_xh', row.xh)
this.$refs.pyxxRef.updateFormData('pyxbh_jzrq', row.jzrq)
}
//
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params);
justUpdateFilledFormData();
},
handleClickButton(e, signData) {
console.log(e)
@ -365,6 +380,7 @@ export default {
moment().format('YYYY/MM/DD HH:mm'),
{ 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);
let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType,checkType };
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 = {
uuid: this.uuid,
selectedRows: row,
selectedId:row.map((item)=>item.bdbh).join(","),
selectedId:selectedInfo,
checkType
}
}

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

@ -5,12 +5,14 @@
<div class="header-container">
<div class="header-item">
<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" />
</div>
<div class="header-item">
<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"
v-model="formData.fzsl" />
</div>
@ -20,13 +22,13 @@
<span>分装编号</span>
<span class="ml-20">单位</span>
<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')"
v-model="formData.dw" />
</div>
<span class="ml-20">每份包装量</span>
<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"
v-model="formData.mfbzl" />
</div>
@ -103,6 +105,8 @@ export default {
uuid: "",//id
originalData: {},//
uuid: getuuid(),//id
mybhOptions: [],//
id: "",//id
}
},
computed: {
@ -157,6 +161,16 @@ export default {
this.fzListErrors = new Array(this.fzList.length).fill(false);
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;
//
@ -386,6 +400,13 @@ export default {
}
},
//
onChangeMybh(e,type) {
if(type === "change" && this.formData.fzsl){
this.onBlurFzsl(this.formData.fzsl)
}
},
onAverage() {
const { mfbzl } = this.formData;
this.fzList.forEach((item, index) => {

Loading…
Cancel
Save