MrShi
2025-08-19 f2ac76666299407545fb733f0d21f6e8cfe538a3
h5/pages/riskReporting/riskReporting.vue
@@ -33,15 +33,17 @@
            <u--textarea v-model="model.riskInfo" 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
            :fileList="model.multifileList"
            @afterRead="afterRead"
            @delete="deletePic"
            name="1"
            style="margin-top: 15rpx;" />
            <UploadImage
               :fileList="model.multifileList"
               folder="WORKORDER_FILE_PATH"
               @dele="deletePic"
               @getFileList="afterRead"
               style="margin-top: 15rpx;"
            />
         </u-form-item>
         <u-form-item label="通知人" labelWidth="120" prop="notifier" borderBottom required>
            <u--input v-model="model.notifier" border="none" placeholder="请输入通知人" disabledColor="#ffffff" disabled></u--input>
            <u--textarea v-model="model.notifier" border="none" placeholder="请输入通知人" disabledColor="#ffffff"
               disabled></u--textarea>
         </u-form-item>
      </u--form>
      <u-button type="primary" text="提交" @click="submit" style="margin-top: 60rpx;"></u-button>
@@ -85,9 +87,10 @@
<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'])
      },
@@ -206,20 +209,19 @@
            }
         },
         next() {
            this.model.name = ''
            this.canScroll()
            this.show4 = false
         },
         next1() {
            this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
            this.model.companyName = ''
            this.model.happenTime = ''
            this.model.localtionId = ''
            this.model.localtionName = ''
            this.model.typeId = ''
            this.model.typeName = ''
            this.model.riskInfo = ''
            this.model.notifier = ''
            this.model.multifileList = []
            this.model.type = 3
            this.canScroll()
            this.show4 = false
         },
         toDesc() {
            uni.navigateTo({
@@ -229,33 +231,12 @@
            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: that.$baseUrl + '/web/public/upload',
               filePath: event.file.url,
               name: "file",
               formData: {
                  folder: "WORKORDER_FILE_PATH"
               },
               success: (res) => {
                  uni.hideLoading();
                  let obj = JSON.parse(res.data)
                  if (obj.code === 200) {
                     obj.data.fileurl = obj.data.imgaddr
                     that.model.multifileList.push(obj.data)
                  }
               }
            });
         async afterRead(arr) {
            this.model.multifileList = [...this.model.multifileList, ...arr]
         },
         // 提交
         submit() {
@@ -263,6 +244,7 @@
            that.$refs.uForm.validate().then(async () => {
               let res = await that.$u.api.workOrderCreate(that.model)
               if (res.code === 200) {
                  that.next1()
                  that.id = res.data
                  that.stopScroll()
                  that.show4 = true