From 63343a3a32cd59a8ce7b8e15a68dd996e28f6ad9 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 08 十月 2024 08:59:37 +0800
Subject: [PATCH] 优化

---
 src/components/do/b1-ins-order/add.vue |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 167 insertions(+), 11 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 56e3099..d7c17e7 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -256,8 +256,15 @@
               </el-select>
             </div>
           </el-col>
+          <el-col class="search_thing" :span="6" v-if="addObj.formType==='鍏朵粬鎴愬搧'">
+            <div class="search_label">闆朵欢鍙凤細</div>
+            <div class="search_input">
+              <el-input size="small" :placeholder="active>1 ? '' : '璇疯緭鍏�'" clearable v-model="addObj.partNo"
+                        :readonly="active>1"></el-input>
+            </div>
+          </el-col>
           <el-col class="search_thing" :span="6" v-if="addObj.formType!='鍏朵粬鎴愬搧'&&addObj.formType">
-            <div class="search_label"><span class="required-span">* </span>涓嬪彂鑷冲璞★細</div>
+            <div class="search_label"><span class="required-span">* </span>閫氱煡鑷虫牱鏈哄憳锛�</div>
             <div class="search_input">
               <el-select v-model="addObj.issueUser" size="small" :disabled="active>1" style="width: 100%;">
                 <el-option v-for="(a,ai) in personList" :key="ai" :label="a.label" :value="a.value"></el-option>
@@ -344,12 +351,42 @@
               <el-input size="small" :placeholder="active>1 ? '' : '璇疯緭鍏�'" clearable v-model="addObj.prepareUser" :readonly="active>1"></el-input>
             </div>
           </el-col>
+          <el-col class="search_thing" :span="6">
+            <div class="search_label"><span class="required-span">* </span>绾﹀畾鏃堕棿锛�</div>
+            <div class="search_input">
+              <el-date-picker
+                v-model="addObj.appointed"
+                type="date"
+                placeholder="閫夋嫨鏃ユ湡"
+                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
+              </el-date-picker>
+            </div>
+          </el-col>
+          <el-col class="search_thing" :span="6">
+            <div class="search_label"><span class="required-span">* </span>鏍锋満瀹屾垚鏃堕棿锛�</div>
+            <div class="search_input">
+              <el-date-picker
+                v-model="addObj.issueTime"
+                type="date"
+                placeholder="閫夋嫨鏃ユ湡"
+                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
+              </el-date-picker>
+            </div>
+          </el-col>
           <el-col class="search_thing" :span="6" style="align-items: flex-start;margin: 8px 0;">
             <div class="search_label">澶囨敞锛�</div>
             <div class="search_input">
               <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 2}" size="small" clearable :placeholder="active>1 ? '' : '璇疯緭鍏�'"
                 v-model="addObj.remark" :readonly="active>1"></el-input>
             </div>
+          </el-col>
+          <el-col class="search_thing upload" :span="4" style="align-items: flex-start;margin: 8px 0 0 50px;height: auto" v-if="active==1">
+            <el-upload
+              action="#"
+              :auto-upload="false"
+              accept='.jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv' :on-change="handleChangeUpload">
+              <el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
+            </el-upload>
           </el-col>
           <!-- <el-col class="search_thing" :span="6" v-if="active==1">
             <div class="search_label">RTS锛�</div>
@@ -382,8 +419,12 @@
             </div>
           </div>
         </div>
+        <el-radio-group v-model="currentPage" v-if="active>1" size="small" style="margin-top: 20px;">
+          <el-radio-button :label="0">鏍峰搧</el-radio-button>
+          <el-radio-button :label="1">闄勪欢</el-radio-button>
+        </el-radio-group>
         <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" max-height="400px" tooltip-effect="dark"
-          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;">
+          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;" v-show="currentPage==0">
           <el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column>
           <el-table-column type="index" label="搴忓彿" width="65" align="center"></el-table-column>
           <el-table-column prop="sample" label="鏍峰搧鍚嶇О" align="center" min-width="100">
@@ -454,7 +495,7 @@
         </el-table>
         <el-table class="el-table" ref="productTable" :data="productList" max-height="400px" tooltip-effect="dark" border
           @selection-change="selectProduct" style="margin-bottom: 10px;" @select="upProductSelect"
