Commit 7dec0b9a237546a4166c7f81a7ed646e1ab24b08
1 parent
db7f33e1
Exists in
charge
feat:拜访上传文件
Showing
6 changed files
with
228 additions
and
59 deletions
Show diff stats
api/charge.js
@@ -14,7 +14,7 @@ export const addMcVisit = data => http.post('/schsf/mcVisit/add',data) | @@ -14,7 +14,7 @@ export const addMcVisit = data => http.post('/schsf/mcVisit/add',data) | ||
14 | export const editMcVisit = data => http.post('/schsf/mcVisit/edit',data) | 14 | export const editMcVisit = data => http.post('/schsf/mcVisit/edit',data) |
15 | /* 作废拜访 */ | 15 | /* 作废拜访 */ |
16 | export const cancelMcVisit = data => http.post('/schsf/mcVisit/cancel',data) | 16 | export const cancelMcVisit = data => http.post('/schsf/mcVisit/cancel',data) |
17 | -/* 查询小区下拉树 */ | 17 | +/* 查询项目公司下拉树 */ |
18 | export const getCompanyCascader = params => http.get('/schsf/mcBasicCmty/companyCascader', { params }) | 18 | export const getCompanyCascader = params => http.get('/schsf/mcBasicCmty/companyCascader', { params }) |
19 | /* 查询小区 */ | 19 | /* 查询小区 */ |
20 | export const getVlgOrCmty = params => http.get('/schsf/mcBasicCmty/vlgOrCmty', { params }) | 20 | export const getVlgOrCmty = params => http.get('/schsf/mcBasicCmty/vlgOrCmty', { params }) |
api/chargeFile.js
1 | //请求工具参考https://ext.dcloud.net.cn/plugin?id=392 | 1 | //请求工具参考https://ext.dcloud.net.cn/plugin?id=392 |
2 | -import request from '@/utils/request.js' | ||
3 | import config from '@/common/config.js' | 2 | import config from '@/common/config.js' |
4 | 3 | ||
5 | 4 | ||
@@ -9,36 +8,38 @@ export function uploadFile(url) { | @@ -9,36 +8,38 @@ export function uploadFile(url) { | ||
9 | let a = uni.uploadFile({ | 8 | let a = uni.uploadFile({ |
10 | url: `${config.baseUrl}/schsf/mcFile/upload`, | 9 | url: `${config.baseUrl}/schsf/mcFile/upload`, |
11 | filePath: url, | 10 | filePath: url, |
12 | - name: 'files', | 11 | + name: 'file', |
13 | formData: {}, | 12 | formData: {}, |
14 | header: { | 13 | header: { |
15 | Authorization: "Bearer " + uni.getStorageSync('ACCESS_TOKEN') | 14 | Authorization: "Bearer " + uni.getStorageSync('ACCESS_TOKEN') |
16 | }, | 15 | }, |
17 | success: (res) => { | 16 | success: (res) => { |
18 | if (res.statusCode === 200) { | 17 | if (res.statusCode === 200) { |
19 | - const data = JSON.parse(res.data) | 18 | + console.log(res); |
19 | + const data = JSON.parse(res.data); | ||
20 | + console.log(data); | ||
20 | // console.log('上传成功,返回解析数据', data) | 21 | // console.log('上传成功,返回解析数据', data) |
21 | - let uuid = uni.$u.guid(13) | ||
22 | - let tempData = { | ||
23 | - status:"success", | ||
24 | - name: data.fileName, | ||
25 | - size: data.size, | ||
26 | - percentage: 100, | ||
27 | - uid: uuid, | ||
28 | - raw: { | ||
29 | - uid: uuid | ||
30 | - }, | ||
31 | - response: { | ||
32 | - success: true, | ||
33 | - fileId: data.fileId, | ||
34 | - fileName:data.fileName, | ||
35 | - size: data.size, | ||
36 | - username: '超级管理员' | ||
37 | - } | ||
38 | - } | 22 | + // let uuid = uni.$u.guid(13) |
23 | + // let tempData = { | ||
24 | + // status:"success", | ||
25 | + // name: data.fileName, | ||
26 | + // size: data.size, | ||
27 | + // percentage: 100, | ||
28 | + // uid: uuid, | ||
29 | + // raw: { | ||
30 | + // uid: uuid | ||
31 | + // }, | ||
32 | + // response: { | ||
33 | + // success: true, | ||
34 | + // fileId: data.fileId, | ||
35 | + // fileName:data.fileName, | ||
36 | + // size: data.size, | ||
37 | + // username: '超级管理员' | ||
38 | + // } | ||
39 | + // } | ||
39 | // let FileJson = JSON.stringify(tempData); | 40 | // let FileJson = JSON.stringify(tempData); |
40 | - console.log("返回文件数据Json",tempData); | ||
41 | - resolve(tempData) | 41 | + // console.log("返回文件数据Json",data.data[0]); |
42 | + resolve(data.data[0]) | ||
42 | } else { | 43 | } else { |
43 | reject() | 44 | reject() |
44 | } | 45 | } |
api/user.js
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | const { http } = uni.$u | 2 | const { http } = uni.$u |
3 | 3 | ||
4 | //获取用户信息 | 4 | //获取用户信息 |
5 | -export const getUserInfo = params => http.get('/member/user/get', params) | 5 | +// export const getUserInfo = params => http.get('/member/user/get', params) |
6 | //修改用户头像 | 6 | //修改用户头像 |
7 | export const updateAvatar = filePath => | 7 | export const updateAvatar = filePath => |
8 | http.upload('/member/user/update-avatar', { | 8 | http.upload('/member/user/update-avatar', { |
common/config.js
1 | module.exports = { | 1 | module.exports = { |
2 | //后端接口地址 | 2 | //后端接口地址 |
3 | // baseUrl: 'http://10.11.38.240:9001', //内网开发环境 | 3 | // baseUrl: 'http://10.11.38.240:9001', //内网开发环境 |
4 | - baseUrl: 'http://192.168.0.8:8001', //内网开发环境 | 4 | + // baseUrl: 'http://192.168.0.8:8001', //内网开发环境 |
5 | + baseUrl: 'http://hqpnzc.natappfree.cc', //内网穿透开发环境 | ||
5 | // baseUrl: 'http://172.17.56.37:18082/api', //测试环境 | 6 | // baseUrl: 'http://172.17.56.37:18082/api', //测试环境 |
6 | // baseUrl: 'http://172.17.56.16:18082/api', //ip正式环境 | 7 | // baseUrl: 'http://172.17.56.16:18082/api', //ip正式环境 |
7 | // baseUrl: 'https://scdcapp.chinagasholdings.com/api', //域名正式环境 | 8 | // baseUrl: 'https://scdcapp.chinagasholdings.com/api', //域名正式环境 |
pages/charge/visitsAndFees/createaVisit.vue
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | v-if="item.type === 'date'"> | 13 | v-if="item.type === 'date'"> |
14 | <u-input v-model="model[item.key]" inputAlign="right" :placeholder="item.placeholder" disabled | 14 | <u-input v-model="model[item.key]" inputAlign="right" :placeholder="item.placeholder" disabled |
15 | disabledColor="#fff" border="none"></u-input> | 15 | disabledColor="#fff" border="none"></u-input> |
16 | - <u-icon slot="right" name="calendar" size="20"></u-icon> | 16 | + <u-icon slot="right" name="calendar" size="20" @click="handleDateTime(item)"></u-icon> |
17 | </u-form-item> | 17 | </u-form-item> |
18 | <!-- 输入类型 --> | 18 | <!-- 输入类型 --> |
19 | <u-form-item :required="item.required" :label="item.label" labelWidth="100" borderBottom | 19 | <u-form-item :required="item.required" :label="item.label" labelWidth="100" borderBottom |
@@ -71,7 +71,8 @@ | @@ -71,7 +71,8 @@ | ||
71 | <!-- 文件 --> | 71 | <!-- 文件 --> |
72 | <u-form-item :required="item.required" :label="item.label" labelWidth="75%" borderBottom | 72 | <u-form-item :required="item.required" :label="item.label" labelWidth="75%" borderBottom |
73 | v-if="item.type === 'file'"> | 73 | v-if="item.type === 'file'"> |
74 | - <u-upload width="100rpx" height="100rpx"></u-upload> | 74 | + <u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10" |
75 | + width="100rpx" height="100rpx"></u-upload> | ||
75 | </u-form-item> | 76 | </u-form-item> |
76 | </view> | 77 | </view> |
77 | </view> | 78 | </view> |
@@ -160,10 +161,17 @@ | @@ -160,10 +161,17 @@ | ||
160 | v-if="item.type === 'attachment'"> | 161 | v-if="item.type === 'attachment'"> |
161 | <u-input v-model="model[item.key]" inputAlign="right" :placeholder="item.placeholder" disabled | 162 | <u-input v-model="model[item.key]" inputAlign="right" :placeholder="item.placeholder" disabled |
162 | disabledColor="#fff" border="none"></u-input> | 163 | disabledColor="#fff" border="none"></u-input> |
163 | - <view slot="right" class="text-blue">上传附件</view> | 164 | + <view slot="right" class="text-blue" @click="uploadAttachment">上传附件</view> |
164 | </u-form-item> | 165 | </u-form-item> |
165 | <view class="bg-gray"> | 166 | <view class="bg-gray"> |
166 | - 上传内容 | 167 | + <view class="flex justify-between"> |
168 | + <view class="padding" v-for="(item,index) in attachmentList" :key="index"> | ||
169 | + {{item.fileName}} | ||
170 | + </view> | ||
171 | + <view class=""> | ||
172 | + 查看 | ||
173 | + </view> | ||
174 | + </view> | ||
167 | </view> | 175 | </view> |
168 | </view> | 176 | </view> |
169 | </view> | 177 | </view> |
@@ -174,14 +182,20 @@ | @@ -174,14 +182,20 @@ | ||
174 | <u-button shape="circle" color="#CF000D">立即发起</u-button> | 182 | <u-button shape="circle" color="#CF000D">立即发起</u-button> |
175 | </view> | 183 | </view> |
176 | 184 | ||
177 | - <u-picker :show="pickerShow" closeOnClickOverlay :columns="columns" @cancel="pickerShow = false" | ||
178 | - @close="pickerShow = false" keyName="label" @confirm="confirm"></u-picker> | 185 | + <u-picker :show="pickerShow" ref="uPicker" closeOnClickOverlay :columns="columns" @cancel="pickerShow = false" |
186 | + @close="pickerShow = false" keyName="label" @confirm="confirm" @change="changeHandler"></u-picker> | ||
187 | + | ||
188 | + <u-datetime-picker :show="datetimeShow" v-model="dataTimeValue" @confirm="dateConfirm" | ||
189 | + mode="datetime"></u-datetime-picker> | ||
179 | </view> | 190 | </view> |
180 | </template> | 191 | </template> |
181 | 192 | ||
182 | <script> | 193 | <script> |
194 | + import chargeFile from '@/api/chargeFile' | ||
195 | + import config from '@/common/config.js' | ||
183 | import { | 196 | import { |
184 | - getCurrentFiscalYear | 197 | + getCurrentFiscalYear, |
198 | + getCompanyCascader | ||
185 | } from '@/api/charge.js' | 199 | } from '@/api/charge.js' |
186 | export default { | 200 | export default { |
187 | components: {}, | 201 | components: {}, |
@@ -195,10 +209,20 @@ | @@ -195,10 +209,20 @@ | ||
195 | fiscalYear: "", | 209 | fiscalYear: "", |
196 | jobNature: "", | 210 | jobNature: "", |
197 | }, | 211 | }, |
212 | + copyModel: {}, | ||
198 | rules: {}, | 213 | rules: {}, |
199 | pickerShow: false, | 214 | pickerShow: false, |
215 | + datetimeShow: false, | ||
216 | + dataTimeValue: Number(new Date()), | ||
200 | columns: [], | 217 | columns: [], |
218 | + regionName: [], | ||
219 | + groupName: [], | ||
220 | + companyName: [], | ||
221 | + companyCode: [], | ||
201 | currentName: "", //弹窗后赋值name | 222 | currentName: "", //弹窗后赋值name |
223 | + companyOption: [], | ||
224 | + fileList: [], | ||
225 | + attachmentList:[], | ||
202 | // 基本信息 | 226 | // 基本信息 |
203 | basisData: [{ | 227 | basisData: [{ |
204 | label: '财年', | 228 | label: '财年', |
@@ -226,11 +250,25 @@ | @@ -226,11 +250,25 @@ | ||
226 | required: true, | 250 | required: true, |
227 | key: "entryTime" | 251 | key: "entryTime" |
228 | }, { | 252 | }, { |
229 | - label: '项目公司/部门', | 253 | + label: '区域', |
230 | placeholder: "请选择", | 254 | placeholder: "请选择", |
231 | type: "select", | 255 | type: "select", |
232 | required: true, | 256 | required: true, |
233 | - key: "companyCode" | 257 | + key: "regionName" |
258 | + }, | ||
259 | + { | ||
260 | + label: '集团', | ||
261 | + placeholder: "请选择", | ||
262 | + type: "select", | ||
263 | + required: true, | ||
264 | + key: "groupName" | ||
265 | + }, | ||
266 | + { | ||
267 | + label: '公司', | ||
268 | + placeholder: "请选择", | ||
269 | + type: "select", | ||
270 | + required: true, | ||
271 | + key: "companyName" | ||
234 | }, { | 272 | }, { |
235 | label: '村(小区)', | 273 | label: '村(小区)', |
236 | placeholder: "请选择", | 274 | placeholder: "请选择", |
@@ -280,62 +318,62 @@ | @@ -280,62 +318,62 @@ | ||
280 | required: true, | 318 | required: true, |
281 | type: "select", | 319 | type: "select", |
282 | key: "houseCondition", | 320 | key: "houseCondition", |
283 | - dict:"sys_mc_visit_house" | 321 | + dict: "sys_mc_visit_house" |
284 | }, { | 322 | }, { |
285 | label: '现用做饭能源', | 323 | label: '现用做饭能源', |
286 | placeholder: "请选择", | 324 | placeholder: "请选择", |
287 | required: true, | 325 | required: true, |
288 | type: "select", | 326 | type: "select", |
289 | key: "currentCookingEnergy", | 327 | key: "currentCookingEnergy", |
290 | - dict:"sys_mc_visit_energy" | 328 | + dict: "sys_mc_visit_energy" |
291 | }, { | 329 | }, { |
292 | label: '现用取暖能源', | 330 | label: '现用取暖能源', |
293 | placeholder: "请选择", | 331 | placeholder: "请选择", |
294 | type: "select", | 332 | type: "select", |
295 | key: "currentHeatingEnergy", | 333 | key: "currentHeatingEnergy", |
296 | - dict:"sys_mc_visit_energy" | 334 | + dict: "sys_mc_visit_energy" |
297 | }, { | 335 | }, { |
298 | label: '家庭人口情况', | 336 | label: '家庭人口情况', |
299 | placeholder: "请选择", | 337 | placeholder: "请选择", |
300 | type: "select", | 338 | type: "select", |
301 | key: "familyMembers", | 339 | key: "familyMembers", |
302 | - dict:"sys_mc_visit_members" | 340 | + dict: "sys_mc_visit_members" |
303 | }, { | 341 | }, { |
304 | label: '电冰箱', | 342 | label: '电冰箱', |
305 | placeholder: "请选择", | 343 | placeholder: "请选择", |
306 | type: "select", | 344 | type: "select", |
307 | key: "fridgeStatus", | 345 | key: "fridgeStatus", |
308 | - dict:'sys_mc_visit_appliance_status' | 346 | + dict: 'sys_mc_visit_appliance_status' |
309 | }, { | 347 | }, { |
310 | label: '空调', | 348 | label: '空调', |
311 | placeholder: "请选择", | 349 | placeholder: "请选择", |
312 | type: "select", | 350 | type: "select", |
313 | key: "acStatus", | 351 | key: "acStatus", |
314 | - dict:'sys_mc_visit_appliance_status' | 352 | + dict: 'sys_mc_visit_appliance_status' |
315 | }, { | 353 | }, { |
316 | label: '电视', | 354 | label: '电视', |
317 | placeholder: "请选择", | 355 | placeholder: "请选择", |
318 | type: "select", | 356 | type: "select", |
319 | key: "tvStatus", | 357 | key: "tvStatus", |
320 | - dict:'sys_mc_visit_appliance_status' | 358 | + dict: 'sys_mc_visit_appliance_status' |
321 | }, { | 359 | }, { |
322 | label: '洗衣机', | 360 | label: '洗衣机', |
323 | placeholder: "请选择", | 361 | placeholder: "请选择", |
324 | type: "select", | 362 | type: "select", |
325 | key: "washerStatus", | 363 | key: "washerStatus", |
326 | - dict:'sys_mc_visit_appliance_status' | 364 | + dict: 'sys_mc_visit_appliance_status' |
327 | }, { | 365 | }, { |
328 | label: '热水器', | 366 | label: '热水器', |
329 | placeholder: "请选择", | 367 | placeholder: "请选择", |
330 | type: "select", | 368 | type: "select", |
331 | key: "waterHeaterStatus", | 369 | key: "waterHeaterStatus", |
332 | - dict:'sys_mc_visit_appliance_status' | 370 | + dict: 'sys_mc_visit_appliance_status' |
333 | }, { | 371 | }, { |
334 | label: '光伏', | 372 | label: '光伏', |
335 | placeholder: "请选择", | 373 | placeholder: "请选择", |
336 | type: "select", | 374 | type: "select", |
337 | key: "pvSystemStatus", | 375 | key: "pvSystemStatus", |
338 | - dict:'sys_mc_visit_appliance_status' | 376 | + dict: 'sys_mc_visit_appliance_status' |
339 | }, { | 377 | }, { |
340 | label: '当前地址', | 378 | label: '当前地址', |
341 | placeholder: "请输入", | 379 | placeholder: "请输入", |
@@ -344,7 +382,8 @@ | @@ -344,7 +382,8 @@ | ||
344 | }, { | 382 | }, { |
345 | label: '上传图片', | 383 | label: '上传图片', |
346 | placeholder: "请选择", | 384 | placeholder: "请选择", |
347 | - type: "file" | 385 | + type: "file", |
386 | + key: 'fieldPhotoFile' | ||
348 | }], | 387 | }], |
349 | // 决策人信息 | 388 | // 决策人信息 |
350 | decisionMakersData: [{ | 389 | decisionMakersData: [{ |
@@ -364,7 +403,7 @@ | @@ -364,7 +403,7 @@ | ||
364 | required: true, | 403 | required: true, |
365 | type: "select", | 404 | type: "select", |
366 | key: "dmIncomeSrc", | 405 | key: "dmIncomeSrc", |
367 | - dict:'sys_mc_visit_dm_income' | 406 | + dict: 'sys_mc_visit_dm_income' |
368 | }, { | 407 | }, { |
369 | label: '决策人联系方式', | 408 | label: '决策人联系方式', |
370 | placeholder: "请输入", | 409 | placeholder: "请输入", |
@@ -408,14 +447,14 @@ | @@ -408,14 +447,14 @@ | ||
408 | required: true, | 447 | required: true, |
409 | type: "select", | 448 | type: "select", |
410 | key: "paymentMeth", | 449 | key: "paymentMeth", |
411 | - dict:'sys_mc_payment_meth', | 450 | + dict: 'sys_mc_payment_meth', |
412 | }, { | 451 | }, { |
413 | label: '收费类型', | 452 | label: '收费类型', |
414 | placeholder: "请选择", | 453 | placeholder: "请选择", |
415 | required: true, | 454 | required: true, |
416 | type: "select", | 455 | type: "select", |
417 | key: "chargeType", | 456 | key: "chargeType", |
418 | - dict:"sys_mc_charge_type" | 457 | + dict: "sys_mc_charge_type" |
419 | }], | 458 | }], |
420 | // 其他信息 | 459 | // 其他信息 |
421 | otherData: [{ | 460 | otherData: [{ |
@@ -437,34 +476,161 @@ | @@ -437,34 +476,161 @@ | ||
437 | this.init() | 476 | this.init() |
438 | }, | 477 | }, |
439 | methods: { | 478 | methods: { |
440 | - init() { | 479 | + async init() { |
441 | console.log(this.$store); | 480 | console.log(this.$store); |
442 | // 查询财年 | 481 | // 查询财年 |
443 | - this.getCurrentFiscalYear() | ||
444 | - | 482 | + await this.getCurrentFiscalYear() |
483 | + await this.getCompanyCascader() | ||
484 | + this.model.billingPersonName = uni.getStorageSync("nickName"); | ||
445 | }, | 485 | }, |
446 | async getCurrentFiscalYear() { | 486 | async getCurrentFiscalYear() { |
447 | this.model.fiscalYear = (await getCurrentFiscalYear()).data; | 487 | this.model.fiscalYear = (await getCurrentFiscalYear()).data; |
448 | console.log("当前财年", this.model.fiscalYear); | 488 | console.log("当前财年", this.model.fiscalYear); |
449 | }, | 489 | }, |
490 | + async getCompanyCascader() { | ||
491 | + this.companyOption = (await getCompanyCascader()).data; | ||
492 | + console.log("当前公司类", this.companyOption); | ||
493 | + }, | ||
450 | // 选择弹出层 | 494 | // 选择弹出层 |
451 | handleSelect(item) { | 495 | handleSelect(item) { |
452 | console.log(item); | 496 | console.log(item); |
453 | - let dict = item.dict; | ||
454 | - let dictArr = this.getDictDatas(dict); | ||
455 | - this.currentName = item.key; | ||
456 | - this.columns = [dictArr]; | ||
457 | - // console.log("字典数组", dictArr); | 497 | + if (item.key === 'companyCode') { |
498 | + this.companyOption.forEach(item1 => { | ||
499 | + // console.log(111,item1); | ||
500 | + this.regionName.push(item1); | ||
501 | + item1.children.forEach(item2 => { | ||
502 | + // console.log(222,item2); | ||
503 | + this.groupName.push(item2); | ||
504 | + item2.children.forEach(item3 => { | ||
505 | + // console.log(333,item3); | ||
506 | + this.companyName.push(item3); | ||
507 | + }); | ||
508 | + }); | ||
509 | + }); | ||
510 | + // console.log("data1", data1); | ||
511 | + // console.log("data2", data2); | ||
512 | + // console.log("data3", data3); | ||
513 | + this.columns = [this.regionName, this.groupName, this.companyName]; | ||
514 | + console.log("数据", this.columns); | ||
515 | + } else { | ||
516 | + let dict = item.dict; | ||
517 | + let dictArr = this.getDictDatas(dict); | ||
518 | + this.currentName = item.key; | ||
519 | + this.columns = [dictArr]; | ||
520 | + } | ||
458 | this.pickerShow = true; | 521 | this.pickerShow = true; |
522 | + console.log(this.columns); | ||
523 | + // console.log("字典数组", dictArr); | ||
459 | }, | 524 | }, |
460 | - // 弹出层确认 | 525 | + // 选择弹出层确认 |
461 | confirm(e) { | 526 | confirm(e) { |
462 | console.log("确认", e); | 527 | console.log("确认", e); |
463 | this.model[this.currentName] = e.value[0].value; | 528 | this.model[this.currentName] = e.value[0].value; |
464 | this.pickerShow = false; | 529 | this.pickerShow = false; |
465 | }, | 530 | }, |
531 | + // 选择时间弹出层 | ||
532 | + handleDateTime(item) { | ||
533 | + this.currentName = item.key; | ||
534 | + this.datetimeShow = true; | ||
535 | + console.log(item); | ||
536 | + }, | ||
537 | + // 时间弹出层确认 | ||
538 | + dateConfirm(e) { | ||
539 | + let time = this.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss'); | ||
540 | + console.log("选择时间", time); | ||
541 | + this.model[this.currentName] = time; | ||
542 | + this.datetimeShow = false; | ||
543 | + }, | ||
544 | + changeHandler(e) { | ||
545 | + console.log(e); | ||
546 | + const { | ||
547 | + columnIndex, | ||
548 | + value, | ||
549 | + values, // values为当前变化列的数组内容 | ||
550 | + index, | ||
551 | + // 微信小程序无法将picker实例传出来,只能通过ref操作 | ||
552 | + picker = this.$refs.uPicker | ||
553 | + } = e | ||
554 | + // 当第一列值发生变化时,变化第二列(后一列)对应的选项 | ||
555 | + // if (columnIndex === 0) { | ||
556 | + // // picker为选择器this实例,变化第二列对应的选项 | ||
557 | + // picker.setColumnValues(1, this.groupName[index]) | ||
558 | + // } | ||
559 | + }, | ||
560 | + // 删除图片 | ||
561 | + deletePic(event) { | ||
562 | + this.fileList.splice(event.index, 1) | ||
563 | + }, | ||
564 | + // 新增图片 | ||
565 | + async afterRead(event) { | ||
566 | + // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 | ||
567 | + let lists = [].concat(event.file) | ||
568 | + let fileListLen = this.fileList.length | ||
569 | + lists.map((item) => { | ||
570 | + this.fileList.push({ | ||
571 | + ...item, | ||
572 | + status: 'uploading', | ||
573 | + message: '上传中' | ||
574 | + }) | ||
575 | + }) | ||
576 | + for (let i = 0; i < lists.length; i++) { | ||
577 | + const result = await this.uploadFilePromise(lists[i].url) | ||
578 | + let item = this.fileList[fileListLen] | ||
579 | + this.fileList.splice(fileListLen, 1, Object.assign(item, { | ||
580 | + status: 'success', | ||
581 | + message: '', | ||
582 | + uuid: result.uuid, | ||
583 | + url: result | ||
584 | + })) | ||
585 | + fileListLen++ | ||
586 | + } | ||
587 | + console.log(this.fileList); | ||
588 | + }, | ||
589 | + uploadFilePromise(url) { | ||
590 | + return new Promise((resolve, reject) => { | ||
591 | + let a = uni.uploadFile({ | ||
592 | + url: `${config.baseUrl}/schsf/mcFile/upload`, | ||
593 | + filePath: url, | ||
594 | + name: 'file', | ||
595 | + header: { | ||
596 | + Authorization: "Bearer " + uni.getStorageSync('ACCESS_TOKEN') | ||
597 | + }, | ||
598 | + success: (res) => { | ||
599 | + console.log("上传结果", res); | ||
600 | + setTimeout(() => { | ||
601 | + if (res.statusCode === 200) { | ||
602 | + let data = JSON.parse(res.data); | ||
603 | + console.log("上传data", data.data[0]); | ||
604 | + resolve(data.data[0]) | ||
605 | + } | ||
606 | + }, 500) | ||
607 | + } | ||
608 | + }); | ||
609 | + }) | ||
610 | + }, | ||
611 | + async uploadAttachment() { | ||
612 | + console.log("上传附件"); | ||
613 | + uni.chooseFile({ | ||
614 | + count: 1, //默认100 | ||
615 | + extension:['.doc','.xlsx','.docx'], | ||
616 | + success:async (res)=> { | ||
617 | + let tempUrl = res.tempFilePaths[0] | ||
618 | + console.log(res); | ||
619 | + const result = await chargeFile.uploadFile(tempUrl); | ||
620 | + this.attachmentList.push(result); | ||
621 | + console.log(result); | ||
622 | + } | ||
623 | + }); | ||
624 | + }, | ||
625 | + // 重构提交数据,不影响表单数据 | ||
626 | + copyMethods() { | ||
627 | + this.copyModel.fieldPhotoFile = this.fileList.map(item => item.uuid).join(","); | ||
628 | + }, | ||
629 | + // 发起拜访 | ||
466 | handleConfirm() { | 630 | handleConfirm() { |
467 | - console.log('提交数据', JSON.parse(JSON.stringify(this.model))); | 631 | + this.copyModel = this.model; |
632 | + this.copyMethods(); | ||
633 | + console.log('提交数据', JSON.parse(JSON.stringify(this.copyModel))); | ||
468 | this.$modal.confirm('确认发起当前这条记录?', '温馨提示').then(() => { | 634 | this.$modal.confirm('确认发起当前这条记录?', '温馨提示').then(() => { |
469 | console.log('确定'); | 635 | console.log('确定'); |
470 | }).catch(() => { | 636 | }).catch(() => { |
store/mudules/user.js
@@ -54,6 +54,7 @@ const user = { | @@ -54,6 +54,7 @@ const user = { | ||
54 | state.roleId = roleIdString; | 54 | state.roleId = roleIdString; |
55 | state.entity = entityString; | 55 | state.entity = entityString; |
56 | state.entityName = entityNameString; | 56 | state.entityName = entityNameString; |
57 | + uni.setStorageSync('nickName', sysUser.nickName) | ||
57 | uni.setStorageSync('roleId', roleIdString) | 58 | uni.setStorageSync('roleId', roleIdString) |
58 | uni.setStorageSync('entity', entityString) | 59 | uni.setStorageSync('entity', entityString) |
59 | uni.setStorageSync('entityName', entityNameString) | 60 | uni.setStorageSync('entityName', entityNameString) |