2 Commits

11 changed files with 111 additions and 46 deletions
Unified View
  1. +9
    -0
      src/api/template/index.js
  2. +3
    -1
      src/components/Template/BaseInfoFormPcakge.vue
  3. +1
    -1
      src/components/Template/CustomTable.vue
  4. +33
    -12
      src/components/Template/HandleFormItem.vue
  5. +1
    -1
      src/components/Template/Step.vue
  6. +2
    -0
      src/utils/eventBus.js
  7. +18
    -11
      src/views/business/comps/template/TemplateTable.vue
  8. +22
    -5
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  9. +9
    -9
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  10. +11
    -4
      src/views/business/comps/template/mixins/templateMixin.js
  11. +2
    -2
      vue.config.js

+ 9
- 0
src/api/template/index.js View File

@ -7,4 +7,13 @@ export const getReagentList = (params) => {
method: 'get', method: 'get',
params params
}) })
}
//获取最新的sn号
export const getLatestSn = (params) => {
return request({
url: '/system/business/public/getSn',
method: 'get',
params
})
} }

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

@ -243,6 +243,7 @@ export default {
this.$set(this.errors, key, false); this.$set(this.errors, key, false);
} }
}, },
//
updateFormData(key, value) { updateFormData(key, value) {
this.formFields[key] = value; this.formFields[key] = value;
// //
@ -250,6 +251,7 @@ export default {
this.$set(this.errors, key, false); this.$set(this.errors, key, false);
} }
}, },
//
batchUpdateFormData(data) { batchUpdateFormData(data) {
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
this.formFields[key] = data[key]; this.formFields[key] = data[key];
@ -467,7 +469,7 @@ export default {
}); });
}, },
// //
getDirectFormData() {
getFilledFormData() {
return this.formFields; return this.formFields;
}, },
getFormDataByKey(key) { getFormDataByKey(key) {

+ 1
- 1
src/components/Template/CustomTable.vue View File

@ -192,7 +192,7 @@ export default {
this.headerSelectFields = headerSelectObj; this.headerSelectFields = headerSelectObj;
}, },
// //
getDirectFormData() {
getFilledFormData() {
return { return {
stepTableFormData: [...this.localDataSource], stepTableFormData: [...this.localDataSource],
headerSelectFields: this.headerSelectFields, headerSelectFields: this.headerSelectFields,

+ 33
- 12
src/components/Template/HandleFormItem.vue View File

@ -33,7 +33,7 @@
</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>
<el-checkbox class="ml-5" @change="onCheckboxChange"></el-checkbox>
<div @mouseenter="onMouseEnter" @mouseleave="onMouseLeave"> <div @mouseenter="onMouseEnter" @mouseleave="onMouseLeave">
<Question class="handle-icon" :class="getQuestionColor()" /> <Question class="handle-icon" :class="getQuestionColor()" />
</div> </div>
@ -75,6 +75,7 @@
<script> <script>
import Question from "./icons/Question.vue"; import Question from "./icons/Question.vue";
import DecimalInput from "./DecimalInput.vue"; import DecimalInput from "./DecimalInput.vue";
import { EventBus } from "@/utils/eventBus"
export default { export default {
components: { components: {
Question, Question,
@ -152,6 +153,17 @@ export default {
//gray green 绿 orange //gray green 绿 orange
return "green" return "green"
}, },
//
onCheckboxChange(val) {
//
EventBus.$emit('onModifyRecord', {
timestamp: new Date().toLocaleString(),
oldValue: this.oldValue,
newValue: val,
});
// this.$emit('input', val);
// this.$emit('change', val);
},
// //
onInputChange(val) { onInputChange(val) {
const value = val !== undefined ? val : this.inputValue; const value = val !== undefined ? val : this.inputValue;
@ -180,24 +192,33 @@ export default {
} }
const {templateStatus} = this.$store.state.template; const {templateStatus} = this.$store.state.template;
// //
if (this.inputValue !== this.oldValue && templateStatus === "actFill") {
if (templateStatus === "actFill") {
// //
try { try {
// const passwordResult = await this.$prompt('', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// inputType: 'password',
// inputPattern: /.+/,
// inputErrorMessage: '',
// zIndex: 10000,
// });
//
if(this.oldValue && this.oldValue !== this.inputValue){
const passwordResult = await this.$prompt('请输入密码以确认修改', '密码验证', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputType: 'password',
inputPattern: /.+/,
inputErrorMessage: '请输入密码',
zIndex: 10000,
});
}
this.$emit("onModifyRecord", {
timestamp: new Date().toLocaleString(),
oldValue: this.oldValue,
value: this.inputValue,
title:this.oldValue?"修改记录":"填写",
field:"试验基本信息-其他信息"
})
//
this.oldValue = this.inputValue; // this.oldValue = this.inputValue; //
this.$emit("blur", val); this.$emit("blur", val);
this.$emit('input', this.inputValue); this.$emit('input', this.inputValue);
this.$emit("change", val); this.$emit("change", val);
// //
await this.saveModificationRecord();
// await this.saveModificationRecord();
} catch { } catch {
// //
this.inputValue = this.oldValue; this.inputValue = this.oldValue;

+ 1
- 1
src/components/Template/Step.vue View File

@ -254,7 +254,7 @@ export default {
}, },
// //
getDirectFormData() {
getFilledFormData() {
return this.steps.map(step => ({ return this.steps.map(step => ({
type: step.type, type: step.type,
...step.formData ...step.formData

+ 2
- 0
src/utils/eventBus.js View File

@ -0,0 +1,2 @@
import Vue from 'vue'
export const EventBus = new Vue()

+ 18
- 11
src/views/business/comps/template/TemplateTable.vue View File

@ -2,12 +2,13 @@
<div class="template-table"> <div class="template-table">
<!-- <SP001 v-if="sn == 'SP0012'" /> <!-- <SP001 v-if="sn == 'SP0012'" />
<SWYPFXRYPZB v-if="sn == 'SP001'" /> --> <SWYPFXRYPZB v-if="sn == 'SP001'" /> -->
<component ref="templateComponent" :is="getTemplateComponent()" :templateData="templateData" :fillType="fillType">
</component>
<component ref="templateComponent" :is="getTemplateComponent()" :templateData="templateData" :fillType="fillType">
</component>
</div> </div>
</template> </template>
<script> <script>
import { EventBus } from "@/utils/eventBus"
// //
import SP001 from './comps/sp/SP001'; import SP001 from './comps/sp/SP001';
import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue"; import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
@ -22,9 +23,9 @@ import MJYLQSQD from "./comps/gy/MJYLQSQD.vue";
export default { export default {
name: "TemplateTable", name: "TemplateTable",
components: {
MJYLQSQD,SYWZPZJHB,
SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SWYPNBGZYZBB,IndexDBDemo
components: {
MJYLQSQD, SYWZPZJHB,
SP001, SWYPFXRYPZB, Demo, SWYPFXCBYPZB, SWYPBQGZYZBB, SWYPNBGZYZBB, IndexDBDemo
}, },
props: { props: {
sn: { sn: {
@ -37,11 +38,11 @@ export default {
}, },
templateData: { templateData: {
type: Object, type: Object,
default: () => {},
default: () => { },
}, },
}, },
computed: { computed: {
templateComponentMap() { templateComponentMap() {
if (!this.componentMap) { if (!this.componentMap) {
this.componentMap = { this.componentMap = {
@ -61,7 +62,7 @@ export default {
sn: { sn: {
immediate: true, immediate: true,
handler(v) { handler(v) {
console.log(v,"sn")
console.log(v, "sn")
} }
} }
}, },
@ -71,17 +72,23 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log(this.fillType,"fillType")
EventBus.$on('onModifyRecord', (data) => {
this.$emit("onModifyRecord", data)
})
},
beforeDestroy() {
//
EventBus.$off('onModifyRecord')
}, },
methods: { methods: {
async getFormData() { async getFormData() {
return await this.$refs.templateComponent.getFormData(); return await this.$refs.templateComponent.getFormData();
}, },
getResource(){
getResource() {
return this.$refs.templateComponent.getResource(); return this.$refs.templateComponent.getResource();
}, },
getTemplateComponent() { getTemplateComponent() {
return this.templateComponentMap[this.sn]
return this.templateComponentMap[this.sn]
}, },
} }
}; };

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

@ -37,6 +37,7 @@ import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step"; import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin"; import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue'; import CustomTable from '@/components/Template/CustomTable.vue';
import { getLatestSn } from '@/api/template';
export default { export default {
name: "SWYPFXRYPZB", name: "SWYPFXRYPZB",
@ -141,11 +142,11 @@ export default {
type: "cellItem", type: "cellItem",
label: this.$t('template.common.configurationTime'), label: this.$t('template.common.configurationTime'),
config: { config: {
createTime: {
startDate: {
label: this.$t('template.common.startTime'), label: this.$t('template.common.startTime'),
type: "input", type: "input",
}, },
endTime: {
endDate: {
label: this.$t('template.common.endTime'), label: this.$t('template.common.endTime'),
type: "input", type: "input",
}, },
@ -169,7 +170,7 @@ export default {
type: "input", type: "input",
subType: "span", subType: "span",
fillType: "preFill", fillType: "preFill",
subKey: "targetCode1",
subKey: "targetCodeSn",
maxlength: 20 maxlength: 20
}, },
targetPreConcentration: { targetPreConcentration: {
@ -254,9 +255,26 @@ export default {
}; };
}, },
mounted() { mounted() {
if(this.fillType === "actFill"){
this.getCode();
}
}, },
methods: { methods: {
//
async getCode(){
const result = await getLatestSn({
count: 1,
})
if(result.code == 200){
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn",result.data)
}
},
//
getFilledFormData(){
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"])
},
async getFormData() { async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]); let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]);
//resource //resource
@ -279,11 +297,10 @@ export default {
//使 //使
this.resource=tmpResource this.resource=tmpResource
console.log(this.resource, "resource")
return content; return content;
}, },
async onSave() { async onSave() {
const formData = await this.getFormData();
const formData = await this.getFilledFormData();
console.log(formData, "formData") console.log(formData, "formData")
}, },

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

@ -785,16 +785,16 @@ export default {
return await this.validFormFields(refsToValidate); return await this.validFormFields(refsToValidate);
}, },
getRealFormData(){ getRealFormData(){
const baseData = this.$refs.baseInfoRef.getDirectFormData();
const conditionData = this.$refs.storageConditionRef.getDirectFormData();
const baseData = this.$refs.baseInfoRef.getFilledFormData();
const conditionData = this.$refs.storageConditionRef.getFilledFormData();
// //
const ladderConfigsData = []; const ladderConfigsData = [];
if (this.formData.ladderConfigs && this.formData.ladderConfigs.length > 0) { if (this.formData.ladderConfigs && this.formData.ladderConfigs.length > 0) {
for (let i = 0; i < this.formData.ladderConfigs.length; i++) { for (let i = 0; i < this.formData.ladderConfigs.length; i++) {
const ladderFormData = this.$refs[`ladderStepFormPackageRef_${i}`][0].getDirectFormData();
const ladderTableFormData = this.$refs[`ladderStepTableRef_${i}`][0].getDirectFormData();
const ladderStepData = this.$refs[`ladderStepRef_${i}`][0].getDirectFormData();
const ladderFormData = this.$refs[`ladderStepFormPackageRef_${i}`][0].getFilledFormData();
const ladderTableFormData = this.$refs[`ladderStepTableRef_${i}`][0].getFilledFormData();
const ladderStepData = this.$refs[`ladderStepRef_${i}`][0].getFilledFormData();
ladderConfigsData.push({ ladderConfigsData.push({
...ladderFormData, ...ladderFormData,
@ -809,9 +809,9 @@ export default {
const paralleConfigsData = []; const paralleConfigsData = [];
if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) {
for (let i = 0; i < this.formData.paralleConfigs.length; i++) { for (let i = 0; i < this.formData.paralleConfigs.length; i++) {
const paralleFormData = this.$refs[`paralleStepFormPackageRef_${i}`][0].getDirectFormData();
const paralleTableFormData = this.$refs[`paralleStepTableRef_${i}`][0].getDirectFormData();
const paralleStepData = this.$refs[`paralleStepRef_${i}`][0].getDirectFormData();
const paralleFormData = this.$refs[`paralleStepFormPackageRef_${i}`][0].getFilledFormData();
const paralleTableFormData = this.$refs[`paralleStepTableRef_${i}`][0].getFilledFormData();
const paralleStepData = this.$refs[`paralleStepRef_${i}`][0].getFilledFormData();
paralleConfigsData.push({ paralleConfigsData.push({
...paralleFormData, ...paralleFormData,
@ -822,7 +822,7 @@ export default {
} }
} }
const remarkData = this.$refs.remarkRef.getDirectFormData();
const remarkData = this.$refs.remarkRef.getFilledFormData();
return { return {
...baseData, ...baseData,

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

@ -43,8 +43,15 @@ export default {
this.setTemplateData({}); this.setTemplateData({});
}, },
methods: { methods: {
getResource() {
return this.resource;
//根据ref数组获取直接formData
getFilledFormDataByRefs(refArr = []){
let result = {};
refArr.map(ref => {
const refData = this.$refs[ref]?.getFilledFormData() || {};
result = { ...result, ...refData };
});
return result;
}, },
//统一校验form表单是否填写 //统一校验form表单是否填写
async validFormFields(refArr = []) { async validFormFields(refArr = []) {
@ -96,9 +103,9 @@ export default {
//统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期 //统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期
onHandleBlur(fields) { onHandleBlur(fields) {
const { key, effectivePeriodUnit, effectivePeriod, codeSTD, targetStartSolution } = fields; const { key, effectivePeriodUnit, effectivePeriod, codeSTD, targetStartSolution } = fields;
const { createTime } = this.formData;
const { startDate } = this.formData;
if (key === "effectivePeriod") {//统一处理有效周期失焦,计算失效事件,保证字段名不能变 if (key === "effectivePeriod") {//统一处理有效周期失焦,计算失效事件,保证字段名不能变
const start = moment(createTime);
const start = moment(startDate);
const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss"); const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss");
this.$refs.stepFormPackageRef.updateFormData("expireDate", end); this.$refs.stepFormPackageRef.updateFormData("expireDate", end);
} else if (key === "codeSTD") {//起始编号STD失焦时,更新stepDataSource } else if (key === "codeSTD") {//起始编号STD失焦时,更新stepDataSource

+ 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