Browse Source

feat:[模板管理][update]

luojie
luojie 2 weeks ago
parent
commit
d93c29d98a
6 changed files with 102 additions and 61 deletions
  1. +3
    -0
      src/components/Template/BaseInfoFormPackage.vue
  2. +71
    -56
      src/components/Template/CustomTable.vue
  3. +9
    -3
      src/components/Template/HandleFormItem.vue
  4. +2
    -0
      src/components/Template/StepFormPackage.vue
  5. +16
    -2
      src/components/Template/mixins/formPackageMixins.js
  6. +1
    -0
      src/views/business/comps/template/dialog/SelectMixReagentDialog.vue

+ 3
- 0
src/components/Template/BaseInfoFormPackage.vue View File

@ -127,6 +127,7 @@
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
:type="sItem.type" sourceFrom="baseInfoFormPackage" :error="errors[key]"
@update:error="errors[key] = false"
:orange-bg="regentIsExpired(key)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, key, sItem)"
:item="sItem" :value="formFields[key]" />
</div>
@ -274,6 +275,7 @@
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, sItem.subKey)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, sItem.subKey, sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:orange-bg="regentIsExpired(sItem.subKey)"
:value="formFields[sItem.subKey]" />
</template>
<div v-if="isShowSub(sItem,'thirdType')">
@ -309,6 +311,7 @@
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, key)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, key, sItem)"
:field-key="prefixKey + '_' + key" :type="sItem.type" :error="errors[key]"
:orange-bg="regentIsExpired(key)"
@update:error="errors[key] = false" :item="getRegentItem(sItem)"
:value="formFields[key]" />
<span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>

+ 71
- 56
src/components/Template/CustomTable.vue View File

