Blame view

pages/official/grouping/grouping.vue 5.96 KB
bd028579   易尊强   2/28
1
2
  <template>
  	<view class="page">
6c679290   易尊强   3/6a上午
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  		<!-- 管理员看到的 -->
  		<view class="test">
  			<view class="top">
  				<view class="groupName">
  					当前分组
  				</view>
  				<view class="nameTitle">
  					{{groupName}}
  				</view>
  			</view>
  			<!-- <xe-upload ref="XeUpload" :options="uploadOptions" @callback="handleUploadCallback"></xe-upload> -->
  			<wyh-tree-select :items="items" :activeIds="city_ids5" :selectAll="true" :isSearch="true"
  				@getTypeCompanyList="getTypeCompanyList" />
  			<view class="official">
  				<view>已选<text class="official-num">{{city_ids5.length}}</text>家企业</view>
  				<!-- <radio :checked="check" @click="change">是否通知</radio> -->
  				<!-- <view class="official-btn" @click="toGrouping">自定义分组</view> -->
  				<view class="official-btn" @click="putComGroup()">确认</view>
  			</view>
  		</view>
bd028579   易尊强   2/28
23
24
25
26
  	</view>
  </template>
  
  <script>
6c679290   易尊强   3/6a上午
27
28
  	import request from '@/utils/request.js'
  	import upLoad from '@/components/ncc/ncc-upload/index.vue'
