hfxc226 преди 3 години
родител
ревизия
7d070609bd
променени са 2 файла, в които са добавени 71 реда и са изтрити 12 реда
  1. 33 7
      src/views/repair/fee/modules/BaseForm.vue
  2. 38 5
      src/views/repair/fee/modules/Detail.vue

+ 33 - 7
src/views/repair/fee/modules/BaseForm.vue

@@ -29,7 +29,9 @@
       >
         <a-input
           disabled
+          style="width:70%"
           v-decorator="['repairNo']" />
+        <a-button style="width: 30%;" type="primary" @click="handleAppNoSelect">选择</a-button>
       </a-form-item>
       <a-form-item
         label="委外单号"
@@ -150,6 +152,7 @@
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
+    <repair-application-form-select-modal ref="rafSelectModal" @selected="handleAppNoSelected"/>
   </a-modal>
 </template>
 
@@ -159,11 +162,13 @@ import { addRepairFee, updateRepairFee } from '@/api/repair/fee'
 import { uploadUrl } from '@/api/upms/file'
 import Vue from 'vue'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
+import RepairApplicationFormSelectModal from '@/views/repair/application-form/modules/RepairApplicationFormSelectModal'
 
 export default {
   name: 'BaseRepairFee',
   data () {
     return {
+      sbId: null,
       confirmLoading: false,
       modalTitle: null,
       defaultImageList: [],
@@ -181,6 +186,9 @@ export default {
       typeMap: {}
     }
   },
+  components: {
+    RepairApplicationFormSelectModal
+  },
   props: {
   },
   created () {
@@ -194,13 +202,16 @@ export default {
       // 如果是空标识添加
       const { form: { setFieldsValue } } = this
       if (this.BaseTool.Object.isBlank(record)) {
-        this.$nextTick(() => {
-          setFieldsValue({
-            'sbId': repairForm.sbId,
-            'repairId': repairForm.id,
-            'repairNo': repairForm.no
+        if (repairForm != null) {
+          this.sbId = repairForm.sbId
+          this.$nextTick(() => {
+            setFieldsValue({
+              'sbId': repairForm.sbId,
+              'repairId': repairForm.id,
+              'repairNo': repairForm.no
+            })
           })
-        })
+        }
         this.imageList = []
         this.fileList = []
         this.defaultImageList = []
@@ -275,7 +286,7 @@ export default {
     },
     handleFileChange (info) {
       this.defaultFileList = info.fileList
-      this.fileList = this.setFileList(info, 18)
+      this.fileList = this.setFileList(info, 19)
     },
     setFileList (info, type) {
       const file = info.file
@@ -289,6 +300,21 @@ export default {
         return []
       }
     },
+    handleAppNoSelect () {
+      this.$refs.rafSelectModal.base(null, { sbId: this.sbId })
+    },
+    handleAppNoSelected (record, keys, rows) {
+      console.log(keys, rows)
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'repairId': key,
+          'repairNo': row.no
+        }))
+      })
+    },
     handleCancel (values) {
       this.visible = false
       this.confirmLoading = false

+ 38 - 5
src/views/repair/fee/modules/Detail.vue

@@ -20,11 +20,19 @@
       <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
       <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
     </detail-list>
-    <detail-list title="图片:" :col="6">
-      <upload-image-detail :images-list="model.imageList"/>
+    <title-divider title="费用图片" width="90px"></title-divider>
+    <detail-list title="" :col="1">
+      <detail-list-item term="" v-if="model.imageList != null && model.imageList.length > 0">
+        <viewer :images="model.imageList" @inited="inited" ref="viewer" :index="1" >
+          <img v-for="item in model.imageList" :src="item.url" :key="item.id" class="image">
+        </viewer>
+      </detail-list-item>
+      <detail-list-item term="" v-if="model.imageList == null || model.imageList.length === 0">
+        暂无
+      </detail-list-item>
     </detail-list>
     <detail-list title="" :col="8">
-      <detail-list-item term="文件">
+      <detail-list-item term="费用文件">
         <a-upload
           :multiple="true"
           :fileList="BaseTool.UPLOAD.transImg(model.fileList)"
@@ -32,7 +40,6 @@
         </a-upload>
       </detail-list-item>
     </detail-list>
-
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
     </template>
@@ -89,8 +96,34 @@ export default {
     handleCancel () {
       this.visible = false
       this.confirmLoading = false
+    },
+    inited (viewer) {
+      this.$viewer = viewer
     }
-
   }
 }
 </script>
+<style scoped>
+/* For demo */
+.ant-carousel {
+  width: 300px;
+  height: 300px;
+}
+.ant-carousel >>> .slick-slide {
+  text-align: center;
+  height: 300px;
+  line-height: 300px;
+  overflow: hidden;
+}
+
+.ant-carousel >>> .slick-slide h3 {
+  color: #fff;
+}
+
+.image {
+  width: calc(20% - 10px);
+  cursor: pointer;
+  margin: 5px;
+  display: inline-block;
+}
+</style>