-          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll">
+          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll" v-show="currentPage==0">
           <el-table-column type="selection" width="65" :selectable="selectable" v-if="active==1"></el-table-column>
           <el-table-column prop="inspectionItemClass" v-if="PROJECT === '瑁呭鐢电紗'" label="妫�楠岄」鍒嗙被" min-width="140" show-overflow-tooltip></el-table-column>
           <el-table-column prop="inspectionItemClassEn" v-if="PROJECT === '瑁呭鐢电紗'" label="妫�楠岄」鍒嗙被(EN)" min-width="140" show-overflow-tooltip></el-table-column>
@@ -536,6 +577,9 @@
           <el-table-column prop="sonLaboratory" label="瀛愬疄楠屽" min-width="130" show-overflow-tooltip :filters="filters"
             :filter-method="filterHandler"></el-table-column>
         </el-table>
+        <ValueTable class="value-table" ref="fileList" :url="$api.insOrderPlan.getFileList"
+        :componentData="componentData0"
+        :delUrl="$api.insOrderPlan.delfile" style="height: 100%;margin-top: 16px;" v-show="currentPage==1"/>
       </div>
     </div>
     <el-dialog title="閫夋嫨鍗曚綅" :visible.sync="selectUserDia" width="70%">
@@ -934,6 +978,13 @@
         <el-button type="primary" @click="spliceTemperatureTest">淇濆瓨</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="鏂囦欢棰勮"
+      :visible.sync="lookFileVisible"
+      width="60%" fullscreen>
+      <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
+      :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
+    </el-dialog>
   </div>
 </template>
 
@@ -944,6 +995,7 @@
 import equipConfig from './equip-config.vue'
 import cableConfig from './cable-config.vue'
 import Vue from 'vue'
+import filePreview from '../../tool/file-preview.vue'
 
 export default {
     components: {
@@ -951,7 +1003,8 @@
       fiberOpticConfig,
       fiberOpticConfigTwo,
       equipConfig,
-      cableConfig
+      cableConfig,
+      filePreview
     },
     props: {
       examine: {
@@ -969,6 +1022,8 @@
     },
     data() {
       return {
+        currentFile:{},
+        lookFileVisible:false,
         inspectionItemST: null,
         sampleSelectionList: [],//鏍峰搧琛ㄦ牸閫変腑鏁版嵁
         editTable:[],
@@ -982,6 +1037,7 @@
           type: '0',
           code: null,
           appointed: null,
+          issueTime:null,
           remark: null,
           otcCode: null,
           mating: 0,
@@ -1006,7 +1062,8 @@
           companyId: null,
           prepareUser:null,
           departmentLimsId:null,
-          departmentLims:null
+          departmentLims:null,
+          partNo: null, // 闆朵欢鍙�
         },
         sample: {
           sampleCode: null,
@@ -1146,6 +1203,52 @@
         deaprtEnum:[],
         standard:[],
         createState:1,//1:閫夋嫨濮旀墭鍗曚綅锛�2锛氶�夋嫨鐢熶骇鍗曚綅
+        fileList:[],
+        currentPage:0,//0:鏍峰搧淇℃伅锛�1锛氶檮浠�
+        componentData0: {
+          entity: {
+            insOrderId:''
+          },
+          isIndex: true,
+          showSelect: false,
+          select: false,
+          sort: false,
+          init:false,
+          do: [
+          {
+						id: 'handleDown',
+						font: '涓嬭浇',
+						type: 'text',
+						method: 'handleDown'
+					},
+          {
+						id: '1',
+						font: '棰勮',
+						type: 'text',
+						method: 'lookFile',
+					}
+          ],
+          isPage: false,
+          linkEvent: {},
+          tagField: {
+            type:{
+              select:[
+                {
+                  value: 1,
+                  label: '鍥剧墖'
+                },
+                {
+                  value: 2,
+                  label: '鏂囦欢'
+                }
+              ]
+            }
+          },
+          currentId: '',
+          selectField: {},
+          requiredAdd: [],
+          requiredUp: []
+        },
       }
     },
     watch: {
@@ -1241,10 +1344,45 @@
             }
           })
         })
