quanyawei
2024-07-04 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7
pages/actionChange/components/approvalnfor.vue
New file
@@ -0,0 +1,199 @@
<template>
   <view class="">
      <!-- 整改信息 -->
      <view class="workOrderDetail">
         <view class="headerCont">
            <p class="title">审批信息</p>
         </view>
         <u-line color="#bbb" />
         <view>
            <view class="mainContent">
               <u--form labelPosition="left" label-width="80" :model="form" :border-bottom="false" :rules="rules"
                  ref="uForm">
                  <view class="formItemContent">
                     <u-form-item border-bottom label="考核打分:" prop="checkScore"
                        :required="basicInfor.pageState==='edit'" :border-bottom="false">
                        <view class="fonttest" v-if="basicInfor.pageState==='view'">
                           {{ basicInfor.checkScore ||''}}
                        </view>
                        <u-input v-else v-model="form.checkScore" border="none" placeholder="请输入"
                           type="number" />
                     </u-form-item>
                  </view>
                  <view class="formItemContent">
                     <u-form-item border-bottom label="理由:" prop="checkDescribe"
                        :required="basicInfor.pageState==='edit'" :border-bottom="false">
                        <view class="fonttest" v-if="basicInfor.pageState==='view'">
                           {{ basicInfor.checkDescribe ||''}}
                        </view>
                        <u--textarea v-else v-model="form.checkDescribe" border="none" placeholder="请输入内容" />
                     </u-form-item>
                  </view>
                  <view class="formItemContent">
                     <u-form-item border-bottom label="相关附件:" :border-bottom="false">
                        <view class="fileBox" v-if="basicInfor.pageState==='view'">
                           <cl-upload v-model="fileList" :add="false" :action="`''`" cloud-type="other"
                              :remove="false" />
                        </view>
                        <view class="fileBox" v-else>
                           <fileUpload class="rowTipContenetAll" :sys-code="sysCode"
                              @handleFile="handleFile" />
                        </view>
                     </u-form-item>
                  </view>
               </u--form>
            </view>
         </view>
      </view>
   </view>
</template>
<script>
   import fileUpload from '../components/fileUpload.vue'
   export default {
      components: {
         fileUpload
      },
      props: {
         basicInfor: {
            type: Object,
            default: () => {}
         },
      },
      computed: {
         pageState() {
            return this.basicInfor.pageState
         }
      },
      data() {
         return {
            sysCode: '1010203',
            form: {
               checkScore: 0,
               checkDescribe: '',
            },
            dictObj: JSON.parse(uni.getStorageSync('dictObj') || '[]'),
            fileList: [],
            fileBaseList: [],
            baseUrl: this.$storage.get('baseUrl'),
            rules: {
               'checkScore': {
                  required: true,
                  message: '请输入',
                  trigger: ['blur', 'change']
               },
               'checkDescribe': {
                  required: true,
                  message: '请输入',
                  trigger: ['blur', 'change']
               },
            }
         }
      },
      onLoad: function(option) {
         //option为object类型,会序列化上个页面传递的参数
         console.log(option) //打印出上个页面传递的参数。
      },
      onReady() {
         //onReady 为uni-app支持的生命周期之一
         this.$refs.uForm.setRules(this.rules)
      },
      mounted() {
         console.log('this.basicInfor', this.basicInfor)
         if (this.basicInfor.fileApproveList && this.basicInfor.fileApproveList.length > 0) {
            this.basicInfor.fileApproveList.forEach(item => {
               let name = item.fileType === 1 ? 'name.png' : 'name.mp4'
               this.fileList.push(`${this.baseUrl}/file/preview/${item.fileId}?${name}`) // 原图
            })
            console.log('this.fileList', this.basicInfor.fileBaseList)
            console.log('this.fileList', this.fileList)
         }
      },
      methods: {
         handleFile(data) {
            this.fileBaseList = data
            this.form.fileChangeList = this.fileBaseList
         },
         formVali() {
            return new Promise((resolve, reject) => {
               if (this.basicInfor.pageState !== 'view') {
                  this.$refs.uForm.validate().then(res => {
                     resolve(true)
                  }).catch(errors => {
                     reject(false)
                     uni.$u.toast('校验失败')
                  })
               } else {
                  resolve(true)
               }
            })
         }
      },
   }
</script>
<style scoped lang="scss">
   /deep/.u-line {
      margin: 19.23rpx 0px !important;
   }
   .workOrderDetail {
      border: 1px solid #bbb;
      border-radius: 5px;
      margin: 19.23rpx;
      padding: 19.23rpx;
      color: #101010;
      font-weight: 700;
      font-size: 30.77rpx;
      .headerCont {
         display: flex;
         justify-content: space-between;
         font-size: 30.77rpx;
      }
      .mainContent {
         margin-bottom: 10px;
         font-weight: 500;
         .rowTip {
            display: flex;
            padding: 5px 0;
            border-bottom: 1px dashed #bbb;
            .wholeLine {
               display: flex;
               width: 100%;
               align-items: center;
               .rowTipContenetLabel {
                  min-width: 144.23rpx;
                  font-size: 28.85rpx;
                  text-align: left;
               }
               .rowTipContenetAll {
                  font-size: 28.85rpx;
                  width: calc(100% - 144.23rpx);
               }
            }
            .rowTipContenet {
               width: 50%;
               text-align: left;
               overflow: hidden;
               text-overflow: ellipsis;
               white-space: nowrap;
               .butsName {
                  display: inline-block;
                  margin-left: 19.23rpx;
                  color: #1990ff;
               }
            }
         }
         .rowTipContenet_right {
            text-align: right !important;
         }
      }
   }
</style>