chris %!s(int64=3) %!d(string=hai) anos
pai
achega
d46b57cd32
Modificáronse 1 ficheiros con 16 adicións e 9 borrados
  1. 16 9
      src/views/modules/sale/outsource-add-or-update.vue

+ 16 - 9
src/views/modules/sale/outsource-add-or-update.vue

@@ -139,7 +139,10 @@
                 align="center"
                 label="附件">
                 <template slot-scope="scope">
-                  <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
+                  <div v-for="(item, index) in scope.row.attachList" style="display: inline">
+                    <span v-if="index > 0">,</span>
+                    <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+                  </div>
                 </template>
               </el-table-column>
               <el-table-column
@@ -200,7 +203,8 @@
         </span>
       <!-- 新增物品 -->
       <Add v-show="addProductVisible" ref="comAddProduct" @addItem="addProductCallback"/>
-      <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
+      <!-- 文件预览 -->
+      <preview-component v-if="previewVisible" ref="preview"/>
     </div>
 </template>
 
@@ -208,12 +212,15 @@
   import { getOutsourceDetail, getOutsourceDetailByScheduleId } from '@/api/sale'
   import { getDictList } from '@/api/dict'
   import Add from './add-product'
-  import AttachDetail from '../common/attach-detail'
+  import ApproveComponent from '../common/approve-component'
+  import PreviewComponent from '../common/preview-component'
 
 export default {
     name: 'outsource-add-or-update',
     components: {
-      Add, AttachDetail
+      PreviewComponent,
+      ApproveComponent,
+      Add
     },
     data () {
       return {
@@ -228,7 +235,7 @@ export default {
         addProductVisible: false,
         productDetails: [],
         prodProductionIds: [], // 排产ID的集合
-        attachVisible: false
+        previewVisible: false
       }
     },
     methods: {
@@ -365,11 +372,11 @@ export default {
         str += '%'
         return str
       },
-      // 附件
-      attachDetails (row) {
-        this.attachVisible = true
+      // 预览
+      previewFile (fileName, url) {
+        this.previewVisible = true
         this.$nextTick(() => {
-          this.$refs.attachDetail.init(row.attachList)
+          this.$refs.preview.init(fileName, url)
         })
       }
     }