Browse Source

feat:[模板管理][暂存]

ouqian
luojie 1 month ago
parent
commit
b272a99172
6 changed files with 91 additions and 29 deletions
  1. +48
    -19
      src/components/Template/CustomTable.vue
  2. +7
    -7
      src/components/Template/HandleFormItem.vue
  3. +9
    -1
      src/components/Template/operation/TableOpertaion.vue
  4. +11
    -1
      src/components/Template/operation/TableOpertaionDelete.vue
  5. +5
    -1
      src/views/business/comps/template/comps/yp/YP003.vue
  6. +11
    -0
      src/views/business/comps/template/mixins/templateMixin.js

+ 48
- 19
src/components/Template/CustomTable.vue View File

@ -111,15 +111,13 @@
</template>
<template v-else-if="col.bodyType === 'checkboxTag'">
<div class="flex flex-wrap"
:class="{ 'error-border': hasError(rowIndex, colIndex, col.prop) }">
:class="{ 'row-error-border': hasError(rowIndex, colIndex, col.prop) }">
<HandleFormItem v-for="(tag, tagIndex) in row[col.prop]" :key="tagIndex"
:fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex + '_' + tagIndex"
:fieldItemLabel="fieldItemLabel" type="checkboxTag" :value="tag"
:item="getBodyItem(col, rowIndex)"
@change="onCheckboxTagChange(rowIndex, col, tagIndex, $event)"
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
@change="onCheckboxTagChange(rowIndex, colIndex,col, tagIndex, $event)"
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" />
</div>
</template>
@ -324,15 +322,11 @@ export default {
onDeleteCheckboxTag(rowIndex, col, tagIndex) {
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1);
this.$emit("onDeleteTag", rowIndex, col, tagIndex);
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
this.justUpdateFilledFormData();
},
onCheckboxTagChange(rowIndex, col, tagIndex, value) {
onCheckboxTagChange(rowIndex, colIndex, col, tagIndex, value) {
this.localDataSource[rowIndex][col.prop][tagIndex] = value;
this.onErrorUpdate(rowIndex, colIndex, col.prop, value?false:true);
this.$emit("onCheckboxTagChange", rowIndex, col, tagIndex, value)
},
handleClickButton(e, data, key, rowIndex, colIndex) {
@ -487,10 +481,35 @@ export default {
//
const mainValue = row[col.prop];
if (col.bodyType === "checkboxTag") {
if(this.templateFillType === "actFill"){
}else if(this.templateFillType === "preFill"){
// checkboxTag
if (this.templateFillType === "actFill") {
// actFillcheckedtrue
const hasChecked = mainValue && mainValue.some(tag => tag.checked === true);
if (!hasChecked && !col.bodyDisabled) {
const errorItem = {
rowIndex,
colIndex,
field: col.prop,
label: this.$t(col.label),
error: `请勾选${this.$t(col.label)}`
};
errors.push(errorItem);
this.formErrors.push(errorItem);
}
} else if (this.templateFillType === "preFill") {
// preFilltagValue
const allTagValuesFilled = mainValue && mainValue.every(tag => tag.tagValue && tag.tagValue.trim() !== '');
if (!allTagValuesFilled && !col.bodyDisabled) {
const errorItem = {
rowIndex,
colIndex,
field: col.prop,
label: this.$t(col.label),
error: `请填写${this.$t(col.label)}`
};
errors.push(errorItem);
this.formErrors.push(errorItem);
}
}
} else {
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') {
@ -761,6 +780,15 @@ export default {
return true;
},
//
justUpdateFilledFormData(){
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
},
onAddRow() {
if (this.$listeners && this.$listeners['onAddRow']) {
this.$emit('onAddRow');
@ -772,6 +800,7 @@ export default {
targetDiluentVolumePrecision: 3,//3
targetStartSolutionVolumePrecision: 3,//3
});
this.justUpdateFilledFormData()
},
//
@ -1055,13 +1084,13 @@ export default {
.flex-wrap {
flex-wrap: wrap;
gap:10px;
}
.error-border {
border-color: #ff5d5d;
.row-error-border {
box-shadow: 0 0 6px #ffc3c3;
padding: 8px;
border-radius: 4px;
border: 1px solid;
border: 1px solid #ff5d5d;
}
</style>

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

@ -820,6 +820,7 @@ export default {
// checkboxTagcheckbox
onCheckboxTagChange() {
this.emitCheckboxTagValue();
this.onCommonHandleSaveRecord();
},
// tag
@ -827,10 +828,7 @@ export default {
const value = e.target.value;
this.tagValue = value;
this.emitCheckboxTagValue();
//
if (this.tagValue) {
this.onCommonHandleSaveRecord(this.tagValue);
}
this.onCommonHandleSaveRecord(this.tagValue);
},
// tag
onDeleteTag() {
@ -961,7 +959,9 @@ export default {
//
handleUpdateRecord(data,recordData) {
const baseInfo = this.getCommonRecordInfo();
if (!this.oldValue && !this.inputValue) return;
if (!this.oldValue && !this.inputValue){
return
}
if(recordData){
this.oldValue = recordData.oldValue;
this.inputValue = recordData.inputValue;
@ -1647,8 +1647,8 @@ export default {
.checkbox-tag-container {
border-radius: 4px;
// transition: all 0.3s;
margin-bottom: 10px;
margin-right: 10px;
// margin-bottom: 10px;
// margin-right: 10px;
&.error-border {
border-color: #ff5d5d !important;

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

@ -162,7 +162,15 @@ export default {
},
//
deleteRow(index) {
this.$emit("deleteRow", index)
this.$emit("deleteRow", index);
setTimeout(() => {
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
}, 30);
}
}
}

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

@ -10,6 +10,8 @@
</template>
<script>
import { EventBus } from "@/utils/eventBus";
export default {
name: "TableOpertaionDelete",
props: {
@ -25,7 +27,15 @@ export default {
methods: {
//
deleteRow(index) {
this.$emit("deleteRow", index)
this.$emit("deleteRow", index);
setTimeout(() => {
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
}, 30);
}
}
}

+ 5
- 1
src/views/business/comps/template/comps/yp/YP003.vue View File

@ -171,7 +171,7 @@ export default {
bodySubFillType:"preFill",
bodySubButtonName:"template.common.importTemplate",
bodySubKey:"exportBtn",
showBodySub:true,
showBodySub:this.fillType === "preFill",
width: 280,
},{
label: 'template.yp.yp003.ypsl',
@ -240,7 +240,11 @@ export default {
}
})
this.$refs.tableRef.updateDataSourceByRowIndex(this.currentRowIndex,{dwbh:tagData});
this.$refs.tableRef.onErrorUpdate(this.currentRowIndex, 1, 'dwbh', false)
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData();
}, 100);
},
downloadExcelTemplate(arr){
this.exportExcel(arr)

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

@ -6,6 +6,8 @@ import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from
import {convertConcentration} from "@/utils/conConverter";//浓度单位转换
import {volumeConverter} from "@/utils/volConverter";//体积单位转换
import * as XLSX from 'xlsx'
import { EventBus } from "@/utils/eventBus";
export default {
dicts: [
'business_pztj',
@ -226,6 +228,15 @@ export default {
this.setTemplateData({})
},
methods: {
// 只是更新已填写的表单数据,不触发校验
justUpdateFilledFormData(){
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
},
//试剂弹窗确认前
onBeforeReagentSubmit(data){
const {selectData, callback, key, formFields} = data;

Loading…
Cancel
Save