diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue
index 27c18e0..d5623c0 100644
--- a/src/components/Template/HandleFormItem.vue
+++ b/src/components/Template/HandleFormItem.vue
@@ -687,7 +687,7 @@ export default {
}
.handle-row {
- margin-left: 10px;
+ margin-left: 5px;
display: flex;
align-items: center;
cursor: pointer;
diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue
index cb23d36..274ef84 100644
--- a/src/components/Template/Step.vue
+++ b/src/components/Template/Step.vue
@@ -11,8 +11,9 @@
v-model="step.type" @change="onTypeChange(index)" />
-
+
+
+
@@ -41,7 +50,10 @@
import HandleFormItem from '@/components/Template/HandleFormItem.vue'
import formPackageMixins from '@/components/Template/mixins/formPackageMixins.js'
import { isShowOther } from "@/utils/formPackageCommon.js";
+import { EventBus } from "@/utils/eventBus";
+import { getuuid } from "@/utils/index.js";
export default {
+ inject: ['templateFillType','templateData'],
components: {
HandleFormItem,
},
@@ -65,6 +77,12 @@ export default {
default: ""
}
},
+ mounted() {
+ EventBus.$on("onReagentSubmit",this.onReagentSubmit)
+ },
+ unmounted() {
+ EventBus.$off("onReagentSubmit",this.onReagentSubmit)
+ },
data() {
return {
formFields: {},//表单绑定字段
@@ -72,15 +90,34 @@ export default {
errors: {},//存储表单错误信息,用于标红提示
orangeBgFields: {},// 存储需要橙色背景的字段
isShowOther,
+ currentClickKey: "",//当前点击的字段key
+ uuid:getuuid(),
}
},
methods: {
+ // 处理选择试剂提交
+ onReagentSubmit(data){
+ if(data.uuid !== this.uuid) return;
+ this.formFields[this.currentClickKey] = data.selectedId;
+ },
getClickableItem(sItem) {
return {
...sItem,
type:"clickable"
}
- }
+ },
+ handleClickInstrument(key,type) {
+ this.currentClickKey = key;
+ if(type === 'regent'){
+ EventBus.$emit("showSelectReagentDialog",{
+ studyFormId:this.templateData.id,
+ uuid:this.uuid,
+ })
+ }
+ },
+ onSelectReagentSubmit(reagent){
+ this.formFields[this.currentClickKey] = reagent
+ },
}
}
@@ -93,7 +130,7 @@ export default {
}
.step-row {
- width: 180px;
+ min-width: 180px;
}
.step-item {
diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js
index 316403d..43b8b77 100644
--- a/src/components/Template/mixins/formPackageMixins.js
+++ b/src/components/Template/mixins/formPackageMixins.js
@@ -31,7 +31,6 @@ export default {
this.handleFormField();
},
unmounted() {
- console.log("unmounted")
this.formFields = {};//清空当前填写的数据
},
@@ -79,7 +78,6 @@ export default {
})
},
handleClickable(sItem, event) {
- console.log("clickable", sItem)
if (this.templateFillType !== 'actFill') {
return
}
@@ -220,10 +218,8 @@ export default {
validateFormData() {
const { formFields, allFieldsConfig } = this;
const errors = [];
-
// 清空之前的错误状态
this.errors = {};
-
for (const key in allFieldsConfig) {
const o = allFieldsConfig[key];
if (o.otherCode) {//
@@ -246,7 +242,7 @@ export default {
continue
}
//span的字段不校验
- if (o.type === "span") {
+ if (o.type === "span" || o.type ==="text") {
continue
}
if (o.fillType === this.templateFillType && !o.disabled) {
@@ -268,6 +264,7 @@ export default {
}
}
}
+ console.log(errors,"errors")
return {
valid: errors.length === 0,
errors: errors
diff --git a/src/components/Template/mixins/stepMixins.js b/src/components/Template/mixins/stepMixins.js
new file mode 100644
index 0000000..b71fc42
--- /dev/null
+++ b/src/components/Template/mixins/stepMixins.js
@@ -0,0 +1,16 @@
+export default {
+ props: {
+ formData: {
+ type: Object,
+ default: () => ({})
+ }
+ },
+ methods: {
+ async getFormData() {
+ return await this.$refs.stepFormPackageRef.getFormData();
+ },
+ getFilledFormData() {
+ return this.$refs.stepFormPackageRef?.getFilledFormData();
+ }
+ },
+}
\ No newline at end of file
diff --git a/src/utils/index.js b/src/utils/index.js
index 70a1657..189bb71 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -418,3 +418,8 @@ export const getExpireDate = (startDate, effectivePeriod, effectivePeriodUnit) =
.format('YYYY-MM-DD HH:mm:ss');
return end;
}
+
+export function getuuid() {
+ return Math.random().toString(36).substring(2) +
+ Date.now().toString(36);
+}
\ No newline at end of file
diff --git a/src/views/business/comps/template/TemplateTable.vue b/src/views/business/comps/template/TemplateTable.vue
index c97472e..4b1c233 100644
--- a/src/views/business/comps/template/TemplateTable.vue
+++ b/src/views/business/comps/template/TemplateTable.vue
@@ -4,11 +4,17 @@
+
+