+        // 鏂囦欢淇℃伅
+        this.componentData0.entity.insOrderId = this.currentId
+        this.$refs.fileList.selectList()
       }
     },
     methods: {
+      lookFile(row){
+        this.currentFile = row;
+        if(row.type==1){
+          this.currentFile.url = this.javaApi+'/img/'+row.fileUrl
+        }else{
+          this.currentFile.url = this.javaApi+'/word/'+row.fileUrl
+        }
+        this.lookFileVisible = true
+      },
+      handleDown(row){
+        this.$axios.post(this.$api.insOrderPlan.downFile, {
+          id: row.id,
+        }).then(res => {
+          if (res.code === 200) {
+            let url = '';
+            if(res.data.type==1){
+              url = this.javaApi+'/img/'+res.data.fileUrl
+              file.downloadIamge(url,row.fileName)
+            }else{
+              url = this.javaApi+'/word/'+res.data.fileUrl
+              const link = document.createElement('a');
+              link.href = url;
+              link.download = row.fileName;
+              link.click();
+            }
+          }
+        }).catch(error => {
 
+        })
+      },
+      handleChangeUpload(file, fileLists){
+        this.fileList = fileLists
+      },
       //鐗规畩鍊煎~鍐欏鐞�
       inputValueHandler(row,index){
         if(row){
@@ -1559,7 +1697,12 @@
           }
         }else if(this.createState==2){
           this.addObj.production = selects.company
-          this.addObj.productionEn = selects.companyEn
+          // 濡傛灉閫夋嫨鐨勫崟浣嶆槸娌℃湁瀵瑰簲鐨勮嫳鏂囧悕绉板氨鐢�'/'浠f浛
+          if (!selects.companyEn) {
+            this.addObj.productionEn = '/'
+          } else {
+            this.addObj.productionEn = selects.companyEn
+          }
         }
         this.selectUserDia = false
       },
@@ -1657,10 +1800,14 @@
           this.$message.error('璇疯緭鍏ユ牱鍝佸悕绉�')
         } else if (!this.sampleList.every(m => m.model)) {
           this.$message.error('璇疯緭鍏ユ牱鍝佸瀷鍙�')
+        }else if (!this.addObj.appointed) {
+          this.$message.error('璇烽�夋嫨绾﹀畾鏃堕棿')
+        }else if (!this.addObj.issueTime) {
+          this.$message.error('璇烽�夋嫨鏍锋満瀹屾垚鏃堕棿')
         } else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
           this.$message.error('璇烽�夋嫨妫�楠屾爣鍑�')
         } else if(this.addObj.formType&&this.addObj.formType!='鍏朵粬鎴愬搧'&&!this.addObj.issueUser){
-          this.$message.error('璇烽�夋嫨涓嬪彂瀵硅薄')
+          this.$message.error('璇烽�夋嫨閫氱煡鑷虫牱鏈哄憳')
         }else{
           //鏍¢獙妫�楠岄」鐨勮姹傚�煎拰瑕佹眰鎻忚堪,浠呭鎵樿姹�
           // if(this.active==1&&this.isAskOnlyRead){
@@ -2031,8 +2178,12 @@
           return false;
         }
         this.saveLoad = true
-        this.$axios.post(this.$api.insOrder.addInsOrder, {
-          str: JSON.stringify({
+        let fd = new FormData();
+        this.fileList.forEach((item,index)=>{
+            //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
+            fd.append("files",item.raw);
+        })
+        fd.append("str",JSON.stringify({
             insOrder: this.addObj,
             list: JSON.stringify(sampleList.map(a => {
               if (this.PROJECT === '瑁呭鐢电紗') {
@@ -2055,7 +2206,12 @@
               return a
             })),
             pairing: JSON.stringify(this.bsm2Val2)
-          })
+          }));
+        this.$axios.post(this.$api.insOrder.addInsOrder, fd,{
+          headers: {
+            'Content-Type': 'multipart/form-data'
+          },
+          noQs:true
         }).then(res => {
           this.saveLoad = false
           if (res.code == 201) return
@@ -3236,7 +3392,7 @@
       },
       selectDepartmentEnum(){
         this.$axios.get(this.$api.department.selectDepartmentLimsEnum).then(res=>{
-          this.deaprtEnum = res.data
+          this.deaprtEnum = res.data.filter(item=>item.name === '璐ㄩ噺閮�' || item.name === '妫�娴嬩腑蹇�')
         })
       }
     }

--
Gitblit v1.9.3