bd028579   易尊强   2/28
29
  	export default {
6c679290   易尊强   3/6a上午
30
31
32
33
34
35
  		computed: {
  			city_name5() {
  				return this.getCityNames(this.city_ids5);
  			},
  
  		},
bd028579   易尊强   2/28
36
  		components: {
6c679290   易尊强   3/6a上午
37
  			upLoad
bd028579   易尊强   2/28
38
39
40
  		},
  		data() {
  			return {
6c679290   易尊强   3/6a上午
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  				items: [],
  				city_ids5: [],
  				files: [],
  				// 上传的文件路径
  				fileUrl: '',
  				uploadOptions: {
  					url: 'http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1', // 不传入上传地址则返回本地链接
  					// url: '', // 不传入上传地址则返回本地链接
  				},
  				check: false,
  				// 文件名
  				fileName: '文件名',
  				// 当前用户ID:
  				userId: '',
  				isAdmin:false,
  				// 用户公司ID
  				companyId: '',
  				// 公文列表
  				fileList: [],
  				isNull: false,
  				baseUrl: 'http://deyanggaoxin.fengshiyun.com',
  				// 新建分组名:
  				groupName:'',
  				// 新建分组code
  				groupCode:'',
  				groupId:''
bd028579   易尊强   2/28
67
68
  			}
  		},
6c679290   易尊强   3/6a上午
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  		onLoad(options) {
  			// console.log('options',options)
  			this.groupId = JSON.parse(options.data)
  			this.groupName = JSON.parse(options.fullName)
  			console.log('groupId',this.groupId)
  			console.log('groupName',this.groupName)
  		},
  		onShow() {
  			this.getUser()
  			if(this.isAdmin){
  				this.getFileList()
  			}else{
  				this.getTypeOfCompany()
  				this.getTypeCompanyList(null)
  			}	
  			// this.getCompanyList()
  			// this.getTypeOfCompany()
  		},
  		watch: {
  
  		},
bd028579   易尊强   2/28
90
  		methods: {
6c679290   易尊强   3/6a上午
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  			// 添加企业到分组
  			putComGroup(){
  				let ids = this.city_ids5.join(",")
  				let query = {
  					group:this.groupId,
  					ids:ids
  				}
  				console.log('添加分组',query)
  				request({
  					url:'https://www.dygxq-es.cn/api/permission/Organize/SetGroup?n=1709620981',
  					method:'post',
  					data:query
  				}).then(res=>{
  					console.log('添加分组情况',res)
  					if(res.code == 200){
  						uni.showToast({
  							icon:'success',
  							title:"添加企业成功!"
  						})
  					}
  				})
  			},
  			change() {
  				console.log('check', this.check)
  				this.check = !this.check
  				console.log('check', this.check)
  			},
  			// 获取用户信息判断是否有表单设计和企业通知的ID,权限判断authority = 361476463456683269
  			getUser() {
  				if (uni.getStorageSync('user')) {
  					let userCode = uni.getStorageSync('user')
  					// console.log("用户的code", this.userCode)
  					// this.userId = userCode.userInfo.userId
  					// this.userName = userCode.userInfo.userAccount
  					// this.userIcon = userCode.userInfo.headIcon
  					// this.organizeName = userCode.userInfo.organizeName
  					let authorityID = userCode.permissionList
  					this.isAdmin = userCode.userInfo.isCompany
  					// if(this.isAdmin && !userCode.userInfo.isCompany){
  					// 	uni.showToast({
  					// 		icon:"error",
  					// 		title:"您无该权限!"
  					// 	})
  					// }
  					// console.log('是否有诉求管理权限',this.isAdmin)
  					console.log(userCode)
  				} else {
  					uni.showToast({
  						title: '请登录',
  						icon: 'none'
  					})
  					setTimeout(() => {
  						uni.reLaunch({
  							url: '/pages/login/index'
  						})
  					})
  				}
  			},
  
  			// 跳转到自定义分组页面
  			toGrouping() {
  				uni.navigateTo({
  					url: '/pages/official/grouping/grouping'
  				})
  			},
  			// 获取企业分类
  			getTypeOfCompany() {
  				request({
  					url: '/api/system/DictionaryData/365138541614728453',
  					method: 'get',
  					data: {}
  				}).then(res => {
  					if (res.code == 200) {
  						console.log(res)
  						this.items = []
  						this.items.push({
  							text: "全部",
  							id: null,
  							children: []
  						})
  						console.log('item',this.items)
  					} else if (res.code == 600) {
  						uni.showToast({
  							title: '请登录',
  							icon: 'none'
  						})
  					}
  				})
  			},
  			// 根据分类获取企业列表
  			getTypeCompanyList(id) {
  				request({
  					url: 'https://www.dygxq-es.cn/api/permission/Organize/list?n=1709623341',
  					method: 'get',
  					data: {
  						pageSize: 1000,
  						groupId: id
  					}
  				}).then(res => {
  					console.log(res)
  					if (res.code == 200) {
  						let result = this.items.findIndex(it => it.id === id)
  						this.items[result].children = []
  						console.log('下标', result)
  						let arr = res.data.list.map(it => {
  							return {
  								...it,
  								text: it.fullName,
  								id: it.id,
  								type: false,
  							}
  						})
  						this.items[result].children = arr
  					}
  				})
  			},
  			handleUploadClick() {
  				// 使用默认配置则不需要传入第二个参数
  				type: ['image', 'video', 'file'];
  				this.$refs.XeUpload.upload('file', {});
  				// this.$refs.XeUpload.upload('image', {
  				//  count: 6,
  				//  sizeType: ['original', 'compressed'],
  				//  sourceType: ['album'],
  				// });
  			},
  			handleUploadCallback(e) {
  				// e.type: ['choose', 'success', 'warning']
  				// choose 是options没有传入url,返回临时链接时触发
  				// success 是上传成功返回对应的数据时触发
  				// warning 上传或者选择文件失败触发
  				// ......
  				console.log(e)
  				this.fileUrl = e.data[0].response.data.url
  				this.fileName = e.data[0].name
  
  			},
  			onItem(res) {
  				console.log(res);
  			},
bd028579   易尊强   2/28
231
232
233
234
  		},
  	}
  </script>
  
6c679290   易尊强   3/6a上午
235
236
  <style scoped lang="scss">
  	@import 'official.scss';
bd028579   易尊强   2/28
237
  </style>