|  |  |  | 
|---|
|  |  |  | <u-form-item label="部门" labelWidth="120" prop="companyName" borderBottom required> | 
|---|
|  |  |  | <u--input v-model="model.companyName" border="none" placeholder="请选择部门" disabledColor="#ffffff" | 
|---|
|  |  |  | disabled></u--input> | 
|---|
|  |  |  | <u-icon slot="right" name="arrow-right"></u-icon> | 
|---|
|  |  |  | <!-- <u-icon slot="right" name="arrow-right"></u-icon> --> | 
|---|
|  |  |  | </u-form-item> | 
|---|
|  |  |  | <u-form-item label="上报时间" labelWidth="120" prop="submitDate" borderBottom required> | 
|---|
|  |  |  | <u--input v-model="model.submitDate" border="none" placeholder="请选择上报时间" disabledColor="#ffffff" | 
|---|
|  |  |  | disabled></u--input> | 
|---|
|  |  |  | <u-icon slot="right" name="arrow-right"></u-icon> | 
|---|
|  |  |  | <!-- <u-icon slot="right" name="arrow-right"></u-icon> --> | 
|---|
|  |  |  | </u-form-item> | 
|---|
|  |  |  | <u-form-item label="发生时间" labelWidth="120" prop="happenTime" borderBottom @click="openTime" required> | 
|---|
|  |  |  | <u--input v-model="model.happenTime" border="none" placeholder="请选择发生时间" disabledColor="#ffffff" | 
|---|
|  |  |  | 
|---|
|  |  |  | <u--textarea v-model="model.eventInfo" placeholder="请输入事件说明" style="margin-top: 15rpx;" maxlength="200" count></u--textarea> | 
|---|
|  |  |  | </u-form-item> | 
|---|
|  |  |  | <u-form-item label="上传图片" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom> | 
|---|
|  |  |  | <u-upload | 
|---|
|  |  |  | <UploadImage | 
|---|
|  |  |  | :fileList="model.multifileList" | 
|---|
|  |  |  | @afterRead="afterRead" | 
|---|
|  |  |  | @delete="deletePic" | 
|---|
|  |  |  | accept="image" | 
|---|
|  |  |  | multiple | 
|---|
|  |  |  | name="1" | 
|---|
|  |  |  | style="margin-top: 15rpx;"></u-upload> | 
|---|
|  |  |  | folder="WORKORDER_FILE_PATH" | 
|---|
|  |  |  | @dele="deletePic" | 
|---|
|  |  |  | @getFileList="afterRead" | 
|---|
|  |  |  | style="margin-top: 15rpx;" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </u-form-item> | 
|---|
|  |  |  | </u--form> | 
|---|
|  |  |  | <u-button type="primary" text="提交" @click="submit" style="margin-top: 60rpx;"></u-button> | 
|---|
|  |  |  | 
|---|
|  |  |  | <view class="slot-content"> | 
|---|
|  |  |  | <u-icon name="checkmark-circle-fill" color="#3875C5" size="70"></u-icon> | 
|---|
|  |  |  | <text>提交成功</text> | 
|---|
|  |  |  | <text>感谢您的反馈</text> | 
|---|
|  |  |  | <text>已收到您的上报,稍后会有相关同事和您联系</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </u-modal> | 
|---|
|  |  |  | <!-- 发生地点 --> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import { mapState } from 'vuex' | 
|---|
|  |  |  | import UploadImage from '@/components/uploadImage/uploadImage.vue' | 
|---|
|  |  |  | import pengTree from '@/uni_modules/peng-tree/peng-tree/peng-tree.vue' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | components: { pengTree }, | 
|---|
|  |  |  | components: { pengTree, UploadImage }, | 
|---|
|  |  |  | computed: { | 
|---|
|  |  |  | ...mapState(['userInfo']) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.getType() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | selectImage() { | 
|---|
|  |  |  | var that = this | 
|---|
|  |  |  | that.$ww.chooseImage({ | 
|---|
|  |  |  | count: 1, | 
|---|
|  |  |  | sizeType: ['original', 'compressed'], | 
|---|
|  |  |  | sourceType: ['album', 'camera'], | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | let serverIds = that.getUploadImage(res.localIds) | 
|---|
|  |  |  | console.log(serverIds) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | fail(err) { | 
|---|
|  |  |  | console.log(err) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 获取服务器图片id | 
|---|
|  |  |  | getUploadImage(localIds) { | 
|---|
|  |  |  | var that = this | 
|---|
|  |  |  | let serverIds = [] | 
|---|
|  |  |  | localIds.forEach(localId => { | 
|---|
|  |  |  | that.$ww.uploadImage({ | 
|---|
|  |  |  | localId, | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | console.log(res.serverId) | 
|---|
|  |  |  | serverIds.push(res.serverId) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | fail(err) { | 
|---|
|  |  |  | console.log(err) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return serverIds; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | closeTime() { | 
|---|
|  |  |  | this.show1 = false | 
|---|
|  |  |  | this.canScroll() | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | next() { | 
|---|
|  |  |  | this.canScroll() | 
|---|
|  |  |  | this.show4 = false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | next1() { | 
|---|
|  |  |  | this.model.name = '' | 
|---|
|  |  |  | this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM') | 
|---|
|  |  |  | this.model.companyName = '' | 
|---|
|  |  |  | 
|---|
|  |  |  | this.model.multifileList = [] | 
|---|
|  |  |  | this.model.fileList = [] | 
|---|
|  |  |  | this.model.type = 0 | 
|---|
|  |  |  | this.canScroll() | 
|---|
|  |  |  | this.show4 = false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | toDesc() { | 
|---|
|  |  |  | uni.navigateTo({ | 
|---|
|  |  |  | 
|---|
|  |  |  | this.show4 = false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 删除图片 | 
|---|
|  |  |  | deletePic(event) { | 
|---|
|  |  |  | this.model.multifileList.forEach((item, index) => { | 
|---|
|  |  |  | if (item.imgaddr === event.file.imgaddr) { | 
|---|
|  |  |  | this.model.multifileList.splice(index, 1) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | deletePic(index) { | 
|---|
|  |  |  | this.model.multifileList.splice(index, 1) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 新增图片 | 
|---|
|  |  |  | async afterRead(event) { | 
|---|
|  |  |  | var that = this | 
|---|
|  |  |  | uni.showLoading({ title: '上传中...', mask: true }) | 
|---|
|  |  |  | uni.uploadFile({ | 
|---|
|  |  |  | url: this.$baseUrl + '/web/public/uploadBatch', | 
|---|
|  |  |  | files: event.file.map(e => { | 
|---|
|  |  |  | return { name: 'files', uri: e.url } | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | formData: { | 
|---|
|  |  |  | folder: "WORKORDER_FILE_PATH", | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | uni.hideLoading(); | 
|---|
|  |  |  | let obj = JSON.parse(res.data) | 
|---|
|  |  |  | if (obj.code === 200) { | 
|---|
|  |  |  | console.log(obj.data) | 
|---|
|  |  |  | obj.data.forEach(item => { | 
|---|
|  |  |  | item.fileurl = item.imgaddr | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | that.model.multifileList = [...that.model.multifileList, ...obj.data] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | async afterRead(arr) { | 
|---|
|  |  |  | this.model.multifileList = [...this.model.multifileList, ...arr] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 提交 | 
|---|
|  |  |  | submit() { | 
|---|
|  |  |  | 
|---|
|  |  |  | form.happenTime = form.happenTime + ':00' | 
|---|
|  |  |  | let res = await that.$u.api.workOrderCreate(form) | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | that.next1() | 
|---|
|  |  |  | that.id = res.data | 
|---|
|  |  |  | this.stopScroll() | 
|---|
|  |  |  | that.show4 = true | 
|---|