소스 검색

委外材料页面接口联调

ljb 10 달 전
부모
커밋
65a88bc772
3개의 변경된 파일175개의 추가작업 그리고 53개의 파일을 삭제
  1. 32 0
      src/api/projectManage/outsourcingDoc.js
  2. 1 1
      src/components/project-select/index.vue
  3. 142 52
      src/views/project-manage/components/outsourcing-doc.vue

+ 32 - 0
src/api/projectManage/outsourcingDoc.js

@@ -0,0 +1,32 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/kd-scientific/xm/wwxm/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+// 新增或修改
+export const submit = (row) => {
+  return request({
+    url: '/api/kd-scientific/xm/wwxm/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/kd-scientific/xm/wwxm/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}

+ 1 - 1
src/components/project-select/index.vue

@@ -69,8 +69,8 @@ export default {
       })
     },
     handleProjectChange(val) {
+      this.$emit('input', val);
       this.findProjectObj(val, proData => {
-        this.$emit('input', val);
         this.$emit('change', proData);
       });
     },

+ 142 - 52
src/views/project-manage/components/outsourcing-doc.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-loading="loading">
     <div class="header-btn" style="width: 1200px; margin: 0 auto; text-align: right;">
       <el-button type="primary">下载</el-button>
       <el-button type="primary">打印</el-button>
@@ -7,15 +7,16 @@
     </div>
     <div class="doc-page">
       <h3 class="page-title" style="margin: 24px 0 20px;">委外项目管理</h3>
+      <year-month-select v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
       <table class="doc-table">
         <tbody>
           <tr>
             <td class="doc-label">研发项目名称</td>
             <td class="doc-input">
-              <project-select v-model="currProjectId"></project-select>
+              <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
             </td>
             <td class="doc-label">研发项目编号</td>
-            <td class="doc-input">{{ selProject.xmsqdw }}</td>
+            <td class="doc-input">{{ selProject.xmbh }}</td>
           </tr>
           <tr>
             <td colspan="4">
@@ -34,23 +35,36 @@
                   </tr>
                 </thead>
                 <tbody>
-                  <tr v-for="(item, index) of  list" :key="index">
-                    <td v-for="key of colKey" :key="key">
-                      <template v-if="key == 'fileTypeList'">
-                        <div class="file-list">
-                          <div class="file-list-item" v-for="(file, fileIdx) of item[key]" :key="fileIdx">
-                            <div class="file-name">{{ file.label }}</div>
-                            <div class="file-url">{{ file.url }}</div>
+                  <template v-if="list.length">
+                    <tr v-for="(item, index) of  list" :key="index">
+                      <td v-for="key of colKey" :key="key" style="padding: 0;">
+                        <template v-if="key == 'fileTypeList'">
+                          <div class="file-list">
+                            <div class="file-list-item" v-for="(typeItem, typeIdx) of item[key]" :key="typeIdx">
+                              <div class="file-name">{{ typeItem.label }}</div>
+                              <div class="file-url" style="text-align: left; line-height: 16px;">
+                                <el-link
+                                  v-for="(file, fileIdx) of typeItem.fileList"
+                                  :key="fileIdx" style="margin: 0 4px;"
+                                  @click="handleDownloadFile(file)"
+                                >
+                                  {{ file.label }}
+                                </el-link>
+                              </div>
+                            </div>
                           </div>
-                        </div>
-                      </template>
-                      <span v-else>{{ item[key] }}</span>
-                    </td>
-                    <td width="10%">
-                      <el-button type="text" @click="handleEditClick(item)">编辑</el-button>
-                      <el-button type="text" style="margin-left: 0;">删除</el-button>
-                    </td>
-                  </tr>
+                        </template>
+                        <span v-else>{{ item[key] }}</span>
+                      </td>
+                      <td width="10%">
+                        <el-button type="text" @click="handleEditClick(item)">编辑</el-button>
+                        <el-button type="text" style="margin-left: 0;" @click="handleDel(item)">删除</el-button>
+                      </td>
+                    </tr>
+                  </template>
+                  <template v-else>
+                    <td colspan="9" style="border: none;"><el-empty description="暂无数据"></el-empty></td>
+                  </template>
                 </tbody>
               </table>
             </td>
@@ -68,8 +82,7 @@
         size="500px"
         destroy-on-close
       >
-        <avue-form v-model="form" :option="option">
-
+        <avue-form v-model="form" :option="option" @submit="handleSubmit" @reset-change="handleResetForm">
         </avue-form>
       </el-drawer>
     </div>
@@ -77,51 +90,33 @@
 </template>
 
 <script>
+import yearMonthSelect from "@/components/year-month-select";
 import projectSelect from "@/components/project-select";
+import moment from "moment";
+import { getList, submit, remove } from "@/api/projectManage/outsourcingDoc";
 
 export default {
   props: {
     projectId: [String, Number]
   },
   components: {
+    yearMonthSelect,
     projectSelect
   },
   data() {
     return {
-      list: [{
-        stfmc: '111',
-        stflx: '境内个人',
-        htmc: '333',
-        wwfyje: 20,
-        isDj: '是',
-        htlx: '技术开发合同',
-        htje: 20,
-        fileTypeList: [{
-          label: '技术合同协议',
-          url: 'aaa.doc'
-        }, {
-          label: '委外费用发票',
-          url: 'bbb.doc'
-        }, {
-          label: '技术合同登记证明',
-          url: 'ccc.doc'
-        }, {
-          label: '受托方交付成果',
-          url: 'ddd.doc'
-        }, {
-          label: '其他资料',
-          url: 'eee.doc'
-        }]
-      }],
-      colKey: ['stfmc', 'stflx', 'htmc', 'wwfyje', 'isDj', 'htlx', 'htje', 'fileTypeList'],
+      loading: false,
+
+      list: [],
+      colKey: ['stfqc', 'stflx', 'htmc', 'wwfyje', 'sfwcjshtdj', 'jshtdjlx', 'jshtdjje', 'fileTypeList'],
 
-      currProjectId: '',
       selProject: {},
 
       drawerTitle: '',
       drawerVisible: false,
       option:{
         labelWidth: 170,
+        emptyText: "取消",
         column:[
           {
             label: '受托方全称',
@@ -156,7 +151,7 @@ export default {
           },
           {
             label: '委外费用金额(万元)',
-            prop: 'htmc',
+            prop: 'wwfyje',
             span: 24,
             type: 'number',
             min: 0,
@@ -180,7 +175,7 @@ export default {
           },
           {
             label: '技术合同类型',
-            prop: 'jshtlx',
+            prop: 'jshtdjlx',
             span: 24,
             type: 'select',
             dicUrl: '/api/kd-system/dict-biz/dictionary?code=contract_registration_type',
@@ -191,7 +186,7 @@ export default {
           },
           {
             label: '技术合同登记金额(万元)',
-            prop: 'htmc',
+            prop: 'jshtdjje',
             span: 24,
             type: 'number',
             min: 0,
@@ -271,11 +266,67 @@ export default {
         ]
       },
       form: {},
-
+      params: {
+        yearAndMonth: moment(new Date()).format('yyyy'),
+        xmId: ''
+      },
     };
   },
+  watch: {
+    "params.xmId"() {
+      this.getListData();
+    }
+  },
+  mounted() {
+    this.params.xmId = this.projectId;
+  },
   methods: {
+    handleProjectChange(data) {
+      this.selProject = data;
+    },
+    getListData() {
+      this.loading = true;
+      getList(1, 99999, this.params).then(({ data }) => {
+        this.loading = false;
+        if (data.code == 200) {
+          this.list = data.data.records.map(item => {
+            item.wwfyje = (item.wwfyje || 0).toFixed(2);
+            item.jshtdjje = (item.jshtdjje || 0).toFixed(2);
+            item.jshtxy = item.jshtxy ? JSON.parse(item.jshtxy) : [];
+            item.wwfyfp = item.wwfyfp ? JSON.parse(item.wwfyfp) : [];
+            item.jshtdjzm = item.jshtdjzm ? JSON.parse(item.jshtdjzm) : [];
+            item.stfjfcg = item.stfjfcg ? JSON.parse(item.stfjfcg) : [];
+            item.qtzl = item.qtzl ? JSON.parse(item.qtzl) : [];
+            item.fileTypeList = [{
+              label: '技术合同协议',
+              fileList: item.jshtxy
+            }, {
+              label: '委外费用发票',
+              fileList: item.wwfyfp
+            }, {
+              label: '技术合同登记证明',
+              fileList: item.jshtdjzm
+            }, {
+              label: '受托方交付成果',
+              fileList: item.stfjfcg
+            }, {
+              label: '其他资料',
+              fileList: item.qtzl
+            }];
+
+            return item;
+          });
+        }
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
     handleAddClick() {
+      if (!this.params.xmId) {
+        this.$message.error("请选择所属项目!");
+        return;
+      }
+      this.form = {};
       this.drawerVisible = true;
       this.drawerTitle = '新增委外信息';
     },
@@ -283,6 +334,45 @@ export default {
       this.drawerVisible = true;
       this.form = { ...data };
       this.drawerTitle = '编辑委外信息';
+    },
+    handleSubmit(form, done) {
+      const params = { ...form, yearAndMonth: this.params.yearAndMonth, xmId: this.params.xmId };
+      params.jshtxy = JSON.stringify(params.jshtxy);
+      params.wwfyfp = JSON.stringify(params.wwfyfp);
+      params.jshtdjzm = JSON.stringify(params.jshtdjzm);
+      params.stfjfcg = JSON.stringify(params.stfjfcg);
+      params.qtzl = JSON.stringify(params.qtzl);
+
+      submit(params).then(({ data }) => {
+        if (data.code == 200) {
+          this.$message.success("操作成功!");
+          this.getListData();
+          this.drawerVisible = false;
+        }
+        done();
+      }).catch(() => {
+        done();
+      });
+    },
+    handleDownloadFile(file) {
+      window.open(file.value);
+    },
+    handleResetForm() {
+      this.drawerVisible = false;
+    },
+    handleDel(records) {
+      this.$confirm('确定将选择数据删除?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        remove(records.id).then(({ data }) => {
+          if (data.code == 200) {
+            this.$message.success("删除成功!");
+            this.getListData();
+          }
+        });
+      })
     }
   },
 };