olp-table 5.3.1 → 5.3.4
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/.env.build +1 -0
- package/README.md +26 -0
- package/babel.config.js +5 -0
- package/jsconfig.json +22 -0
- package/{olp-table.common.js → olp-table/olp-table.common.js} +5 -5
- package/{olp-table.umd.js → olp-table/olp-table.umd.js} +5 -5
- package/{olp-table.umd.min.js → olp-table/olp-table.umd.min.js} +3 -3
- package/package.json +92 -12
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/rmMode.bat +1 -0
- package/src/App.vue +199 -0
- package/src/api/crud.js +22 -0
- package/src/api/dist.js +6 -0
- package/src/assets/iconfont/iconfont.css +20 -0
- package/src/assets/iconfont/iconfont.json +16 -0
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/auto-height/index.vue +75 -0
- package/src/components/codemirror-tag.vue +100 -0
- package/src/components/lazy-load-select.vue +107 -0
- package/src/components/ol-dialog-excel.vue +112 -0
- package/src/components/ol-dialog-import.vue +304 -0
- package/src/components/ol-dialog-json.vue +82 -0
- package/src/components/ol-dialog-table.vue +81 -0
- package/src/components/ol-dialog-upload-file.vue +208 -0
- package/src/components/ol-dict-tag.vue +271 -0
- package/src/components/ol-select-dom.vue +71 -0
- package/src/components/ol-table-filter.vue +28 -0
- package/src/components/ol-table-render.vue +44 -0
- package/src/components/ol-table-select.vue +150 -0
- package/src/components/pinia-init.vue +18 -0
- package/src/components/table/model/ModelMixins.js +43 -0
- package/src/components/table/model/model-index.vue +121 -0
- package/src/components/table/model/ot-left-right.vue +18 -0
- package/src/components/table/model/ot-left-tree-right-table.scss +14 -0
- package/src/components/table/model/ot-left-tree-right-table.vue +41 -0
- package/src/components/table/model/ot-top-1-bottom-2.vue +39 -0
- package/src/components/table/model/ot-top-2-bottom-1.vue +38 -0
- package/src/components/table/model/ot-top-2-bottom-2.vue +38 -0
- package/src/components/table/model/ot-top-bottom.vue +18 -0
- package/src/components/table/model/splitpanesModel.css +22 -0
- package/src/components/table/model/splitpanesModel.vue +54 -0
- package/src/components/table/ol-form/index.vue +537 -0
- package/src/components/table/ol-form-v3/index.vue +455 -0
- package/src/components/table/ol-main-form-sub-table/index.vue +601 -0
- package/src/components/table/ol-pager/index.vue +46 -0
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +233 -0
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +145 -0
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +88 -0
- package/src/components/table/ol-table/index.vue +232 -0
- package/src/components/table/ol-table-operate/index.vue +61 -0
- package/src/components/table/ol-table-search/index.vue +17 -0
- package/src/components/table/ol-table-tool-btn/index.vue +60 -0
- package/src/components/tree/components/o-tree.vue +289 -0
- package/src/components/tree/index.vue +46 -0
- package/src/components/v-component/index.vue +43 -0
- package/src/config/dev-config.js +5 -0
- package/src/config/prod-config.js +5 -0
- package/src/config/shared-config.js +20 -0
- package/src/data.js +9378 -0
- package/src/directives/permission/hasPermi.js +63 -0
- package/src/directives/permission/hasRole.js +30 -0
- package/src/main.js +55 -0
- package/src/mixins/VTMixin/DefaultMethods.js +749 -0
- package/src/mixins/VTMixin/OTMixinBody.js +105 -0
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +93 -0
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +420 -0
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +450 -0
- package/src/mixins/VTMixin/OTMixinInitMethod.js +130 -0
- package/src/mixins/VTMixin/OTMixinPager.js +38 -0
- package/src/mixins/VTMixin/OTMixinSortable.js +43 -0
- package/src/mixins/VTMixin/index.js +18 -0
- package/src/package/index.js +20 -0
- package/src/plugins/axios.js +61 -0
- package/src/store/dict.js +76 -0
- package/src/store/dictType.js +52 -0
- package/src/store/permi.js +45 -0
- package/src/styles/common.scss +37 -0
- package/src/styles/index.scss +48 -0
- package/src/styles/theme.scss +32 -0
- package/src/utils/AESCRUDUtils.js +87 -0
- package/src/utils/DateUtils.js +35 -0
- package/src/utils/ExcelUtil.js +159 -0
- package/src/utils/TableSortUtil.js +91 -0
- package/src/utils/columnProp.js +3 -0
- package/src/utils/groupCompute.js +68 -0
- package/src/utils/http/httpFactory.js +92 -0
- package/src/utils/http/httpFactory2.js +79 -0
- package/src/utils/http/httpUtil.js +123 -0
- package/src/utils/http/httpUtils.js +38 -0
- package/src/utils/loadStyle.js +14 -0
- package/src/utils/message.js +56 -0
- package/src/utils/object.js +80 -0
- package/src/utils/security/TokenUtil.js +19 -0
- package/src/utils/tree.js +54 -0
- package/src/utils/util.js +127 -0
- package/src/views/Test/index.vue +77 -0
- package/src/views/Test/index2.vue +33 -0
- package/src/views/components/btn-config/index.vue +202 -0
- package/src/views/components/option-config/index.vue +192 -0
- package/src/views/db/chineseToEnglish.vue +127 -0
- package/src/views/db/filed.vue +395 -0
- package/src/views/db/index.vue +192 -0
- package/src/views/db/preview/index.vue +139 -0
- package/src/views/db/preview/left.vue +204 -0
- package/src/views/db/preview/right.vue +466 -0
- package/src/views/groupTable/index.vue +137 -0
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +194 -0
- package/src/views/groupTable/ol-table-column-config/index.vue +92 -0
- package/src/views/table/add-or-edit/config/base-config/index.vue +539 -0
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +333 -0
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +475 -0
- package/src/views/table/add-or-edit/config/column-config/index.vue +790 -0
- package/src/views/table/add-or-edit/config/data/column.js +218 -0
- package/src/views/table/add-or-edit/config/data/crud.js +122 -0
- package/src/views/table/add-or-edit/config/data/events.js +109 -0
- package/src/views/table/add-or-edit/config/data/method.js +127 -0
- package/src/views/table/add-or-edit/config/data/option.js +725 -0
- package/src/views/table/add-or-edit/config/data/page.js +79 -0
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +42 -0
- package/src/views/table/add-or-edit/config/field-config/index.vue +91 -0
- package/src/views/table/add-or-edit/config/form-config/index.vue +1179 -0
- package/src/views/table/add-or-edit/config/index.vue +376 -0
- package/src/views/table/add-or-edit/config/initFormObject.js +25 -0
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +71 -0
- package/src/views/table/add-or-edit/config/script-config/index.vue +70 -0
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +340 -0
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +132 -0
- package/src/views/table/add-or-edit/config/table-config/index.vue +446 -0
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +41 -0
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +74 -0
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +439 -0
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +79 -0
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +74 -0
- package/src/views/table/add-or-edit/configOld/index.vue +127 -0
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +5 -0
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +353 -0
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +75 -0
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +92 -0
- package/src/views/table/add-or-edit/index.vue +201 -0
- package/src/views/table/add-or-edit/themeModel/index.vue +53 -0
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +48 -0
- package/src/views/table/add-or-edit/themeModel/init-model.vue +81 -0
- package/src/views/table/add-or-edit/themeModel/left-right.vue +24 -0
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +75 -0
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +42 -0
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +49 -0
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +29 -0
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +32 -0
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +32 -0
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +14 -0
- package/src/views/table/index.vue +43 -0
- package/src/views/table/index2.vue +199 -0
- package/src/views/table/preview/index.vue +29 -0
- package/src/views/tree/components/config-core-data.vue +85 -0
- package/src/views/tree/components/config-core-table.vue +362 -0
- package/src/views/tree/components/config-core-tree/data/events.js +95 -0
- package/src/views/tree/components/config-core-tree/data/option.js +88 -0
- package/src/views/tree/components/config-core-tree/data/prop.js +28 -0
- package/src/views/tree/components/config-core-tree/index.vue +181 -0
- package/src/views/tree/components/config-core.vue +42 -0
- package/src/views/tree/components/form-config/index.vue +967 -0
- package/src/views/tree/index.vue +424 -0
- package/vue.config.js +44 -0
- /package/{demo.html → olp-table/demo.html} +0 -0
- /package/{fonts → olp-table/fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{fonts → olp-table/fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
- /package/{olp-table.css → olp-table/olp-table.css} +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog v-model="show" :title="title"
|
|
3
|
+
:width="800" show-footer @close="close">
|
|
4
|
+
<template #default>
|
|
5
|
+
<div v-loading="loading">
|
|
6
|
+
<el-upload
|
|
7
|
+
ref="uploadRef"
|
|
8
|
+
v-model:file-list="fileList"
|
|
9
|
+
:multiple="multiple"
|
|
10
|
+
:on-change="onchange"
|
|
11
|
+
:auto-upload="false">
|
|
12
|
+
<template #trigger>
|
|
13
|
+
<el-button type="primary" ref="selectFiles">选择文件</el-button>
|
|
14
|
+
</template>
|
|
15
|
+
<template #tip>
|
|
16
|
+
<div class="el-upload__tip">
|
|
17
|
+
当前文件:<span style="color: red">{{ fileList.length }}个</span>
|
|
18
|
+
,已成功上传:<span style="color: green">{{ okIndex }}个</span>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<template #file="{file}">
|
|
22
|
+
<div style="padding: 6px;font-size: 15px;border-bottom:1px solid #caced0">
|
|
23
|
+
{{ file.name }}
|
|
24
|
+
<span style="float: right">
|
|
25
|
+
{{ file.percentCompleted ? file.percentCompleted : '未上传' }}
|
|
26
|
+
<el-button type="primary" size="small" @click="uploadFile(getFile(file.uid))">上传</el-button>
|
|
27
|
+
<el-button type="danger" size="small" @click="fileList.splice(getFile(file.uid),1)"
|
|
28
|
+
v-if="file.percentCompleted == '上传失败'">删除</el-button>
|
|
29
|
+
<el-tooltip
|
|
30
|
+
class="box-item"
|
|
31
|
+
effect="dark"
|
|
32
|
+
:content="file.message"
|
|
33
|
+
placement="right"
|
|
34
|
+
>
|
|
35
|
+
<el-button v-if="file.message" size="small">原因</el-button>
|
|
36
|
+
</el-tooltip>
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</el-upload>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<template #footer>
|
|
44
|
+
<el-button @click="close">返回</el-button>
|
|
45
|
+
<el-button type="primary" @click="uploadFile" :loading="loading">全部上传</el-button>
|
|
46
|
+
</template>
|
|
47
|
+
</el-dialog>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
|
|
52
|
+
import {upload} from "@/utils/http/httpUtils";
|
|
53
|
+
import {useMessage} from "@/utils/message";
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'olDialogUploadFile',
|
|
57
|
+
inject: ['http'],
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
title: '上传文件',
|
|
61
|
+
show: false,
|
|
62
|
+
fileList: [],
|
|
63
|
+
okIndex: 0,
|
|
64
|
+
multiple: true,
|
|
65
|
+
loading: true,
|
|
66
|
+
url: '',
|
|
67
|
+
autoClose: false,
|
|
68
|
+
query: false,
|
|
69
|
+
js: '',
|
|
70
|
+
okFileInfos: [],
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
getFile(uid) {
|
|
75
|
+
for (let i = 0; i < this.fileList.length; i++) {
|
|
76
|
+
if (this.fileList[i].uid == uid) {
|
|
77
|
+
return i;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onchange(file, fileList) {
|
|
82
|
+
this.fileList = fileList;
|
|
83
|
+
if (this.multiple == false) {
|
|
84
|
+
this.uploadFile();
|
|
85
|
+
} else {
|
|
86
|
+
this.loading = false;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async uploadFile(index) {
|
|
90
|
+
if (this.fileList.length == 0) {
|
|
91
|
+
useMessage().error("请选择文件!");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let length = this.fileList.length;
|
|
95
|
+
let i = 0;
|
|
96
|
+
let thIndex = index == undefined || typeof index !== 'number' ? 0 : index;
|
|
97
|
+
console.info("thIndex", thIndex);
|
|
98
|
+
this.loading = true;
|
|
99
|
+
while (i < length) {
|
|
100
|
+
let file = this.fileList[thIndex];
|
|
101
|
+
console.info(file.name + "上传中...", file);
|
|
102
|
+
file.percentCompleted = 0;
|
|
103
|
+
const formData = new FormData();
|
|
104
|
+
formData.append('files', file.raw);
|
|
105
|
+
//调用文件上传接口
|
|
106
|
+
await upload(this.http, this.url, formData, progressEvent => {
|
|
107
|
+
const percentCompleted = Math.round((progressEvent.loaded * 100) /
|
|
108
|
+
progressEvent.total)
|
|
109
|
+
file.percentCompleted = percentCompleted + "%";
|
|
110
|
+
}).then(({code, msg, data}) => {
|
|
111
|
+
if (code === 200 || code === 0) {
|
|
112
|
+
this.okFileInfos.push(
|
|
113
|
+
{
|
|
114
|
+
name: file.name,
|
|
115
|
+
path: data?.path,
|
|
116
|
+
configId: data?.configId,
|
|
117
|
+
suffix:this.getFileExtension(file.name)
|
|
118
|
+
});
|
|
119
|
+
this.okIndex++;
|
|
120
|
+
this.fileList.splice(thIndex, 1)
|
|
121
|
+
} else {
|
|
122
|
+
file.percentCompleted = "上传失败";
|
|
123
|
+
file.message = msg;
|
|
124
|
+
thIndex++;
|
|
125
|
+
}
|
|
126
|
+
}).catch(error => {
|
|
127
|
+
thIndex++;
|
|
128
|
+
// 上传失败处理逻辑
|
|
129
|
+
console.error('上传失败', error);
|
|
130
|
+
});
|
|
131
|
+
// if (index != undefined) {
|
|
132
|
+
// break
|
|
133
|
+
// }
|
|
134
|
+
i++;
|
|
135
|
+
}
|
|
136
|
+
this.loading = false;
|
|
137
|
+
if (this.okIndex === 0) {
|
|
138
|
+
useMessage().error("上传失败!")
|
|
139
|
+
} else {
|
|
140
|
+
// console.info('上传成功文件:', this.okFileInfos);
|
|
141
|
+
useMessage().success("上传成功!")
|
|
142
|
+
if (this.autoClose || this.multiple == false) {
|
|
143
|
+
this.close();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
getFileExtension(filename) {
|
|
148
|
+
// 检查字符串是否有效
|
|
149
|
+
if (typeof filename !== 'string') {
|
|
150
|
+
return '';
|
|
151
|
+
}
|
|
152
|
+
// 使用 lastIndexOf 和 substring 方法提取后缀
|
|
153
|
+
const lastDotIndex = filename.lastIndexOf('.');
|
|
154
|
+
// 如果找不到点,返回空字符串,表示没有后缀
|
|
155
|
+
if (lastDotIndex === -1) {
|
|
156
|
+
return '';
|
|
157
|
+
}
|
|
158
|
+
// 提取并返回后缀名(不包括点)
|
|
159
|
+
return filename.substring(lastDotIndex + 1);
|
|
160
|
+
},
|
|
161
|
+
close() {
|
|
162
|
+
let args = {
|
|
163
|
+
js: this.js,
|
|
164
|
+
v: this.okFileInfos,
|
|
165
|
+
}
|
|
166
|
+
if (this.okIndex !== 0 && this.query) {
|
|
167
|
+
args.m = 'query'
|
|
168
|
+
}
|
|
169
|
+
// console.info("关闭上传文件窗口!!!!!!!!", args);
|
|
170
|
+
this.$emit("emits", args);
|
|
171
|
+
|
|
172
|
+
this.show = false;
|
|
173
|
+
},
|
|
174
|
+
init(obj) {
|
|
175
|
+
this.okFileInfos = [];
|
|
176
|
+
this.fileList = [];
|
|
177
|
+
this.okIndex = 0;
|
|
178
|
+
let {url, title, autoClose, multiple, query, js} = obj;
|
|
179
|
+
if (!url) {
|
|
180
|
+
url = obj;
|
|
181
|
+
}
|
|
182
|
+
if (!url) {
|
|
183
|
+
useMessage().error("请填写上传文件url!");
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
this.query = query != false;
|
|
187
|
+
this.js = js;
|
|
188
|
+
this.show = true;
|
|
189
|
+
this.url = url;
|
|
190
|
+
this.title = title ? title : this.title;
|
|
191
|
+
this.autoClose = autoClose != undefined ? autoClose : this.autoClose;
|
|
192
|
+
this.multiple = multiple != undefined ? multiple : this.multiple;
|
|
193
|
+
this.$nextTick(() => {
|
|
194
|
+
this.$refs.selectFiles.$el.click();
|
|
195
|
+
setTimeout(() => {
|
|
196
|
+
this.loading = false;
|
|
197
|
+
}, 300)
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
</script>
|
|
203
|
+
<style lang="less" scoped>
|
|
204
|
+
/deep/ .el-upload-list {
|
|
205
|
+
overflow-x: auto;
|
|
206
|
+
height: 300px;
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-radio-group v-model="value" @change="change" v-if="props.type == 'radio'">
|
|
3
|
+
<el-radio v-for="item in options" :label="item[props.label]" :value-key="props.value"
|
|
4
|
+
:value="item[props.value]" :border="props.border">{{ item.label }}
|
|
5
|
+
</el-radio>
|
|
6
|
+
</el-radio-group>
|
|
7
|
+
<el-checkbox-group v-model="value" @change="change" v-else-if="props.type == 'checkbox'">
|
|
8
|
+
<el-checkbox v-for="item in options" :label="item[props.label]" :value-key="props.value"
|
|
9
|
+
:value="item[props.value]" :border="props.border">{{ item.label }}
|
|
10
|
+
</el-checkbox>
|
|
11
|
+
</el-checkbox-group>
|
|
12
|
+
<el-select ref="dictTag" v-else v-model="value" :placeholder="placeholder"
|
|
13
|
+
:clearable="props.clearable"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
:loading="loading"
|
|
16
|
+
@clear="clear"
|
|
17
|
+
@change="change"
|
|
18
|
+
@visible-change="visibleChange"
|
|
19
|
+
:filter-method="filterMethod"
|
|
20
|
+
filterable>
|
|
21
|
+
<el-option v-for="item in options" :label="item[props.label]" :value-key="props.value"
|
|
22
|
+
:value="item[props.value]"></el-option>
|
|
23
|
+
</el-select>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script scope setup>
|
|
27
|
+
import {nextTick, ref, defineProps, defineEmits, onMounted, defineExpose, watch, inject} from 'vue'
|
|
28
|
+
|
|
29
|
+
import {storeDictType} from "@/store/dictType";
|
|
30
|
+
import {storeDict} from "@/store/dict";
|
|
31
|
+
import {initDictTag} from "@/api/dist";
|
|
32
|
+
|
|
33
|
+
const http = inject("http")
|
|
34
|
+
const dict = storeDict();
|
|
35
|
+
const dictType = storeDictType();
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
border: {default: false, type: Boolean},
|
|
38
|
+
type: {default: 'select'},
|
|
39
|
+
code: {},
|
|
40
|
+
like: {},
|
|
41
|
+
placeholder: {default: '可搜索'},
|
|
42
|
+
clearable: {default: true, type: Boolean},
|
|
43
|
+
modelValue: {required: true},
|
|
44
|
+
dictType: {default: false, type: Boolean},
|
|
45
|
+
label: {default: 'dictLabel'},
|
|
46
|
+
value: {default: 'dictValue'},
|
|
47
|
+
orderBy: {default: undefined, type: Array},
|
|
48
|
+
groupBy: {default: undefined, type: Array},
|
|
49
|
+
whereAnd: {default: []},
|
|
50
|
+
whereOr: {default: []},
|
|
51
|
+
//[{String key:''value:'',type:''}]//type 查询类型 默认等于1--> 1:= 2:!= 3: > 4:< 5: >= 6: <= 7:like '%value' 8:like '%value%' 9:like 'value%'
|
|
52
|
+
disabledInit: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
data: {default: []}
|
|
58
|
+
})
|
|
59
|
+
const loading = ref(false)
|
|
60
|
+
const ex = ref(0)
|
|
61
|
+
const value = ref(undefined)
|
|
62
|
+
watch(() => props.modelValue, () => {
|
|
63
|
+
if (props.type == 'checkbox') {
|
|
64
|
+
value.value = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue + '']
|
|
65
|
+
} else {
|
|
66
|
+
value.value = props.modelValue + ''
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
deep: true // 开启深度监听
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const getValue = () => {
|
|
73
|
+
if (!props.modelValue) {
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
if (props.type == 'checkbox') {
|
|
77
|
+
return Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue + '']
|
|
78
|
+
} else {
|
|
79
|
+
return props.modelValue + ''
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const options = ref([]);
|
|
84
|
+
let optionsBk = ref([]);
|
|
85
|
+
const isDictTable = ref(false);
|
|
86
|
+
onMounted(() => {
|
|
87
|
+
dict.init(http)
|
|
88
|
+
dictType.init(http)
|
|
89
|
+
if (!props.disabledInit) {
|
|
90
|
+
nextTick(() => {
|
|
91
|
+
init();
|
|
92
|
+
value.value = getValue()
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
function doFilterMethod(o) {
|
|
98
|
+
if (optionsBk.value.length == 0) {
|
|
99
|
+
optionsBk.value = options.value;
|
|
100
|
+
}
|
|
101
|
+
let data = optionsBk.value.filter(option =>
|
|
102
|
+
option[props.label].toLowerCase().includes(o ? o.trim().toLowerCase() : '')
|
|
103
|
+
);
|
|
104
|
+
options.value = data;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function getParameter(valueData) {
|
|
108
|
+
let code = props.code.split(",");
|
|
109
|
+
let whereAnd = JSON.parse(JSON.stringify(props.whereAnd));
|
|
110
|
+
let whereOr = JSON.parse(JSON.stringify(props.whereOr));
|
|
111
|
+
let parameter = {
|
|
112
|
+
dbName: code[0],
|
|
113
|
+
tableName: code[1],
|
|
114
|
+
label: code[2],
|
|
115
|
+
value: code[3],
|
|
116
|
+
orderByStr: props.orderBy,
|
|
117
|
+
groupBy: props.groupBy,
|
|
118
|
+
whereAnd: whereAnd,
|
|
119
|
+
whereOr: whereOr
|
|
120
|
+
}
|
|
121
|
+
if (valueData) {
|
|
122
|
+
loading.value = true
|
|
123
|
+
initDictTag(http, parameter).then(data => {
|
|
124
|
+
options.value = data;
|
|
125
|
+
let existValue = data.map(item => item[props.value]);
|
|
126
|
+
let initValue = [];
|
|
127
|
+
if (props.modelValue instanceof Array) {
|
|
128
|
+
for (const modelValue of props.modelValue) {
|
|
129
|
+
if (modelValue != undefined && existValue.indexOf(modelValue) == -1) {
|
|
130
|
+
initValue.push(modelValue)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
if (props.modelValue != undefined && existValue.indexOf(props.modelValue) == -1) {
|
|
135
|
+
initValue.push(props.modelValue)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
value.value = props.modelValue;
|
|
139
|
+
if (initValue.length != 0) {
|
|
140
|
+
for (const modelValue of initValue) {
|
|
141
|
+
if (modelValue) {
|
|
142
|
+
parameter.whereAnd.push({key: parameter.value, value: modelValue})
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
initDictTag(http, parameter).then(data => {
|
|
146
|
+
options.value = [...options.value, ...data];
|
|
147
|
+
value.value = props.modelValue;
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
}).finally(() => {
|
|
151
|
+
loading.value = false
|
|
152
|
+
})
|
|
153
|
+
} else {
|
|
154
|
+
return parameter;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function filterMethod(o) {
|
|
159
|
+
|
|
160
|
+
if (isDictTable.value == false) {
|
|
161
|
+
doFilterMethod(o);
|
|
162
|
+
} else {
|
|
163
|
+
nextTick(() => {
|
|
164
|
+
ex.value++;
|
|
165
|
+
if (ex.value == 1) {
|
|
166
|
+
getParameter(true);
|
|
167
|
+
} else {
|
|
168
|
+
let parameter = getParameter();
|
|
169
|
+
if (o) {
|
|
170
|
+
parameter.whereAnd.push({key: parameter.label, value: o, type: 8})
|
|
171
|
+
if (props.like) {
|
|
172
|
+
let like = props.like.split(",");
|
|
173
|
+
for (let key of like) {
|
|
174
|
+
parameter.whereOr.push({key: key, value: o, type: 8})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
loading.value = true
|
|
179
|
+
initDictTag(http, parameter).then(data => {
|
|
180
|
+
options.value = data;
|
|
181
|
+
}).finally(() => {
|
|
182
|
+
loading.value = false
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
async function init() {
|
|
191
|
+
if (props.code) {
|
|
192
|
+
let code = props.code.split(",");
|
|
193
|
+
//逗号分割是查询数据表
|
|
194
|
+
if (code.length < 3) {
|
|
195
|
+
//查询数据字典
|
|
196
|
+
options.value = dict.val(props.code);
|
|
197
|
+
setDefault(options.value);
|
|
198
|
+
} else {
|
|
199
|
+
isDictTable.value = true;
|
|
200
|
+
getParameter(true)
|
|
201
|
+
}
|
|
202
|
+
} else if (props.dictType) {
|
|
203
|
+
options.value = dictType.val();
|
|
204
|
+
} else {
|
|
205
|
+
options.value = props.data;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function setDefault(res) {
|
|
211
|
+
if (res == undefined || (props.value.modelValue != undefined && props.value.modelValue != "")) {
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
for (let o of res) {
|
|
215
|
+
if (o.isDefault == 1) {
|
|
216
|
+
value.value = o.dictValue.toString()
|
|
217
|
+
emits("update:modelValue", o.dictValue.toString());
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function getLabel(code) {
|
|
223
|
+
if (!code) {
|
|
224
|
+
code = value.value;
|
|
225
|
+
}
|
|
226
|
+
for (const option of this.options) {
|
|
227
|
+
if (option[props.value] == code) {
|
|
228
|
+
return option[props.label];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function getObj(code) {
|
|
234
|
+
if (!code) {
|
|
235
|
+
code = value.value;
|
|
236
|
+
}
|
|
237
|
+
for (const option of this.options) {
|
|
238
|
+
if (option[props.value] == code) {
|
|
239
|
+
return option;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function clear() {
|
|
245
|
+
filterMethod();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function change(e) {
|
|
249
|
+
emits("update:modelValue", value.value == undefined ? '' : value.value)
|
|
250
|
+
emits("change", e);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function visibleChange(par) {
|
|
254
|
+
if (par) {
|
|
255
|
+
ex.value = 0;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 子组件调用父组件
|
|
260
|
+
const emits = defineEmits(['update:modelValue', 'change']); //声明 emits
|
|
261
|
+
defineExpose({
|
|
262
|
+
init,
|
|
263
|
+
getLabel,
|
|
264
|
+
getObj,
|
|
265
|
+
})
|
|
266
|
+
</script>
|
|
267
|
+
<script>
|
|
268
|
+
export default {
|
|
269
|
+
name: "olDictTag",
|
|
270
|
+
};
|
|
271
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-date-picker
|
|
3
|
+
v-if="item.domDate"
|
|
4
|
+
v-model="localValue"
|
|
5
|
+
v-bind="item"
|
|
6
|
+
:type="item.domType"
|
|
7
|
+
style="width: 100%"
|
|
8
|
+
:value-format="item.domFormat"
|
|
9
|
+
:placeholder="item.placeholder"
|
|
10
|
+
@change="handleChange"
|
|
11
|
+
/>
|
|
12
|
+
<el-radio-group @change="handleChange" v-else-if="item.selectDom == 4" v-model="localValue" v-bind="item">
|
|
13
|
+
<!-- 修正 v-for 语法并添加 :key 绑定 -->
|
|
14
|
+
<el-radio
|
|
15
|
+
v-for="(obj, index) in item.options"
|
|
16
|
+
:key="obj.id || index"
|
|
17
|
+
:label="obj.value"
|
|
18
|
+
:value="obj.value"
|
|
19
|
+
>{{obj.label}}</el-radio>
|
|
20
|
+
</el-radio-group>
|
|
21
|
+
<el-checkbox-group @change="handleChange" v-else-if="item.selectDom == 5" v-model="localValue" v-bind="item">
|
|
22
|
+
<el-checkbox
|
|
23
|
+
v-for="(obj, index) in item.options"
|
|
24
|
+
:key="index"
|
|
25
|
+
:label="obj.label"
|
|
26
|
+
:value="obj.value"
|
|
27
|
+
> </el-checkbox>
|
|
28
|
+
</el-checkbox-group>
|
|
29
|
+
<el-select @change="handleChange" style="width: 100%" v-else-if="item.options" v-model="localValue" v-bind="item">
|
|
30
|
+
<el-option
|
|
31
|
+
v-for="(obj, index) in item.options"
|
|
32
|
+
:key="obj.id || index"
|
|
33
|
+
:label="obj.label"
|
|
34
|
+
:value="obj.value"
|
|
35
|
+
></el-option>
|
|
36
|
+
</el-select>
|
|
37
|
+
<span v-else>
|
|
38
|
+
{{ item.selectDom }}-未开发
|
|
39
|
+
</span>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
export default {
|
|
44
|
+
name: 'olSelectDom',
|
|
45
|
+
props: {
|
|
46
|
+
modelValue: {
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
item: {
|
|
50
|
+
required: true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
localValue: this.modelValue
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
modelValue(newValue) {
|
|
60
|
+
this.localValue = newValue;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
handleChange(newValue) {
|
|
65
|
+
this.localValue = newValue;
|
|
66
|
+
this.$emit('update:modelValue', newValue);
|
|
67
|
+
this.$emit('updateOk', newValue);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-for="(option, index) in $attrs.event.column.filters" :key="index">
|
|
3
|
+
<el-input v-model="option.data" style="width: 100%;" placeholder="关键字搜索" clearable
|
|
4
|
+
@input="changeNameFilter(option)"
|
|
5
|
+
@change="changeNameFilter(option)">
|
|
6
|
+
</el-input>
|
|
7
|
+
</span>
|
|
8
|
+
</template>
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'olTableFilter',
|
|
12
|
+
methods: {
|
|
13
|
+
changeNameFilter(option) {
|
|
14
|
+
option.checked = true;
|
|
15
|
+
this.$attrs.event.$grid.updateData();
|
|
16
|
+
},
|
|
17
|
+
filterMethod({option, row, column}) {
|
|
18
|
+
if (option.data && row[column.field]) {
|
|
19
|
+
return row[column.field].indexOf(option.data) != -1
|
|
20
|
+
}
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
},created() {
|
|
24
|
+
this.$attrs.event.column.filters= [{data: ''}]
|
|
25
|
+
this.$attrs.event.column.filterMethod = this.filterMethod;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-date-picker
|
|
3
|
+
v-if="item.selectDom === 3 || item.selectDom === 6"
|
|
4
|
+
v-model="localValue"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
style="width: 100%"
|
|
7
|
+
:type="item.selectDom === 3 ? 'datetime' : 'date'"
|
|
8
|
+
:value-format="item.selectDom === 3 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'"
|
|
9
|
+
:placeholder="item.placeholder"
|
|
10
|
+
@change="handleChange"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'olSelectDom',
|
|
17
|
+
props: {
|
|
18
|
+
modelValue: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
item: {
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ['update:modelValue'],
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
localValue: this.modelValue
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
watch: {
|
|
33
|
+
modelValue(newValue) {
|
|
34
|
+
this.localValue = newValue;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
handleChange(newValue) {
|
|
39
|
+
this.localValue = newValue;
|
|
40
|
+
this.$emit('update:modelValue', newValue);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|