Преглед изворни кода

完成项目实施报告页面

ljb пре 9 месеци
родитељ
комит
b61e698ea4

+ 18 - 0
src/api/projectManage/implement.js

@@ -1,5 +1,13 @@
 import request from '@/router/axios';
 
+// 实施报告列表
+export const getList = (xmId) => {
+  return request({
+    url: `/kd-scientific/xm/jdxbg/list/${xmId}`,
+    method: 'get',
+  })
+}
+
 // 获取阶段性详情
 export const getDetail = (params) => {
   return request({
@@ -19,3 +27,13 @@ export const save = (row) => {
     data: row
   })
 }
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/kd-scientific/xm/jdxbg/remove',
+    method: 'delete',
+    params: {
+      ids
+    }
+  })
+}

+ 73 - 0
src/option/projectManage/implement.js

@@ -0,0 +1,73 @@
+export default {
+  height: 'auto',
+  calcHeight: 30,
+  tip: false,
+  searchShow: true,
+  searchMenuSpan: 6,
+  border: true,
+  index: true,
+  addBtn: false,
+  editBtn: false,
+  delBtn: false,
+  selection: false,
+  searchLabelWidth: 140,
+  labelWidth: 140,
+  menuWidth: 220,
+  dialogClickModal: false,
+  dialogWidth: 760,
+  dialogType: "drawer",
+  column: [
+    {
+      label: '研发项目名称',
+      prop: 'xmmc',
+      type: 'input',
+      minWidth: 240,
+      showOverflowTooltip: true,
+    },
+    {
+      label: '研发项目编号',
+      prop: 'xmbh',
+      type: 'input',
+      minWidth: 160,
+      align: 'center',
+      showOverflowTooltip: true,
+    },
+    {
+      label: '项目实施类型',
+      prop: 'type',
+      width: 140,
+      align: 'center',
+      type: 'select',
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=项目实施-阶段性报告-附件类型',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      showOverflowTooltip: true,
+    },
+    {
+      label: '项目申请单位',
+      prop: 'xmsqdw',
+      type: 'select',
+      minWidth: 140,
+      align: 'center',
+      showOverflowTooltip: true,
+    },
+    {
+      label: '项目负责人',
+      prop: 'xmfzrxm',
+      type: 'input',
+      minWidth: 140,
+      align: 'center',
+      showOverflowTooltip: true,
+    },
+    {
+      label: '填报时间',
+      prop: 'fillDate',
+      type: 'input',
+      minWidth: 140,
+      align: 'center',
+      showOverflowTooltip: true,
+    },
+  ],
+};

+ 0 - 1
src/views/project-manage/change.vue

@@ -58,7 +58,6 @@
     >
       
       <change-form
-        
         :projectId="params.xmId"
         :data="changeFormData"
         :disabled="isFormReadonly"

+ 0 - 1
src/views/project-manage/components/change-form.vue

