From f7eedc924df60b69353b190dc3579ef7d0852019 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 06 十二月 2022 10:24:26 +0800
Subject: [PATCH] 1.sop上传接口接入

---
 src/permission.js     |    2 
 /dev/null             |   31 ------
 src/views/scgl/gd.vue |   88 ++++++++++++++---
 src/views/xtsz/sc.vue |  129 ++++++++++---------------
 src/api/scgl.js       |    9 +
 src/router/index.js   |    5 -
 src/api/xtsz.js       |    2 
 7 files changed, 135 insertions(+), 131 deletions(-)

diff --git a/src/api/scgl.js b/src/api/scgl.js
index 1f38393..602a55e 100644
--- a/src/api/scgl.js
+++ b/src/api/scgl.js
@@ -296,3 +296,12 @@
     data
   })
 }
+// MES宸ュ崟宸ュ簭浠诲姟鏌ョ湅SOP,鑾峰彇SOP鏂囦欢涓嬫媺鍒楄〃
+export function SearchWorkStepSopList(data) {
+  return request({
+    url: 'ProductionManagement/SearchWorkStepSopList',
+    method: 'get',
+    params: data
+  })
+}
+
diff --git a/src/api/xtsz.js b/src/api/xtsz.js
index 3e7278b..576e87c 100644
--- a/src/api/xtsz.js
+++ b/src/api/xtsz.js
@@ -86,7 +86,7 @@
   return request({
     url: 'SystemSetting/SystemSopSava',
     method: 'post',
-    params: data
+    data
   })
 }
 
diff --git a/src/permission.js b/src/permission.js
index 8304258..fd74217 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -8,7 +8,7 @@
 
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
-const whiteList = ['/login', '/zhkb', '/ckgl', '/cgdd', '/bzcj', '/dccj', '/zpcj', '/back', '/xtsz/yl'] // no redirect whitelist
+const whiteList = ['/login', '/zhkb', '/ckgl', '/cgdd', '/bzcj', '/dccj', '/zpcj', '/back'] // no redirect whitelist
 
 router.beforeEach(async(to, from, next) => {
   // start progress bar
diff --git a/src/router/index.js b/src/router/index.js
index 6cdd187..f394774 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -64,11 +64,6 @@
     component: () => import('@/views/kb/bzcj'),
     hidden: true
   },
-  {
-    path: '/xtsz/yl',
-    component: () => import('@/views/xtsz/yl'),
-    hidden: true
-  },
 
   {
     path: '/login',
diff --git a/src/views/scgl/gd.vue b/src/views/scgl/gd.vue
index 0443ebd..13bb53d 100644
--- a/src/views/scgl/gd.vue
+++ b/src/views/scgl/gd.vue
@@ -319,11 +319,6 @@
             <template slot-scope="{row}">
               <div class="operationClass">
                 <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ崟" placement="top">
-                  <!--                  <i-->
-                  <!--                    class="el-icon-tickets"-->
-                  <!--                    style="cursor: pointer;color: #42b983;margin-right: 15px"-->
-                  <!--                    @click="check(row)"-->
-                  <!--                  />-->
                   <i
                     class="el-icon-tickets"
                     style="cursor: pointer;color: #42b983;margin-right: 15px"
@@ -423,6 +418,9 @@
                     style="cursor: pointer;color: #42b983;margin-right: 15px"
                     @click="supplementSmallClick(row)"
                   />
+                </el-tooltip>
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top">
+                  <i class="el-icon-files" style="cursor: pointer;color:#42b983;" @click="check(row)" />
                 </el-tooltip>
               </div>
             </template>
@@ -1557,6 +1555,46 @@
       </span>
     </el-dialog>
 
+    <el-dialog
+      title="鏂囦欢棰勮"
+      :visible.sync="dialogVisibleCheck"
+      width="800px"
+      :close-on-click-modal="false"
+      top="15vh"
+      @closed="handleCloseCheck"
+      @close="handleCloseCheck"
+    >
+      <el-form label-width="80px">
+        <el-form-item label="鏂囦欢鐗堟湰">
+          <el-select
+            v-model="sopSelectValue"
+            style="width: 200px"
+            placeholder="璇烽�夋嫨"
+            filterable
+            :popper-append-to-body="false"
+          >
+            <el-option
+              v-for="item in sopSelectArr"
+              :key="item.id"
+              :label="item.define_name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+
+      </el-form>
+
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button @click="dialogVisibleCancelCheck">杩� 鍥�</el-button>
+          <el-button
+            type="primary"
+            @click="dialogVisibleConfirmCheck"
+          >棰� 瑙�</el-button>
+        </div>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -1566,7 +1604,7 @@
   AddUpdateMesOrder,
   ClosedMesOrder,
   DeleteMesOrder, ErpOrderSearch,
-  MesOrderSearch, PartSelectRoute, RouteSelectWkshop, SearchWorkStep,
+  MesOrderSearch, PartSelectRoute, RouteSelectWkshop, SearchWorkStep, SearchWorkStepSopList,
   SelectRouteStep
 } from '@/api/scgl'
 import { InventoryFileAssociationRoute, PartSelect, SaveInventoryFile } from '@/api/zzmx'
@@ -1576,6 +1614,7 @@
 import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
 import QRCode from 'qrcodejs2'
 import $ from 'jquery'
+import { SystemSopView } from '@/api/xtsz'
 
 export default {
   name: 'GD',
@@ -1798,7 +1837,11 @@
         disabledDate(time) {
           return time.getTime() < Date.now() - 8.64e7
         }
-      }
+      },
+      /* 鏂囦欢棰勮閮ㄥ垎*/
+      dialogVisibleCheck: false,
+      sopSelectArr: [], // sop涓嬫媺閫夐」鏁扮粍
+      sopSelectValue: ''// sop涓嬫媺閫変腑鍊�
     }
   },
   created() {
@@ -1947,17 +1990,32 @@
       this.wkshopArr = res2
       this.dialogForm.wkshopcode = ''
     },
