Browse Source

Merge branches 'kd-dev' and 'kd-dev' of https://gitee.com/zhoulisky/kd-web into kd-dev

zhouli 10 months ago
parent
commit
5cf12b5af8

+ 12 - 4
src/api/yfCostManage/basicDataSetting/wwCostLedger.js

@@ -2,7 +2,7 @@ import request from '@/router/axios';
 
 
 export const getList = (current, size, params) => {
 export const getList = (current, size, params) => {
   return request({
   return request({
-    url: '/api/kd-scientific/direct-cost/page',
+    url: '/api/kd-scientific/xm/wwxm/cost/page',
     method: 'get',
     method: 'get',
     params: {
     params: {
       ...params,
       ...params,
@@ -12,9 +12,17 @@ export const getList = (current, size, params) => {
   })
   })
 }
 }
 
 
+export const getWwxmList = (params) => {
+  return request({
+    url: '/api/kd-scientific/xm/wwxm/list',
+    method: 'get',
+    params
+  })
+}
+
 export const add = (row) => {
 export const add = (row) => {
   return request({
   return request({
-    url: '/api/kd-scientific/direct-cost/submit',
+    url: '/api/kd-scientific/xm/wwxm/cost/submit',
     method: 'post',
     method: 'post',
     data: row
     data: row
   })
   })
@@ -23,7 +31,7 @@ export const add = (row) => {
 
 
 export const update = (row) => {
 export const update = (row) => {
   return request({
   return request({
-    url: '/api/kd-scientific/direct-cost/submit',
+    url: '/api/kd-scientific/xm/wwxm/cost/submit',
     method: 'post',
     method: 'post',
     data: row
     data: row
   })
   })
@@ -32,7 +40,7 @@ export const update = (row) => {
 
 
 export const remove = (ids) => {
 export const remove = (ids) => {
   return request({
   return request({
-    url: '/api/kd-scientific/direct-cost/remove',
+    url: '/api/kd-scientific/xm/wwxm/cost/remove',
     method: 'post',
     method: 'post',
     params: {
     params: {
       ids
       ids

+ 13 - 30
src/option/yfCostManage/basicDataSetting/wwCostLedger.js

@@ -16,7 +16,11 @@ export default {
   showSummary: true,
   showSummary: true,
   sumColumnList: [
   sumColumnList: [
     {
     {
-      name: 'amount',
+      name: 'payAmount',
+      type: 'sum',
+    },
+    {
+      name: 'jshtdjje',
       type: 'sum',
       type: 'sum',
     },
     },
   ],
   ],
@@ -41,38 +45,22 @@ export default {
       display: false
       display: false
     },
     },
     {
     {
-      label: '研发项目名称',
-      prop: 'xmId',
-      type: 'select',
-      span: 24,
-      showOverflowTooltip: true,
-      rules: [
-        {
-          required: true,
-          message: '请选择研发项目名称',
-          trigger: 'blur',
-        },
-      ],
-      hide: true,
-    },
-    {
       label: '费用类型',
       label: '费用类型',
-      prop: 'type',
+      prop: 'costType',
       span: 24,
       span: 24,
-      width: 100,
+      width: 120,
       align: 'center',
       align: 'center',
       display: false,
       display: false,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
     },
     },
     {
     {
       label: '日期',
       label: '日期',
-      prop: 'rq',
+      prop: 'payDate',
       type: 'date',
       type: 'date',
       valueFormat: 'yyyy-MM-dd',
       valueFormat: 'yyyy-MM-dd',
       span: 24,
       span: 24,
       width: 90,
       width: 90,
       align: 'center',
       align: 'center',
-      search: true,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,
@@ -81,21 +69,16 @@ export default {
       }]
       }]
     },
     },
     {
     {
-      label: '受托方全称',
-      prop: 'stfqcId',
-      type: 'select',
-      dicData: [],
-      props: {
-        label: 'stfqc',
-        value: 'id'
-      },
+      label: '受托方',
+      prop: 'wwId',
+      type: 'cascader',
       span: 24,
       span: 24,
       width: 140,
       width: 140,
       hide: true,
       hide: true,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,
-        message: '请选择受托方全称',
+        message: '请选择受托方',
         trigger: 'blur'
         trigger: 'blur'
       }]
       }]
     },
     },
@@ -133,7 +116,7 @@ export default {
     },
     },
     {
     {
       label: '委外费用金额(元)',
       label: '委外费用金额(元)',
-      prop: 'wwje',
+      prop: 'payAmount',
       width: 100,
       width: 100,
       align: 'center',
       align: 'center',
       span: 24,
       span: 24,

+ 5 - 2
src/views/project-manage/components/outsourcing-doc.vue

@@ -295,7 +295,10 @@ export default {
   watch: {
   watch: {
     "params.xmId"() {
     "params.xmId"() {
       this.getListData();
       this.getListData();
-    }
+    },
+    "params.yearAndMonth"() {
+      this.getListData();
+    },
   },
   },
   mounted() {
   mounted() {
     this.params.xmId = this.projectId;
     this.params.xmId = this.projectId;
@@ -305,7 +308,7 @@ export default {
       this.selProject = data;
       this.selProject = data;
     },
     },
     getListData() {
     getListData() {
-      if (!this.params.xmId) {
+      if (!this.params.xmId || !this.params.yearAndMonth) {
         return;
         return;
       }
       }
       this.loading = true;
       this.loading = true;

+ 59 - 0
src/views/yf-cost-manage/basic-data-setting/components/ww-project-cascader.vue

@@ -0,0 +1,59 @@
+<template>
+  <avue-cascader placeholder="请选择" v-model="cascaderVal" :dic="list"></avue-cascader>
+</template>
+
+<script>
+import { getWwxmList } from "@/api/yfCostManage/basicDataSetting/wwCostLedger";
+
+export default {
+  name: 'wwProjectCascader',
+  props: {
+    value: [Array],
+    // 搜索条件
+    params: Object,
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+  },
+  data() {
+    return {
+      cascaderVal: [],
+      list: []
+    }
+  },
+  watch: {
+    cascaderVal(newVal) {
+      console.log(newVal)
+      this.$emit('input', newVal);
+    }
+  },
+  mounted() {
+    
+    this.getWwxmListFunc();
+  },
+  methods: {
+    getWwxmListFunc() {
+      getWwxmList(this.params).then(({ data }) => {
+        if (data.success) {
+          let list = [];
+          data.data.forEach((item, index) => {
+            let oldListItem = list.find(listItem => listItem.value === item.xmId);
+            if (!!oldListItem) {
+              oldListItem.children.push({ label: item.stfqc, value: item.wwId });
+            } else {
+              list.push({ label: item.xmmc, value: item.xmId, children: [{ label: item.stfqc, value: item.wwId }] });
+            }
+          });
+          this.list = list;
+          this.cascaderVal = this.value || [];
+        }
+      })
+    },
+    handleProjectChange(val) {
+      console.log(val)
+      this.$emit('input', val);
+    },
+  }
+}
+</script>

+ 29 - 3
src/views/yf-cost-manage/basic-data-setting/working-hours-records.vue

@@ -92,6 +92,8 @@ export default window.$crudCommon({
       },
       },
       defaultColumns: [],
       defaultColumns: [],
 
 
+      oldMonthData: [],
+
       wideTableColumns: [],
       wideTableColumns: [],
       printTitle: "",
       printTitle: "",
     };
     };
@@ -111,6 +113,10 @@ export default window.$crudCommon({
     this.option.column = deepClone(this.defaultColumns);
     this.option.column = deepClone(this.defaultColumns);
   },
   },
   methods: {
   methods: {
+    handleBeforeOpen(done, type) {
+      this.oldMonthData = this.form.dailyAttendances || [];
+      done();
+    },
     refreshTableCol(yearAndMonth) {
     refreshTableCol(yearAndMonth) {
       let yearMonth = moment(yearAndMonth).format("YYYY-MM").split("-");
       let yearMonth = moment(yearAndMonth).format("YYYY-MM").split("-");
       const monthDays = getMonthDatesWithMarkers(Number(yearMonth[0]), Number(yearMonth[1]));
       const monthDays = getMonthDatesWithMarkers(Number(yearMonth[0]), Number(yearMonth[1]));
@@ -172,18 +178,38 @@ export default window.$crudCommon({
     getFormData() {
     getFormData() {
       const newFormData = { ...this.form, yearAndMonth: this.params.yearAndMonth  };
       const newFormData = { ...this.form, yearAndMonth: this.params.yearAndMonth  };
       let dailyAttendances = [];
       let dailyAttendances = [];
+      let _oldMonthData = this.oldMonthData;
       Object.keys(this.form).forEach(key => {
       Object.keys(this.form).forEach(key => {
         if (key.indexOf(this.params.yearAndMonth) > -1) {
         if (key.indexOf(this.params.yearAndMonth) > -1) {
-          if (this.form[key]) {
+          let oldObj = _oldMonthData.find(old => old.workDate == key) || {};
+          if (this.form[key] || oldObj.workHours || oldObj.workHours === 0) {
+            let workHours = this.form[key];
+            if (workHours === undefined || workHours === null || workHours === '') {
+              workHours = null;
+            }
             dailyAttendances.push({
             dailyAttendances.push({
               workDate: key,
               workDate: key,
-              workHours: this.form[key]
+              workHours
             });
             });
           }
           }
           delete newFormData[key];
           delete newFormData[key];
         }
         }
       });
       });
-      newFormData.dailyAttendances = dailyAttendances;
+
+      console.log(dailyAttendances)
+
+      // 获取最新修改过的数据
+      let updatedMonthData = [];
+      dailyAttendances.forEach(item => {
+        let oldObj = _oldMonthData.find(old => item.workDate === old.workDate);
+        if (!!oldObj && item.workHours !== oldObj.workHours) {
+          updatedMonthData.push(item);
+        } else if (!oldObj) {
+          updatedMonthData.push(item);
+        }
+      })
+
+      newFormData.dailyAttendances = updatedMonthData;
       return newFormData;
       return newFormData;
     },
     },
     getDelParams(row) {
     getDelParams(row) {

+ 13 - 24
src/views/yf-cost-manage/basic-data-setting/ww-cost-ledger.vue

@@ -44,8 +44,8 @@
         </div>
         </div>
       </template>
       </template>
 
 
-      <template slot="xmIdForm">
-        <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }" @change="handleProjectChange"></project-select>
+      <template slot="wwIdForm">
+        <ww-project-cascader v-model="form.wwId" :params="{ yearAndMonth: params.yearAndMonth }"></ww-project-cascader>
       </template>
       </template>
       
       
     </avue-crud>
     </avue-crud>
@@ -64,10 +64,9 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getList as getOutsourcingList } from "@/api/projectManage/outsourcingDoc";
 import YearMonthSelect from "@/components/year-month-select";
 import YearMonthSelect from "@/components/year-month-select";
 import UploadExcelDialog from "@/components/upload-excel-dialog";
 import UploadExcelDialog from "@/components/upload-excel-dialog";
-import projectSelect from "@/components/project-select";
+import wwProjectCascader from "./components/ww-project-cascader.vue";
 import {exportBlob} from "@/api/common";
 import {exportBlob} from "@/api/common";
 import {getToken} from "@/util/auth";
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
 import {downloadXls} from "@/util/util";
@@ -77,8 +76,8 @@ import moment from "moment";
 export default window.$crudCommon({
 export default window.$crudCommon({
   components: {
   components: {
     YearMonthSelect,
     YearMonthSelect,
-    projectSelect,
     UploadExcelDialog,
     UploadExcelDialog,
+    wwProjectCascader
   },
   },
   data() {
   data() {
     return {
     return {
@@ -102,10 +101,6 @@ export default window.$crudCommon({
       this.page.currentPage = 1;
       this.page.currentPage = 1;
       this.getList(this.page);
       this.getList(this.page);
     },
     },
-    'form.xmId'(newVal) {
-      this.form.stfqcId = '';
-      this.getOutsourcingListFunc(newVal);
-    }
   },
   },
   computed: {
   computed: {
     permissionList() {
     permissionList() {
@@ -117,31 +112,19 @@ export default window.$crudCommon({
     },
     },
   },
   },
   methods: {
   methods: {
-    loadData() {},
-    getOutsourcingListFunc(xmId) {
-      if (!xmId) {
-        return;
-      }
-      getOutsourcingList(1, 99999, { xmId, yearAndMonth: moment(this.params.yearAndMonth).format('YYYY') }).then(res => {
-        if (res.data.code == 200) {
-          const column = this.findObject(this.option.column, "stfqcId");
-          column.dicData = res.data.data.records;
-        }
-      });
-    },
     getFormData() {
     getFormData() {
-      return { ...this.form, yearAndMonth: this.params.yearAndMonth };
+      return { ...this.form, wwId: this.form.wwId[1], yearAndMonth: this.params.yearAndMonth };
     },
     },
     handleImport() {
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('/api/kd-scientific/direct-cost/import', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/xm/wwxm/cost/import', excelParams);
     },
     },
     uploadAfter() {
     uploadAfter() {
       this.page.currentPage = 1;
       this.page.currentPage = 1;
       this.getList(this.page);
       this.getList(this.page);
     },
     },
     handleExport() {
     handleExport() {
-      exportBlob(`/api/kd-scientific/direct-cost/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBlob(`/api/kd-scientific/xm/wwxm/cost/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `${this.params.yearAndMonth}委托外部研发费用-基本信息台账.xlsx`);
         downloadXls(res.data, `${this.params.yearAndMonth}委托外部研发费用-基本信息台账.xlsx`);
       });
       });
     },
     },
@@ -161,6 +144,12 @@ export default window.$crudCommon({
   // 模块路径
   // 模块路径
   name: 'yfCostManage/basicDataSetting/wwCostLedger',
   name: 'yfCostManage/basicDataSetting/wwCostLedger',
   res: ({ data }) => {
   res: ({ data }) => {
+    data.records = data.records.map(item => {
+      if (item.wwId && item.xmId) {
+        item.wwId = [item.xmId, item.wwId];
+      }
+      return item;
+    })
     return data;
     return data;
   },
   },
 });
 });