@ -12,13 +12,13 @@
@change="handleCheckAllChange"></el-checkbox>
</div>
</div>
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell header-cell no-break"
:style="getCellWidth(col)">
<div v-for="(col, colIndex) in columns" :key="colIndex"
class="custom-table-cell header-cell no-break" :style="getCellWidth(col)">
<div class="header-cell-content" v-if="col.headerColumns && col.headerColumns.length > 0">
<div class="header-columns-grid"
:style="{ 'grid-template-columns': `repeat(${col.span || 2}, 1fr)` }">
<div v-for="(headerCol, headerIndex) in col.headerColumns" :key="headerIndex"
class="header-column-item" >
class="header-column-item">
<template v-if="headerCol.type === 'span'">
<div class="span-content">{{ $t(headerCol.label) }}</div>
</template>
@ -31,6 +31,7 @@
:value="headerFields[`${colIndex}_${headerIndex}`]"
:error="hasHeaderError(colIndex, headerIndex, headerCol.key)"
@update:error="onHeaderColumnErrorUpdate(colIndex, headerIndex, headerCol.key, $event)"
:orange-bg="regentIsExpired(headerCol.key,rowIndex)"
@onRegentSubmit="(data, inputValue) => onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex)" />
</template>
<template
@ -83,8 +84,8 @@
<el-checkbox v-model="row._checked" @change="handleCheckChange(row, $event)"></el-checkbox>
</div>
</div>
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell body-cell no-break"
:style="getCellWidth(col)">
<div v-for="(col, colIndex) in columns" :key="colIndex"
class="custom-table-cell body-cell no-break" :style="getCellWidth(col)">
<div class="inner-table-cell">
<div class="flex1" :class="{ 'item-center': !isBorder && col.label }">
<div v-if="!isBorder && col.label" class="mr-5">
@ -97,8 +98,7 @@
:fieldItemLabel="fieldItemLabel" :type="col.bodyType"
@blur="onBlur(rowIndex, col.prop, $event)" @copy="onCopy(rowIndex, col)"
class="body-input" :item="getBodyItem(col, rowIndex)"
v-model="row[col.prop]"
:ref = "col.prop+rowIndex"
v-model="row[col.prop]" :ref="col.prop + rowIndex"
@change="onBodyValueChange(rowIndex, colIndex, $event, row, col.bodyType)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
@ -107,13 +107,14 @@
</div>
</template>
<div v-else-if = "col.bodyType === 'checkboxTree'">
<HandleFormItem
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + col.prop+ rowIndex"
type="checkboxTree" :item="getBodyItem(col, rowIndex)" :value="row[col.prop]"
@change="(e) => onBodyValueChange(rowIndex, colIndex, e, row, col.bodyType)"
:error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
<div v-else-if="col.bodyType === 'checkboxTree'">
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + col.prop + rowIndex" type="checkboxTree"
:item="getBodyItem(col, rowIndex)" :value="row[col.prop]"
@change="(e) => onBodyValueChange(rowIndex, colIndex, e, row, col.bodyType)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div>
<div v-else-if="col.bodyType === 'operableInput'" class="flex flex1">
<div class="flex1 grid-container">
@ -125,9 +126,9 @@
:fieldItemLabel="fieldItemLabel" type="input"
@blur="onOperableInputBlur(opItem, $event)" class="body-input"
:item="getBodyItem(col, rowIndex)" :value="opItem.value"
:error="hasError(rowIndex, colIndex, rowIndex+col.prop+itemIndex)"
@update:error="onErrorUpdate(rowIndex, colIndex, rowIndex+col.prop+itemIndex, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, rowIndex+col.prop+itemIndex)" />
:error="hasError(rowIndex, colIndex, rowIndex + col.prop + itemIndex)"
@update:error="onErrorUpdate(rowIndex, colIndex, rowIndex + col.prop + itemIndex, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, rowIndex + col.prop + itemIndex)" />
<el-popconfirm confirm-button-text='确认' cancel-button-text='取消'
icon="el-icon-info" icon-color="red" title="确认删除当前输入框?"
@confirm="removeOperableInput(rowIndex, colIndex, col.prop, itemIndex)">
@ -136,7 +137,8 @@
</el-popconfirm>
</div>
</div>
<i class="el-icon-circle-plus add-icon" v-if="templateFillType === 'actFill' && !row.isComplete"
<i class="el-icon-circle-plus add-icon"
v-if="templateFillType === 'actFill' && !row.isComplete"
@click="addOperableInput(rowIndex, colIndex, col.prop)"></i>
</div>
@ -158,7 +160,7 @@
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row, col.prop)"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, col, row)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
:orange-bg="regentIsExpired(col.prop,rowIndex)" />
</div>
<template v-else-if="col.bodyType === 'span'">
<div class="body-span">
@ -201,7 +203,8 @@
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.otherCode)" />
</div>
</div>
<div class="m-l-5 flex" :class="{ 'flex1': (col.bodySubType !== 'button' && col.bodySubType !== 'span') }"
<div class="m-l-5 flex"
:class="{ 'flex1': (col.bodySubType !== 'button' && col.bodySubType !== 'span') }"
v-if="isShowBodySub(col, row)">
<template
v-if="col.bodySubType === 'inputNumber' || col.bodySubType === 'input' || col.bodySubType === 'select'">
@ -209,7 +212,6 @@
:fieldItemLabel="fieldItemLabel" :type="col.bodySubType"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event, row, col.bodySubType)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@ -224,8 +226,8 @@
<template v-else-if="col.bodySubType === 'button'">
<HandleFormItem class="ml-10" type="button" :item="getBodyButtonItem(col, rowIndex)"
:value="row[col.bodySubKey]"
:fieldKey="prefixKey + '_' + col.bodySubKey + '_' + row.id"
@clickButton="(e,val, data) => handleClickButton(e, data, col.bodySubKey, rowIndex, colIndex)" />
:fieldKey="prefixKey + '_' + col.bodySubKey + '_' + row.id"
@clickButton="(e, val, data) => handleClickButton(e, data, col.bodySubKey, rowIndex, colIndex)" />
</template>
<div class="flex flex1" v-else-if="isRegent(col, 'bodySubType')">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + row.id"
@ -236,13 +238,13 @@
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row, col.bodySubKey)"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, col, row)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
:orange-bg="regentIsExpired(col.bodySubKey,rowIndex)" />
</div>
<template v-if="col.bodyThirdType === 'button'">
<HandleFormItem class="ml-10" type="button" :item="getBodyThirdButtonItem(col, rowIndex)"
:value="row[col.bodyThirdKey]"
:fieldKey="prefixKey + '_' + col.bodyThirdKey + '_' + row.id"
@clickButton="(e,val, data) => handleClickButton(e, data, col.bodyThirdKey, rowIndex, colIndex)" />
<HandleFormItem class="ml-10" type="button"
:item="getBodyThirdButtonItem(col, rowIndex)" :value="row[col.bodyThirdKey]"
:fieldKey="prefixKey + '_' + col.bodyThirdKey + '_' + row.id"
@clickButton="(e, val, data) => handleClickButton(e, data, col.bodyThirdKey, rowIndex, colIndex)" />
</template>
</div>
</div>
@ -278,6 +280,7 @@ import { EventBus } from "@/utils/eventBus";
import { getuuid, justUpdateFilledFormData } from "@/utils/index.js";
import { isRegent } from "@/utils/index.js";
import { isValueEmpty } from '@/utils/index.js';
import moment from 'moment';
import _ from "lodash";
export default {
@ -465,7 +468,7 @@ export default {
isValid = value && value.some(tag => tag.checked === true);
} else if (this.templateFillType === "preFill") {
// preFilltagValue
isValid = value && value.every(tag => tag.tagValue && (tag.tagValue+'').trim() !== '');
isValid = value && value.every(tag => tag.tagValue && (tag.tagValue + '').trim() !== '');
}
this.onErrorUpdate(rowIndex, colIndex, col.prop, !isValid);
this.$emit("onCheckboxTagChange", rowIndex, col, value)
@ -505,7 +508,7 @@ export default {
},
//
getOperationColumns() {
return { columnsData: this.columns, headerSelectFields: this.headerSelectFields,fieldItemLabel: this.fieldItemLabel }
return { columnsData: this.columns, headerSelectFields: this.headerSelectFields, fieldItemLabel: this.fieldItemLabel }
},
//
getOtherItem(sItem) {
@ -543,11 +546,23 @@ export default {
this.$emit("onHeaderRegentSubmit", { selectInfo: data, headerIndex, colIndex, headerFields: this.headerFields })
},
//
regentIsExpired(key,rowIndex) {
const item = this.localDataSource[rowIndex];
const { yxq, sxrq } = item[`selectInfo_${key}`] || {};
const rq = sxrq || yxq;
if (rq) {
const time = moment(yxq);
return time.isBefore(moment());
} else {
return false;
}
},
onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row, key) {
// if (this.templateFillType !== 'actFill') {
// return
// }
this.updateDataSourceByRowIndex(rowIndex, { [key]: inputValue })
this.updateDataSourceByRowIndex(rowIndex, { [key]: inputValue, [`selectInfo_${key}`]: data.selectInfo })
this.$emit("onRegentSubmit", { selectInfo: data, key, col, rowIndex, colIndex, rowData: row })
},
isShowAddRos() {
@ -664,7 +679,7 @@ export default {
if (this.templateFillType === "actFill") {
// actFillcheckedtrue
const hasChecked = mainValue && mainValue.some(tag => tag.checked === true);
if (!hasChecked && !col.bodyDisabled) {
if (!hasChecked) {
const errorItem = {
rowIndex,
colIndex,
@ -677,8 +692,8 @@ export default {
}
} else if (this.templateFillType === "preFill") {
// preFilltagValue
const allTagValuesFilled = mainValue && mainValue.every(tag => tag.tagValue && (tag.tagValue+'').trim() !== '');
if (!allTagValuesFilled && !col.bodyDisabled) {
const allTagValuesFilled = mainValue && mainValue.every(tag => tag.tagValue && (tag.tagValue + '').trim() !== '');
if (!allTagValuesFilled) {
const errorItem = {
rowIndex,
colIndex,
@ -693,7 +708,7 @@ export default {
} else if (col.bodyType === "checkbox") {
// checkbox
// checkboxactFill
if (!col.bodyDisabled && this.templateFillType === 'actFill' && !col.isNeedCheck) {
if (this.templateFillType === 'actFill' && !col.isNeedCheck) {
// checkboxtrue
// checkbox
const hasChecked = Array.isArray(mainValue) ? mainValue.length > 0 : mainValue === true;
@ -709,13 +724,13 @@ export default {
this.formErrors.push(errorItem);
}
}
} else if(col.bodyType === "operableInput"){
} else if (col.bodyType === "operableInput") {
mainValue.forEach((itemItem, itemIndex) => {
if (isValueEmpty(itemItem.value)) {
const errorItem = {
rowIndex,
colIndex,
field: rowIndex+col.prop+itemIndex,
field: rowIndex + col.prop + itemIndex,
label: this.$t(col.label),
error: `请填写${this.$t(col.label)}`
};
@ -724,8 +739,8 @@ export default {
}
})
}else {
if (isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span' && col.bodyType !== 'button') {
} else {
if (isValueEmpty(mainValue) && col.bodyType !== 'span' && col.bodyType !== 'button') {
const errorItem = {
rowIndex,
colIndex,
@ -737,7 +752,7 @@ export default {
this.formErrors.push(errorItem);
}
//
if (col.bodySubKey && !col.bodySubDisabled && col.bodySubFillType === this.templateFillType && col.bodySubType !== 'span' && col.bodySubType !== "button") {
if (col.bodySubKey && col.bodySubFillType === this.templateFillType && col.bodySubType !== 'span' && col.bodySubType !== "button") {
const subValue = row[col.bodySubKey];
if (isValueEmpty(subValue)) {
const errorItem = {
@ -939,20 +954,20 @@ export default {
// 使checkboxLabel
item.checkboxLabel = this.$t(col.checkboxLabel);
}
if (col.bodyType === "operableInput" ) {
if(currentItem.isComplete || this.templateFillType !== 'actFill'){
if (col.bodyType === "operableInput") {
if (currentItem.isComplete || this.templateFillType !== 'actFill') {
item.disabled = true;
}else{
} else {
item.disabled = false;
}
}
if(col.noBorder){
if (col.noBorder) {
item.noBorder = true;
}
if(col.bodyLayout){
if (col.bodyLayout) {
item.layout = col.bodyLayout;
}
return item
},
getBodyButtonItem(col,) {
@ -1019,15 +1034,15 @@ export default {
this.checkCompareToOnDataLoad();
},
// autoUpdateRecord
updateDataSourceByRowIndex(rowIndex, data,updateFieldsInfo={}) {
const {signData,updateFields = []} = updateFieldsInfo;
updateDataSourceByRowIndex(rowIndex, data, updateFieldsInfo = {}) {
const { signData, updateFields = [] } = updateFieldsInfo;
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource));
this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data };
this.localDataSource = [...this.localDataSource];
if(updateFields.length > 0){
updateFields.map((key)=>{
const ref = this.$refs[key+rowIndex];
if(ref){
if (updateFields.length > 0) {
updateFields.map((key) => {
const ref = this.$refs[key + rowIndex];
if (ref) {
ref[0].handleUpdateRecord(signData, { oldValue: this.oldLocalDataSource[rowIndex][key], inputValue: data[key] });
}
})
@ -1036,7 +1051,7 @@ export default {
this.checkCompareToOnDataLoad();
// justUpdateFilledFormData();
},
pushDataSource(data=[]) {
pushDataSource(data = []) {
this.localDataSource.push(...data);
this.localDataSource = [...this.localDataSource];
this.checkCompareToOnDataLoad();
@ -1084,7 +1099,7 @@ export default {
},
onAddRow() {
if (this.$listeners && this.$listeners['onAddRow']) {
this.$emit('onAddRow',{dataSource:this.localDataSource});
this.$emit('onAddRow', { dataSource: this.localDataSource });
return;
}
this.addRow({
@ -1092,8 +1107,8 @@ export default {
actSolutionConcentrationPrecision: 3,//3
targetDiluentVolumePrecision: 3,//3
targetStartSolutionVolumePrecision: 3,//3
id:getuuid(),
rowIndex:this.localDataSource.length,
id: getuuid(),
rowIndex: this.localDataSource.length,
});
justUpdateFilledFormData()
},

+ 9
- 3
src/components/Template/HandleFormItem.vue View File

@ -1249,7 +1249,7 @@ export default {
this.oldValue = recordData.oldValue;
this.inputValue = recordData.inputValue;
}
let recordOldVlaue = this.oldValue, recordValue = this.inputValue, isModify = !!this.oldValue;
let recordOldVlaue = this.oldValue, recordValue = this.inputValue, isModify = !!this.oldValue,oldUrl = "",url="";
if (this.type === "checkboxTag") {
// checkboxTagtagIndex
const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {};
@ -1288,6 +1288,8 @@ export default {
const oldAttList = JSON.parse(recordOldVlaue || "[]");
recordValue = attList.map(item => item.name).join(";");
recordOldVlaue = oldAttList.map(item => item.name).join(";");
oldUrl = oldAttList.map(item => item.url).join(";");
url = attList.map(item => item.url).join(";");
}
const record = {
@ -1297,6 +1299,10 @@ export default {
title: !this.isUnSubmitted(finallyKey) ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
}
if(url){
record.url = url;
record.oldUrl = oldUrl;
}
if (data) {
record.reason = data.remark
}
@ -1738,11 +1744,11 @@ export default {
.clickable,
.el-date-editor,
.el-checkbox__inner {
border-color: #ff5d5d;
border-color: #ff5d5d !important;
box-shadow: 0 0 6px #ffc3c3 !important;
&:focus {
border-color: #ff5d5d;
border-color: #ff5d5d !important;
box-shadow: 0 0 6px #ffc3c3 !important;
}

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

@ -40,6 +40,7 @@
:type="sItem.type" :error="errors[key]"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@update:error="errors[key] = false" :item="getRegentItem(sItem)"
:orange-bg="regentIsExpired(key)"
:value="formFields[key]" />
</template>
<template v-else-if="sItem.type === 'text'">
@ -131,6 +132,7 @@ export default {
}
},
methods: {
isShowJcb(item,key){
const {stepTableFormData = []} = this.formData[key] || {};
return item.type === 'qb' || (item.type === 'dcjcb' && stepTableFormData.length > 0);

+ 16
- 2
src/components/Template/mixins/formPackageMixins.js View File

@ -1,6 +1,8 @@
import _ from 'lodash'
import { getuuid, isEqual, isValueEmpty } from '@/utils/index.js'
import { isShowOtherByCheckboxTree } from '@/utils/formPackageCommon.js'
import moment from 'moment'
export default {
inject: ['getZdxgjl', 'updateZdxgjl'],
watch: {
@ -59,10 +61,22 @@ export default {
this.$set(this.errors, key, false)
}
},
//是否过期
regentIsExpired(key) {
const { yxq, sxrq } = this.formFields[`selectInfo_${key}`] || {};
const rq = sxrq || yxq;
if (rq) {
const time = moment(rq);
return time.isBefore(moment());
} else {
return false;
}
},
//试剂/仪器等弹窗提交
onRegentSubmit(data, inputValue, key, item) {
this.updateFormData(key, inputValue)
this.formFields[`selectInfo_${key}`] = data.selectInfo;
console.log(this.formFields,"fff")
this.$emit('onRegentSubmit', {
selectInfo: data,
inputValue,
@ -557,7 +571,7 @@ export default {
if (o.type === 'span' || o.type === 'text' || o.type === 'button') {
continue
}
if (o.fillType === this.templateFillType && !o.disabled) {
if (o.fillType === this.templateFillType) {
let prefix = ''
if (
o.type === 'input' ||

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

@ -185,6 +185,7 @@ export default {
ly: row.ly,
nddw: row.nddw,
sxrq: row.sxr,
yxq: row.yxq,
ndz: (row.nd||"")+(row.nddw||""),
type: Number(this.selectType),
kc: row.kc,

Loading…
Cancel
Save