Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
c61236b1b1
10 changed files with 65 additions and 55 deletions
  1. +2
    -6
      src/components/Template/BaseInfoFormPcakge.vue
  2. +8
    -12
      src/components/Template/CustomTable.vue
  3. +7
    -7
      src/components/Template/operation/TableOpertaion.vue
  4. +11
    -0
      src/utils/formPackageCommon.js
  5. +4
    -2
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  6. +1
    -1
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  7. +3
    -9
      src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue
  8. +1
    -1
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  9. +1
    -1
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  10. +27
    -16
      src/views/business/comps/template/dialog/SubPackageDialog.vue

+ 2
- 6
src/components/Template/BaseInfoFormPcakge.vue View File

@ -181,6 +181,7 @@
import HandleFormItem from "./HandleFormItem.vue"; import HandleFormItem from "./HandleFormItem.vue";
import LineLabel from "./LineLabel.vue"; import LineLabel from "./LineLabel.vue";
import { isEqual } from "@/utils/index.js"; import { isEqual } from "@/utils/index.js";
import { isShowOther } from "@/utils/formPackageCommon.js";
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
components: { components: {
@ -218,6 +219,7 @@ export default {
errors: {},// errors: {},//
orangeBgFields: {},// orangeBgFields: {},//
oldFormFields: {},// oldFormFields: {},//
isShowOther,
}; };
}, },
watch: { watch: {
@ -339,12 +341,6 @@ export default {
parentLabel: sItem.label, parentLabel: sItem.label,
} }
}, },
isShowOther(v = []) {
// v
const arr = Array.isArray(v) ? v : [v];
//value
return arr.some(item => item < 0);
},
// formConfigform // formConfigform
handleFormField(update = false) { handleFormField(update = false) {
const result = {}; const result = {};

+ 8
- 12
src/components/Template/CustomTable.vue View File

@ -127,7 +127,7 @@
<!-- 默认操作栏 --> <!-- 默认操作栏 -->
<div class="custom-table-cell body-cell" :style="{ width: '245px' }" v-if="showOperation"> <div class="custom-table-cell body-cell" :style="{ width: '245px' }" v-if="showOperation">
<div class="inner-table-cell"> <div class="inner-table-cell">
<slot name="operation" :row="row" :rowIndex="rowIndex" :columns = "columns"></slot>
<slot name="operation" :row="row" :rowIndex="rowIndex" :columns = "getOperationColumns()" ></slot>
</div> </div>
</div> </div>
</div> </div>
@ -147,6 +147,7 @@
<script> <script>
import HandleFormItem from "./HandleFormItem.vue"; import HandleFormItem from "./HandleFormItem.vue";
import { isEqual } from "@/utils/index.js"; import { isEqual } from "@/utils/index.js";
import { isShowOther } from "@/utils/formPackageCommon.js";
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
name: 'CustomTable', name: 'CustomTable',
@ -201,7 +202,8 @@ export default {
localDataSource: [], localDataSource: [],
headerSelectFields: {}, headerSelectFields: {},
formErrors: [], // formErrors: [], //
orangeBgCells: {} // {rowIndex-colIndex: true/false}
orangeBgCells: {}, // {rowIndex-colIndex: true/false}
isShowOther,
} }
}, },
watch: { watch: {
@ -231,6 +233,10 @@ export default {
// this.initHeaderSelectValues(); // this.initHeaderSelectValues();
}, },
methods: { methods: {
//
getOperationColumns(){
return {columnsData:this.columns,headerSelectFields:this.headerSelectFields}
},
// //
getOtherItem(sItem) { getOtherItem(sItem) {
return { return {
@ -241,16 +247,6 @@ export default {
type: "input" type: "input"
} }
}, },
//
isShowOther(v = [],col) {
if(!col.otherCode){
return false;
}
// v
const arr = Array.isArray(v) ? v : [v];
//value
return arr.some(item => item < 0);
},
isShowBodySub(col, row) { isShowBodySub(col, row) {
if (col.hasOwnProperty("disabled")) { if (col.hasOwnProperty("disabled")) {
return col.showBodySub return col.showBodySub

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

@ -27,8 +27,8 @@ export default {
default: () => { }, default: () => { },
}, },
columns: { columns: {
type: Array,
default: [],
type: Object,
default: () => { },
}, },
rowIndex: { rowIndex: {
type: Number, type: Number,
@ -60,19 +60,19 @@ export default {
}, },
// //
onSubPackage() { onSubPackage() {
console.log(this.row,this.columns,"this.row")
const {columns,row} = this; const {columns,row} = this;
const col = columns.find((item)=>item.myCodeFields);
const {myCodeFields} = col;
const {headerSelectFields,columnsData} = columns;
const col = columnsData.find((item)=>item.myCodeFields);
const {myCodeFields,maxVolumeField,maxVolumeFieldUnit} = col;
console.log(row,col,"ooooo")
const fields = []; const fields = [];
myCodeFields.forEach((key)=>{ myCodeFields.forEach((key)=>{
fields.push(row[key]) fields.push(row[key])
}) })
EventBus.$emit("showSubPackageDialog",{mybh:fields.join(""),maxVolume:10,volumeUnit:"ml",rowIndex:this.rowIndex})
EventBus.$emit("showSubPackageDialog",{mybh:fields.join(""),maxVolume:row[maxVolumeField],maxVolumeUnit:headerSelectFields[maxVolumeFieldUnit],rowIndex:this.rowIndex})
}, },
onSubPackageSubmit(data){ onSubPackageSubmit(data){
if(data.rowIndex === this.rowIndex){ if(data.rowIndex === this.rowIndex){
console.log(data,"onSubPackageSubmit")
this.$emit("subPackageSubmit", data) this.$emit("subPackageSubmit", data)
} }
}, },

+ 11
- 0
src/utils/formPackageCommon.js View File

@ -0,0 +1,11 @@
//判断是否显示其他输入框
export const isShowOther=(v = [],col)=> {
if(col &&!col.otherCode){
return false;
}
// 确保v是数组类型,以避免类型错误
const arr = Array.isArray(v) ? v : [v];
const otherArr = ["其他","遮光","CA-QC Dilution_"]
//和凡哥商量,只要value为负数都显示其他
return arr.some(item => otherArr.includes(item));
}

+ 4
- 2
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -269,7 +269,9 @@ export default {
bodySubKey: "subTargetSolutionCode", bodySubKey: "subTargetSolutionCode",
bodyFillType: "preFill", bodyFillType: "preFill",
width: 280, width: 280,
myCodeFields: ["targetSolutionCode", "subTargetSolutionCode"],
myCodeFields: ["targetSolutionCode", "subTargetSolutionCode"],//
maxVolumeField: "actSolutionVolume",//
maxVolumeFieldUnit: "actSolutionVolumeUnit",//
}, },
{ {
label: "起始溶液编号", label: "起始溶液编号",
@ -425,7 +427,7 @@ export default {
} }
const snList = await this.getLatestSn(stepTableFormData.length); const snList = await this.getLatestSn(stepTableFormData.length);
stepTableFormData.forEach((item, index) => { stepTableFormData.forEach((item, index) => {
this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: stepTableFormData.length == 1 ? snList : snList[index] });
this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode:snList[index] });
}) })
this.$nextTick(() => { this.$nextTick(() => {
// //

+ 1
- 1
src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue View File

@ -275,7 +275,7 @@ export default {
count: 1, count: 1,
}) })
if(result.code == 200){ if(result.code == 200){
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn",result.data)
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn",result.data[0])
} }
}, },
// //

+ 3
- 9
src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue View File

@ -305,16 +305,10 @@ export default {
count: stepTableFormData.length, count: stepTableFormData.length,
}) })
if(result.code == 200){ if(result.code == 200){
if(stepTableFormData.length===1){
this.$refs.tableRef.updateDataSourceByRowIndex(0,{
bhCode: result.data,
for(let i=0;i<stepTableFormData.length;i++){
this.$refs.tableRef.updateDataSourceByRowIndex(i,{
bhCode: result.data[i],
}) })
}else{
for(let i=0;i<stepTableFormData.length;i++){
this.$refs.tableRef.updateDataSourceByRowIndex(i,{
bhCode: result.data[i],
})
}
} }
const params = { const params = {

+ 1
- 1
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -278,7 +278,7 @@ export default {
count: 1, count: 1,
}) })
if(result.code == 200){ if(result.code == 200){
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn",result.data)
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn",result.data[0])
} }
}, },
// //