-    // 宸ュ簭浠诲姟
+    // 棰勮
     async check(row) {
-      const { data: res } = await SearchWorkStep({ wo_code: row.wo_code })
-      this.taskTableData = res
-
-      if (this.taskTableData.length === 0) {
-        return this.$message.info('鏃犵敓浜т换鍔℃暟鎹紒')
+      this.dialogVisibleCheck = true
+      const data = {
+        partcode: row.partcode,
+        routecode: this.tableData.find(i => i.wo_code === this.radioSelected).route_code,
+        stepcode: row.stepcode
       }
-      this.dialogForm.mesordercode = res[0].wo_code
-      this.dialogVisibleTask = true
+      const { data: res } = await SearchWorkStepSopList(data)
+      this.sopSelectArr = res
+      this.sopSelectValue = res[0].id
     },
+    // 棰勮鍏抽棴
+    handleCloseCheck() {
+      this.sopSelectValue = ''
+    },
+    // 棰勮杩斿洖
+    dialogVisibleCancelCheck() {
+      this.dialogVisibleCheck = false
+    },
+    // 棰勮鏂板紑娴忚鍣ㄩ〉绛�
+    async dialogVisibleConfirmCheck() {
+      const { data: res } = await SystemSopView({ id: this.sopSelectValue, filepath: this.sopSelectArr.find(i => i.id === this.sopSelectValue).file_path })
+      window.open(res)
+    },
+
     dialogVisibleBack() {
       this.dialogVisibleTask = false
     },
diff --git a/src/views/xtsz/sc.vue b/src/views/xtsz/sc.vue
index 5171b82..b473666 100644
--- a/src/views/xtsz/sc.vue
+++ b/src/views/xtsz/sc.vue
@@ -12,17 +12,15 @@
           >
             <div class="elForm" style="justify-content: flex-start">
               <el-form-item style="margin-right: 30px">
-                <el-checkbox v-model="form.checked">澶囬�夐」</el-checkbox>
+                <el-checkbox v-model="checked" @change="checkedChange">鏈�鏂扮増鏈�</el-checkbox>
               </el-form-item>
               <el-form-item>
-                <!--                prefix-icon="el-icon-search"-->
                 <el-input v-model="form.search" placeholder="璇疯緭鍏ュ叧閿瓧" style="width: 260px" />
               </el-form-item>
             </div>
           </el-form>
           <el-button type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">鏌ヨ</el-button>
           <el-button type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
-
         </div>
       </div>
 
@@ -47,7 +45,7 @@
             label="搴忓彿"
           />
           <el-table-column
-            prop="file_name"
+            prop="define_name"
             label="鏂囦欢鍚嶇О"
             min-width="160"
             show-tooltip-when-overflow
@@ -95,7 +93,7 @@
           <el-table-column
             prop="lm_date"
             label="涓婁紶鏃堕棿"
-            width="160"
+            min-width="160"
             sortable="custom"
           />
           <el-table-column
@@ -105,8 +103,8 @@
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="棰勮" placement="top">
-                  <i class="el-icon-files" style="cursor: pointer;color:#42b983;margin-right: 15px" @click="check" />
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="棰勮" placement="top">
+                  <i class="el-icon-files" style="cursor: pointer;color:#42b983;margin-right: 15px" @click="check(row)" />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
                   <i class="el-icon-delete" @click="del(row)" />
@@ -172,9 +170,10 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">
-          <el-input v-model="dialogForm.defilename" style="width: 200px" />
-        </el-form-item>
+        <!--        <el-form-item label="鏂囦欢鍚嶇О" prop="defilename">-->
+        <!--        <el-form-item label="鏂囦欢鍚嶇О">-->
+        <!--          <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />-->
+        <!--        </el-form-item>-->
         <el-form-item label="鏂囦欢绫诲瀷" prop="filetypecode">
           <el-select
             v-model="dialogForm.filetypecode"
@@ -192,10 +191,10 @@
             />
           </el-select>
         </el-form-item>
-
+        <el-form-item label="鐗堟湰鍙�">
+          <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />
+        </el-form-item>
         <el-form-item label="鏂囦欢涓婁紶" prop="Files">
-          <!--          <el-input v-model="dialogForm.Files" style="width: 200px" />-->
-
           <div style="width: 200px;">
             <el-upload
               ref="uploadFileRef"
@@ -208,8 +207,6 @@
               :multiple="false"
               accept=".mp4,.pdf"
             >
-              <!--              :http-request="upload"-->
-              <!--              :before-upload="beforeUpload"-->
               <el-button
                 type="primary"
                 style="width: 200px;display: flex;justify-content: center"
@@ -219,15 +216,16 @@
             </el-upload>
           </div>
         </el-form-item>
-        <el-form-item label="鐗堟湰鍙�">
-          <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />
-        </el-form-item>
-
       </el-form>
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
           <el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+          <el-button
+            type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            @click="dialogVisibleConfirm"
+          >纭� 瀹�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -237,9 +235,14 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, PrentOrganization } from '@/api/jcsz'
-import { getCookie } from '@/utils/auth'
-import { SystemSopDelete, SystemSopDeviceSearch, SystemSopMaxVersion, SystemSopSava, SystemSopSearch } from '@/api/xtsz'
+import {
+  SystemSopDelete,
+  SystemSopDeviceSearch,
+  SystemSopMaxVersion,
+  SystemSopSava,
+  SystemSopSearch,
+  SystemSopView
+} from '@/api/xtsz'
 import { PartSelect } from '@/api/zzmx'
 
 export default {
@@ -254,13 +257,15 @@
       mainHeight: 0,
       tableHeight: 0,
       form: {
-        checked: '', // 鏄惁閫変腑鏈�楂樼増鏈�
+        check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈�
         search: '', // 鎼滅储鍏抽敭瀛�
         prop: 'lm_date', // 鎺掑簭瀛楁
         order: 'desc', // 鎺掑簭瀛楁
         page: 1, // 绗嚑椤�
         rows: 20 // 姣忛〉澶氬皯鏉�
       },
+      checked: false,
+
       total: 10,
       tableData: [],
       dialogVisible: false,
@@ -285,10 +290,6 @@
         filetypecode: [
           { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷', trigger: ['blur', 'change'] }
         ]
-        // Files: [
-        //   { required: true, message: '璇疯緭鍏ユ枃浠跺悕绉�', trigger: ['blur', 'change'] }
-        // ]
-
       },
       devicetvpeArr: [], // 璁惧绫诲瀷涓嬫媺鍒楄〃
       partArr: [], // 鐗╂枡涓嬫媺鍒楄〃
@@ -297,6 +298,7 @@
         { code: 'P002', name: '妫�楠屾寚瀵间功' },
         { code: 'P003', name: '鍥剧焊' }
       ]