@@ -162,7 +162,6 @@ export default {
     this.formData = {
       ...this.data,
     };
-    console.log(this.formData.attachment)
   },
   methods: {
     /**

+ 182 - 123
src/views/project-manage/components/implement-form.vue

@@ -9,7 +9,7 @@
       <div class="info-row">{{ `项目执行期:${ getXmDateRange || '' }` }}</div>
       <div class="info-row">
         <span>填报时间:</span>
-        <span><el-date-picker v-model="formData.tbsj" value-format="yyyy-MM-dd" /></span>
+        <span><el-date-picker v-model="formData.fillDate" value-format="yyyy-MM-dd" /></span>
       </div>
     </div>
 
@@ -26,6 +26,21 @@
           <td class="doc-label">项目申请单位</td>
           <td class="doc-input">{{ selProject.xmsqdw }}</td>
         </tr>
+
+        <tr>
+          <td class="doc-label">项目编号</td>
+          <td class="doc-input">{{ selProject.xmbh }} </td>
+          <td class="doc-label">项目实施类型</td>
+          <td class="doc-input">
+            <avue-select
+              v-model="formData.type"
+              placeholder="请选择"
+              :dic="typeList"
+              style="width: 100%"
+            ></avue-select>
+          </td>
+        </tr>
+
         <tr>
           <td class="doc-label">项目负责人</td>
           <td class="doc-input">{{ selProject.xmfzrxm }} </td>
@@ -58,11 +73,11 @@
     </table>
 
     <avue-form v-model="formData" :option="option" style="margin-top: 30px; padding: 0;">
-      <template slot="jdbgLabel">
-        <label>季度报告</label>
+      <template slot="attachmentLabel">
+        <label>附件信息</label>
         <el-link type="primary" style="position: absolute; left: 290px; z-index: 1;">下载模板</el-link>
       </template>
-      <template slot="zqbgLabel">
+      <!-- <template slot="zqbgLabel">
         <label>中期报告</label>
         <el-link type="primary" style="position: absolute; left: 290px; z-index: 1;">下载模板</el-link>
       </template>
@@ -77,7 +92,7 @@
       <template slot="qtjdxzjbgLabel">
         <label>其他阶段性总结报告</label>
         <el-link type="primary" style="position: absolute; left: 290px; z-index: 1;">下载模板</el-link>
-      </template>
+      </template> -->
     </avue-form>
     <p class="tip">注:可一次上传多个相关文件(文档、表格、图片等)。 支持格式:DOC, PDF, Excel, PNG, JPG, PPT 等。 请确保文件内容清晰有效。</p>
 
@@ -89,13 +104,14 @@
 
 <script>
 import projectSelect from "@/components/project-select";
+import { getDictionary } from "@/api/system/dictbiz";
 import { save, getDetail } from "@/api/projectManage/implement";
 import moment from "moment";
 
 export default {
   props: {
     projectId: [String, Number],
-    yearAndMonth: [Number, String]
+    data: Object,
   },
   components: {
     projectSelect
@@ -105,10 +121,11 @@ export default {
       formData: {},
 
       loading: false,
-      projectList: [],
 
       currProjectId: '',
       selProject: {},
+
+      typeList: [],
     };
   },
   computed: {
@@ -126,154 +143,195 @@ export default {
         labelWidth: 150,
         column: [
           {
-            label: "季度报告",
-            prop: "jdbg",
-            type: "upload",
-            multiple: true,
-            span: 24,
-            dataType: "object",
-            propsHttp: {
-              url: "link",
-              name: 'originalName',
-              res: "data",
-            },
-            action: '/api/kd-resource/oss/endpoint/put-file',
-            uploadPreview: (file, column, done) => {
-              window.open(file.url, "_blank");
-              return;
-            },
-            disabled: !this.currProjectId
-          },
-          {
-            label: "中期报告",
-            prop: "zqbg",
-            type: "upload",
-            multiple: true,
-            span: 24,
-            dataType: "object",
-            propsHttp: {
-              url: "link",
-              name: 'originalName',
-              res: "data",
-            },
-            action: '/api/kd-resource/oss/endpoint/put-file',
-            uploadPreview: (file, column, done) => {
-              window.open(file.url, "_blank");
-              return;
-            },
-            disabled: !this.currProjectId
-          },
-          {
-            label: "年度报告",
-            prop: "ndbg",
+            label: "附件信息",
+            prop: "attachment",
             type: "upload",
             multiple: true,
             span: 24,
-            action: '/api/kd-resource/oss/endpoint/put-file',
-            uploadPreview: (file, column, done) => {
-              window.open(file.url, "_blank");
-              return;
-            },
             dataType: "object",
             propsHttp: {
               url: "link",
               name: 'originalName',
               res: "data",
             },
-            disabled: !this.currProjectId
-          },
-          {
-            label: "里程碑报告",
-            prop: "lcbbg",
-            type: "upload",
-            multiple: true,
-            span: 24,
             action: '/api/kd-resource/oss/endpoint/put-file',
             uploadPreview: (file, column, done) => {
               window.open(file.url, "_blank");
               return;
             },
-            dataType: "object",
-            propsHttp: {
-              url: "link",
-              name: 'originalName',
-              res: "data",
-            },
-            disabled: !this.currProjectId
-          },
-          {
-            label: "其他阶段性总结报告",
-            prop: "qtjdxzjbg",
-            type: "upload",
-            multiple: true,
-            span: 24,
-            action: '/api/kd-resource/oss/endpoint/put-file',
-            uploadPreview: (file, column, done) => {
-              window.open(file.url, "_blank");
-              return;
-            },
-            dataType: "object",
-            propsHttp: {
-              url: "link",
-              name: 'originalName',
-              res: "data",
-            },
             disabled: !this.currProjectId
           },
+          // {
+          //   label: "季度报告",
+          //   prop: "jdbg",
+          //   type: "upload",
+          //   multiple: true,
+          //   span: 24,
+          //   dataType: "object",
+          //   propsHttp: {
+          //     url: "link",
+          //     name: 'originalName',
+          //     res: "data",
+          //   },
+          //   action: '/api/kd-resource/oss/endpoint/put-file',
+          //   uploadPreview: (file, column, done) => {
+          //     window.open(file.url, "_blank");
+          //     return;
+          //   },
+          //   disabled: !this.currProjectId
+          // },
+          // {
+          //   label: "中期报告",
+          //   prop: "zqbg",
+          //   type: "upload",
+          //   multiple: true,
+          //   span: 24,
+          //   dataType: "object",
+          //   propsHttp: {
+          //     url: "link",
+          //     name: 'originalName',
+          //     res: "data",
+          //   },
+          //   action: '/api/kd-resource/oss/endpoint/put-file',
+          //   uploadPreview: (file, column, done) => {
+          //     window.open(file.url, "_blank");
+          //     return;
+          //   },
+          //   disabled: !this.currProjectId
+          // },
+          // {
+          //   label: "年度报告",
+          //   prop: "ndbg",
+          //   type: "upload",
+          //   multiple: true,
+          //   span: 24,
+          //   action: '/api/kd-resource/oss/endpoint/put-file',
+          //   uploadPreview: (file, column, done) => {
+          //     window.open(file.url, "_blank");
+          //     return;
+          //   },
+          //   dataType: "object",
+          //   propsHttp: {
+          //     url: "link",
+          //     name: 'originalName',
+          //     res: "data",
+          //   },
+          //   disabled: !this.currProjectId
+          // },
+          // {
+          //   label: "里程碑报告",
+          //   prop: "lcbbg",
+          //   type: "upload",
+          //   multiple: true,
+          //   span: 24,
+          //   action: '/api/kd-resource/oss/endpoint/put-file',
+          //   uploadPreview: (file, column, done) => {
+          //     window.open(file.url, "_blank");
+          //     return;
+          //   },
+          //   dataType: "object",
+          //   propsHttp: {
+          //     url: "link",
+          //     name: 'originalName',
+          //     res: "data",
+          //   },
+          //   disabled: !this.currProjectId
+          // },
+          // {
+          //   label: "其他阶段性总结报告",
+          //   prop: "qtjdxzjbg",
+          //   type: "upload",
+          //   multiple: true,
+          //   span: 24,
+          //   action: '/api/kd-resource/oss/endpoint/put-file',
+          //   uploadPreview: (file, column, done) => {
+          //     window.open(file.url, "_blank");
+          //     return;
+          //   },
+          //   dataType: "object",
+          //   propsHttp: {
+          //     url: "link",
+          //     name: 'originalName',
+          //     res: "data",
+          //   },
+          //   disabled: !this.currProjectId
+          // },
         ],
       }
     }
   },
   watch: {
     currProjectId() {
-      this.getImplementDetail();
+      // this.getImplementDetail();
+      
+    },
+    detailData: {
+      handler(newVal) {
+        this.formData = newVal || {};
+      },
+      immediate: true
     }
   },
   mounted() {
     this.currProjectId = this.projectId || '';
-    if (this.currProjectId) {
-      this.getImplementDetail();
-    }
+    // if (this.currProjectId) {
+    //   this.getImplementDetail();
+    // }
+
+    this.formData = {
+      ...this.data,
+    };
+
+    this.getDictList("项目实施-阶段性报告-附件类型", "typeList");
   },
   methods: {
-    getImplementDetail() {
-      this.loading = true;
-      getDetail({ xmId: this.currProjectId, yearAndMonth: this.yearAndMonth }).then(({ data }) => {
-        this.loading = false;
-        if (data.code == 200 && data.data && Object.keys(data.data).length) {
-          this.formData = {
-            id: data.data.id,
-            xmId: data.data.xmId,
-            tbsj: data.data.tbsj,
-            jdbg: data.data.jdbg ? JSON.parse(data.data.jdbg) : [],
-            zqbg: data.data.zqbg ? JSON.parse(data.data.zqbg) : [],
-            ndbg: data.data.ndbg ? JSON.parse(data.data.ndbg) : [],
-            lcbbg: data.data.lcbbg ? JSON.parse(data.data.lcbbg) : [],
-            qtjdxzjbg: data.data.qtjdxzjbg ? JSON.parse(data.data.qtjdxzjbg) : [],
-          };
-        } else {
-          this.formData = {
-            tbsj: '',
-            jdbg: [],
-            zqbg: [],
-            ndbg: [],
-            lcbbg: [],
-            qtjdxzjbg: [],
-          };
-        }
-      }).catch(() => {
-        this.loading = false;
+    getDictList(code, toListKey) {
+      getDictionary({ code }).then((res) => {
+        this[toListKey] = res.data.data.map((item) => {
+          return { label: item.dictValue, value: item.dictKey };
+        });
       });
     },
+    // getImplementDetail() {
+    //   this.loading = true;
+    //   getDetail({ xmId: this.currProjectId, yearAndMonth: this.yearAndMonth }).then(({ data }) => {
+    //     this.loading = false;
+    //     if (data.code == 200 && data.data && Object.keys(data.data).length) {
+    //       this.formData = {
+    //         id: data.data.id,
+    //         xmId: data.data.xmId,
+    //         tbsj: data.data.tbsj,
+    //         jdbg: data.data.jdbg ? JSON.parse(data.data.jdbg) : [],
+    //         zqbg: data.data.zqbg ? JSON.parse(data.data.zqbg) : [],
+    //         ndbg: data.data.ndbg ? JSON.parse(data.data.ndbg) : [],
+    //         lcbbg: data.data.lcbbg ? JSON.parse(data.data.lcbbg) : [],
+    //         qtjdxzjbg: data.data.qtjdxzjbg ? JSON.parse(data.data.qtjdxzjbg) : [],
+    //       };
+    //     } else {
+    //       this.formData = {
+    //         tbsj: '',
+    //         jdbg: [],
+    //         zqbg: [],
+    //         ndbg: [],
+    //         lcbbg: [],
+    //         qtjdxzjbg: [],
+    //       };
+    //     }
+    //   }).catch(() => {
+    //     this.loading = false;
+    //   });
+    // },
     handleProjectChange(data) {
       this.selProject = data;
     },
     validForm() {
       let errorText = '';
-      if (!this.formData.tbsj) {
+      if (!this.formData.fillDate) {
         errorText = '请选择填报时间';
       } else if (!this.currProjectId) {
         errorText = '请选择填报的项目';
+      } else if (!this.formData.type) {
+        errorText = '请选择项目实施类型'
       }
 
       return errorText;
@@ -286,18 +344,19 @@ export default {
       }
 
       const params = { ...this.formData, xmId: this.currProjectId };
-      params.jdbg = JSON.stringify(params.jdbg);
-      params.zqbg = JSON.stringify(params.zqbg);
-      params.ndbg = JSON.stringify(params.ndbg);
-      params.lcbbg = JSON.stringify(params.lcbbg);
-      params.qtjdxzjbg = JSON.stringify(params.qtjdxzjbg);
+      params.attachment = JSON.stringify(params.attachment);
+      // params.zqbg = JSON.stringify(params.zqbg);
+      // params.ndbg = JSON.stringify(params.ndbg);
+      // params.lcbbg = JSON.stringify(params.lcbbg);
+      // params.qtjdxzjbg = JSON.stringify(params.qtjdxzjbg);
 
       this.saveData(params);
     },
     saveData(params) {
       save(params).then(({ data }) => {
         if (data.code == 200) {
-          this.$message.success('保存成功!');
+          this.$message.success(params.id ? '修改成功' : '保存成功!');
+          this.$emit("success");
         }
       });
     }

+ 183 - 7
src/views/project-manage/implement.vue

@@ -1,15 +1,191 @@
 <template>
   <basic-container>
-    <implement-form></implement-form>
+    <div style="margin-top: 6px;">
+      <el-form :inline="true">
+        <el-form-item label="研发项目名称">
+          <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
+        </el-form-item>
+        <el-form-item label="研发项目编号">
+          {{ selProject.xmbh }}
+        </el-form-item>
+      </el-form>
+    </div>
+
+    <avue-crud
+      ref="crud"
+      v-bind="bindVal"
+      v-on="onEvent"
+      v-model="form"
+      :page.sync="page"
+      :before-open="handleBeforeOpen"
+      :permission="permissionList"
+      @row-dblclick="handleRowDbClick"
+    >
+      <template slot="menuLeft">
+        <el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">
+          新增
+        </el-button>
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          @click="handleExport"
+        >
+          导出
+        </el-button>
+        <print-table-btn @click="printTable" />
+      </template>
+
+      <template slot-scope="{row, index}" slot="menu">
+        <el-button type="text" icon="el-icon-edit" @click="rowEdit(row)" style="margin-right: 12px;">编辑</el-button>
+        <el-button type="text" icon="el-icon-delete" style="margin-left: 0;" @click="rowDel(row, index)">删除</el-button>
+      </template>
+      
+    </avue-crud>
+
+    <WideTablePrinter
+      ref="printWideTable"
+      :columns="wideTableColumns"
+      :data="data"
+      :print-title="printTitle"
+      :rows-per-page="30"
+      :default-landscape="true"
+    />
+
+    <el-drawer
+      v-if="drawerVisible"
+      :title="drawerTitle"
+      :visible.sync="drawerVisible"
+      modal-append-to-body
+      append-to-body
+      size="960px"
+    >
+      
+      <implement-form
+        :projectId="params.xmId"
+        :data="implementFormData"
+        :disabled="isFormReadonly"
+        @success="handleImplementSucc"
+      >
+      </implement-form>
+    </el-drawer>
   </basic-container>
 </template>
 
 <script>
-import implementForm from './components/implement-form.vue';
+import {exportBloByPost} from "@/api/common";
+import {getToken} from "@/util/auth";
+import projectSelect from "@/components/project-select";
+import {downloadXls} from "@/util/util";
+import implementForm from "./components/implement-form.vue";
 
-export default {
+
+export default window.$crudCommon({
+  props: {
+    projectId: [String, Number]
+  },
   components: {
-    implementForm
-  }
-}
-</script>
+    implementForm,
+    projectSelect
+  },
+  data() {
+    return {
+      params: {
+        xmId: ''
+      },
+      selProject: {},
+
+      drawerTitle: "",
+      drawerVisible: false,
+
+      wideTableColumns: [],
+      printTitle: "",
+
+      implementFormData: {},
+      isFormReadonly: false,
+    };
+  },
+  watch: {
+    "params.xmId"() {
+      this.getList();
+    }
+  },
+  created() {
+    this.params.xmId = this.projectId;
+  },
+  methods: {
+    handleImplementSucc() {
+      this.drawerVisible = false;
+      this.loadData();
+    },
+    loadData() {
+      if (!this.params.xmId) {
+        return;
+      }
+      this.loading = true;
+      this.api[this.option.list || 'getList'](this.params.xmId).then(({ data }) => {
+        this.data = data.data.map(item => {
+          item.xmmc = item.xmEntity ? item.xmEntity.xmmc : '';
+          item.xmbh = item.xmEntity ? item.xmEntity.xmbh : '';
+          item.xmsqdw = item.xmEntity ? item.xmEntity.xmsqdw : '';
+          item.xmfzrxm = item.xmEntity ? item.xmEntity.xmfzrxm : '';
+          return item;
+        });
+        this.loading = false;
+      });
+    
+    },
+    handleProjectChange(data) {
+      this.selProject = data;
+    },
+    handleExport() {
+      exportBloByPost(`/api/kd-scientific/xm-bgrz/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `${this.selProject.xmmc}阶段性报告列表.xlsx`);
+      });
+    },
+    /**
+     * 打印表格
+     * @param isLandscape 是否横向打印
+     */
+    printTable(isLandscape) {
+      this.wideTableColumns = this.$refs.crud.columnOption;
+      this.printTitle = `${this.selProject.xmmc}阶段性报告列表`;
+      this.$nextTick(() => {
+        this.$refs.printWideTable.printTable(isLandscape);
+      })
+    },
+    handleAdd() {
+      this.drawerVisible = true;
+      this.isFormReadonly = false;
+      this.drawerTitle = "新增阶段性报告";
+      this.implementFormData = {};
+    },
+    rowEdit(data) {
+      this.drawerVisible = true;
+      this.isFormReadonly = false;
+      this.drawerTitle = "编辑阶段性报告";
+      this.implementFormData = {
+        ...data,
+        attachment: data.attachment ? JSON.parse(data.attachment) : []
+      };
+    },
+    handleRowDbClick(data) {
+      this.drawerVisible = true;
+      this.isFormReadonly = true;
+      this.drawerTitle = "阶段性报告详情";
+      this.implementFormData = {
+        ...data,
+        attachment: data.attachment ? JSON.parse(data.attachment) : []
+      };
+    },
+    handleChangeSucc() {
+      this.drawerVisible = false;
+      this.getList();
+    }
+  },
+}, {
+  // 模块路径
+  name: 'projectManage/implement',
+});
+</script>