loulijun2021
2023-10-19 52a132d27e8ff3213d32bd5dd326b59b4b17b2e4
pages/mjgl/mjwx.vue
@@ -12,7 +12,7 @@
      <view v-show="topContent.length!==0">
         <view class="mainContent" :style="{maxHeight: '600rpx',overflow: 'scroll'}">
         <view class="mainContent">
            <view>
               <u-gap height="10" bgColor="#eff0f1"></u-gap>
               <view class="head">
@@ -20,12 +20,12 @@
                     <view class="head_left">
                        <view class="head_bar"></view>
                        <view class="head_title">
                           扫描维修模具
                           模具信息
                        </view>
                     </view>
                     <view class="marginRight20">
                        <u-icon name="scan" @click="topScanClick" color="red" size="56"></u-icon>
                        <u-icon name="scan" @click="topScanClick" color="red" size="24"></u-icon>
                     </view>
                  </view>
@@ -34,25 +34,25 @@
                     style="max-height: 420rpx;overflow:scroll;">
                     <u-radio-group v-model="radioValue" class="flex_column">
                        <view class="marginBottom20" style="position: relative"
                           @click="groupChange(item.docu_code)" v-for="item in topContent"
                           :key="item.docu_code">
                           @click="groupChange(item.mouldcode)" v-for="item in topContent"
                           :key="item.mouldcode">
                           <view style="display: flex;float: left;">
                              <view class="titleFont">
                                 <view>维修申请单:</view>
                                 <view>模具编码:</view>
                                 <view>模具名称:</view>
                                 <view>规格型号:</view>
                                 <view>申请人员:</view>
                                 <view>申请时间:</view>
                                 <view>故障来源:</view>
                                 <view>故障描述:</view>
                                 <view>申请单号:</view>
                                 <view>模具编码:</view>
                                 <view>模具名称:</view>
                                 <view>规格型号:</view>
                                 <view>申请人员:</view>
                                 <view>申请时间:</view>
                                 <view>故障来源:</view>
                                 <view>故障描述:</view>
                              </view>
                              <view class="contentFont">
                                 <view>{{item.docu_code}}</view>
                                 <view>{{item.code}}</view>
                                 <view>{{item.name}}</view>
                                 <view>{{item.mouldcode}}</view>
                                 <view>{{item.mouldname}}</view>
                                 <view>{{item.spec?item.spec:'/'}}</view>
                                 <view>{{item.request_person}}</view>
                                 <view>{{item.request_name}}</view>
                                 <view>{{item.request_date}}</view>
                                 <view>{{item.source}}</view>
                                 <view style="width:400rpx;word-wrap:break-word">
@@ -60,16 +60,16 @@
                                 </view>
                              </view>
                           </view>
                           <u-radio size='40' style='position: absolute;top: 45%;right: 0;'
                              :key="item.docu_code" :name="item.docu_code"
                              @change="groupChange(item.docu_code)" activeColor="red"></u-radio>
                           <u-radio size='18' style='position: absolute;top: 45%;right: 0;'
                              :key="item.mouldcode" :name="item.mouldcode"
                              @change="groupChange(item.mouldcode)" activeColor="red"></u-radio>
                        </view>
                     </u-radio-group>
                  </view>
               </view>
               <u-gap height="20" bgColor="#eff0f1"></u-gap>
               <u-gap height="10" bgColor="#eff0f1"></u-gap>
               <view class="head" style="padding-bottom: 10rpx;">
                  <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
@@ -81,7 +81,7 @@
                     </view>
                  </view>
                  <view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='100'
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='80'
                        v-model="descMessage">
                     </u--textarea>
                  </view>
@@ -103,29 +103,32 @@
               </view>
               <u-gap height="20" bgColor="#eff0f1"></u-gap>
               <u-gap height="10" bgColor="#eff0f1"></u-gap>
               <view class="head" style="padding-bottom: 10rpx;">
                  <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                     <view class="head_left">
                        <view class="head_bar"></view>
                        <view class="head_title">
                           停机维修
                           下机维修
                        </view>
                     </view>
                     <view class="marginRight20" style="width: 200rpx;display: flex;">
                        <u-button type="primary" :plain="isStop!=='Y'" text="是" @click="isStopClick('Y')">
                     <view class="marginRight20" style="width: 250rpx;display: flex;">
                        <u-button type="primary" shape='circle' size="small" style='margin-right: 10rpx;'
                           :plain="isStop!=='Y'" text="是" @click="isStopClick('Y')">
                        </u-button>
                        <u-button type="warning" :plain="isStop!=='N'" text="否" @click="isStopClick('N')">
                        <u-button type="warning" shape='circle' size="small" :plain="isStop!=='N'" text="否"
                           @click="isStopClick('N')">
                        </u-button>
                     </view>
                  </view>
               </view>
               <u-gap height="20" bgColor="#eff0f1"></u-gap>
               <u-gap height="10" bgColor="#eff0f1"></u-gap>
               <view v-show="isStop==='N'" class="head" style="padding-bottom: 10rpx;padding-bottom: 20rpx;">
               <!-- v-show="isStop==='N'" -->
               <view class="head" style="padding-bottom: 10rpx;padding-bottom: 20rpx;">
                  <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                     <view class="head_left">
                        <view class="head_bar"></view>
@@ -135,15 +138,17 @@
                     </view>
                  </view>
                  <view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='100'
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='80'
                        v-model="descMessage2">
                     </u--textarea>
                  </view>
               </view>
               <u-gap height="20" bgColor="#eff0f1"></u-gap>
               <!-- margin-bottom: 110rpx; -->
               <view style="height: 120rpx;"> </view>
               <!--    <u-gap height="10" bgColor="#eff0f1"></u-gap>
               <view v-show="isStop==='N'" class="head" style="padding-bottom: 10rpx;">
                  <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                     <view class="head_left">