+
     }
   },
 
@@ -330,42 +332,24 @@
     search() {
       this.getSystemSopSearch()
     },
-    // 瀵煎叆鎸夐挳
-    // upload(param) {
-    //   console.log('111')
-    //   this.dialogForm.Files = param.file
-    // },
-    // 鏂囦欢涓婁紶涔嬪墠鏂规硶
-    // beforeUpload(file) {
-    // console.log(file, 1)
-    // const isLt100M = file.size / 1024 / 1024 < 100
-    // // if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb'].indexOf(file.type) == -1) {
-    // if (['video/mp4', '.pdf'].indexOf(file.type) === -1) {
-    //   this.$message.error('涓婁紶鏂囦欢鍙兘鏄� pdf銆乵p4 鏍煎紡!')
-    //   // this.$message.error('涓婁紶瑙嗛鍙兘鏄� mp4銆乷gg銆乫lv銆乤vi銆亀mv銆乺mvb 鏍煎紡!')
-    //   return false
-    // }
-    // if (!isLt100M) {
-    //   this.$message.error('涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 100MB!')
-    //   return false
-    // }
-    // return true
-    // },
+    // 鏈�鏂扮増鏈敼鍙樻椂瑙﹀彂
+    checkedChange(val) {
+      this.form.check = val ? 'Y' : 'N'
+      this.getSystemSopSearch()
+    },
     // 鏂囦欢鏁伴噺瓒呰繃闄愬畾瑙﹀彂
     handleExceed() {
       this.$message.info('鏆備笉鏀寔澶氭枃浠朵笂浼狅紒')
     },
