Browse Source

feat:[模板管理][组件抽离2]

master
luojie 1 week ago
parent
commit
dcbb09a0b0
9 changed files with 330 additions and 147 deletions
  1. +31
    -3
      src/components/Template/BaseInfoFormPcakge.vue
  2. +146
    -0
      src/components/Template/DecimalInput.vue
  3. +78
    -81
      src/components/Template/HandleFormItem.vue
  4. +6
    -0
      src/store/modules/template.js
  5. +45
    -41
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  6. +4
    -4
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  7. +8
    -16
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  8. +10
    -0
      src/views/business/comps/template/mixins/templateMixin.js
  9. +2
    -2
      vue.config.js

+ 31
- 3
src/components/Template/BaseInfoFormPcakge.vue View File

@ -94,7 +94,7 @@
<HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" <HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]"
@copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" /> @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" />
<div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem)">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem)">{{ formFields[sItem.subKey] }}</div>
</div> </div>
<div v-else-if="sItem.type === 'inputNumber'" class="flex flex1"> <div v-else-if="sItem.type === 'inputNumber'" class="flex flex1">
<HandleFormItem type = "inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem" @input = "onInputNumberChange(key, $event)" :value = "formFields[key]" <HandleFormItem type = "inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem" @input = "onInputNumberChange(key, $event)" :value = "formFields[key]"
@ -102,7 +102,7 @@
<HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" <HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]"
@copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" /> @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" />
<div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem)">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem)">{{ formFields[sItem.subKey] }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -157,12 +157,19 @@ export default {
} }
} }
}, },
mounted() { mounted() {
this.handleFormField(); this.handleFormField();
}, },
methods: { methods: {
getFillType(type) {
const typeObj = {
actFill: "orange-border",//
green: "green-border",
preFill: "blue-border",//
}
return typeObj[type] || ""
},
onInputNumberChange(key, val){ onInputNumberChange(key, val){
if(val === 0){ if(val === 0){
this.formFields[key] = null; this.formFields[key] = null;
@ -413,4 +420,25 @@ export default {
width: auto; width: auto;
margin-left: 10px; margin-left: 10px;
} }
.clickable{
cursor: pointer;
width: auto;
margin-left: 10px;
min-width: 100px;
height: 28px;
border-radius: 4px;
border:1px solid #4ea2ff;
}
.orange-border {
border-color: #f9c588;
}
.green-border {
border-color: green;
}
.blue-border {
border-color: #4ea2ff;
}
</style> </style>

+ 146
- 0
src/components/Template/DecimalInput.vue View File

@ -0,0 +1,146 @@
<template>
<el-input v-model="internalValue" @input="handleInput" @blur="handleBlur" :placeholder="placeholder" type="text" />
</template>
<script>
export default {
name: 'DecimalInput',
props: {
value: {
type: [Number, String],
default: ''
},
decimalDigits: {
type: Number,
default: 0
},
placeholder: {
type: String,
default: '请输入'
}
},
data() {
return {
internalValue: this.value !== null && this.value !== undefined ? String(this.value) : ''
};
},
watch: {
value(newVal) {
//
if (newVal === '' || newVal == null) {
this.internalValue = '';
} else {
this.internalValue = String(newVal);
}
}
},
methods: {
handleInput(val) {
if (val === '') {
this.internalValue = '';
this.$emit('input', '');
return;
}
// 1.
let cleaned = val
.replace(/[^\d.-]/g, '')
.replace(/^(-)\1+/, '$1'); //
// 2.
const dotIndex = cleaned.indexOf('.');
if (dotIndex !== -1) {
const beforeDot = cleaned.slice(0, dotIndex);
const afterDot = cleaned.slice(dotIndex + 1).replace(/\./g, ''); //
cleaned = beforeDot + '.' + afterDot;
}
// 3.
if (this.decimalDigits > 0 && cleaned.includes('.')) {
const parts = cleaned.split('.');
let integerPart = parts[0];
let decimalPart = parts[1] || '';
//
if (decimalPart.length > this.decimalDigits) {
decimalPart = decimalPart.slice(0, this.decimalDigits);
}
// 使 decimalPart "1."
cleaned = integerPart + '.' + decimalPart;
} else if (this.decimalDigits === 0) {
//
cleaned = cleaned.split('.')[0];
}
// 4. . -.
if (cleaned === '.') {
cleaned = '0.';
} else if (cleaned === '-.') {
cleaned = '-0.';
} else if (cleaned.startsWith('.')) {
cleaned = '0' + cleaned;
} else if (cleaned.startsWith('-.')) {
cleaned = '-0.' + cleaned.slice(2);
}
// 5. 0 -0
if (cleaned.includes('.')) {
// 0 -0
const parts = cleaned.split('.');
let intPart = parts[0];
if (intPart === '' || intPart === '-') {
intPart = intPart + '0';
} else if (/^-?0+\d/.test(intPart)) {
// -0012 -120012 12
intPart = intPart.replace(/^-?0+(\d)/, '$1');
}
cleaned = intPart + '.' + parts[1];
} else {
//
if (/^-?0+\d/.test(cleaned)) {
cleaned = cleaned.replace(/^-?0+(\d)/, '$1');
}
}
this.internalValue = cleaned;
// emit '-'
if (cleaned === '' || cleaned === '-') {
this.$emit('input', cleaned === '-' ? '-' : '');
} else {
const num = parseFloat(cleaned);
if (!isNaN(num)) {
this.$emit('input', num);
} else {
this.$emit('input', '');
}
}
},
handleBlur() {
let finalValue = this.internalValue.trim();
if (finalValue === '' || finalValue === '-') {
this.internalValue = '';
this.$emit('input', '');
return;
}
const num = parseFloat(finalValue);
if (isNaN(num)) {
this.internalValue = '';
this.$emit('input', '');
return;
}
// blur toFixed +
const formatted = num.toFixed(this.decimalDigits);
this.internalValue = formatted;
// emit emit
this.$emit('input', parseFloat(formatted));
this.$emit('blur', parseFloat(formatted));
}
}
};
</script>

+ 78
- 81
src/components/Template/HandleFormItem.vue View File

@ -1,73 +1,54 @@
<template> <template>
<div class="flex w-100"> <div class="flex w-100">
<div class="flex1 flex"> <div class="flex1 flex">
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 30" :disabled="getDisabled()"
:class="item.fillType | getFillType"
@blur="onBlur"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="item.fillType | getFillType" @blur="onBlur"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue"
@input="onInputChange" @change="onInputChange" />
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="item.fillType | getFillType" type="textarea" show-word-limit resize="none" @blur="onBlur"
:rows="item.rows || 3" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 30" :disabled="getDisabled()"
:class="item.fillType | getFillType"
type = "textarea"
show-word-limit
resize = "none"
@blur="onBlur"
:rows="item.rows || 3"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-input-number v-else-if="type === 'inputNumber'"
@blur="onBlur"
:maxlength="item.maxlength || 30"
class="flex1"
:disabled="getDisabled()"
:controls = "item.controls || false"
:min = "item.min || 0"
:precision="item.precision"
:class="item.fillType | getFillType"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-select v-else-if="type === 'select'" class="flex1"
:multiple = "item.multiple"
:class="item.fillType | getFillType"
v-model="inputValue"
:disabled="getDisabled()"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)"
@change = "onInputChange"
>
<el-option v-for="op in item.options" :key="op.value" :label="op.label"
:value="op.value">
<DecimalInput v-else-if="type === 'inputNumber'" @blur="onBlur" :maxlength="item.maxlength || 10"
class="flex1" :disabled="getDisabled()" :controls="item.controls || false" :min="item.min || 0"
:decimalDigits="item.precision" :class="item.fillType | getFillType"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue"
@input="onInputChange" @change="onInputChange" />
<el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple"
:class="item.fillType | getFillType" v-model="inputValue" :disabled="getDisabled()"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange">
<el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value">
</el-option> </el-option>
</el-select> </el-select>
<el-date-picker
v-else-if="type === 'dateTime'" class="flex1"
:class="item.fillType | getFillType"
v-model="inputValue"
:disabled="getDisabled()"
format="yyyy/MM/DD HH:mm:ss" value-format="yyyy/MM/DD HH:mm:ss"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)"
@change="onInputChange">
</el-date-picker>
<el-date-picker v-else-if="type === 'dateTime'" class="flex1" :class="item.fillType | getFillType"
v-model="inputValue" :disabled="getDisabled()" format="yyyy/MM/DD HH:mm:ss"
value-format="yyyy/MM/DD HH:mm:ss"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange">
</el-date-picker>
</div> </div>
<!-- qc才能操作 --> <!-- qc才能操作 -->
<div class="handle-row" v-if="isShowHandle()"> <div class="handle-row" v-if="isShowHandle()">
<el-checkbox class = "ml-5"></el-checkbox>
<Question class="handle-icon" :class = "getQuestionColor()"/>
<img v-if="getIsShowCopyIcon()" @click="onCopy" src="@/assets/images/copy-icon.svg" class="handle-icon" alt=""/>
<img src="@/assets/images/record-icon.svg" class="handle-icon" alt=""/>
<el-checkbox class="ml-5"></el-checkbox>
<Question class="handle-icon" :class="getQuestionColor()" />
<img v-if="getIsShowCopyIcon()" @click="onCopy" src="@/assets/images/copy-icon.svg" class="handle-icon"
alt="" />
<img src="@/assets/images/record-icon.svg" class="handle-icon" alt="" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Question from "./icons/Question.vue"
import Question from "./icons/Question.vue";
import DecimalInput from "./DecimalInput.vue";
export default { export default {
components: { components: {
Question
Question,
DecimalInput
}, },
props: { props: {
type: {//form input/select type: {//form input/select
type:String,
default:"input"
type: String,
default: "input"
}, },
item: { item: {
type: Object, type: Object,
@ -82,7 +63,7 @@ export default {
}, },
// v-model // v-model
value: { value: {
type: [String, Number,Array],
type: [String, Number, Array],
default: '' default: ''
}, },
}, },
@ -109,7 +90,7 @@ export default {
}, },
methods: { methods: {
//question //question
getQuestionColor(){
getQuestionColor() {
//gray green 绿 orange //gray green 绿 orange
return "green" return "green"
}, },
@ -120,31 +101,31 @@ export default {
this.$emit('change', value); this.$emit('change', value);
}, },
// //
getIsShowCopyIcon(){
const {copyFrom} = this.item;
const {templateStatus} = this.$store.state.template;
return copyFrom && templateStatus=== "actFill";
getIsShowCopyIcon() {
const { copyFrom } = this.item;
const { templateStatus } = this.$store.state.template;
return copyFrom && templateStatus === "actFill";
}, },
// //
isShowHandle(){
const {fillType} = this.item;
const {templateStatus} = this.$store.state.template;
isShowHandle() {
const { fillType } = this.item;
const { templateStatus } = this.$store.state.template;
//qc //qc
return (templateStatus === "qc" || templateStatus === "actFill")&&fillType === "actFill";
return (templateStatus === "qc" || templateStatus === "actFill") && fillType === "actFill";
}, },
// //
getDisabled(){
const {item} = this;
const {fillType} = item;
if(item.hasOwnProperty("disabled")){
getDisabled() {
const { item } = this;
const { fillType } = item;
if (item.hasOwnProperty("disabled")) {
return item.disabled return item.disabled
}else{
const {templateStatus} = this.$store.state.template;
if(fillType === "actFill"){//fillTypeactFill
} else {
const { templateStatus } = this.$store.state.template;
if (fillType === "actFill") {//fillTypeactFill
return templateStatus !== "actFill" return templateStatus !== "actFill"
}else if(fillType === "preFill"){//fillTypepreFill
} else if (fillType === "preFill") {//fillTypepreFill
return templateStatus !== "preFill" return templateStatus !== "preFill"
}else{
} else {
return true return true
} }
} }
@ -152,8 +133,8 @@ export default {
onCopy() { onCopy() {
this.$emit("copy") this.$emit("copy")
}, },
onBlur(val){
this.$emit("blur",val)
onBlur(val) {
this.$emit("blur", val)
}, },
}, },
} }
@ -175,28 +156,37 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.w-100{
.w-100 {
width: 100%; width: 100%;
} }
.handle-icon{
.handle-icon {
width: 18px; width: 18px;
height: 18px; height: 18px;
margin-left: 5px; margin-left: 5px;
} }
.ml-5{
.ml-5 {
margin-left: 5px; margin-left: 5px;
} }
.orange{
.orange {
color: #f9c588; color: #f9c588;
} }
.green{
.green {
color: green; color: green;
} }
.gray{
.gray {
color: #b2b2b2; color: #b2b2b2;
} }
.orange-border { .orange-border {
input, textarea {
input,
textarea {
border-color: #f9c588; border-color: #f9c588;
&:focus { &:focus {
@ -206,6 +196,7 @@ export default {
&:hover { &:hover {
border-color: #f9c588; border-color: #f9c588;
} }
&:disabled { &:disabled {
border-color: #f9c588 !important; border-color: #f9c588 !important;
} }
@ -214,7 +205,9 @@ export default {
} }
.green-border { .green-border {
input, textarea {
input,
textarea {
border-color: green; border-color: green;
&:focus { &:focus {
@ -224,6 +217,7 @@ export default {
&:hover { &:hover {
border-color: green; border-color: green;
} }
&:disabled { &:disabled {
border-color: green !important; border-color: green !important;
} }
@ -232,7 +226,9 @@ export default {
} }
.blue-border { .blue-border {
input, textarea {
input,
textarea {
border-color: #4ea2ff; border-color: #4ea2ff;
&:focus { &:focus {
@ -242,6 +238,7 @@ export default {
&:hover { &:hover {
border-color: #4ea2ff; border-color: #4ea2ff;
} }
&:disabled { &:disabled {
border-color: #4ea2ff !important; border-color: #4ea2ff !important;
} }

+ 6
- 0
src/store/modules/template.js View File

@ -26,6 +26,12 @@ const template = {
{ label: "小时", value: "hours" }, { label: "小时", value: "hours" },
{ label: "天", value: "days" }, { label: "天", value: "days" },
], ],
containerMaterialOptions: [
{ label: "容器材质1", value: "1" },
{ label: "容器材质2", value: "2" },
{ label: "容器材质3", value: "3" },
{ label: "其他", value: "-1" },
],
}, },
mutations: { mutations: {
SET_TEMPLATE_STATUS: (state, status) => { SET_TEMPLATE_STATUS: (state, status) => {

+ 45
- 41
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -15,6 +15,7 @@
<LineLabel label="操作步骤" /> <LineLabel label="操作步骤" />
<div class="template-form-item"> <div class="template-form-item">
<BaseInfoFormPcakge ref="stepFormPackageRef" :formConfig="stepFormConfig" <BaseInfoFormPcakge ref="stepFormPackageRef" :formConfig="stepFormConfig"
@blur = "onHandleBlur"
:formData="formData" /> :formData="formData" />
</div> </div>
<Step ref="stepRef" :formData="formData"></Step> <Step ref="stepRef" :formData="formData"></Step>
@ -113,11 +114,13 @@ export default {
label: "方法编号", label: "方法编号",
type: "input", type: "input",
fillType: "preFill", fillType: "preFill",
maxlength: 50,
}, },
versionNum: { versionNum: {
label: "版本号", label: "版本号",
type: "input", type: "input",
fillType: "actFill"
fillType: "actFill",
maxlength: 50,
}, },
} }
@ -132,13 +135,13 @@ export default {
multiple: true, multiple: true,
fillType: "preFill", fillType: "preFill",
options: this.$store.state.template.conditionOptions, options: this.$store.state.template.conditionOptions,
otherCode: "other1",
otherCode: "preOther",
}, },
act: { act: {
label: "实际", label: "实际",
type: "select", type: "select",
fillType: "actFill", fillType: "actFill",
otherCode: "other2",
otherCode: "actOther",
multiple: true, multiple: true,
options: this.$store.state.template.conditionOptions options: this.$store.state.template.conditionOptions
} }
@ -147,11 +150,12 @@ export default {
{ {
type: "cellItem", type: "cellItem",
config: { config: {
remark: {
containerMaterial: {
label: "容器材质", label: "容器材质",
type: "input",
type: "select",
options: this.$store.state.template.containerMaterialOptions,
fillType: "actFill", fillType: "actFill",
placeholder: "请输入备注",
otherCode: "containerMaterialOther",
} }
} }
}, },
@ -176,56 +180,51 @@ export default {
{ {
type: "step", type: "step",
config: { config: {
targetName: {
label: "目标溶液名称",
startSolution: {
label: "起始源溶液",
type: "input", type: "input",
fillType: "preFill", fillType: "preFill",
subType: "clickable",
subKey: "subStartSolution",
subFillType: "actFill",
}, },
targetCode: {
label: "目标溶液编号",
type: "input",
subType: "span",
fillType: "preFill",
subKey: "targetCode1",
},
targetPreConcentration: {
label: "目标溶液预计浓度",
targetStartSolution: {
label: "预设起始源溶液浓度",
type: "input", type: "input",
subType: "select", subType: "select",
subKey: "targetPreConcentrationUnit",
fillType: "preFill", fillType: "preFill",
subOptions: this.$store.state.template.mgOptions, subOptions: this.$store.state.template.mgOptions,
subKey: "subTargetStartSolution",
}, },
targetActConcentration: {
label: "目标溶液实际浓度",
targetAcSolution: {
label: "实际起始源溶液浓度",
type: "input", type: "input",
subType: "select",
subKey: "targetActConcentrationUnit",
fillType: "actFill", fillType: "actFill",
subFillType: "preFill",
subOptions: this.$store.state.template.mgOptions,
copyFrom: "targetPreConcentration",//
}, },
targetPreVolume: {
label: "目标溶液预计体积",
solution: {
label: "稀释液",
type: "input", type: "input",
subType: "select",
subKey: "targetPreVolumeUnit",
subOptions: this.$store.state.template.volumeOptions,
fillType: "preFill", fillType: "preFill",
subType: "clickable",
subKey: "subSolution",
subFillType: "actFill",
}, },
targetActVolume: {
label: "目标溶液实际体积",
startSTD: {
label: "起始编号STD",
type: "input", type: "input",
subType: "select",
subKey: "targetActVolumeUnit",
fillType: "actFill",
subFillType: "preFill",
subOptions: this.$store.state.template.volumeOptions,
copyFrom: "targetPreVolume",//
maxlength: 10,
fillType: "preFill",
},
stepStorageCondition: {
label: "存储条件",
type: "select",
fillType: "preFill",
options: this.$store.state.template.conditionOptions,
otherCode: "stepStorageConditionOther",
}, },
effectivePeriod: { effectivePeriod: {
label: "有效周期",
label: "目标溶液有效周期",
type: "input", type: "input",
subType: "select", subType: "select",
subKey: "effectivePeriodUnit", subKey: "effectivePeriodUnit",
@ -233,7 +232,7 @@ export default {
subOptions: this.$store.state.template.effectivePeriodOptions, subOptions: this.$store.state.template.effectivePeriodOptions,
}, },
expireDate: { expireDate: {
label: "失效日",
label: "目标溶液失效日",
type: "input", type: "input",
}, },
} }
@ -264,7 +263,12 @@ export default {
}; };
}, },
mounted() { mounted() {
if (this.fillType === "preFill") {
this.formData = {
effectivePeriodUnit: "days",//
createTime: "2026-01-02 18:05:36",//
}
}
}, },
methods: { methods: {
async getFormData() { async getFormData() {

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

@ -64,12 +64,12 @@ export default {
{ {
type: "conditionItem", type: "conditionItem",
config: { config: {
storageCondition1: {
storageCondition: {
label: "存储条件", label: "存储条件",
type: "select", type: "select",
fillType: "preFill", fillType: "preFill",
options: this.$store.state.template.conditionOptions, options: this.$store.state.template.conditionOptions,
otherCode: "other1",
otherCode: "storageConditionOther",
}, },
} }
@ -132,13 +132,13 @@ export default {
multiple: true, multiple: true,
fillType: "preFill", fillType: "preFill",
options: this.$store.state.template.conditionOptions, options: this.$store.state.template.conditionOptions,
otherCode: "other1",
otherCode: "preOther",
}, },
act: { act: {
label: "实际", label: "实际",
type: "select", type: "select",
fillType: "actFill", fillType: "actFill",
otherCode: "other2",
otherCode: "actOther",
multiple: true, multiple: true,
options: this.$store.state.template.conditionOptions options: this.$store.state.template.conditionOptions
} }

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

@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<!-- <button @click = "onSave">{{ $t('template.SWYPFXRYPZB.saveBtn') }}</button> -->
<button @click = "onSave">{{ $t('template.common.saveBtn') }}</button>
</div> </div>
</div> </div>
</template> </template>
@ -65,12 +65,12 @@ export default {
{ {
type: "conditionItem", type: "conditionItem",
config: { config: {
storageCondition1: {
storageCondition: {
label: this.$t('template.common.storageConditionLabel'), label: this.$t('template.common.storageConditionLabel'),
type: "select", type: "select",
fillType: "preFill", fillType: "preFill",
options: this.$store.state.template.conditionOptions, options: this.$store.state.template.conditionOptions,
otherCode: "other1",
otherCode: "storageConditionOther",
}, },
} }
@ -119,7 +119,8 @@ export default {
versionNum: { versionNum: {
label: this.$t('template.common.versionNumber'), label: this.$t('template.common.versionNumber'),
type: "input", type: "input",
fillType: "actFill"
fillType: "actFill",
maxlength:50
}, },
} }
@ -134,13 +135,13 @@ export default {
multiple: true, multiple: true,
fillType: "preFill", fillType: "preFill",
options: this.$store.state.template.conditionOptions, options: this.$store.state.template.conditionOptions,
otherCode: "other1",
otherCode: "preOther",
}, },
act: { act: {
label: this.$t('template.common.actualFill'), label: this.$t('template.common.actualFill'),
type: "select", type: "select",
fillType: "actFill", fillType: "actFill",
otherCode: "other2",
otherCode: "actOther",
multiple: true, multiple: true,
options: this.$store.state.template.conditionOptions options: this.$store.state.template.conditionOptions
} }
@ -291,16 +292,7 @@ export default {
const formData = await this.getFormData(); const formData = await this.getFormData();
console.log(formData, "formData") console.log(formData, "formData")
}, },
onHandleBlur(fields){
const {key ,effectivePeriodUnit,effectivePeriod} = fields;
const {createTime} = this.formData;
console.log(fields)
if(key ==="effectivePeriod"){//
const start = moment(createTime);
const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss");
this.$refs.stepFormPackageRef.updateFormField("expireDate", end);
}
}
} }
}; };
</script> </script>

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

@ -50,6 +50,16 @@ export default {
setConditionOptions(options) { setConditionOptions(options) {
this.$store.commit('template/SET_CONDITION_OPTIONS', options) this.$store.commit('template/SET_CONDITION_OPTIONS', options)
}, },
//统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期
onHandleBlur(fields){
const {key ,effectivePeriodUnit,effectivePeriod} = fields;
const {createTime} = this.formData;
if(key ==="effectivePeriod"){//统一处理有效周期失焦,计算失效事件,保证字段名不能变
const start = moment(createTime);
const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss");
this.$refs.stepFormPackageRef.updateFormField("expireDate", end);
}
}
}, },

+ 2
- 2
vue.config.js View File

@ -34,8 +34,8 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`,
//target: `http://39.99.251.173:8080`,
// target: `http://localhost:8080`,
target: `http://39.99.251.173:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save