@gonsin/gview 1.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +2 -0
- package/README.md +26 -0
- package/babel.config.js +5 -0
- package/package.json +29 -0
- package/postcss.config.js +5 -0
- package/public/css/theme/animate.min.css +7 -0
- package/public/css/theme/brownishTheme.css +10 -0
- package/public/css/theme/coffeeTheme.css +10 -0
- package/public/css/theme/cyanTheme.css +10 -0
- package/public/css/theme/defaultTheme.css +10 -0
- package/public/css/theme/greenTheme.css +16 -0
- package/public/css/theme/greyTheme.css +10 -0
- package/public/css/theme/orangeTheme.css +10 -0
- package/public/css/theme/purpleTheme.css +10 -0
- package/public/css/theme/skyblueTheme.css +10 -0
- package/public/favicon.ico +0 -0
- package/public/imgs/antOutline-border.png +0 -0
- package/public/imgs/bg.png +0 -0
- package/public/imgs/logo.png +0 -0
- package/public/imgs/menu.png +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +143 -0
- package/src/api/api.js +28 -0
- package/src/api/index.js +31 -0
- package/src/api/request.js +210 -0
- package/src/assets/font/font.scss +12 -0
- package/src/assets/font/font_dev.scss +12 -0
- package/src/assets/font/icon.scss +179 -0
- package/src/assets/images/svg/color.svg +1 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/scss/common.scss +338 -0
- package/src/assets/scss/themeColor.scss +35 -0
- package/src/components/MyDialog.vue +251 -0
- package/src/components/MyForm.vue +324 -0
- package/src/components/MyFormAutocomplete.vue +135 -0
- package/src/components/MyFormCascader.vue +107 -0
- package/src/components/MyFormCheckBox.vue +67 -0
- package/src/components/MyFormEditor.vue +85 -0
- package/src/components/MyFormInput.vue +68 -0
- package/src/components/MyFormLine.vue +49 -0
- package/src/components/MyFormRadio.vue +92 -0
- package/src/components/MyFormSelect.vue +122 -0
- package/src/components/MyFormSelectDate.vue +72 -0
- package/src/components/MyFormSelectDateTime.vue +82 -0
- package/src/components/MyFormSelectTime.vue +84 -0
- package/src/components/MyFormSwitch.vue +60 -0
- package/src/components/MyFormTag.vue +67 -0
- package/src/components/MyFormTree.vue +137 -0
- package/src/components/MyFormUploads.vue +91 -0
- package/src/components/MyHeader.vue +176 -0
- package/src/components/MyMenus.vue +150 -0
- package/src/components/MyPageHeader.vue +344 -0
- package/src/components/MyTab.vue +69 -0
- package/src/components/MyTable.vue +245 -0
- package/src/components/Templatess.vue +630 -0
- package/src/index.js +23 -0
- package/src/main.js +86 -0
- package/src/router.js +52 -0
- package/src/store/index.js +71 -0
- package/src/utils/common.js +96 -0
- package/src/utils/permission.js +36 -0
- package/src/views/GView.vue +185 -0
- package/src/views/Home.vue +26 -0
- package/src/views/Login.vue +249 -0
- package/src/websocket/test.js +140 -0
- package/src/websocket/websocket.js +141 -0
- package/src/websocket/websocket1.js +117 -0
- package/src/websocket/websocket2.js +128 -0
- package/vue.config.js +42 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2022-04-24 14:22:27
|
|
4
|
+
* @LastEditTime: 2022-11-22 16:36:34
|
|
5
|
+
* @LastEditors: lrm lrm@gonsin.cn
|
|
6
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
+
* @FilePath: \client\src\components\MyForm.vue
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="my_form">
|
|
12
|
+
<el-form ref="form" :model="form" label-width="140px">
|
|
13
|
+
<div
|
|
14
|
+
class="form_group"
|
|
15
|
+
v-for="(item, index) in formData"
|
|
16
|
+
:key="index"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
class="my_el_form_item"
|
|
20
|
+
v-for="(items, indexss) in item.formItems"
|
|
21
|
+
:key="indexss"
|
|
22
|
+
>
|
|
23
|
+
<myFormLine
|
|
24
|
+
v-if="items.itemType == 'line' && isShowByFinishDom"
|
|
25
|
+
></myFormLine>
|
|
26
|
+
<el-form-item
|
|
27
|
+
:label="items.name"
|
|
28
|
+
v-if="items.itemType != 'line' && isShowByFinishDom && handleShowIf(items.showIf)"
|
|
29
|
+
:class="[
|
|
30
|
+
items.itemType == 'hidden' ? 'display_none' : '',
|
|
31
|
+
]"
|
|
32
|
+
>
|
|
33
|
+
<myFormInput
|
|
34
|
+
v-if="
|
|
35
|
+
items.itemType == 'text_input' &&
|
|
36
|
+
isShowByFinishDom
|
|
37
|
+
"
|
|
38
|
+
:placeholder="items.placeholder"
|
|
39
|
+
:value.sync="form[items.keyName]"
|
|
40
|
+
@update:value="handleAfterUpdateValue"
|
|
41
|
+
:targetViewName="viewName"
|
|
42
|
+
></myFormInput>
|
|
43
|
+
<myFormCheckBox
|
|
44
|
+
v-if="
|
|
45
|
+
items.itemType == 'check_box' &&
|
|
46
|
+
isShowByFinishDom
|
|
47
|
+
"
|
|
48
|
+
:value.sync="form[items.keyName]"
|
|
49
|
+
@update:value="handleAfterUpdateValue"
|
|
50
|
+
:target="items"
|
|
51
|
+
:targetViewName="viewName"
|
|
52
|
+
></myFormCheckBox>
|
|
53
|
+
<myFormSelect
|
|
54
|
+
v-if="
|
|
55
|
+
items.itemType == 'selector' &&
|
|
56
|
+
isShowByFinishDom
|
|
57
|
+
"
|
|
58
|
+
:value.sync="form[items.keyName]"
|
|
59
|
+
@update:value="handleAfterUpdateValue"
|
|
60
|
+
:target="items"
|
|
61
|
+
:targetViewName="viewName"
|
|
62
|
+
></myFormSelect>
|
|
63
|
+
<myFormTag
|
|
64
|
+
v-if="items.itemType == 'label' && isShowByFinishDom"
|
|
65
|
+
:target="items"
|
|
66
|
+
:form="form"
|
|
67
|
+
></myFormTag>
|
|
68
|
+
<myFormUploads
|
|
69
|
+
v-if="items.itemType == 'file' && isShowByFinishDom"
|
|
70
|
+
:value.sync="form[items.keyName]"
|
|
71
|
+
:target="items"
|
|
72
|
+
:targetViewName="viewName"
|
|
73
|
+
></myFormUploads>
|
|
74
|
+
<myFormSelect
|
|
75
|
+
v-if="items.itemType == 'multi_selector' && isShowByFinishDom"
|
|
76
|
+
:value.sync="form[items.keyName]"
|
|
77
|
+
@update:value="handleAfterUpdateValue"
|
|
78
|
+
:target="items"
|
|
79
|
+
:targetViewName="viewName"
|
|
80
|
+
:multi="true"
|
|
81
|
+
></myFormSelect>
|
|
82
|
+
<myFormSelectDateTime
|
|
83
|
+
v-if="items.itemType == 'date_time_selector' && isShowByFinishDom"
|
|
84
|
+
:value.sync="form[items.keyName]"
|
|
85
|
+
:targetViewName="viewName"
|
|
86
|
+
></myFormSelectDateTime>
|
|
87
|
+
<myFormSelectDate
|
|
88
|
+
v-if="items.itemType == 'date_selector' && isShowByFinishDom"
|
|
89
|
+
:value.sync="form[items.keyName]"
|
|
90
|
+
@update:value="handleAfterUpdateValue"
|
|
91
|
+
:targetViewName="viewName"
|
|
92
|
+
></myFormSelectDate>
|
|
93
|
+
<myFormSelectTime
|
|
94
|
+
v-if="items.itemType == 'time_selector' && isShowByFinishDom"
|
|
95
|
+
:value.sync="form[items.keyName]"
|
|
96
|
+
:targetViewName="viewName"
|
|
97
|
+
></myFormSelectTime>
|
|
98
|
+
<myFormCascader
|
|
99
|
+
v-if="items.itemType == 'multi_tree_selector' && isShowByFinishDom"
|
|
100
|
+
:value.sync="form[items.keyName]"
|
|
101
|
+
@update:value="handleAfterUpdateValue"
|
|
102
|
+
:target="items"
|
|
103
|
+
:targetViewName="viewName"
|
|
104
|
+
></myFormCascader>
|
|
105
|
+
<myFormCascader
|
|
106
|
+
v-if="items.itemType == 'tree_selector' && isShowByFinishDom"
|
|
107
|
+
:value.sync="form[items.keyName]"
|
|
108
|
+
@update:value="handleAfterUpdateValue"
|
|
109
|
+
:target="items"
|
|
110
|
+
:targetViewName="viewName"
|
|
111
|
+
></myFormCascader>
|
|
112
|
+
<!-- <myFormTree
|
|
113
|
+
v-if="
|
|
114
|
+
items.itemType == 'tree_selector' &&
|
|
115
|
+
isShowByFinishDom
|
|
116
|
+
"
|
|
117
|
+
:value.sync="form[items.keyName]"
|
|
118
|
+
:target="items"
|
|
119
|
+
:targetViewName="viewName"
|
|
120
|
+
></myFormTree> -->
|
|
121
|
+
<myFormRadio
|
|
122
|
+
v-if="items.itemType == 'radio' && isShowByFinishDom"
|
|
123
|
+
:value.sync="form[items.keyName]"
|
|
124
|
+
@update:value="handleAfterUpdateValue"
|
|
125
|
+
:target="items"
|
|
126
|
+
:targetViewName="viewName"
|
|
127
|
+
></myFormRadio>
|
|
128
|
+
<myFormSwitch
|
|
129
|
+
v-if="items.itemType == 'switch' && isShowByFinishDom"
|
|
130
|
+
:value.sync="form[items.keyName]"
|
|
131
|
+
@update:value="handleAfterUpdateValue"
|
|
132
|
+
></myFormSwitch>
|
|
133
|
+
<myFormTree
|
|
134
|
+
v-if="items.itemType == 'tree_check_box' && isShowByFinishDom"
|
|
135
|
+
:value.sync="form[items.keyName]"
|
|
136
|
+
:target="items"
|
|
137
|
+
:targetViewName="viewName"
|
|
138
|
+
:isShowCheckBox="true"
|
|
139
|
+
@resetData="treeCheckBoxReset"
|
|
140
|
+
></myFormTree>
|
|
141
|
+
<myFormUeditor
|
|
142
|
+
v-if="items.itemType == 'rich_text' && isShowByFinishDom"
|
|
143
|
+
:value.sync="form[items.keyName]"
|
|
144
|
+
></myFormUeditor>
|
|
145
|
+
</el-form-item>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<div class="form_btns">
|
|
149
|
+
<el-button
|
|
150
|
+
type="default"
|
|
151
|
+
@click="clickDom(item.cancelButton)"
|
|
152
|
+
>{{ item.cancelButton.name }}</el-button
|
|
153
|
+
>
|
|
154
|
+
<el-button
|
|
155
|
+
type="primary"
|
|
156
|
+
@click="clickDom(item.okButton)"
|
|
157
|
+
>{{ item.okButton.name }}</el-button
|
|
158
|
+
>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</el-form>
|
|
162
|
+
</div>
|
|
163
|
+
</template>
|
|
164
|
+
<script>
|
|
165
|
+
import myFormInput from "./MyFormInput.vue";
|
|
166
|
+
import myFormCheckBox from "./MyFormCheckBox.vue";
|
|
167
|
+
import myFormSelect from "./MyFormSelect.vue";
|
|
168
|
+
import myFormTag from "./MyFormTag.vue";
|
|
169
|
+
import myFormUploads from "./MyFormUploads.vue";
|
|
170
|
+
import myFormLine from "./MyFormLine.vue";
|
|
171
|
+
import myFormCascader from "./MyFormCascader.vue";
|
|
172
|
+
import myFormRadio from "./MyFormRadio.vue";
|
|
173
|
+
import myFormSwitch from "./MyFormSwitch.vue";
|
|
174
|
+
import myFormTree from "./MyFormTree.vue";
|
|
175
|
+
import myFormUeditor from "./MyFormEditor.vue";
|
|
176
|
+
import myFormSelectDate from "./MyFormSelectDate.vue";
|
|
177
|
+
import myFormSelectDateTime from "./MyFormSelectDateTime.vue";
|
|
178
|
+
import myFormSelectTime from "./MyFormSelectTime.vue";
|
|
179
|
+
|
|
180
|
+
import * as api from '../api'
|
|
181
|
+
import Mustache from 'mustache'
|
|
182
|
+
import { vFun } from '../utils/common'
|
|
183
|
+
export default {
|
|
184
|
+
props: {
|
|
185
|
+
queryProps:{
|
|
186
|
+
type: Array,
|
|
187
|
+
default:() => [],
|
|
188
|
+
},
|
|
189
|
+
formData: {
|
|
190
|
+
type: Array,
|
|
191
|
+
default:() => [],
|
|
192
|
+
},
|
|
193
|
+
selectData: {
|
|
194
|
+
type: Object,
|
|
195
|
+
default:null
|
|
196
|
+
},
|
|
197
|
+
viewName: {
|
|
198
|
+
type: String,
|
|
199
|
+
default:'',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
components: {
|
|
203
|
+
myFormInput,
|
|
204
|
+
myFormCheckBox,
|
|
205
|
+
myFormSelect,
|
|
206
|
+
myFormTag,
|
|
207
|
+
myFormUploads,
|
|
208
|
+
myFormLine,
|
|
209
|
+
myFormCascader,
|
|
210
|
+
myFormTree,
|
|
211
|
+
myFormRadio,
|
|
212
|
+
myFormSwitch,
|
|
213
|
+
myFormUeditor,
|
|
214
|
+
myFormSelectDate,
|
|
215
|
+
myFormSelectDateTime,
|
|
216
|
+
myFormSelectTime
|
|
217
|
+
},
|
|
218
|
+
data() {
|
|
219
|
+
return {
|
|
220
|
+
isShowByFinishDom: false, //动态生成dom之后再显示
|
|
221
|
+
form: {},
|
|
222
|
+
formItemShowIf: {},
|
|
223
|
+
confirmPassWord: "",
|
|
224
|
+
selectList: [],
|
|
225
|
+
};
|
|
226
|
+
},
|
|
227
|
+
mounted() {
|
|
228
|
+
let timeout = setTimeout(()=>{
|
|
229
|
+
let list = this.formData[0].formItems;
|
|
230
|
+
if (list.length != 0) {
|
|
231
|
+
// console.log(JSON.stringify(this.selectData) != null);
|
|
232
|
+
list.forEach((element) => {
|
|
233
|
+
|
|
234
|
+
if (element.name == "确认密码") {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//判断是否有数据传进来,即判断是否修改和添加
|
|
239
|
+
if (this.selectData) {
|
|
240
|
+
//修改
|
|
241
|
+
if (
|
|
242
|
+
typeof this.selectData[element.keyName] != "undefined"
|
|
243
|
+
) {
|
|
244
|
+
this.form[element.keyName] =
|
|
245
|
+
this.selectData[element.keyName];
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
//添加
|
|
249
|
+
this.form[element.keyName] = "";
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
this.isShowByFinishDom = true;
|
|
253
|
+
clearTimeout(timeout);
|
|
254
|
+
}
|
|
255
|
+
},100)
|
|
256
|
+
},
|
|
257
|
+
methods: {
|
|
258
|
+
//重置treeCheckBox
|
|
259
|
+
treeCheckBoxReset(value, target) {
|
|
260
|
+
console.log(value);
|
|
261
|
+
console.log(target);
|
|
262
|
+
// return false;
|
|
263
|
+
console.log("是否为空" + this.form[target] == "");
|
|
264
|
+
if (this.form[target] != "") {
|
|
265
|
+
console.log("不空");
|
|
266
|
+
this.form[target] = this.form[target] + "," + value;
|
|
267
|
+
console.log(this.form[target]);
|
|
268
|
+
} else {
|
|
269
|
+
console.log("空");
|
|
270
|
+
this.form[target] = value;
|
|
271
|
+
}
|
|
272
|
+
// this.form[target] = value;
|
|
273
|
+
},
|
|
274
|
+
//点击事件
|
|
275
|
+
clickDom(dom) {
|
|
276
|
+
if (dom.action == "CONFIRM_AND_CLOSE") {
|
|
277
|
+
this.$emit("confirmForm", this.form, dom.buttonId)
|
|
278
|
+
// this.$emit("confirmDialog", this.form, dom.buttonId);
|
|
279
|
+
} else if (dom.action == "CLOSE_DIALOG") {
|
|
280
|
+
this.$emit("closeDialog");
|
|
281
|
+
} else if (dom.action == "CONFIRM") {
|
|
282
|
+
this.$emit("confirmForm", this.form, dom.buttonId)
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
// 根据表单的showIf字段隐藏或展示某些表单项目
|
|
286
|
+
handleShowIf (showIf) {
|
|
287
|
+
const v = vFun
|
|
288
|
+
|
|
289
|
+
if (typeof(showIf) != "undefined" && showIf != 1) {
|
|
290
|
+
let result, evalResult
|
|
291
|
+
try {
|
|
292
|
+
result = Mustache.render(showIf, this)
|
|
293
|
+
evalResult = eval(result)
|
|
294
|
+
// console.log("showIf", showIf, "mustacheResult", result, "evalResult", evalResult);
|
|
295
|
+
// console.log(evalResult);
|
|
296
|
+
} catch (e) {
|
|
297
|
+
console.warn(e);
|
|
298
|
+
}
|
|
299
|
+
return eval(evalResult)
|
|
300
|
+
} else {
|
|
301
|
+
return showIf
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
// 解决父子组件双向绑定数据后视图更新问题
|
|
305
|
+
handleAfterUpdateValue(e) {
|
|
306
|
+
this.$forceUpdate()
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
watch: {
|
|
310
|
+
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
</script>
|
|
314
|
+
<style lang="scss" scoped>
|
|
315
|
+
.form_group {
|
|
316
|
+
text-align: left;
|
|
317
|
+
}
|
|
318
|
+
.form_btns {
|
|
319
|
+
text-align: right;
|
|
320
|
+
}
|
|
321
|
+
.display_none {
|
|
322
|
+
display: none;
|
|
323
|
+
}
|
|
324
|
+
</style>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2022-04-28 15:10:38
|
|
4
|
+
* @LastEditTime: 2022-11-07 16:46:15
|
|
5
|
+
* @LastEditors: lrm lrm@gonsin.cn
|
|
6
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
+
* @FilePath: \client\src\components\MyFormAutocomplete.vue
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="my_autocomplete">
|
|
12
|
+
<el-autocomplete
|
|
13
|
+
class="inline-input"
|
|
14
|
+
v-model="childData"
|
|
15
|
+
:fetch-suggestions="querySearch"
|
|
16
|
+
placeholder="请输入内容"
|
|
17
|
+
:trigger-on-focus="false"
|
|
18
|
+
@focus="returnList(target)"
|
|
19
|
+
@input="forceUpdate($event)"
|
|
20
|
+
@select="forceUpdate($event)"
|
|
21
|
+
:size="size"
|
|
22
|
+
></el-autocomplete>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import * as api from '../api'
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
props: {
|
|
31
|
+
value:{
|
|
32
|
+
type:String
|
|
33
|
+
},
|
|
34
|
+
target:{
|
|
35
|
+
type:Object
|
|
36
|
+
},
|
|
37
|
+
targetViewName:{
|
|
38
|
+
type:String
|
|
39
|
+
},
|
|
40
|
+
size:{
|
|
41
|
+
type:String,
|
|
42
|
+
default:'medium',
|
|
43
|
+
},
|
|
44
|
+
isSpecial:{
|
|
45
|
+
type:Boolean,
|
|
46
|
+
default:false,
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
watch:{
|
|
50
|
+
value(){
|
|
51
|
+
this.childData = this.value
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
components: {
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
childData:this.value,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
mounted(){
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
forceUpdate(e) {
|
|
67
|
+
this.$emit('update:value',e)
|
|
68
|
+
},
|
|
69
|
+
//返回处理的列表
|
|
70
|
+
returnList(item) {
|
|
71
|
+
console.log(item);
|
|
72
|
+
if(this.isSpecial){
|
|
73
|
+
this.getSelects(item,(list)=>{
|
|
74
|
+
this.restaurants = list;
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
//特殊的数据
|
|
79
|
+
getSelects(item, callback) {
|
|
80
|
+
api
|
|
81
|
+
.getViewData({
|
|
82
|
+
viewName: this.targetViewName,
|
|
83
|
+
dataId: item.simpleListData.dataId,
|
|
84
|
+
})
|
|
85
|
+
.then((res) => {
|
|
86
|
+
// console.log(res);
|
|
87
|
+
if (res.data.state == 200) {
|
|
88
|
+
if (res.data.data != null) {
|
|
89
|
+
let list = res.data.data;
|
|
90
|
+
if (list.length != 0) {
|
|
91
|
+
let arr = [];
|
|
92
|
+
list.forEach((item) => {
|
|
93
|
+
arr.push({
|
|
94
|
+
label: item,
|
|
95
|
+
value: item,
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
callback(arr);
|
|
99
|
+
} else {
|
|
100
|
+
callback([]);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
callback([]);
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
callback([]);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
querySearch(queryString, cb) {
|
|
111
|
+
var restaurants = this.restaurants;
|
|
112
|
+
var results = queryString
|
|
113
|
+
? restaurants.filter(this.createFilter(queryString))
|
|
114
|
+
: restaurants;
|
|
115
|
+
// 调用 callback 返回建议列表的数据
|
|
116
|
+
cb(results);
|
|
117
|
+
},
|
|
118
|
+
createFilter(queryString) {
|
|
119
|
+
return (restaurant) => {
|
|
120
|
+
console.log(restaurant.value);
|
|
121
|
+
return (
|
|
122
|
+
restaurant.value
|
|
123
|
+
.toLowerCase()
|
|
124
|
+
.indexOf(queryString.toLowerCase()) === 0
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
handleSelect(e) {
|
|
129
|
+
console.log(e);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
</script>
|
|
134
|
+
<style lang="scss" scoped>
|
|
135
|
+
</style>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2022-04-29 15:02:12
|
|
4
|
+
* @LastEditTime: 2022-11-19 16:35:53
|
|
5
|
+
* @LastEditors: lrm lrm@gonsin.cn
|
|
6
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
+
* @FilePath: \client\src\components\MyFormCascader.vue
|
|
8
|
+
-->
|
|
9
|
+
<template>
|
|
10
|
+
<div class="my_cascader">
|
|
11
|
+
<el-cascader
|
|
12
|
+
:options="options"
|
|
13
|
+
:props="props"
|
|
14
|
+
@change="handleChange"
|
|
15
|
+
clearable
|
|
16
|
+
></el-cascader>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import * as api from '../api'
|
|
22
|
+
import { initSelectorTreeData } from '../utils/common'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
props: {
|
|
26
|
+
value: {
|
|
27
|
+
type: Array | String,
|
|
28
|
+
},
|
|
29
|
+
target: {
|
|
30
|
+
type: Object,
|
|
31
|
+
},
|
|
32
|
+
targetViewName: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "medium",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
watch: {},
|
|
41
|
+
components: {},
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
childData:this.value,
|
|
45
|
+
props: { multiple: true },
|
|
46
|
+
options: [
|
|
47
|
+
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
mounted() {
|
|
52
|
+
this.getSelect(this.target);
|
|
53
|
+
},
|
|
54
|
+
methods: {
|
|
55
|
+
handleChange(e) {
|
|
56
|
+
if(this.target.itemType == 'tree_selector'){
|
|
57
|
+
//单选
|
|
58
|
+
// let arr = [];
|
|
59
|
+
// arr.push(e[e.length-1]);
|
|
60
|
+
this.$emit("update:value", e[e.length-1]);
|
|
61
|
+
} else {
|
|
62
|
+
this.$emit("update:value", e);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
// forceUpdate(e) {
|
|
66
|
+
// this.$emit("update:value", e);
|
|
67
|
+
// },
|
|
68
|
+
//根据请求的数据重新设置新的数据
|
|
69
|
+
setData(list, model) {
|
|
70
|
+
if(model.itemType == 'tree_selector'){
|
|
71
|
+
this.props.multiple = false;
|
|
72
|
+
}else{
|
|
73
|
+
this.props.multiple = true;
|
|
74
|
+
}
|
|
75
|
+
let arrModel = initSelectorTreeData({
|
|
76
|
+
list,
|
|
77
|
+
parentKey: null,
|
|
78
|
+
keyName: model.treeData.keyName,
|
|
79
|
+
titleName: model.treeData.titleName,
|
|
80
|
+
parentKeyName: model.treeData.parentKeyName
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
this.options = arrModel;
|
|
84
|
+
},
|
|
85
|
+
//特殊的数据
|
|
86
|
+
getSelect(item) {
|
|
87
|
+
api
|
|
88
|
+
.getViewData({
|
|
89
|
+
viewName: this.targetViewName,
|
|
90
|
+
dataId: item.treeData.dataId,
|
|
91
|
+
})
|
|
92
|
+
.then((res) => {
|
|
93
|
+
if (res.data.state == 200) {
|
|
94
|
+
if (res.data.data != null) {
|
|
95
|
+
let list = res.data.data;
|
|
96
|
+
this.setData(list, item);
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
<style lang="scss" scoped>
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2022-04-28 09:30:27
|
|
4
|
+
* @LastEditTime: 2022-11-07 16:47:44
|
|
5
|
+
* @LastEditors: lrm lrm@gonsin.cn
|
|
6
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
+
* @FilePath: \client\src\components\MyFormCheckBox.vue
|
|
8
|
+
-->
|
|
9
|
+
<!--
|
|
10
|
+
* @Author: your name
|
|
11
|
+
* @Date: 2022-04-22 15:51:20
|
|
12
|
+
* @LastEditTime: 2022-04-27 17:47:53
|
|
13
|
+
* @LastEditors: Please set LastEditors
|
|
14
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
15
|
+
* @FilePath: \gview\src\components\MyDialog.vue
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="my_check_box">
|
|
20
|
+
<el-checkbox :size="size" v-model="childData" @change="forceUpdate">{{
|
|
21
|
+
target.name
|
|
22
|
+
}}</el-checkbox>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
props: {
|
|
29
|
+
value: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
target: {
|
|
34
|
+
type: Object,
|
|
35
|
+
},
|
|
36
|
+
targetViewName: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
size: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "medium",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
watch: {
|
|
45
|
+
// value() {
|
|
46
|
+
// this.childData = this.value ==""?false:this.value;
|
|
47
|
+
// },
|
|
48
|
+
},
|
|
49
|
+
components: {},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
childData: this.targetViewName.indexOf('Add') >-1?false:this.value,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
forceUpdate(e) {
|
|
60
|
+
// this.$forceUpdate(); // @change="forceUpdate($event)"主要是解决clear图标响应问题
|
|
61
|
+
this.$emit('update:value',e)
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
<style lang="scss" scoped>
|
|
67
|
+
</style>
|