+ 1
- 1
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -200,7 +200,7 @@ export default {
targetSolutionExpirationDate: date targetSolutionExpirationDate: date
} }
} }
this.$refs[ref][0]?.updateDataSourceByRowIndex(idx,{subTargetSolutionCode: length==1?snList:snList[idx],...expDate});
this.$refs[ref][0]?.updateDataSourceByRowIndex(idx,{subTargetSolutionCode:snList[idx],...expDate});
}); });
Promise.resolve(); Promise.resolve();
} }

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

@ -30,7 +30,7 @@
</div> </div>
<div class="header-container"> <div class="header-container">
<div v-for="(item, index) in fzList" class="list-item" :key="index"> <div v-for="(item, index) in fzList" class="list-item" :key="index">
<div class="list-label">{{ formData.mybh }}-set01</div>
<div class="list-label">{{ formData.mybh }}-set{{ item.subCode }}</div>
<HandleFormItem :isFieldsRecord="false" :item="inputNumberItem" :error="fzListErrors[index]" <HandleFormItem :isFieldsRecord="false" :item="inputNumberItem" :error="fzListErrors[index]"
@blur="onBlurFzNum(index)" v-model="item.num" /> @blur="onBlurFzNum(index)" v-model="item.num" />
<el-button type="primary" plain @click="onPrint">打印</el-button> <el-button type="primary" plain @click="onPrint">打印</el-button>
@ -48,7 +48,8 @@
<script> <script>
import HandleFormItem from '@/components/Template/HandleFormItem.vue'; import HandleFormItem from '@/components/Template/HandleFormItem.vue';
import { compareVolume } from '@/utils/volumeTools.js'; import { compareVolume } from '@/utils/volumeTools.js';
import { EventBus } from '@/utils/eventBus'
import { EventBus } from '@/utils/eventBus';
import { getLatestSn } from '@/api/template';
export default { export default {
dicts: [ dicts: [
'business_tjdw', 'business_tjdw',
@ -102,6 +103,8 @@ export default {
methods: { methods: {
close() { close() {
this.visible = false; this.visible = false;
this.fzList = [];
this.formData = {};
this.resetErrors(); this.resetErrors();
}, },
show(data) { show(data) {
@ -122,10 +125,10 @@ export default {
return; return;
} else { } else {
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?" const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?"
const {maxVolume,volumeUnit,dw} = this.formData;
const {maxVolume,maxVolumeUnit,dw} = this.formData;
const totalVolume = this.fzList.reduce((acc, cur) => acc + Number(cur.num), 0); const totalVolume = this.fzList.reduce((acc, cur) => acc + Number(cur.num), 0);
const compareResult = compareVolume(totalVolume,dw,maxVolume, volumeUnit);
if(compareResult > 0){
const compareResult = compareVolume(totalVolume,dw,maxVolume, maxVolumeUnit);
if(compareResult > 0||!maxVolume){//
this.$modal.confirm(errMsg, '提示', { this.$modal.confirm(errMsg, '提示', {
confirmButtonText: this.$t('form.saveConfirm'), confirmButtonText: this.$t('form.saveConfirm'),
cancelButtonText: this.$t('form.cancel'), cancelButtonText: this.$t('form.cancel'),
@ -144,9 +147,9 @@ export default {
}, },
submitEmit(){ submitEmit(){
console.log({...this.formData, fzList: this.fzList})
EventBus.$emit('subPackageSubmit', {...this.formData, fzList: this.fzList}); EventBus.$emit('subPackageSubmit', {...this.formData, fzList: this.fzList});
this.fzList = [];
this.formData = {};
this.close(); this.close();
}, },
validateFormData() { validateFormData() {
@ -199,7 +202,7 @@ export default {
}); });
}, },
// //
onBlurFzsl(e) {
async onBlurFzsl(e) {
// //
if (e) { if (e) {
this.formErrors.fzsl = false; this.formErrors.fzsl = false;
@ -207,15 +210,23 @@ export default {
// //
this.fzList = []; this.fzList = [];
this.fzListErrors = []; this.fzListErrors = [];
//
for (let i = 0; i < e; i++) {
this.fzList.push({
num: "",
});
//
this.fzListErrors.push(false);
const result = await getLatestSn({
my: this.formData.mybh,
count: e,
})
if(result.code === 200){
const codes = result.data;
//
for (let i = 0; i < e; i++) {
this.fzList.push({
num: "",
subCode: codes[i],
});
//
this.fzListErrors.push(false);
}
} }
}, },
onAverage() { onAverage() {
const { mfbzl } = this.formData; const { mfbzl } = this.formData;

Loading…
Cancel
Save