Blame view

pages/receiptRegistration/organization.vue 10.2 KB
8eed5287   “DataPlanet”   11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
67
68
69
70
71
72
73
  <template>
  	<!-- 机构 -->
  	<view class="page">
  		<view class="content">
  			<view class="top-box" @click="gopath('/pages/receiptRegistration/receiptRegistrationList')">
  				<view>上报历史</view>
  				<view class="top-box-img">
  					<image src="../../static/right2.png"></image>
  				</view>
  			</view>
  			<view class="titleall-left">
  				<view class="titleall-left-line"></view>我要上报
  			</view>
  			<view class="message-list">
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">发生地点</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.incidentLocation" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">儿童姓名</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.childName" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">儿童性别</view>
  							<view class="serve-right">
  								<picker @change="bindPickerChangeSex" :value="index" :range="sexArray">
  									<view class="uni-input">{{form.sex?sexArray[form.sex]:'请选择'}}</view>
  								</picker>
  								<image src="../../static/down3.png"></image>
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">儿童年龄</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.age" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">报告原因</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.reportReason" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
e3296b98   smile   111
74
75
76
77
78
  						<view>
  							<view class="serve-title" style="font-size: 25rpx;color: #909090;">其他信息</view>
  							<textarea v-model="form.reportRecord" placeholder="请输入"
  								placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  								style="margin-top: 20rpx;"></textarea>
8eed5287   “DataPlanet”   11
79
  							<view>
e3296b98   smile   111
80
81
82
  
  								<!-- <input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.reportRecord" placeholder="请输入" style="text-align: right;" /> -->
8eed5287   “DataPlanet”   11
83
84
85
86
87
88
89
90
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
  							</view>
  						</view>
  					</view>
  				</view>
  			</view>
  			<view class="titleall-left">
  				<view class="titleall-left-line"></view>报告人信息
  			</view>
  			<view class="message-list">
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">所属机构</view>
  							<view class="serve-right">
  								<picker @change="organization" :value="index2" :range="organizationArray">
  									<view class="uni-input">{{form.filingAgencyName?organizationArray[index2]:'请选择'}}
  									</view>
  								</picker>
  								<image src="../../static/down3.png"></image>
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">报告类型</view>
  							<view class="serve-right">
  								<picker @change="report" :value="index1" :range="reportArray">
  									<view class="uni-input">{{form.reportType?reportArray[index1]:'请选择'}}</view>
  								</picker>
  								<image src="../../static/down3.png"></image>
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">姓名</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.reporterName" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">与儿童关系</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.relationshipWithChild" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">电话</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.phone" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">报告主体</view>
  							<view class="serve-right">
  								<picker @change="bindPickerChangeSubject" :value="index" :range="SubjectArray">
  									<view class="uni-input">{{form.reporterType?SubjectArray[index]:'请选择'}}</view>
  								</picker>
  								<image src="../../static/down3.png"></image>
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box" v-if="form.reporterType == '群众'">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">职业</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.reporterOccupation" placeholder="请输入" style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  				<view class="info-box" v-if="form.reporterType == '单位' || form.reporterType == '社会组织'">
  					<view class="info-box-list">
  						<view class="serve">
  							<view class="serve-title">单位名称</view>
  							<view>
  								<input placeholder-style="color:#3d3d3d;font-weight: bold;font-size: 25rpx;"
  									v-model="form.reporterOrganizationName" placeholder="请输入"
  									style="text-align: right;" />
  							</view>
  						</view>
  					</view>
  				</view>
  			</view>
  			<view class="page-footer">
  				<view class="footer-buy">
  					<view class="cart-add" @click="register">
  						<image src="../../static/btn5.png"></image>
  						<text>立即上报</text>
  					</view>
  				</view>
  			</view>
  
  		</view>
  	</view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
  				form: {
  					reportTime: "",
  					reportPlatform: "",
  					incidentLocation: "",
  					childName: "",
  					sex: "",
  					age: "",
  					reportReason: "",
  					reportRecord: "",
  					reporterName: "",
  					relationshipWithChild: "",
  					phone: "",
  					reporterType: "",
  					reporterOrganizationName: "",
  					reporterOccupation: "",
  					userId: uni.getStorageSync('USERS_KEY').userId,
  					reportPlatform: ''
  				},
  				pages: {
  					roleName: '机构用户'
  				},
  				// 性别下拉框
  				sexArray: ['男', '女'],
  				// 报告主体
  				SubjectArray: ['群众', '单位', '社会组织'],
  				reportArray: ['强制报告', '机构项目'],
  				organizationArray: [],
  				organization1: [],
  				index: 0,
  				index1: 0,
  				index2: 0,
  			};
  		},
  		created() {
  			this.getListRoles();
  		},
  		methods: {
  			gopath(e) {
  				uni.navigateTo({
  					url: e
  				})
  			},
  			// 选择性别
  			bindPickerChangeSex: function(e) {
  				console.log('picker发送选择改变,携带值为', e)
  				this.form.sex = e.detail.value;
  			},
  			// 选择主体
  			bindPickerChangeSubject: function(e) {
  				console.log('picker发送选择改变,携带值为', e)
  				this.index = e.detail.value;
  				this.form.reporterType = this.SubjectArray[this.index];
  			},
  			// 选择报告类型
  			report: function(e) {
  				console.log('picker发送选择改变,携带值为', e)
  				this.index1 = e.detail.value;
  				this.form.reportType = this.reportArray[this.index1];
  			},
  			// 选择机构
  			organization: function(e) {
  				console.log('picker发送选择改变,携带值为', e)
  				this.index2 = e.detail.value;
  				this.form.filingAgencyName = this.organizationArray[this.index2];
  			},
  			// 获取当前时间
  			getTime() {
  				var now = new Date();
  				var year = now.getFullYear(); //获取完整的年份(4位,1970-????)
  				var month = now.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  				var day = now.getDate(); //获取当前日(1-31)
  				var hour = now.getHours(); //获取当前小时数(0-23)
  				var minute = now.getMinutes(); //获取当前分钟数(0-59)
  				var second = now.getSeconds(); //获取当前秒数(0-59)
  				this.form.reportTime = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day :
e3296b98   smile   111
282
283
  						day) + " " + (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" +
  					(
8eed5287   “DataPlanet”   11
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  						second < 10 ? "0" + second : second);
  			},
  			register() {
  				this.getTime();
  				this.form.filingType = '机构';
  				this.form.reportPlatform = this.form.filingAgencyName;
  				this.organization1.forEach(item => {
  					if (this.form.filingAgencyName == item.userName) {
  						this.form.filingAgencyId = item.userId
  					}
  				})
  				console.log(this.form)
  				this.API.addRegistration(this.form).then(res => {
  					console.log(res)
  					if (res.code == 200) {
  						uni.showToast({
  							icon: 'success',
  							title: '上报成功'
  						})
  						setTimeout(() => {
  							uni.redirectTo({
  								url: '/pages/receiptRegistrationSuccess/receiptRegistrationSuccess',
  							})
  						}, 800)
  					}
  				})
  			},
  			// 获得机构
  			getListRoles() {
  				this.API.getListRoles(this.pages).then(res => {
  					console.log(res)
  					if (res.code == 200) {
  						this.organization1 = res.data;
  						res.data.forEach(item => {
  							this.organizationArray.push(item.userName)
  						})
  					}
  				})
  
  			}
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'receiptRegistration.scss';
  </style>