QuKatie 3 éve
szülő
commit
6f7c1b7a00

+ 12 - 0
src/api/basicData/part.js

@@ -0,0 +1,12 @@
+import request from '@/router/axios';
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-purchase-sales/orderparts/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}

+ 39 - 0
src/components/part-dialog/configuration/mainList.json

@@ -0,0 +1,39 @@
+{
+  "align": "center",
+  "border": true,
+  "index": true,
+  "addBtn": false,
+  "menuWidth":150,
+  "selection": true,
+  "tip":false,
+  "delBtn":false,
+  "editBtn":false,
+  "showSummary": true,
+  "column": [
+    {
+      "label": "类型",
+      "prop": "goodTypeName",
+      "width": 250
+    },
+    {
+      "label": "名称",
+      "prop": "goodName",
+      "width": 250
+    },
+    {
+      "label": "数量",
+      "prop": "goodNumber",
+      "width": 120
+    },
+    {
+      "label": "单价",
+      "prop": "price",
+      "width": 120
+    },
+    {
+      "label": "金额",
+      "prop": "amout",
+      "width": 120
+    }
+  ]
+}

+ 200 - 0
src/components/part-dialog/main.vue

@@ -0,0 +1,200 @@
+<template>
+  <div>
+    <el-dialog
+      title="配件信息"
+      :visible.sync="partVisible"
+      width="60%"
+      append-to-body
+      @closed="closed"
+      v-dialog-drag
+    >
+      <span>
+        <avue-crud
+          ref="crud"
+          :data="data"
+          :option="tableOption"
+          @refresh-change="refreshChange"
+          @saveColumn="saveColumn"
+          @selection-change="selectionChange"
+          :summary-method="summaryMethod"
+        >
+          <template slot="menuLeft">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="small"
+              @click.stop="rowAdd"
+              >选择</el-button
+            >
+          </template>
+          <template slot="menu" slot-scope="{ row, index }">
+            <el-button type="text" size="small" @click.stop="rowDel(row, index)"
+              >删除</el-button
+            >
+          </template>
+          <template slot="goodName" slot-scope="{ row, index }">
+            <el-button
+              size="small"
+              type="text"
+              style="padding:4px 10px;float:left"
+              @click="rePick(row.index)"
+              >选择</el-button
+            >
+            <span> {{ row.goodName }}</span>
+          </template>
+          <template slot="goodNumber" slot-scope="{ row }">
+            <el-input
+              v-if="row.$cellEdit"
+              v-model="row.goodNumber"
+              size="small"
+              oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+              @change="priceChange(row)"
+            ></el-input>
+            <span v-else>{{ row.goodNumber }}</span>
+          </template>
+          <template slot="price" slot-scope="{ row }">
+            <el-input
+              v-if="row.$cellEdit"
+              v-model="row.price"
+              size="small"
+              oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+              @change="priceChange(row)"
+            ></el-input>
+            <span v-else>{{ row.price | micrometerFormat }}</span>
+          </template>
+        </avue-crud>
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="partVisible = false">取 消</el-button>
+        <el-button type="primary" @click="importPart">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import option from "./configuration/mainList.json";
+import { micrometerFormat } from "@/util/validate";
+import _ from "lodash";
+export default {
+  data() {
+    return {
+      loading: true,
+      data: [],
+      tableOption: option,
+      height: window.innerHeight - 500,
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 10
+      },
+      partVisible: false,
+      selectionList: [],
+      goodsIndex: null,
+      amoutSum:0
+    };
+  },
+  props: {
+    partList: Array
+  },
+  filters: {
+    micrometerFormat(val) {
+      return micrometerFormat(val);
+    }
+  },
+  created() {},
+  methods: {
+    rePick(row,index){
+            this.$message({
+        type: "warning",
+        message: "正在开发中!"
+      });
+    },
+    priceChange(row) {
+      row.amout = _.multiply(
+        Number(row.goodNumber ? row.goodNumber : 0),
+        Number(row.price ? row.price : 0)
+      );
+    },
+    rowDel(row, index) {
+      this.$message({
+        type: "success",
+        message: "删除成功!"
+      });
+      this.data.splice(index, 1);
+    },
+    rowAdd() {
+      this.$emit("partOpen", true);
+    },
+    init(rows, index) {
+      this.data = rows;
+      this.goodsIndex = index;
+      this.partVisible = true;
+    },
+    closed() {
+      this.amoutSum=0
+      this.$refs.crud.toggleSelection();
+      this.$emit("partClosed");
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    importPart() {
+      this.$emit("importPart", this.data,this.amoutSum, this.goodsIndex);
+      this.partVisible = false;
+    },
+    sizeChange(val) {
+      this.page.pageSize = val;
+      this.getList();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getList();
+    },
+    refreshChange() {
+      this.getList(this.page, this.search);
+    },
+    saveColumn(row, column) {
+      console.log(row, column);
+    },
+    summaryMethod({ columns, data }) {
+      const sums = [];
+      if (columns.length > 0) {
+        columns.forEach((item, index) => {
+          sums[0] = "合计";
+          if (
+            item.property == "goodNumber" ||
+            item.property == "amout"
+          ) {
+            let qtySum = 0;
+            let amountSum = 0;
+            this.amoutSum=0
+            data.forEach(e => {
+              qtySum = _.add(qtySum, Number(e.goodNumber));
+              amountSum = _.add(amountSum, Number(e.amout));
+              this.amoutSum=amountSum
+            });
+            //数量总计
+            if (item.property == "goodNumber") {
+              sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
+            }
+            //金额总计
+            if (item.property == "amout") {
+              sums[index] = micrometerFormat(amountSum);
+            }
+          }
+        });
+      }
+      return sums;
+    }
+  },
+  watch: {
+    partList: function(arr) {
+      console.log(arr);
+      this.data = arr;
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss"></style>

+ 16 - 2
src/views/exportTrade/customerInquiry/config/customerContact.json

@@ -40,7 +40,7 @@
       "overHidden": true,
       "cell": true,
       "type": "select",
-      "dicData":[],
+      "dicData": [],
       "props": {
         "label": "dictValue",
         "value": "dictKey"
@@ -68,6 +68,20 @@
       "overHidden": true
     },
     {
+      "label": "配件信息",
+      "prop": "partsList",
+      "index": 7,
+      "width": 100,
+      "overHidden": true
+    },
+    {
+      "label": "配件价格",
+      "prop": "partsPrice",
+      "index": 7,
+      "width": 100,
+      "overHidden": true
+    },
+    {
       "label": "供应商",
       "prop": "corpId",
       "index": 8,
@@ -104,7 +118,7 @@
       "overHidden": true,
       "cell": true,
       "type": "select",
-      "dicData":[],
+      "dicData": [],
       "props": {
         "label": "dictValue",
         "value": "dictValue"

+ 67 - 11
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -187,12 +187,20 @@
               type="text"
               @click="rePick(row, index)"
               :disabled="disabled"
-              class="picker"
               style="padding:4px 10px;float:left"
               >选择</el-button
             >
             <span> {{ row.cname }}</span>
           </template>
+          <template slot="partsList" slot-scope="{ row, index }">
+            <el-button
+              size="small"
+              type="text"
+              @click="partrePick(row, index)"
+              :disabled="disabled"
+              >操作</el-button
+            >
+          </template>
           <template slot="priorityReferrer" slot-scope="{ row }">
             <el-checkbox
               :disabled="!row.$cellEdit"
@@ -350,6 +358,13 @@
       reportName="客户询价"
       @onClose="onClose()"
     ></report-dialog>
+    <part-dialog
+      ref="part"
+      @partOpen="partOpen()"
+      :partList="partList"
+      @importPart="importPart"
+      @partClosed="partClosed"
+    />
   </div>
 </template>
 
@@ -358,6 +373,7 @@ import tableOption from "./config/customerContact.json";
 import goodsOption from "./config/commodity.json";
 import feeInfo from "@/components/fee-info/main";
 import customerDialog from "@/components/customer-dialog/main";
+import partDialog from "@/components/part-dialog/main";
 import {
   detail,
   submit,
@@ -669,10 +685,13 @@ export default {
       olddata: [],
       oldorderFeesList: [],
       reData: null,
-      loading:false,
+      loading: false,
       subLoading: false,
-      pageLoading:false,
-      showBut: true
+      pageLoading: false,
+      showBut: true,
+      partreData: {},
+      partType: false,
+      partList: []
     };
   },
   props: {
@@ -683,7 +702,8 @@ export default {
   components: {
     reportDialog,
     feeInfo,
-    customerDialog
+    customerDialog,
+    partDialog
   },
   async created() {
     this.tableOption = await this.getColumnData(
@@ -742,6 +762,10 @@ export default {
         });
       });
     },
+    partOpen() {
+      this.partType = true;
+      this.newDetails();
+    },
     rePick(row, index) {
       this.reData = {
         ...row,
@@ -749,6 +773,17 @@ export default {
       };
       this.newDetails();
     },
+    partrePick(row, index) {
+      this.partList = row.partsList;
+      this.$refs.part.init(row.partsList, index);
+    },
+    importPart(rows, sum, index) {
+      this.data[index].partsList = rows;
+      this.data[index].partsPrice = sum;
+    },
+    partClosed() {
+      this.partList = [];
+    },
     getcorpId(row) {
       this.data[row.index].corpId = row.id;
     },
@@ -895,8 +930,20 @@ export default {
       });
     },
     importGoods() {
-      if (this.reData) {
-        console.log(this.reData);
+      if (this.partType) {
+        this.selectionList.forEach(e => {
+          this.partList.push({
+            goodId: e.id,
+            goodTypeId: e.goodsTypeId,
+            goodTypeName: e.goodsTypeName,
+            goodName: e.cname,
+            price: e.price,
+            goodNumber: 0,
+            amout: 0,
+            $cellEdit: true
+          });
+        });
+      } else if (this.reData) {
         if (this.selectionList.length != 1) {
           return this.$message.error("重新选择的时候只能选择一条数据");
         } else {
@@ -909,6 +956,8 @@ export default {
                 item.priceCategory = e.goodsTypeName;
                 item.itemUrl = e.url;
                 item.itemProp = this.reData.itemProp;
+                item.partsList = this.reData.partsList;
+                item.partsPrice = this.reData.ppartsPrice;
                 item.itemDescription = e.cnameDescription;
                 item.itemType = this.reData.itemType;
                 item.tradeTerms = this.reData.tradeTerms;
@@ -936,6 +985,8 @@ export default {
             itemUrl: e.url,
             itemProp: null,
             itemDescription: e.cnameDescription,
+            partsList: [],
+            partsPrice: 0,
             itemType: null,
             tradeTerms: null,
             price: 0,
@@ -957,6 +1008,9 @@ export default {
       this.selectionList = [];
       this.treeDeptId = "";
       this.reData = null;
+      if (this.partType) {
+        this.partType = false;
+      }
     },
     selectionChange(list) {
       this.selectionList = list;
@@ -994,7 +1048,7 @@ export default {
     getDetail(id) {
       this.loading = true;
       this.showBut = false;
-      this.pageLoading= true;
+      this.pageLoading = true;
       detail(id)
         .then(res => {
           this.form = res.data.data;
@@ -1008,7 +1062,7 @@ export default {
         .finally(() => {
           this.loading = false;
           this.showBut = true;
-          this.pageLoading=false;
+          this.pageLoading = false;
         });
     },
     //修改提交触发
@@ -1068,6 +1122,9 @@ export default {
     //返回列表
     backToList() {
       let orderFeesList = this.$refs.feeInfo.submitData();
+      console.log(
+      this.data, this.olddata
+      );
       if (
         contrastObj(this.form, this.oldform) ||
         contrastList(this.data, this.olddata) ||
@@ -1158,8 +1215,7 @@ export default {
         this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
       }
     }
-  },
-
+  }
 };
 </script>