+
     // 閲嶇疆
     reset() {
-      this.form.checked = ''
       this.form.search = ''
       this.getSystemSopSearch()
     },
-
     // 鏂板鎸夐挳
     add() {
       this.dialogVisible = true
-
       this.getSystemSopDeviceSearch()
       this.getPartSelect()
     },
@@ -379,7 +363,6 @@
       const { data: res } = await PartSelect()
       this.partArr = res
     },
-
     // 鏂囦欢绫诲瀷鍊兼敼鍙樻椂
     async fileversionChange(val, type) {
       const data = {
@@ -391,21 +374,10 @@
 
       this.dialogForm.fileversion = res
     },
-
     // 棰勮
-    check() {
-      const url = this.$router.resolve({
-        path: '/xtsz/yl',
-        query: {
-          // clue_id: row.clue_id,
-          // operation: 'check',
-          name: '鏂囦欢棰勮'
-        }
-      })
-
-      window.open(url.href)
-
-      // SystemSopView
+    async  check(row) {
+      const { data: res } = await SystemSopView({ id: row.id, filepath: row.file_path })
+      window.open(res)
     },
 
     // 鍒犻櫎鎸夐挳
@@ -416,8 +388,8 @@
         type: 'warning'
       }).then(() => {
         const data = {
-          id: '',
-          filepath: ''
+          id: row.id,
+          filepath: row.file_path
         }
         SystemSopDelete(data).then(res => {
           if (res.code === '200') {
@@ -440,16 +412,17 @@
       this.dialogForm.filetypecode = ''
       this.dialogForm.fileversion = ''
       this.dialogForm.Files = ''
+      this.$refs.uploadFileRef.clearFiles()
       this.$refs.dialogForm.clearValidate()
     },
     // 瀵硅瘽妗嗗彇娑�
     dialogVisibleCancel() {
       this.dialogVisible = false
+      this.$store.state.app.buttonIsDisabled = false
     },
     // 瀵硅瘽妗嗙‘璁�
     dialogVisibleConfirm() {
       console.log(this.$refs.uploadFileRef.uploadFiles[0])
-
       if (!this.$refs.uploadFileRef.uploadFiles[0]) {
         this.$message.info('璇烽�夋嫨鏂囦欢涓婁紶锛�')
       }
@@ -457,25 +430,25 @@
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const formData = new FormData()
-          formData.append('devicetvpecode', this.dialogForm.devicetvpecode)
+          formData.append('devicetypecode', this.dialogForm.devicetvpecode)
           formData.append('partcode', this.dialogForm.partcode)
-          formData.append('defilename', this.dialogForm.defilename)
+          formData.append('defilename', this.$refs.uploadFileRef.uploadFiles[0].name)
           formData.append('filetypecode', this.dialogForm.filetypecode)
           formData.append('fileversion', this.dialogForm.fileversion)
           formData.append('Files', this.$refs.uploadFileRef.uploadFiles[0].raw)
-          // formData.append('Files', JSON.stringify(this.$refs.uploadFileRef.uploadFiles[0].raw))
-          // formData.append('Files', JSON.stringify(this.$refs.uploadFileRef.uploadFiles[0]))
-          for (var [key, value] of formData) {
-            console.log(key, value)
-          }
-          // 鍙傝�冩枃浠朵笂浼犲湴鏂癸紝鏄庡ぉ鐪�
+          // for (var [key, value] of formData) {
+          //   console.log(key, value)
+          // }
+          this.$store.state.app.buttonIsDisabled = true
           SystemSopSava(formData).then(res => {
             if (res.code === '200') {
               this.$message.success('鏂囦欢涓婁紶鎴愬姛锛�')
               this.dialogVisible = false
+              this.$store.state.app.buttonIsDisabled = false
               this.getSystemSopSearch()
             } else {
               this.$message.error('鏂囦欢涓婁紶澶辫触锛�')
+              this.$store.state.app.buttonIsDisabled = false
             }
           })
         }
diff --git a/src/views/xtsz/yl.vue b/src/views/xtsz/yl.vue
deleted file mode 100644
index 46c0017..0000000
--- a/src/views/xtsz/yl.vue
+++ /dev/null
@@ -1,31 +0,0 @@
-<template>
-  <div>
-    1
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'Yl',
-  data() {
-    return {
-
-    }
-  },
-  created() {
-    const url = window.location.hash.split('?')[1]
-    const titleName = url.split('=')[1] // sop鏂囦欢棰勮鍚嶇О
-    document.title = decodeURIComponent(titleName) + ' - 鏂板嚡杩櫤閫犱簯骞冲彴'
-  },
-  mounted() {
-
-  },
-  methods: {
-
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

--
Gitblit v1.9.3