1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
| <template>
| <el-dialog
| :visible.sync="dialogVisible"
| v-dialogDrag
| top="0vh"
| :title="title"
| class="avue-dialog avue-dialog--top"
| :width="width"
| append-to-body
| @opened="openDialog"
| >
| <FormTempalte
| v-bind="$attrs"
| :visible="visible"
| :type="type"
| v-if="dialogVisible"
| ref="FormTempalte"
| @getFormTemplateEnd="getFormTemplate"
| @getFormData="getFormData"
| ></FormTempalte>
|
| <div class="tab_box" v-if="type !== 'detail' && dialogVisible && (showCodeApply || showResembleQuery)">
| <el-tabs v-model="activeName" type="border-card">
| <el-tab-pane label="码值申请" name="codeApply" v-if="showCodeApply">
| <CodeApply
| ref="CodeApply"
| v-bind="$attrs"
| @getCodeRuleOid="getCodeRuleOid"
| ></CodeApply>
| </el-tab-pane>
| <el-tab-pane
| label="相似项查询"
| name="resembleQuery"
| v-if="showResembleQuery"
| >
| <ResembleQuery
| v-bind="$attrs"
| ref="resembleQueryRef"
| :hasResemble="this.hasResemble"
| :column="this.resembleTableColumn"
| :form="this.form"
| ></ResembleQuery>
| </el-tab-pane>
| </el-tabs>
| </div>
| <div class="avue-dialog__footer" v-if="type !== 'detail'">
| <el-button @click="close()">取 消</el-button>
| <el-button @click="submit()" type="primary" :loading="submitBtnLoading"
| >确 定</el-button
| >
| <el-button @click="resembleQuerySubmit" type="primary" v-if="showResembleQuery"
| >相似像查询</el-button
| >
| </div>
| </el-dialog>
| </template>
|
| <script>
| import FormTempalte from "./FormTempalte";
| import ResembleQuery from "./ResembleQuery";
| import CodeApply from "./CodeApply";
| export default {
| name: "FormTemplateDialog",
| components: { ResembleQuery, FormTempalte, CodeApply },
| props: {
| visible: {
| type: Boolean,
| default: false,
| },
| type: {
| type: String,
| default: "add",
| },
| title: {
| type: String,
| default: "编码申请",
| },
| width: {
| type: String,
| default: "80%",
| },
| },
| data() {
| return {
| loading: false,
| submitBtnLoading: false,
| hasResemble: false,
| resembleTableColumn: [],
| secVOList: [],
| form: {},
| };
| },
| created() {},
| computed: {
| dialogVisible: {
| get() {
| return this.visible;
| },
| set(val) {
| this.$emit("update:visible", val);
| },
| },
| showCodeApply() {
| if (this.type === "add") {
| if (this.hasResemble && this.secVOList.length === 0) {
| return false;
| }
| } else {
| return false;
| }
| return true;
| },
| showResembleQuery() {
| return this.hasResemble;
| },
| activeName() {
| return (
| (this.showCodeApply && "codeApply") ||
| (this.showResembleQuery && "resembleQuery")
| );
| },
| },
| methods: {
| openDialog() {
| this.$nextTick(() => {
| this.$refs.FormTempalte.init();
| });
| },
| close() {
| this.dialogVisible = false;
| },
| getCodeRuleOid(data) {
| this.secVOList = data.secVOList;
| },
| getFormTemplate(data) {
| this.hasResemble =
| data.resembleTableVO &&
| data.resembleTableVO.cols &&
| data.resembleTableVO.cols.length > 0;
| this.resembleTableColumn = data.resembleTableVO.cols || [];
| },
| getFormData(form) {
| this.form = form;
| },
| resembleQuerySubmit() {
| this.$refs.resembleQueryRef.resembleQuery(this.form);
| },
| async submit() {
| const formValidate = await this.$refs.FormTempalte.validate();
| if (this.showCodeApply) {
| const codeValidate = this.$refs.CodeApply.validate();
| console.log(formValidate, codeValidate);
| }
| },
| },
| };
| </script>
|
| <style lang="scss" scoped>
| .key_attr_icon {
| font-size: 24px;
| position: relative;
| top: 2px;
| color: red;
| }
| // 解决swich组件不垂直居中的问题
| /deep/ .el-switch {
| vertical-align: baseline;
| }
| </style>
|
|