MrShi
2025-08-19 f2ac76666299407545fb733f0d21f6e8cfe538a3
h5/pages/report_dca/report_dca.vue
@@ -33,17 +33,17 @@
            </view>
         </u-form-item>
         <u-form-item label="DCA图片" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom>
            <u-upload
            :fileList="model.multifileList"
            @afterRead="afterRead"
            @delete="deletePic"
            multiple
            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>
@@ -91,9 +91,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'])
      },
@@ -164,10 +165,13 @@
            time1: new Date().getTime(),
            address: [],
            theme: [],
            total: 0
            total: 0,
            list: []
         };
      },
      onLoad() {
         this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
         this.model.happenTime = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
         this.model.companyName = this.userInfo.companyName
         this.getNotifier()
         this.getLocation()
@@ -178,10 +182,17 @@
            this.model.dcaYesNum = data.dcaYesNum
            this.model.dcaNoNum = data.dcaNoNum
            this.model.dcaNoProblemDTOList = data.dcaNoProblemDTOList
            this.list = data.list
         })
      },
      methods: {
         openG() {
            // this.theme = []
            this.total = 0
            this.list = []
            this.model.dcaYesNum = ''
            this.model.dcaNoNum = ''
            this.model.dcaNoProblemDTOList = []
            this.stopScroll()
            this.show2 = true
         },
@@ -190,21 +201,21 @@
            this.show2 = false
         },
         next() {
            this.canScroll()
            this.show6 = false
         },
         next1() {
            this.model.submitDate = ''
            this.model.happenTime = ''
            this.model.companyName = ''
            this.model.localtionName = ''
            this.model.localtionId = ''
            this.model.typeId = ''
            this.model.typeName = ''
            this.model.notifier = ''
            this.model.dcaYesNum = 0
            this.model.dcaNoNum = 0
            this.model.dcaNoProblemDTOList = []
            this.model.multifileList = []
            this.model.type = 1
            this.canScroll()
            this.show6 = false
         },
         toDesc() {
            this.canScroll()
@@ -217,6 +228,7 @@
         async report() {
            let res = await this.$u.api.workOrderCreate(this.model)
            if (res.code === 200) {
               this.next1()
               this.show4 = false
               this.id = res.data
               this.show6 = true
@@ -264,57 +276,24 @@
               })
               return
            }
            uni.navigateTo({
               url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}`
            })
            if (this.list.length > 0) {
               uni.setStorageSync('list', this.list);
               uni.navigateTo({
                  url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}&disable=1`
               })
            } else {
               uni.navigateTo({
                  url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}`
               })
            }
         },
         // 删除图片
         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]
                  }
               }
            })
            // uni.uploadFile({
            //    url: this.$baseUrl + '/web/public/upload',
            //    filePath: event.file.url,
            //    name: "file",
            //    formData: {
            //       folder: "WORKORDER_FILE_PATH"
            //    },
            //    success: (res) => {
            //       let obj = JSON.parse(res.data)
            //       if (obj.code === 200) {
            //          obj.data.fileurl = obj.data.imgaddr
            //          this.model.multifileList.push(obj.data)
            //       }
            //    }
            // });
         afterRead(arr) {
            this.model.multifileList = [...this.model.multifileList, ...arr]
         },
         submit() {
            this.$refs.uForm.validate().then(res => {