Browse Source

燃料动力接口调试

ljb 10 months ago
parent
commit
b9cf3f326f

+ 8 - 6
src/api/yfCostManage/basicDataSetting/pickingDetail.js

@@ -2,7 +2,7 @@ import request from '@/router/axios';
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/kd-scientific/technician/page',
+    url: '/api/kd-scientific/goods/page',
     method: 'get',
     params: {
       ...params,
@@ -14,7 +14,7 @@ export const getList = (current, size, params) => {
 
 export const add = (row) => {
   return request({
-    url: '/api/kd-scientific/technician/save',
+    url: '/api/kd-scientific/goods/submit',
     method: 'post',
     data: row
   })
@@ -23,17 +23,19 @@ export const add = (row) => {
 
 export const update = (row) => {
   return request({
-    url: '/api/kd-scientific/technician/update',
+    url: '/api/kd-scientific/goods/submit',
     method: 'post',
     data: row
   })
 }
 
 
-export const remove = (data) => {
+export const remove = (ids) => {
   return request({
-    url: '/api/kd-scientific/technician/remove',
+    url: '/api/kd-scientific/goods/remove',
     method: 'post',
-    data
+    params: {
+      ids
+    }
   })
 }

+ 16 - 15
src/option/yfCostManage/basicDataSetting/pickingDetail.js

@@ -16,18 +16,18 @@ export default {
   showSummary: true,
   sumColumnList: [
     {
-      name: 'lqsl',
+      name: 'useQuantity',
       type: 'sum',
     },
     {
-      name: 'je',
+      name: 'amount',
       type: 'sum'
     }
   ],
   column: [
     {
       label: '日期',
-      prop: 'rq',
+      prop: 'useDate',
       type: 'date',
       valueFormat: 'yyyy-MM-dd',
       span: 24,
@@ -74,10 +74,10 @@ export default {
       prop: 'type',
       type: 'select',
       span: 24,
-      width: 100,
+      width: 60,
       align: 'center',
       search: true,
-      dicUrl: '/api/kd-system/dict-biz/dictionary?code=renyuanleixing',
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=wuzi_lx',
       props: {
         label: 'dictValue',
         value: 'dictKey',
@@ -93,7 +93,7 @@ export default {
     },
     {
       label: '物资编号',
-      prop: 'wzbh',
+      prop: 'code',
       type: 'input',
       span: 24,
       search: true,
@@ -110,7 +110,7 @@ export default {
     },
     {
       label: '物资名称',
-      prop: 'wzmc',
+      prop: 'name',
       type: 'input',
       span: 24,
       search: true,
@@ -126,25 +126,26 @@ export default {
     },
     {
       label: '型号规格',
-      prop: 'xhgg',
+      prop: 'model',
       type: 'input',
       span: 24,
       search: true,
-      minWidth: 140,
+      minWidth: 100,
+      align: 'center',
       showOverflowTooltip: true,
     },
     {
       label: '单位',
-      prop: 'dw',
+      prop: 'unit',
       type: 'input',
       span: 24,
-      width: 100,
+      width: 80,
       align: 'center',
       showOverflowTooltip: true,
     },
     {
       label: '单价(元)',
-      prop: 'dj',
+      prop: 'unitPrice',
       type: 'number',
       span: 24,
       width: 100,
@@ -155,10 +156,10 @@ export default {
     },
     {
       label: '领取数量',
-      prop: 'lqsl',
+      prop: 'useQuantity',
       type: 'number',
       span: 24,
-      width: 100,
+      width: 80,
       align: 'center',
       min: 0,
       precision: 0,
@@ -166,7 +167,7 @@ export default {
     },
     {
       label: '金额(元)',
-      prop: 'je',
+      prop: 'amount',
       type: 'number',
       span: 24,
       width: 100,

+ 26 - 7
src/views/yf-cost-manage/basic-data-setting/picking-detail.vue

@@ -41,6 +41,10 @@
         </div>
       </template>
 
+      <template slot="xmId" slot-scope="{ row }">
+        <span>{{ row.xmmc }}</span>
+      </template>
+
       <template slot="xmIdForm">
         <project-select placeholder="请选择项目名称" v-model="form.xmId" @change="handleProjectChange"></project-select>
       </template>
@@ -63,9 +67,13 @@
 <script>
 import YearMonthSelect from "@/components/year-month-select";
 import UploadExcelDialog from "@/components/upload-excel-dialog";
+import {exportBloByPost} from "@/api/common";
+import {getToken} from "@/util/auth";
+import {downloadXls} from "@/util/util";
 import projectSelect from "@/components/project-select";
 import moment from "moment";
 import { isAlphanumericCombination } from "@/util/regex";
+import Decimal from "decimal.js";
 
 
 export default window.$crudCommon({
@@ -93,38 +101,39 @@ export default window.$crudCommon({
   },
   methods: {
     validCustom() {
-      if (!isAlphanumericCombination(this.form.wzbh)) {
+      if (!isAlphanumericCombination(this.form.code)) {
         this.$message.warning("物质编号必须是英文字母加数字组合!");
         return false;
       }
       return true;
     },
     addBefore(loading, callback) {
-      console.log(this.form)
       if (!this.validCustom()) {
         loading();
         return;
       }
-      // callback && callback();
+      callback && callback();
     },
     updateBefore(loading, callback) {
       if (!this.validCustom()) {
         loading();
         return false;
       }
-      console.log(this.form)
-      // callback && callback();
+      callback && callback();
+    },
+    getFormData() {
+      return { ...this.form, yearAndMonth: this.params.yearAndMonth }
     },
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('/api/kd-scientific/technician/import', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/goods/import', excelParams);
     },
     uploadAfter() {
       this.page.currentPage = 1;
       this.getList(this.page);
     },
     handleExport() {
-      exportBloByPost(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBloByPost(`/api/kd-scientific/goods/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `研发领料燃料动力明细清单${this.params.yearAndMonth}.xlsx`);
       });
     },
@@ -144,6 +153,16 @@ export default window.$crudCommon({
   // 模块路径
   name: 'yfCostManage/basicDataSetting/pickingDetail',
   res: ({ data }) => {
+    data.records = data.records.map(item => {
+      let amount;
+      if (item.unitPrice && item.useQuantity) {
+        let unitPriceD = new Decimal(item.unitPrice);
+        let useQuantityD = new Decimal(item.useQuantity);
+        amount = unitPriceD.mul(useQuantityD).toFixed(2);
+      }
+      item.amount = amount;
+      return item;
+    });
     return data;
   },
 });