Browse Source

提交设计费用与装备调试费用与试验台账

ljb 10 months ago
parent
commit
2651f65a96

+ 41 - 0
src/api/yfCostManage/basicDataSetting/sjzbsyCostLedger.js

@@ -0,0 +1,41 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/kd-scientific/direct-cost/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/kd-scientific/direct-cost/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+
+export const update = (row) => {
+  return request({
+    url: '/api/kd-scientific/direct-cost/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/kd-scientific/direct-cost/remove',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}

+ 110 - 0
src/option/yfCostManage/basicDataSetting/sjzbsyCostLedger.js

@@ -0,0 +1,110 @@
+export default {
+  height: 'auto',
+  calcHeight: 30,
+  tip: false,
+  searchShow: true,
+  searchMenuSpan: 6,
+  border: true,
+  index: true,
+  selection: true,
+  searchLabelWidth: 140,
+  labelWidth: 130,
+  menuWidth: 140,
+  dialogClickModal: false,
+  dialogWidth: 500,
+  dialogType: "drawer",
+  showSummary: true,
+  sumColumnList: [
+    {
+      name: 'amount',
+      type: 'sum',
+    },
+  ],
+  column: [
+    {
+      label: '研发项目编号',
+      prop: 'xmbh',
+      type: 'input',
+      span: 24,
+      search: true,
+      width: 100,
+      align: 'center',
+      showOverflowTooltip: true,
+      display: false,
+    },
+    {
+      label: '研发项目名称',
+      prop: 'xmmc',
+      span: 24,
+      minWidth: 160,
+      search: true,
+      showOverflowTooltip: true,
+      display: false
+    },
+    {
+      label: '研发项目名称',
+      prop: 'xmId',
+      type: 'select',
+      span: 24,
+      showOverflowTooltip: true,
+      rules: [
+        {
+          required: true,
+          message: '请选择研发项目名称',
+          trigger: 'blur',
+        },
+      ],
+      hide: true,
+    },
+    {
+      label: '费用类型',
+      prop: 'type',
+      type: 'select',
+      span: 24,
+      minWidth: 260,
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=zhitoufeiyong_lx',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      showOverflowTooltip: true,
+      rules: [
+        {
+          required: true,
+          message: '请选择费用类型',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '日期',
+      prop: 'rq',
+      type: 'date',
+      valueFormat: 'yyyy-MM-dd',
+      span: 24,
+      width: 100,
+      align: 'center',
+      search: true,
+      showOverflowTooltip: true,
+    },
+    {
+      label: '合同名称',
+      prop: 'rq',
+      span: 24,
+      minWidth: 160,
+      showOverflowTooltip: true,
+    },
+    {
+      label: '单价(元)',
+      prop: 'amount',
+      type: 'number',
+      span: 24,
+      width: 100,
+      align: 'center',
+      min: 0,
+      precision: 2,
+      showOverflowTooltip: true,
+    },
+  ],
+};

+ 0 - 1
src/views/yf-cost-manage/basic-data-setting/project-zjtl-cost.vue

@@ -81,7 +81,6 @@ export default window.$crudCommon({
       params: {
         yearAndMonth: moment(new Date()).format('YYYYMM'),
       },
-      defaultColumns: [],
 
       wideTableColumns: [],
       printTitle: "",

+ 163 - 0
src/views/yf-cost-manage/basic-data-setting/sjzbsy-cost-ledger.vue

@@ -0,0 +1,163 @@
+<template>
+  <basic-container>
+    <avue-crud
+      v-bind="bindVal"
+      v-on="onEvent"
+      v-model="form"
+      :page.sync="page"
+      :permission="permissionList"
+    >
+      <template slot="menuLeft">
+        <el-button
+          v-if="!isSelAnnual"
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          plain
+          @click="handleDelete"
+        >
+          删 除
+        </el-button>
+        <el-button
+          v-if="!isSelAnnual"
+          type="success"
+          size="small"
+          plain
+          icon="el-icon-upload2"
+          @click="handleImport"
+        >
+          导入
+        </el-button>
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          @click="handleExport"
+        >
+          导出
+        </el-button>
+        <print-table-btn @click="printTable" />
+        
+        <div style="display: flex; align-items: center;">
+          <year-month-select v-model="params.yearAndMonth"></year-month-select>
+        </div>
+      </template>
+
+      <template slot="rqSearch">
+        <el-date-picker
+          v-model="params.rq"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyy-MM-dd"
+          style="width: 220px !important;"
+        >
+        </el-date-picker>
+      </template>
+
+      <template slot="xmIdForm">
+        <project-select placeholder="请选择项目名称" v-model="form.xmId" @change="handleProjectChange"></project-select>
+      </template>
+      
+    </avue-crud>
+
+    <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
+
+    <WideTablePrinter
+      ref="printWideTable"
+      :columns="wideTableColumns"
+      :data="data"
+      :print-title="printTitle"
+      :rows-per-page="30"
+      :default-landscape="true"
+    />
+  </basic-container>
+</template>
+
+<script>
+import YearMonthSelect from "@/components/year-month-select";
+import UploadExcelDialog from "@/components/upload-excel-dialog";
+import projectSelect from "@/components/project-select";
+import {exportBlob} from "@/api/common";
+import {getToken} from "@/util/auth";
+import {downloadXls} from "@/util/util";
+import moment from "moment";
+
+
+export default window.$crudCommon({
+  components: {
+    YearMonthSelect,
+    projectSelect,
+    UploadExcelDialog,
+  },
+  data() {
+    return {
+      params: {
+        yearAndMonth: moment(new Date()).format('YYYYMM'),
+      },
+      isSelAnnual: false,
+
+      wideTableColumns: [],
+      printTitle: "",
+    };
+  },
+  watch: {
+    'params.yearAndMonth'(newVal) {
+      if (newVal.length > 4) {
+        // 是否勾选未全年
+        this.isSelAnnual = false;
+      } else {
+        this.isSelAnnual = true;
+      }
+      this.page.currentPage = 1;
+      this.getList(this.page);
+    }
+  },
+  computed: {
+    permissionList() {
+      return {
+        addBtn: !this.isSelAnnual,
+        editBtn: !this.isSelAnnual,
+        delBtn: !this.isSelAnnual,
+      };
+    },
+  },
+  methods: {
+    getFormData() {
+      return { ...this.form, yearAndMonth: this.params.yearAndMonth };
+    },
+    handleImport() {
+      let excelParams = { yearAndMonth: this.params.yearAndMonth };
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/direct-cost/import', excelParams);
+    },
+    uploadAfter() {
+      this.page.currentPage = 1;
+      this.getList(this.page);
+    },
+    handleExport() {
+      exportBlob(`/api/kd-scientific/direct-cost/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `设计费用、装备调试费用与试验费用基本信息台账${this.params.yearAndMonth}.xlsx`);
+      });
+    },
+    /**
+     * 打印表格
+     * @param isLandscape 是否横向打印
+     */
+    printTable(isLandscape) {
+      this.wideTableColumns = this.$refs.crud.columnOption;
+      this.printTitle = `设计费用、装备调试费用与试验费用基本信息台账${this.params.yearAndMonth}`;
+      this.$nextTick(() => {
+        this.$refs.printWideTable.printTable(isLandscape);
+      })
+    },
+  },
+}, {
+  // 模块路径
+  name: 'yfCostManage/basicDataSetting/sjzbsyCostLedger',
+  res: ({ data }) => {
+    return data;
+  },
+});
+</script>