scorpioyq 2 năm trước cách đây
mục cha
commit
65d02e6708

+ 6 - 2
src/components/filepicker/index.vue

@@ -9,8 +9,8 @@
         @click="show = true"
         >上传
       </el-button>
-      <el-button v-else type="primary" icon="Upload" @click="show = true"
-        >文件上传
+      <el-button v-else type="primary" icon="Plus" @click="show = true"
+        >{{ btnText }}
       </el-button>
     </div>
     <el-dropdown v-else class="ml-10" @command="commandChange">
@@ -155,6 +155,10 @@ export default {
     fileWay
   },
   props: {
+    btnText: {
+      type: Boolean,
+      default: '文件上传'
+    },
     projectId: {
       required: true,
       type: String,

+ 8 - 4
src/views/contract/index.vue

@@ -54,7 +54,11 @@
       <template #menu-left>
         <div class="flex flex-center">
           <div class="main-color ml-10 mr-20 bold font-15">金额单位:万元</div>
-          <filepicker :project-id="projectId" @submit="selection" />
+          <filepicker
+            btn-text="新增合同"
+            :project-id="projectId"
+            @submit="selection"
+          />
         </div>
       </template>
     </avue-crud>
@@ -128,12 +132,12 @@ export default {
           {
             label: '签订日期',
             prop: 'signTime',
-            width: 100
+            width: 110
           },
           {
             label: '合同状态',
             prop: 'contractsStatus',
-            width: 100,
+            width: 90,
             dicUrl:
               '/api/blade-system/dict-biz/dictionary?code=contract-status',
             props: {
@@ -144,7 +148,7 @@ export default {
           {
             label: '到期日期',
             prop: 'expireTime',
-            width: 100
+            width: 110
           }
         ]
       },

+ 204 - 0
src/views/project/componens/info3.vue

@@ -0,0 +1,204 @@
+<template>
+  <wt-card title="相关合同" class="mt-10">
+    <div
+      class="full-width text-right main-color pointer"
+      style="margin-top: -10px"
+      @click="moreContract"
+    >
+      查看更多>>
+    </div>
+    <div class="flex flex-justify-start full-width mt-15">
+      <avue-crud
+        :option="option"
+        :data="data"
+        ref="crud"
+        v-model="form"
+        :before-open="beforeOpen"
+        @row-del="rowDel"
+        @row-save="rowSave"
+        @row-update="rowUpdate"
+      >
+        <template #menu-left>
+          <div class="flex flex-center">
+            <filepicker
+              btn-text="新增合同"
+              :project-id="projectId"
+              @submit="selection"
+            />
+          </div>
+        </template>
+      </avue-crud>
+    </div>
+  </wt-card>
+</template>
+
+<script>
+import wtCard from '@/components/wt-card/index.vue'
+import filepicker from '@/components/filepicker/index.vue'
+
+export default {
+  name: 'info3',
+  components: {
+    wtCard,
+    filepicker
+  },
+  props: {
+    projectId: {
+      required: true,
+      type: String,
+      default: ''
+    },
+    stageId: {
+      required: true,
+      type: String,
+      default: ''
+    }
+  },
+  watch: {
+    projectId: {
+      handler(val) {
+        if (val.length > 0) {
+          this.onLoad()
+        }
+      },
+      immediate: true
+    },
+    stageId: {
+      handler(val) {
+        if (val.length > 0) {
+          this.onLoad()
+        }
+      },
+      immediate: true
+    }
+  },
+  data() {
+    return {
+      form: {},
+      data: [],
+      option: {
+        align: 'center',
+        menuAlign: 'center',
+        menuWidth: 180,
+        size: 'mini',
+        addBtn: false,
+        // addBtnText: '新增合同',
+        editBtn: false,
+        viewBtn: true,
+        delBtn: true,
+        columnBtn: false,
+        labelWidth: 140,
+        border: true,
+        column: [
+          {
+            label: '合同名称',
+            prop: 'title',
+            fixed: true
+          },
+          {
+            label: '合同金额',
+            prop: 'amount',
+            width: 180
+          },
+          {
+            label: '业务联系人',
+            prop: 'contacts',
+            width: 120
+          },
+          {
+            label: '合同乙方',
+            prop: 'partyB'
+          }
+        ]
+      },
+      page: {
+        size: 10,
+        current: 1
+      }
+    }
+  },
+  methods: {
+    onLoad() {
+      this.loading = true
+      const data = Object.assign({
+        projectId: this.projectId,
+        stageId: this.stageId
+      })
+      this.$api.contract
+        .contractList(Object.assign(this.page, data))
+        .then(res => {
+          this.data = res.data.records.map(ele => {
+            if (ele.contractsStatus === -1) {
+              ele.contractsStatus = ''
+            }
+            if (ele.type === -1) {
+              ele.type = ''
+            }
+            return ele
+          })
+          this.page.total = res.data.total
+        })
+        .finally(() => {
+          this.loading = false
+        })
+    },
+    beforeOpen(done, type) {
+      if (type === 'view') {
+        const data = this.$router.resolve({
+          path: '/contract/detail',
+          query: { id: this.form.id }
+        })
+        window.open(data.href, '_blank')
+      }
+    },
+    rowDel(row, index, done) {
+      this.$confirm('确定将选择数据删除?', {
+        type: 'warning'
+      }).then(res => {
+        console.log(res)
+        if (res === 'confirm') {
+          this.$api.contract.contractRemove({ ids: row.id }).then(res => {
+            if (res.code === 200) {
+              this.$message.success(res.msg)
+              this.onLoad()
+            } else {
+              this.$message.error(res.msg)
+            }
+          })
+        }
+      })
+    },
+    currentChange(currentPage) {
+      this.page.current = currentPage
+    },
+    sizeChange(pageSize) {
+      this.page.size = pageSize
+    },
+    refreshChange() {
+      this.onLoad()
+    },
+    selection(list) {
+      const tmps = list.map(ele => {
+        return {
+          fileId: ele.id,
+          projectId: ele.projectId,
+          title: ele.title
+        }
+      })
+      this.$api.contract.linkContract(tmps).then(res => {
+        if (res.code === 200) {
+          this.refreshChange()
+        }
+      })
+    },
+    moreContract() {
+      this.$router.push({
+        path: '/contract',
+        query: { id: this.projectId }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped></style>

+ 5 - 2
src/views/project/componens/top.vue

@@ -7,6 +7,7 @@
         style="width: 200px"
         clearable
         v-model="stage"
+        @change="changeStage"
       >
         <el-option
           v-for="item in stages"
@@ -20,8 +21,6 @@
 </template>
 
 <script>
-import confing from '@/config/website.js'
-
 export default {
   props: {
     projectId: {
@@ -57,8 +56,12 @@ export default {
           if (res.code === 200) {
             this.stages = res.data
             this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
+            this.$emit('change', this.stage)
           }
         })
+    },
+    changeStage(res) {
+      this.$emit('change', res)
     }
   }
 }

+ 9 - 2
src/views/project/index.vue

@@ -7,13 +7,14 @@
         <el-tag class="ml-10">{{ detail.report_type_name }}</el-tag>
       </template>
       <template #default>
-        <top :project-id="projectId" />
+        <top :project-id="projectId" @change="changeStage" />
       </template>
     </tips-custom>
     <!--    content-->
     <div>
       <info1 />
       <info2 />
+      <info3 :project-id="projectId" :stage-id="stageId" />
     </div>
     <!--    buttom-->
     <div class="bottom flex flex-center flex-justify-end">
@@ -40,12 +41,14 @@ import top from '@/views/project/componens/top.vue'
 import confing from '@/config/website.js'
 import Info1 from '@/views/project/componens/info1.vue'
 import Info2 from '@/views/project/componens/info2.vue'
+import info3 from '@/views/project/componens/info3.vue'
 
 export default {
-  components: { Info2, Info1, tipsCustom, top },
+  components: { Info2, Info1, tipsCustom, top, info3 },
   data() {
     return {
       projectId: '',
+      stageId: '',
       detail: {}
     }
   },
@@ -58,6 +61,7 @@ export default {
       this.$api.project.projectMapInfo(this.projectId).then(res => {
         if (res.code === 200) {
           this.detail = res.data
+          this.stageId = res.data.stageId
           this.detail.tagsName =
             this.detail.tags === 1 ? '政府投资项目' : '企业投资项目'
           const status = confing.reportTypes.find(
@@ -68,6 +72,9 @@ export default {
           }
         }
       })
+    },
+    changeStage(res) {
+      this.stageId = res
     }
   }
 }