|
|
@@ -1,218 +1,224 @@
|
|
1
|
1
|
<template>
|
|
2
|
|
- <el-cascader ref="cascader" v-model="orderType" :options="orderData" :props="TagProps" clearable style="width:100%;" @change="handleChange" />
|
|
|
2
|
+ <el-cascader ref="cascader" v-model="orderType" :options="orderData" :props="TagProps" clearable style="width:100%;"
|
|
|
3
|
+ @change="handleChange" />
|
|
3
|
4
|
</template>
|
|
4
|
5
|
|
|
5
|
6
|
<script>
|
|
6
|
|
-import {
|
|
7
|
|
- getOrderTypeList
|
|
8
|
|
-} from '@/api/commonAPI'
|
|
9
|
|
-import { getOrderTypeLists } from '@/api/systemSetup/roleSetting/orderTypeManage'
|
|
10
|
|
-import {
|
|
11
|
|
- eventBus
|
|
12
|
|
-} from './eventBus.js'
|
|
13
|
|
-export default {
|
|
14
|
|
- name: 'SelectOrderType',
|
|
15
|
|
- filters: {
|
|
16
|
|
- orderFilter(status) {
|
|
17
|
|
- const statusMap = {
|
|
18
|
|
- // 2003: true,
|
|
19
|
|
- // 2008: true,
|
|
20
|
|
- // 2009: true
|
|
21
|
|
- }
|
|
22
|
|
- return statusMap[status]
|
|
23
|
|
- }
|
|
24
|
|
- },
|
|
25
|
|
- props: {
|
|
26
|
|
- firstOrderType: {
|
|
27
|
|
- type: Object,
|
|
28
|
|
- default() {
|
|
29
|
|
- return {}
|
|
|
7
|
+ import {
|
|
|
8
|
+ getOrderTypeList
|
|
|
9
|
+ } from '@/api/commonAPI'
|
|
|
10
|
+ import {
|
|
|
11
|
+ getOrderTypeLists
|
|
|
12
|
+ } from '@/api/systemSetup/roleSetting/orderTypeManage'
|
|
|
13
|
+ import {
|
|
|
14
|
+ eventBus
|
|
|
15
|
+ } from './eventBus.js'
|
|
|
16
|
+ export default {
|
|
|
17
|
+ name: 'SelectOrderType',
|
|
|
18
|
+ filters: {
|
|
|
19
|
+ orderFilter(status) {
|
|
|
20
|
+ const statusMap = {
|
|
|
21
|
+ // 2003: true,
|
|
|
22
|
+ // 2008: true,
|
|
|
23
|
+ // 2009: true
|
|
|
24
|
+ }
|
|
|
25
|
+ return statusMap[status]
|
|
30
|
26
|
}
|
|
31
|
27
|
},
|
|
32
|
|
- secondOrderType: {
|
|
33
|
|
- type: Object,
|
|
34
|
|
- default() {
|
|
35
|
|
- return {}
|
|
|
28
|
+ props: {
|
|
|
29
|
+ firstOrderType: {
|
|
|
30
|
+ type: Object,
|
|
|
31
|
+ default () {
|
|
|
32
|
+ return {}
|
|
|
33
|
+ }
|
|
|
34
|
+ },
|
|
|
35
|
+ secondOrderType: {
|
|
|
36
|
+ type: Object,
|
|
|
37
|
+ default () {
|
|
|
38
|
+ return {}
|
|
|
39
|
+ }
|
|
|
40
|
+ },
|
|
|
41
|
+ thirdOrderType: {
|
|
|
42
|
+ type: Object,
|
|
|
43
|
+ default () {
|
|
|
44
|
+ return {}
|
|
|
45
|
+ }
|
|
|
46
|
+ },
|
|
|
47
|
+ orderTypeparams: {
|
|
|
48
|
+ type: Array,
|
|
|
49
|
+ default () {
|
|
|
50
|
+ return []
|
|
|
51
|
+ }
|
|
|
52
|
+ },
|
|
|
53
|
+ r2type:{
|
|
|
54
|
+ type:String,
|
|
|
55
|
+ default:''
|
|
36
|
56
|
}
|
|
37
|
57
|
},
|
|
38
|
|
- thirdOrderType: {
|
|
39
|
|
- type: Object,
|
|
40
|
|
- default() {
|
|
41
|
|
- return {}
|
|
|
58
|
+ data() {
|
|
|
59
|
+ return {
|
|
|
60
|
+ TagProps: {
|
|
|
61
|
+ checkStrictly: true,
|
|
|
62
|
+ value: 'id',
|
|
|
63
|
+ label: 'text',
|
|
|
64
|
+ children: 'children',
|
|
|
65
|
+ },
|
|
|
66
|
+ orderTypeData: {
|
|
|
67
|
+ name: '',
|
|
|
68
|
+ value: 0,
|
|
|
69
|
+ identification: '',
|
|
|
70
|
+ type2Arr: []
|
|
|
71
|
+ },
|
|
|
72
|
+ typeid: 1,
|
|
|
73
|
+ pid: 0,
|
|
|
74
|
+ orderData: [], // 业务类别数据
|
|
|
75
|
+ orderType: []
|
|
42
|
76
|
}
|
|
43
|
77
|
},
|
|
44
|
|
- orderTypeparams:{
|
|
45
|
|
- type: Array,
|
|
46
|
|
- default() {
|
|
47
|
|
- return []
|
|
48
|
|
- }
|
|
49
|
|
- }
|
|
50
|
|
- },
|
|
51
|
|
- data() {
|
|
52
|
|
- return {
|
|
53
|
|
- TagProps: {
|
|
54
|
|
- checkStrictly: true,
|
|
55
|
|
- value: 'id',
|
|
56
|
|
- label: 'text',
|
|
57
|
|
- children: 'children',
|
|
58
|
|
- },
|
|
59
|
|
- orderTypeData: {
|
|
60
|
|
- name: '',
|
|
61
|
|
- value: 0,
|
|
62
|
|
- identification:'',
|
|
63
|
|
- type2Arr:[]
|
|
|
78
|
+ watch: {
|
|
|
79
|
+ orderTypeparams(val) {
|
|
|
80
|
+ this.orderType = val
|
|
64
|
81
|
},
|
|
65
|
|
- typeid: 1,
|
|
66
|
|
- pid: 0,
|
|
67
|
|
- orderData: [], // 业务类别数据
|
|
68
|
|
- orderType:[]
|
|
69
|
|
- }
|
|
70
|
|
- },
|
|
71
|
|
- watch: {
|
|
72
|
|
- orderTypeparams(val){
|
|
73
|
|
- this.orderType = val
|
|
74
|
|
- },
|
|
75
|
|
- 'firstOrderType.pid': function() {
|
|
76
|
|
- // console.log(this.firstOrderType)
|
|
77
|
|
- this.orderTypeData.name = ''
|
|
78
|
|
- this.orderTypeData.value = 0
|
|
79
|
|
- this.$emit('post-first-order-type', this.orderTypeData)
|
|
80
|
|
- this.typeid = this.firstOrderType.typeid
|
|
81
|
|
- this.commonOrderType(this.firstOrderType.typeid, this.firstOrderType.pid)
|
|
82
|
|
- },
|
|
83
|
|
- 'secondOrderType.pid': function() {
|
|
84
|
|
- // console.log(this.secondOrderType.pid)
|
|
85
|
|
- this.orderTypeData.name = ''
|
|
86
|
|
- this.orderTypeData.value = 0
|
|
87
|
|
- this.$emit('post-second-order-type', this.orderTypeData)
|
|
88
|
|
- this.typeid = this.secondOrderType.typeid
|
|
89
|
|
- this.commonOrderType(this.secondOrderType.typeid, this.secondOrderType.pid)
|
|
90
|
|
- },
|
|
91
|
|
- 'thirdOrderType.pid': function() {
|
|
92
|
|
- this.orderTypeData.name = ''
|
|
93
|
|
- this.orderTypeData.value = 0
|
|
94
|
|
- this.$emit('post-third-order-type', this.orderTypeData)
|
|
95
|
|
- this.typeid = this.thirdOrderType.typeid
|
|
96
|
|
- this.commonOrderType(this.thirdOrderType.typeid, this.thirdOrderType.pid)
|
|
97
|
|
- }
|
|
98
|
|
-
|
|
99
|
|
- },
|
|
100
|
|
- created() {
|
|
101
|
|
- // 默认数据加载
|
|
102
|
|
- this.defaultData()
|
|
103
|
|
- // 编辑详情展示
|
|
104
|
|
- this.showDetail()
|
|
105
|
|
-
|
|
106
|
|
- this.getEventBus()
|
|
107
|
|
- // if(this.orderTypeData.name==''){
|
|
108
|
|
- // console.log(this.orderTypeData)
|
|
109
|
|
- // this.getTreeList(1000)
|
|
110
|
|
- // }
|
|
111
|
|
- },
|
|
112
|
|
- methods: {
|
|
113
|
|
- getEventBus() {
|
|
114
|
|
- eventBus.$on('typeId', (data) => {
|
|
115
|
|
- // console.log(data);
|
|
116
|
|
- this.secondOrderType.pid = data
|
|
117
|
|
- })
|
|
118
|
|
- },
|
|
119
|
|
- defaultData() {
|
|
120
|
|
- if (JSON.stringify(this.firstOrderType) !== '{}') {
|
|
121
|
|
- console.log(this.firstOrderType)
|
|
122
|
|
- console.log(JSON.stringify(this.firstOrderType))
|
|
|
82
|
+ 'firstOrderType.pid': function() {
|
|
|
83
|
+ this.orderTypeData.name = ''
|
|
|
84
|
+ this.orderTypeData.value = 0
|
|
|
85
|
+ this.$emit('post-first-order-type', this.orderTypeData)
|
|
|
86
|
+ this.typeid = this.firstOrderType.typeid
|
|
123
|
87
|
this.commonOrderType(this.firstOrderType.typeid, this.firstOrderType.pid)
|
|
124
|
|
- }
|
|
125
|
|
- if (JSON.stringify(this.thirdOrderType) !== '{}' && this.thirdOrderType.pid) {
|
|
126
|
|
- this.typeid = this.thirdOrderType.typeid
|
|
127
|
|
- this.commonOrderType(this.thirdOrderType.typeid, this.thirdOrderType.pid)
|
|
128
|
|
- }
|
|
129
|
|
- if (JSON.stringify(this.secondOrderType) !== '{}' && this.secondOrderType.pid) {
|
|
|
88
|
+ },
|
|
|
89
|
+ 'secondOrderType.pid': function() {
|
|
|
90
|
+ this.orderTypeData.name = ''
|
|
|
91
|
+ this.orderTypeData.value = 0
|
|
|
92
|
+ this.$emit('post-second-order-type', this.orderTypeData)
|
|
130
|
93
|
this.typeid = this.secondOrderType.typeid
|
|
131
|
94
|
this.commonOrderType(this.secondOrderType.typeid, this.secondOrderType.pid)
|
|
|
95
|
+ },
|
|
|
96
|
+ 'thirdOrderType.pid': function() {
|
|
|
97
|
+ this.orderTypeData.name = ''
|
|
|
98
|
+ this.orderTypeData.value = 0
|
|
|
99
|
+ this.$emit('post-third-order-type', this.orderTypeData)
|
|
|
100
|
+ this.typeid = this.thirdOrderType.typeid
|
|
|
101
|
+ this.commonOrderType(this.thirdOrderType.typeid, this.thirdOrderType.pid)
|
|
132
|
102
|
}
|
|
|
103
|
+
|
|
133
|
104
|
},
|
|
134
|
|
- showDetail() {
|
|
135
|
|
- if (this.firstOrderType.name) {
|
|
136
|
|
- this.orderTypeData.name = this.firstOrderType.name
|
|
137
|
|
- }
|
|
138
|
|
- if (this.secondOrderType.name) {
|
|
139
|
|
- this.orderTypeData.name = this.secondOrderType.name
|
|
140
|
|
- }
|
|
141
|
|
- if (this.thirdOrderType.name) {
|
|
142
|
|
- this.orderTypeData.name = this.thirdOrderType.name
|
|
|
105
|
+ created() {
|
|
|
106
|
+ // 默认数据加载
|
|
|
107
|
+ this.defaultData()
|
|
|
108
|
+ // 编辑详情展示
|
|
|
109
|
+ this.showDetail()
|
|
|
110
|
+
|
|
|
111
|
+ this.getEventBus()
|
|
|
112
|
+
|
|
|
113
|
+ if(this.r2type){
|
|
|
114
|
+ var arr = this.$store.getters.workTypeMap[parseInt(this.r2type)].ids
|
|
|
115
|
+ this.orderType = arr.slice(1)
|
|
143
|
116
|
}
|
|
144
|
117
|
},
|
|
145
|
|
- commonOrderType(id, pid) {
|
|
146
|
|
- console.log(pid)
|
|
147
|
|
- this.getTreeList(pid)
|
|
148
|
|
- },
|
|
149
|
|
- getTreeList(pid) {
|
|
150
|
|
- return new Promise((resolve) => {
|
|
151
|
|
- const params = {
|
|
152
|
|
- pid: pid,
|
|
153
|
|
- flag: 1
|
|
|
118
|
+ methods: {
|
|
|
119
|
+ getEventBus() {
|
|
|
120
|
+ eventBus.$on('typeId', (data) => {
|
|
|
121
|
+ // console.log(data);
|
|
|
122
|
+ this.secondOrderType.pid = data
|
|
|
123
|
+ })
|
|
|
124
|
+ },
|
|
|
125
|
+ defaultData() {
|
|
|
126
|
+ if (JSON.stringify(this.firstOrderType) !== '{}') {
|
|
|
127
|
+ console.log(this.firstOrderType)
|
|
|
128
|
+ console.log(JSON.stringify(this.firstOrderType))
|
|
|
129
|
+ this.commonOrderType(this.firstOrderType.typeid, this.firstOrderType.pid)
|
|
|
130
|
+ }
|
|
|
131
|
+ if (JSON.stringify(this.thirdOrderType) !== '{}' && this.thirdOrderType.pid) {
|
|
|
132
|
+ this.typeid = this.thirdOrderType.typeid
|
|
|
133
|
+ this.commonOrderType(this.thirdOrderType.typeid, this.thirdOrderType.pid)
|
|
|
134
|
+ }
|
|
|
135
|
+ if (JSON.stringify(this.secondOrderType) !== '{}' && this.secondOrderType.pid) {
|
|
|
136
|
+ this.typeid = this.secondOrderType.typeid
|
|
|
137
|
+ this.commonOrderType(this.secondOrderType.typeid, this.secondOrderType.pid)
|
|
|
138
|
+ }
|
|
|
139
|
+ },
|
|
|
140
|
+ showDetail() {
|
|
|
141
|
+ if (this.firstOrderType.name) {
|
|
|
142
|
+ this.orderTypeData.name = this.firstOrderType.name
|
|
|
143
|
+ }
|
|
|
144
|
+ if (this.secondOrderType.name) {
|
|
|
145
|
+ this.orderTypeData.name = this.secondOrderType.name
|
|
|
146
|
+ }
|
|
|
147
|
+ if (this.thirdOrderType.name) {
|
|
|
148
|
+ this.orderTypeData.name = this.thirdOrderType.name
|
|
154
|
149
|
}
|
|
155
|
|
- getOrderTypeLists(params).then((response) => {
|
|
156
|
|
- if (response.state.toLowerCase() === 'success') {
|
|
157
|
|
- this.orderData = response.data
|
|
|
150
|
+ },
|
|
|
151
|
+ commonOrderType(id, pid) {
|
|
|
152
|
+ // console.log(id,pid)
|
|
|
153
|
+ this.getTreeList(pid)
|
|
|
154
|
+ },
|
|
|
155
|
+ getTreeList(pid) {
|
|
|
156
|
+ return new Promise((resolve) => {
|
|
|
157
|
+ const params = {
|
|
|
158
|
+ pid: pid,
|
|
|
159
|
+ flag: 1
|
|
158
|
160
|
}
|
|
|
161
|
+ getOrderTypeLists(params).then((response) => {
|
|
|
162
|
+ if (response.state.toLowerCase() === 'success') {
|
|
|
163
|
+ this.orderData = response.data
|
|
|
164
|
+ }
|
|
|
165
|
+ })
|
|
|
166
|
+ resolve()
|
|
159
|
167
|
})
|
|
160
|
|
- resolve()
|
|
161
|
|
- })
|
|
162
|
|
- },
|
|
163
|
|
- filterTreeDatas(treeDatas) {
|
|
164
|
|
- const accessedRouters = []
|
|
165
|
|
- let j = -1
|
|
166
|
|
- for (const i in treeDatas) {
|
|
167
|
|
- j++
|
|
168
|
|
- accessedRouters.push({
|
|
169
|
|
- id: treeDatas[i].id,
|
|
170
|
|
- label: treeDatas[i].text,
|
|
171
|
|
- typeId: treeDatas[i].TypeId,
|
|
172
|
|
- children: []
|
|
173
|
|
- })
|
|
174
|
|
- if (treeDatas[i].children) {
|
|
175
|
|
- accessedRouters[j].children = this.filterTreeDatas(treeDatas[i].children)
|
|
|
168
|
+ },
|
|
|
169
|
+ filterTreeDatas(treeDatas) {
|
|
|
170
|
+ const accessedRouters = []
|
|
|
171
|
+ let j = -1
|
|
|
172
|
+ for (const i in treeDatas) {
|
|
|
173
|
+ j++
|
|
|
174
|
+ accessedRouters.push({
|
|
|
175
|
+ id: treeDatas[i].id,
|
|
|
176
|
+ label: treeDatas[i].text,
|
|
|
177
|
+ typeId: treeDatas[i].TypeId,
|
|
|
178
|
+ children: []
|
|
|
179
|
+ })
|
|
|
180
|
+ if (treeDatas[i].children) {
|
|
|
181
|
+ accessedRouters[j].children = this.filterTreeDatas(treeDatas[i].children)
|
|
|
182
|
+ }
|
|
176
|
183
|
}
|
|
177
|
|
- }
|
|
178
|
|
- return accessedRouters
|
|
179
|
|
- },
|
|
180
|
|
- handleChange(data) {
|
|
181
|
|
- console.log(Number(data[data.length - 1]))
|
|
182
|
|
- this.orderTypeData.value = Number(data[data.length - 1])
|
|
183
|
|
- this.orderTypeData.name = this.$refs["cascader"].getCheckedNodes()[0].label
|
|
184
|
|
- this.orderTypeData.identification = Number(this.$refs["cascader"].getCheckedNodes()[0].data.identification)
|
|
185
|
|
- this.orderTypeData.type2Arr = data
|
|
186
|
|
- console.log(this.orderTypeData)
|
|
187
|
|
- switch (this.typeid) {
|
|
188
|
|
- case 1:
|
|
189
|
|
- this.$emit('post-first-order-type', this.orderTypeData)
|
|
190
|
|
- break
|
|
191
|
|
- case 2:
|
|
192
|
|
- this.$emit('post-second-order-type', this.orderTypeData)
|
|
193
|
|
- break
|
|
194
|
|
- case 3:
|
|
195
|
|
- this.$emit('post-third-order-type', this.orderTypeData)
|
|
196
|
|
- break
|
|
197
|
|
- }
|
|
198
|
|
- },
|
|
199
|
|
- // changedOrderType(data) {
|
|
200
|
|
- // this.orderTypeData.value = data
|
|
201
|
|
- // this.orderTypeData.name = data ? this.orderData.find(ele => ele.fid === data).text : ''
|
|
202
|
|
- // switch (this.typeid) {
|
|
203
|
|
- // case 1:
|
|
204
|
|
- // this.$emit('post-first-order-type', this.orderTypeData)
|
|
205
|
|
- // break
|
|
206
|
|
- // case 2:
|
|
207
|
|
- // this.$emit('post-second-order-type', this.orderTypeData)
|
|
208
|
|
- // break
|
|
209
|
|
- // case 3:
|
|
210
|
|
- // this.$emit('post-third-order-type', this.orderTypeData)
|
|
211
|
|
- // break
|
|
212
|
|
- // }
|
|
213
|
|
- // }
|
|
|
184
|
+ return accessedRouters
|
|
|
185
|
+ },
|
|
|
186
|
+ handleChange(data) {
|
|
|
187
|
+ console.log(Number(data[data.length - 1]))
|
|
|
188
|
+ this.orderTypeData.value = Number(data[data.length - 1])
|
|
|
189
|
+ this.orderTypeData.name = this.$refs["cascader"].getCheckedNodes()[0].label
|
|
|
190
|
+ this.orderTypeData.identification = Number(this.$refs["cascader"].getCheckedNodes()[0].data.identification)
|
|
|
191
|
+ this.orderTypeData.type2Arr = data
|
|
|
192
|
+ console.log(this.orderTypeData)
|
|
|
193
|
+ switch (this.typeid) {
|
|
|
194
|
+ case 1:
|
|
|
195
|
+ this.$emit('post-first-order-type', this.orderTypeData)
|
|
|
196
|
+ break
|
|
|
197
|
+ case 2:
|
|
|
198
|
+ this.$emit('post-second-order-type', this.orderTypeData)
|
|
|
199
|
+ break
|
|
|
200
|
+ case 3:
|
|
|
201
|
+ this.$emit('post-third-order-type', this.orderTypeData)
|
|
|
202
|
+ break
|
|
|
203
|
+ }
|
|
|
204
|
+ },
|
|
|
205
|
+ // changedOrderType(data) {
|
|
|
206
|
+ // this.orderTypeData.value = data
|
|
|
207
|
+ // this.orderTypeData.name = data ? this.orderData.find(ele => ele.fid === data).text : ''
|
|
|
208
|
+ // switch (this.typeid) {
|
|
|
209
|
+ // case 1:
|
|
|
210
|
+ // this.$emit('post-first-order-type', this.orderTypeData)
|
|
|
211
|
+ // break
|
|
|
212
|
+ // case 2:
|
|
|
213
|
+ // this.$emit('post-second-order-type', this.orderTypeData)
|
|
|
214
|
+ // break
|
|
|
215
|
+ // case 3:
|
|
|
216
|
+ // this.$emit('post-third-order-type', this.orderTypeData)
|
|
|
217
|
+ // break
|
|
|
218
|
+ // }
|
|
|
219
|
+ // }
|
|
|
220
|
+ }
|
|
214
|
221
|
}
|
|
215
|
|
-}
|
|
216
|
222
|
</script>
|
|
217
|
223
|
|
|
218
|
224
|
<style lang="scss" scoped>
|