@@ -154,7 +159,7 @@
                     </view>
                  </view>
                  <view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='100'
                     <u--textarea placeholder="请输入" confirm-type="send" border="surround" height='80'
                        v-model="descMessage3">
                     </u--textarea>
                  </view>
@@ -173,7 +178,7 @@
                     margin: 20rpx;padding: 30rpx;
                     " @click="selectPics2">
                  </view>
               </view>
               </view> -->
            </view>
@@ -182,10 +187,11 @@
         <view class="footer" style="min-height:62rpx;">
            <u-button size="large" :loading="isDisabledSubmitButton" loadingText="正在提交,请稍等..." type="primary"
               @click="submit"
               :disabled="isStop==='Y'?descMessage.toString().length===0:descMessage.toString().length===0||descMessage2.toString().length===0"
               @click="submit" :disabled="descMessage.toString().length===0&&descMessage2.toString().length===0"
               text="确认提交">
            </u-button>
            <!-- :disabled="isStop==='Y'?descMessage.toString().length===0:descMessage.toString().length===0||descMessage2.toString().length===0" -->
         </view>
@@ -196,12 +202,10 @@
</template>
<script>
   // import {
   //    RepairScanDeviceQrCodeDataList,
   // } from '../../config/api.js'
   // import {
   //    data
   // } from '../../uni_modules/uview-ui/libs/mixin/mixin.js';
   import {
      RepairScanMouldQrCodeDataList,
   } from '../../config/api.js'
   // import scanCode from '@/components/scan-code/scan-code.vue'
   export default {
@@ -263,7 +267,7 @@
      },
      mounted() {
         this.init()
         // this.getRepairScanDeviceQrCodeDataList()
         this.getRepairScanMouldQrCodeDataList()
      },
@@ -379,13 +383,13 @@
                  let r = that.topContent.find(i => i.docu_code === that.scanContent)
                  let r = that.topContent.find(i => i.mouldcode === that.scanContent)
                  if (r === undefined) {
                     uni.$u.toast('所扫的二维码不在列表中!')
                  } else {
                     that.topContent.forEach((item, index) => {
                        if (item.docu_code === that.scanContent) {
                        if (item.mouldcode === that.scanContent) {
                           that.topContent.splice(index, 1)
                        }
                     })
@@ -405,12 +409,14 @@
            });
         },
         // 获取维修工位
         async getRepairScanDeviceQrCodeDataList(val) {
            const res = await RepairScanDeviceQrCodeDataList()
         // 获取维修模具
         async getRepairScanMouldQrCodeDataList(val) {
            const res = await RepairScanMouldQrCodeDataList({
               mouldcode: val
            })
            if (res.code === '200') {
               this.topContent = res.data
               this.radioValue = this.topContent.length > 0 ? this.topContent[0].docu_code : ''
               this.radioValue = this.topContent.length > 0 ? this.topContent[0].mouldcode : ''
            }
         },
@@ -419,35 +425,33 @@
            const header = {
               // 'Content-Type': 'multipart/form-data',
               'Content-Type': 'application/x-www-form-urlencoded',
               'rediskey': uni.getStorageSync('rediskey'),
               'admin': uni.getStorageSync('usercode'),
               'username': encodeURIComponent(uni.getStorageSync('username')),
               'navTabId': uni.getStorageSync('usercode'),
               'userid': uni.getStorageSync('userid'),
               'guid': uni.getStorageSync('guid'),
               'usertype': 'APP'
               'Token': uni.getStorageSync('Token'),
            }
            const result = this.topContent.find(item => item.docu_code === this.radioValue)
            const result = this.topContent.find(item => item.mouldcode === this.radioValue)
            const formData = {
               username: uni.getStorageSync('username'),
               menucode: '2504',
               docu_code: result.docu_code,
               eqpcode: result.eqpcode,
               wkshpcode: result.wksp_code,
               mouldcode: result.mouldcode,
               faultdescr: this.descMessage,
               is_stoprepair: this.isStop,
               // files1: this.fileList,
               repaircontent: this.descMessage2,
               replaceparts: this.descMessage3
               // replaceparts: this.descMessage3
            }
            // console.log(formData)
            console.log(formData)
            // console.log([...this.fileList, ...this.fileList2].length)
            this.isDisabledSubmitButton = true
            uni.uploadFile({
               url: this.$baseUrl + '/AppDeviceManage/RepairScanDeviceSave',
               files: [...this.fileList, ...this.fileList2].length === 0 ? [{
               url: this.$baseUrl + '/MouldManager/RepairScanMouldSave',
               // files: [...this.fileList, ...this.fileList2].length === 0 ? [{
               //    "uri": "/"
               // }] : [...this.fileList, ...this.fileList2],
               files: this.fileList === 0 ? [{
                  "uri": "/"
               }] : [...this.fileList, ...this.fileList2],
               }] : this.fileList,
               header: header,
               formData: formData,
               success: (res) => {
@@ -455,9 +459,9 @@
                  let result = JSON.parse(res.data)
                  if (res.statusCode == 200 && result.code == '200') {
                     uni.$u.toast('提交成功!')
                     this.topContent = this.topContent.filter(i => i.docu_code !== this.radioValue)
                     this.topContent = this.topContent.filter(i => i.mouldcode !== this.radioValue)
                     this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
                        .docu_code
                        .mouldcode
                     this.descMessage = ''
                     this.imgPreviewSrcs = []
                     this.fileList = []