askbot-dragon 1.2.9 → 1.3.11
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/README.md +27 -27
- package/babel.config.js +6 -6
- package/dragon.iml +7 -7
- package/package.json +56 -56
- package/public/index.html +43 -43
- package/src/App.vue +31 -31
- package/src/api/index.js +1 -1
- package/src/api/mock.http +2 -2
- package/src/api/requestUrl.js +185 -185
- package/src/assets/js/AliyunlssUtil.js +92 -92
- package/src/assets/js/Base64Util.js +22 -22
- package/src/assets/js/common.js +11 -11
- package/src/assets/js/script.js +36 -36
- package/src/assets/less/common.css +6773 -6773
- package/src/assets/less/converSationContainer/common.less +191 -191
- package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
- package/src/assets/less/iconfont.css +37 -37
- package/src/assets/less/ticketMessage.less +211 -211
- package/src/components/ActionAlertIframe.vue +112 -112
- package/src/components/AiGuide.vue +467 -467
- package/src/components/AnswerDocknowledge.vue +362 -362
- package/src/components/AnswerVoice.vue +256 -0
- package/src/components/AskIFrame.vue +15 -15
- package/src/components/ConversationContainer.vue +4024 -4011
- package/src/components/FileType.vue +86 -86
- package/src/components/Message.vue +27 -27
- package/src/components/actionSatisfaction.vue +107 -107
- package/src/components/actionSendToBot.vue +62 -62
- package/src/components/answerDissatisfaction.vue +62 -62
- package/src/components/answerRadio.vue +76 -76
- package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
- package/src/components/ask-components/Msgloading.vue +37 -37
- package/src/components/ask-components/SatisfactionV2.vue +15 -15
- package/src/components/askVideo.vue +138 -138
- package/src/components/assetDetails.vue +370 -370
- package/src/components/assetMessage.vue +228 -228
- package/src/components/associationIntention.vue +323 -323
- package/src/components/attachmentPreview.vue +90 -90
- package/src/components/botActionSatisfactor.vue +68 -68
- package/src/components/chatContent.vue +513 -513
- package/src/components/feedBack.vue +136 -136
- package/src/components/fielListView.vue +344 -344
- package/src/components/file/AliyunOssComponents.vue +108 -108
- package/src/components/formTemplate.vue +3363 -3363
- package/src/components/loadingProcess.vue +164 -164
- package/src/components/message/ActionAlertIframe.vue +112 -112
- package/src/components/message/ShopMessage.vue +164 -164
- package/src/components/message/TextMessage.vue +924 -924
- package/src/components/message/TicketMessage.vue +177 -177
- package/src/components/message/swiper/index.js +4 -4
- package/src/components/message/swiper/ticketSwiper.vue +503 -503
- package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
- package/src/components/msgLoading.vue +231 -231
- package/src/components/myPopup.vue +70 -70
- package/src/components/popup.vue +227 -227
- package/src/components/previewDoc.vue +108 -112
- package/src/components/previewPdf.vue +205 -205
- package/src/components/receiverMessagePlatform.vue +65 -65
- package/src/components/recommend.vue +89 -89
- package/src/components/selector/hOption.vue +20 -20
- package/src/components/selector/hSelector.vue +199 -199
- package/src/components/selector/hWrapper.vue +216 -216
- package/src/components/senderMessagePlatform.vue +50 -50
- package/src/components/source/BotMessage.vue +24 -24
- package/src/components/source/CustomMessage.vue +24 -24
- package/src/components/test.vue +260 -260
- package/src/components/tree.vue +294 -294
- package/src/components/utils/AliyunIssUtil.js +72 -72
- package/src/components/utils/ckeditor.js +155 -155
- package/src/components/utils/ckeditorImageUpload/command.js +109 -109
- package/src/components/utils/ckeditorImageUpload/editing.js +11 -11
- package/src/components/utils/ckeditorImageUpload/plugin-image.js +11 -11
- package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +40 -40
- package/src/components/utils/ckeditorfileUpload/common.js +111 -111
- package/src/components/utils/ckeditorfileUpload/editing.js +11 -11
- package/src/components/utils/ckeditorfileUpload/plugin_file.js +11 -11
- package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +34 -34
- package/src/components/utils/format_date.js +25 -25
- package/src/components/utils/index.js +6 -6
- package/src/components/utils/math_utils.js +29 -29
- package/src/components/voiceComponent.vue +119 -119
- package/src/main.js +60 -60
- package/vue.config.js +55 -55
package/src/components/tree.vue
CHANGED
|
@@ -1,295 +1,295 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="tree">
|
|
3
|
-
<div class="tree-header">
|
|
4
|
-
<span class="cacel" @click="cancelBtn">取消</span>
|
|
5
|
-
<span class="primary" @click="saveData">确认</span>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="tree-input" v-if="setCascadeOption && setCascadeOption.length > 0">
|
|
8
|
-
<el-input
|
|
9
|
-
placeholder="请搜索"
|
|
10
|
-
v-model="filterText"
|
|
11
|
-
>
|
|
12
|
-
</el-input>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="tree-container">
|
|
15
|
-
<el-tree :data="setCascadeOption"
|
|
16
|
-
:props="defaultProps"
|
|
17
|
-
ref="dataTree"
|
|
18
|
-
node-key="value"
|
|
19
|
-
:expand-on-click-node="false"
|
|
20
|
-
:filter-node-method="filterNode"
|
|
21
|
-
>
|
|
22
|
-
<span class="custom-tree-node" slot-scope="{ node,data}" @click="nodeClick(data)">
|
|
23
|
-
<span class="tree-label">{{ node.label }}</span>
|
|
24
|
-
<span>
|
|
25
|
-
<el-checkbox v-model="data.checked" v-if="dataOptions.extInfo.selectType ==='多选'"></el-checkbox>
|
|
26
|
-
<el-radio v-model="checked" v-else :label="data.value"></el-radio>
|
|
27
|
-
</span>
|
|
28
|
-
</span>
|
|
29
|
-
</el-tree>
|
|
30
|
-
</div>
|
|
31
|
-
<!-- <div class="footer">
|
|
32
|
-
<el-button>取 消</el-button>
|
|
33
|
-
<el-button type="primary" @click="saveData">确 认</el-button>
|
|
34
|
-
</div>-->
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
/* eslint-disable */
|
|
40
|
-
export default {
|
|
41
|
-
name: "tree",
|
|
42
|
-
data(){
|
|
43
|
-
return{
|
|
44
|
-
defaultProps:{
|
|
45
|
-
label:"label",
|
|
46
|
-
value:"value"
|
|
47
|
-
},
|
|
48
|
-
checked:'',
|
|
49
|
-
// dataTree:[],
|
|
50
|
-
checkList:[],
|
|
51
|
-
checkDatas:[],
|
|
52
|
-
filterText:""
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
props:["dataOptions","fieldValue"],
|
|
56
|
-
methods:{
|
|
57
|
-
saveData(){
|
|
58
|
-
this.checkList = []
|
|
59
|
-
this.checkDatas = []
|
|
60
|
-
this.ergodicData(this.setCascadeOption,this.checkList)
|
|
61
|
-
this.$emit('saveData',this.checkList,this.checkDatas)
|
|
62
|
-
},
|
|
63
|
-
cancelBtn(){
|
|
64
|
-
this.$emit('cancelBtn')
|
|
65
|
-
},
|
|
66
|
-
ergodicData(list){
|
|
67
|
-
list.forEach(item=>{
|
|
68
|
-
if (this.dataOptions.extInfo.selectType === '多选'){
|
|
69
|
-
if (item.checked){
|
|
70
|
-
let data = this.$refs.dataTree.getNode(item)
|
|
71
|
-
let checkList = []
|
|
72
|
-
let arr = this.serchParent(data,checkList)
|
|
73
|
-
this.checkList.push(arr)
|
|
74
|
-
this.checkDatas.push(item)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
if (item.value === this.checked){
|
|
79
|
-
let data = this.$refs.dataTree.getNode(item)
|
|
80
|
-
let checkList = []
|
|
81
|
-
let arr = this.serchParent(data,checkList)
|
|
82
|
-
this.checkList = arr
|
|
83
|
-
this.checkDatas = [item]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (item.children){
|
|
87
|
-
this.ergodicData(item.children)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
},
|
|
91
|
-
serchParent(node,list) {
|
|
92
|
-
if(node) {
|
|
93
|
-
if(Object.prototype.toString.call(node.data) == '[object Object]') {
|
|
94
|
-
list.unshift(node.data.value)
|
|
95
|
-
}
|
|
96
|
-
if(node.parent) {
|
|
97
|
-
list = this.serchParent(node.parent,list)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return list
|
|
101
|
-
},
|
|
102
|
-
filterNode(value, data, node) {
|
|
103
|
-
if (!value) return true;
|
|
104
|
-
let upperCase = value.toUpperCase()
|
|
105
|
-
let lowerCase = value.toLowerCase()
|
|
106
|
-
let serchFlag = false
|
|
107
|
-
if (node.parent && Object.prototype.toString.call(node.parent.data) == '[object Object]') {
|
|
108
|
-
serchFlag = node.parent.data.label.indexOf(value) !== -1 || node.parent.data.label.indexOf(upperCase) !== -1 || node.parent.data.label.indexOf(lowerCase) !== -1
|
|
109
|
-
}
|
|
110
|
-
return data.label.indexOf(value) !== -1 || data.label.indexOf(upperCase) !== -1 || data.label.indexOf(lowerCase) !== -1 || serchFlag;
|
|
111
|
-
},
|
|
112
|
-
nodeClick(data,node){
|
|
113
|
-
if (this.dataOptions.extInfo.selectType !== '多选'){
|
|
114
|
-
this.ergodicCascade(this.setCascadeOption)
|
|
115
|
-
} else {
|
|
116
|
-
this.$set(data,'checked',!data.checked)
|
|
117
|
-
}
|
|
118
|
-
if (this.dataOptions.extInfo.selectType !== '多选'){
|
|
119
|
-
this.checked = data.value;
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
ergodicCascade(list){
|
|
123
|
-
list.forEach(item=>{
|
|
124
|
-
item.checked = false;
|
|
125
|
-
if (item.children){
|
|
126
|
-
this.ergodicCascade(item.children)
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
computed: {
|
|
132
|
-
dataTree() {
|
|
133
|
-
let arr = []
|
|
134
|
-
if (this.dataOptions.extInfo.cascadeDown.options){
|
|
135
|
-
arr = this.dataOptions.extInfo.cascadeDown.options
|
|
136
|
-
}
|
|
137
|
-
else if (this.dataOptions.extInfo.cascade){
|
|
138
|
-
arr = this.dataOptions.extInfo.cascade
|
|
139
|
-
}
|
|
140
|
-
else if (this.dataOptions.extInfo.cascadeDown && this.dataOptions.extInfo.cascadeDown[0]){
|
|
141
|
-
arr = this.dataOptions.extInfo.cascadeDown[0].options
|
|
142
|
-
}
|
|
143
|
-
return arr
|
|
144
|
-
},
|
|
145
|
-
//规则中限制极限的选项
|
|
146
|
-
setCascadeOption(){
|
|
147
|
-
let options = [];
|
|
148
|
-
let arr = []
|
|
149
|
-
if (this.dataOptions.extInfo && (this.dataOptions.extInfo.cascadeDown || this.dataOptions.extInfo.cascade)){
|
|
150
|
-
arr = this.dataOptions.extInfo.cascadeDown.options ? this.dataOptions.extInfo.cascadeDown.options :
|
|
151
|
-
(this.dataOptions.extInfo.cascadeDown[0] ? this.dataOptions.extInfo.cascadeDown[0].options :
|
|
152
|
-
(this.dataOptions.extInfo.cascade ? this.dataOptions.extInfo.cascade: []));
|
|
153
|
-
}
|
|
154
|
-
if (this.dataOptions.extInfo && this.dataOptions.extInfo.dependent && JSON.stringify(this.dataOptions.extInfo.dependent)!=='{}'){
|
|
155
|
-
for (let k in this.dataOptions.extInfo.dependent){
|
|
156
|
-
if (Array.isArray(this.fieldValue[k]) && Array.isArray(this.fieldValue[k][0])){
|
|
157
|
-
this.fieldValue[k].forEach(item=>{
|
|
158
|
-
this.dataOptions.extInfo.dependent[k].filterStruct.forEach(filter=>{
|
|
159
|
-
if (filter.input === item || item[item.length - 1] == filter.input){
|
|
160
|
-
if (!options){
|
|
161
|
-
options = []
|
|
162
|
-
}
|
|
163
|
-
options = options.concat(filter.output)
|
|
164
|
-
}
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
console.log(this.dataOptions.extInfo.dependent[k].filterStruct);
|
|
170
|
-
this.dataOptions.extInfo.dependent[k].filterStruct.forEach(filter=>{
|
|
171
|
-
if (this.fieldValue[k] && (filter.input === this.fieldValue[k] || this.fieldValue[k][this.fieldValue[k].length - 1] == filter.input)){
|
|
172
|
-
options = filter.output;
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const initCascade = (arr, parent)=>{
|
|
179
|
-
return JSON.parse(JSON.stringify(arr)).filter(item =>{
|
|
180
|
-
if (item.children){
|
|
181
|
-
item.children = initCascade(item.children, item)
|
|
182
|
-
}
|
|
183
|
-
let flag = null
|
|
184
|
-
for (let i = 0; i < options.length; i++) {
|
|
185
|
-
const optArr = options[i];
|
|
186
|
-
item.checked = false;
|
|
187
|
-
if(optArr.indexOf(item.value) !== -1) {
|
|
188
|
-
if(parent === null || item.children && item.children.length != 0) {
|
|
189
|
-
flag = true
|
|
190
|
-
} else if(parent && optArr.indexOf(parent.value) !== -1 &&
|
|
191
|
-
(Math.abs(optArr.indexOf(parent.value) - optArr.indexOf(item.value)) === 1 )) {
|
|
192
|
-
flag = true
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return flag && item
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
arr = initCascade(arr,null)
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
return arr
|
|
203
|
-
}
|
|
204
|
-
console.debug('options',arr)
|
|
205
|
-
return arr
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
watch:{
|
|
209
|
-
filterText(val) {
|
|
210
|
-
this.$refs.dataTree.filter(val);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// mounted() {
|
|
214
|
-
// if (this.dataOptions.extInfo.cascadeDown.options){
|
|
215
|
-
// debugger
|
|
216
|
-
// this.dataTree = this.dataOptions.extInfo.cascadeDown.options
|
|
217
|
-
// }
|
|
218
|
-
// else if (this.dataOptions.extInfo.cascade){
|
|
219
|
-
// this.dataTree = this.dataOptions.extInfo.cascade
|
|
220
|
-
// }
|
|
221
|
-
// else if (this.dataOptions.extInfo.cascadeDown && this.dataOptions.extInfo.cascadeDown[0]){
|
|
222
|
-
// this.dataTree = this.dataOptions.extInfo.cascadeDown[0].options
|
|
223
|
-
// }
|
|
224
|
-
// console.debug('dataTree',this.dataOptions,this.dataTree)
|
|
225
|
-
// }
|
|
226
|
-
};
|
|
227
|
-
</script>
|
|
228
|
-
|
|
229
|
-
<style scoped lang="less">
|
|
230
|
-
#tree{
|
|
231
|
-
height: 100%;
|
|
232
|
-
overflow: hidden;
|
|
233
|
-
/deep/.el-tree-node__content{
|
|
234
|
-
height: 38px;
|
|
235
|
-
line-height: 38px;
|
|
236
|
-
}
|
|
237
|
-
.tree-header{
|
|
238
|
-
height: 30px;
|
|
239
|
-
display: flex;
|
|
240
|
-
align-items: center;
|
|
241
|
-
justify-content: space-between;
|
|
242
|
-
margin: 0 20px;
|
|
243
|
-
width: calc(100% - 40px);
|
|
244
|
-
/*font-size: 14px;*/
|
|
245
|
-
padding-bottom: 20px;
|
|
246
|
-
.primary{
|
|
247
|
-
color: #366aff;
|
|
248
|
-
cursor: pointer;
|
|
249
|
-
}
|
|
250
|
-
.cacel{
|
|
251
|
-
color: #969799;
|
|
252
|
-
cursor: pointer;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
.tree-input{
|
|
256
|
-
width: calc(100% - 20px);
|
|
257
|
-
margin: 0 10px 10px 10px;
|
|
258
|
-
}
|
|
259
|
-
.tree-container{
|
|
260
|
-
height:260px;
|
|
261
|
-
overflow-y: scroll;
|
|
262
|
-
overflow-x: hidden;
|
|
263
|
-
}
|
|
264
|
-
.custom-tree-node{
|
|
265
|
-
display: flex;
|
|
266
|
-
align-items: center;
|
|
267
|
-
justify-content: space-between;
|
|
268
|
-
width: calc(100% - 40px);
|
|
269
|
-
font-size: 14px;
|
|
270
|
-
.tree-label{
|
|
271
|
-
max-width: 100%;
|
|
272
|
-
overflow: hidden;
|
|
273
|
-
text-overflow: ellipsis;
|
|
274
|
-
white-space: nowrap;
|
|
275
|
-
}
|
|
276
|
-
/deep/.el-radio__label{
|
|
277
|
-
display: none;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
.footer{
|
|
281
|
-
position: absolute;
|
|
282
|
-
bottom: 0;
|
|
283
|
-
height: 60px;
|
|
284
|
-
display: flex;
|
|
285
|
-
align-items: center;
|
|
286
|
-
justify-content: space-between;
|
|
287
|
-
width: calc(100% - 40px);
|
|
288
|
-
margin: 0 20px;
|
|
289
|
-
.el-button{
|
|
290
|
-
flex: 1;
|
|
291
|
-
border-radius: 9px;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div id="tree">
|
|
3
|
+
<div class="tree-header">
|
|
4
|
+
<span class="cacel" @click="cancelBtn">取消</span>
|
|
5
|
+
<span class="primary" @click="saveData">确认</span>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="tree-input" v-if="setCascadeOption && setCascadeOption.length > 0">
|
|
8
|
+
<el-input
|
|
9
|
+
placeholder="请搜索"
|
|
10
|
+
v-model="filterText"
|
|
11
|
+
>
|
|
12
|
+
</el-input>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="tree-container">
|
|
15
|
+
<el-tree :data="setCascadeOption"
|
|
16
|
+
:props="defaultProps"
|
|
17
|
+
ref="dataTree"
|
|
18
|
+
node-key="value"
|
|
19
|
+
:expand-on-click-node="false"
|
|
20
|
+
:filter-node-method="filterNode"
|
|
21
|
+
>
|
|
22
|
+
<span class="custom-tree-node" slot-scope="{ node,data}" @click="nodeClick(data)">
|
|
23
|
+
<span class="tree-label">{{ node.label }}</span>
|
|
24
|
+
<span>
|
|
25
|
+
<el-checkbox v-model="data.checked" v-if="dataOptions.extInfo.selectType ==='多选'"></el-checkbox>
|
|
26
|
+
<el-radio v-model="checked" v-else :label="data.value"></el-radio>
|
|
27
|
+
</span>
|
|
28
|
+
</span>
|
|
29
|
+
</el-tree>
|
|
30
|
+
</div>
|
|
31
|
+
<!-- <div class="footer">
|
|
32
|
+
<el-button>取 消</el-button>
|
|
33
|
+
<el-button type="primary" @click="saveData">确 认</el-button>
|
|
34
|
+
</div>-->
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
/* eslint-disable */
|
|
40
|
+
export default {
|
|
41
|
+
name: "tree",
|
|
42
|
+
data(){
|
|
43
|
+
return{
|
|
44
|
+
defaultProps:{
|
|
45
|
+
label:"label",
|
|
46
|
+
value:"value"
|
|
47
|
+
},
|
|
48
|
+
checked:'',
|
|
49
|
+
// dataTree:[],
|
|
50
|
+
checkList:[],
|
|
51
|
+
checkDatas:[],
|
|
52
|
+
filterText:""
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
props:["dataOptions","fieldValue"],
|
|
56
|
+
methods:{
|
|
57
|
+
saveData(){
|
|
58
|
+
this.checkList = []
|
|
59
|
+
this.checkDatas = []
|
|
60
|
+
this.ergodicData(this.setCascadeOption,this.checkList)
|
|
61
|
+
this.$emit('saveData',this.checkList,this.checkDatas)
|
|
62
|
+
},
|
|
63
|
+
cancelBtn(){
|
|
64
|
+
this.$emit('cancelBtn')
|
|
65
|
+
},
|
|
66
|
+
ergodicData(list){
|
|
67
|
+
list.forEach(item=>{
|
|
68
|
+
if (this.dataOptions.extInfo.selectType === '多选'){
|
|
69
|
+
if (item.checked){
|
|
70
|
+
let data = this.$refs.dataTree.getNode(item)
|
|
71
|
+
let checkList = []
|
|
72
|
+
let arr = this.serchParent(data,checkList)
|
|
73
|
+
this.checkList.push(arr)
|
|
74
|
+
this.checkDatas.push(item)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (item.value === this.checked){
|
|
79
|
+
let data = this.$refs.dataTree.getNode(item)
|
|
80
|
+
let checkList = []
|
|
81
|
+
let arr = this.serchParent(data,checkList)
|
|
82
|
+
this.checkList = arr
|
|
83
|
+
this.checkDatas = [item]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (item.children){
|
|
87
|
+
this.ergodicData(item.children)
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
serchParent(node,list) {
|
|
92
|
+
if(node) {
|
|
93
|
+
if(Object.prototype.toString.call(node.data) == '[object Object]') {
|
|
94
|
+
list.unshift(node.data.value)
|
|
95
|
+
}
|
|
96
|
+
if(node.parent) {
|
|
97
|
+
list = this.serchParent(node.parent,list)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return list
|
|
101
|
+
},
|
|
102
|
+
filterNode(value, data, node) {
|
|
103
|
+
if (!value) return true;
|
|
104
|
+
let upperCase = value.toUpperCase()
|
|
105
|
+
let lowerCase = value.toLowerCase()
|
|
106
|
+
let serchFlag = false
|
|
107
|
+
if (node.parent && Object.prototype.toString.call(node.parent.data) == '[object Object]') {
|
|
108
|
+
serchFlag = node.parent.data.label.indexOf(value) !== -1 || node.parent.data.label.indexOf(upperCase) !== -1 || node.parent.data.label.indexOf(lowerCase) !== -1
|
|
109
|
+
}
|
|
110
|
+
return data.label.indexOf(value) !== -1 || data.label.indexOf(upperCase) !== -1 || data.label.indexOf(lowerCase) !== -1 || serchFlag;
|
|
111
|
+
},
|
|
112
|
+
nodeClick(data,node){
|
|
113
|
+
if (this.dataOptions.extInfo.selectType !== '多选'){
|
|
114
|
+
this.ergodicCascade(this.setCascadeOption)
|
|
115
|
+
} else {
|
|
116
|
+
this.$set(data,'checked',!data.checked)
|
|
117
|
+
}
|
|
118
|
+
if (this.dataOptions.extInfo.selectType !== '多选'){
|
|
119
|
+
this.checked = data.value;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
ergodicCascade(list){
|
|
123
|
+
list.forEach(item=>{
|
|
124
|
+
item.checked = false;
|
|
125
|
+
if (item.children){
|
|
126
|
+
this.ergodicCascade(item.children)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
dataTree() {
|
|
133
|
+
let arr = []
|
|
134
|
+
if (this.dataOptions.extInfo.cascadeDown.options){
|
|
135
|
+
arr = this.dataOptions.extInfo.cascadeDown.options
|
|
136
|
+
}
|
|
137
|
+
else if (this.dataOptions.extInfo.cascade){
|
|
138
|
+
arr = this.dataOptions.extInfo.cascade
|
|
139
|
+
}
|
|
140
|
+
else if (this.dataOptions.extInfo.cascadeDown && this.dataOptions.extInfo.cascadeDown[0]){
|
|
141
|
+
arr = this.dataOptions.extInfo.cascadeDown[0].options
|
|
142
|
+
}
|
|
143
|
+
return arr
|
|
144
|
+
},
|
|
145
|
+
//规则中限制极限的选项
|
|
146
|
+
setCascadeOption(){
|
|
147
|
+
let options = [];
|
|
148
|
+
let arr = []
|
|
149
|
+
if (this.dataOptions.extInfo && (this.dataOptions.extInfo.cascadeDown || this.dataOptions.extInfo.cascade)){
|
|
150
|
+
arr = this.dataOptions.extInfo.cascadeDown.options ? this.dataOptions.extInfo.cascadeDown.options :
|
|
151
|
+
(this.dataOptions.extInfo.cascadeDown[0] ? this.dataOptions.extInfo.cascadeDown[0].options :
|
|
152
|
+
(this.dataOptions.extInfo.cascade ? this.dataOptions.extInfo.cascade: []));
|
|
153
|
+
}
|
|
154
|
+
if (this.dataOptions.extInfo && this.dataOptions.extInfo.dependent && JSON.stringify(this.dataOptions.extInfo.dependent)!=='{}'){
|
|
155
|
+
for (let k in this.dataOptions.extInfo.dependent){
|
|
156
|
+
if (Array.isArray(this.fieldValue[k]) && Array.isArray(this.fieldValue[k][0])){
|
|
157
|
+
this.fieldValue[k].forEach(item=>{
|
|
158
|
+
this.dataOptions.extInfo.dependent[k].filterStruct.forEach(filter=>{
|
|
159
|
+
if (filter.input === item || item[item.length - 1] == filter.input){
|
|
160
|
+
if (!options){
|
|
161
|
+
options = []
|
|
162
|
+
}
|
|
163
|
+
options = options.concat(filter.output)
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
console.log(this.dataOptions.extInfo.dependent[k].filterStruct);
|
|
170
|
+
this.dataOptions.extInfo.dependent[k].filterStruct.forEach(filter=>{
|
|
171
|
+
if (this.fieldValue[k] && (filter.input === this.fieldValue[k] || this.fieldValue[k][this.fieldValue[k].length - 1] == filter.input)){
|
|
172
|
+
options = filter.output;
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const initCascade = (arr, parent)=>{
|
|
179
|
+
return JSON.parse(JSON.stringify(arr)).filter(item =>{
|
|
180
|
+
if (item.children){
|
|
181
|
+
item.children = initCascade(item.children, item)
|
|
182
|
+
}
|
|
183
|
+
let flag = null
|
|
184
|
+
for (let i = 0; i < options.length; i++) {
|
|
185
|
+
const optArr = options[i];
|
|
186
|
+
item.checked = false;
|
|
187
|
+
if(optArr.indexOf(item.value) !== -1) {
|
|
188
|
+
if(parent === null || item.children && item.children.length != 0) {
|
|
189
|
+
flag = true
|
|
190
|
+
} else if(parent && optArr.indexOf(parent.value) !== -1 &&
|
|
191
|
+
(Math.abs(optArr.indexOf(parent.value) - optArr.indexOf(item.value)) === 1 )) {
|
|
192
|
+
flag = true
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return flag && item
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
arr = initCascade(arr,null)
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
return arr
|
|
203
|
+
}
|
|
204
|
+
console.debug('options',arr)
|
|
205
|
+
return arr
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
watch:{
|
|
209
|
+
filterText(val) {
|
|
210
|
+
this.$refs.dataTree.filter(val);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// mounted() {
|
|
214
|
+
// if (this.dataOptions.extInfo.cascadeDown.options){
|
|
215
|
+
// debugger
|
|
216
|
+
// this.dataTree = this.dataOptions.extInfo.cascadeDown.options
|
|
217
|
+
// }
|
|
218
|
+
// else if (this.dataOptions.extInfo.cascade){
|
|
219
|
+
// this.dataTree = this.dataOptions.extInfo.cascade
|
|
220
|
+
// }
|
|
221
|
+
// else if (this.dataOptions.extInfo.cascadeDown && this.dataOptions.extInfo.cascadeDown[0]){
|
|
222
|
+
// this.dataTree = this.dataOptions.extInfo.cascadeDown[0].options
|
|
223
|
+
// }
|
|
224
|
+
// console.debug('dataTree',this.dataOptions,this.dataTree)
|
|
225
|
+
// }
|
|
226
|
+
};
|
|
227
|
+
</script>
|
|
228
|
+
|
|
229
|
+
<style scoped lang="less">
|
|
230
|
+
#tree{
|
|
231
|
+
height: 100%;
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
/deep/.el-tree-node__content{
|
|
234
|
+
height: 38px;
|
|
235
|
+
line-height: 38px;
|
|
236
|
+
}
|
|
237
|
+
.tree-header{
|
|
238
|
+
height: 30px;
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
margin: 0 20px;
|
|
243
|
+
width: calc(100% - 40px);
|
|
244
|
+
/*font-size: 14px;*/
|
|
245
|
+
padding-bottom: 20px;
|
|
246
|
+
.primary{
|
|
247
|
+
color: #366aff;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
}
|
|
250
|
+
.cacel{
|
|
251
|
+
color: #969799;
|
|
252
|
+
cursor: pointer;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
.tree-input{
|
|
256
|
+
width: calc(100% - 20px);
|
|
257
|
+
margin: 0 10px 10px 10px;
|
|
258
|
+
}
|
|
259
|
+
.tree-container{
|
|
260
|
+
height:260px;
|
|
261
|
+
overflow-y: scroll;
|
|
262
|
+
overflow-x: hidden;
|
|
263
|
+
}
|
|
264
|
+
.custom-tree-node{
|
|
265
|
+
display: flex;
|
|
266
|
+
align-items: center;
|
|
267
|
+
justify-content: space-between;
|
|
268
|
+
width: calc(100% - 40px);
|
|
269
|
+
font-size: 14px;
|
|
270
|
+
.tree-label{
|
|
271
|
+
max-width: 100%;
|
|
272
|
+
overflow: hidden;
|
|
273
|
+
text-overflow: ellipsis;
|
|
274
|
+
white-space: nowrap;
|
|
275
|
+
}
|
|
276
|
+
/deep/.el-radio__label{
|
|
277
|
+
display: none;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
.footer{
|
|
281
|
+
position: absolute;
|
|
282
|
+
bottom: 0;
|
|
283
|
+
height: 60px;
|
|
284
|
+
display: flex;
|
|
285
|
+
align-items: center;
|
|
286
|
+
justify-content: space-between;
|
|
287
|
+
width: calc(100% - 40px);
|
|
288
|
+
margin: 0 20px;
|
|
289
|
+
.el-button{
|
|
290
|
+
flex: 1;
|
|
291
|
+
border-radius: 9px;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
295
|
</style>
|