Browse Source

Merge branch 'dev' of git.echepei.com:caojunjie/Smart_platform_ui into dev

caojunjie 3 years ago
parent
commit
a6454cae62

+ 50 - 0
src/components/crop-dialog/configuration/mainList.json

@@ -0,0 +1,50 @@
+{
+    "lazy": true,
+    "align": "center",
+    "border": true,
+    "index": true,
+    "tree": true,
+    "addBtn": false,
+    "menu":false,
+    "selection":true,
+    "tip":false,
+    "header":false,
+    "column":[
+        {
+            "label": "客户编码",
+            "prop": "code",
+            "index": 1,
+            "width":100
+        },{
+            "label": "客户全称",
+            "prop": "cname",
+            "index": 2,
+            "width":180
+        },{
+            "label": "区域",
+            "prop": "belongtoarea",
+            "index": 4,
+            "width":180
+        },{
+            "label": "所属公司",
+            "prop": "belongtocompany",
+            "index": 5,
+            "width":100
+        },{
+            "label": "联系人",
+            "prop": "attn",
+            "index": 6,
+            "width":100
+        },{
+            "label": "代理品牌",
+            "prop": "goodtypes",
+            "index": 7,
+            "width":100
+        },{
+            "label": "客户等级 ",
+            "prop": "creditLevel",
+            "index": 8,
+            "width":100
+        }
+    ]
+}

+ 180 - 0
src/components/crop-dialog/main.vue

@@ -0,0 +1,180 @@
+<template>
+  <div>
+    <el-dialog
+      title="客户信息"
+      :visible.sync="portinfoVisible"
+      width="60%"
+      append-to-body
+      @closed="closed"
+      v-dialog-drag
+    >
+      <span>
+        <el-row>
+          <el-col :span="5">
+            <el-scrollbar>
+              <basic-container>
+                <avue-tree
+                  :option="treeOption"
+                  :data="treeData"
+                  @node-click="nodeClick"
+                />
+              </basic-container>
+            </el-scrollbar>
+          </el-col>
+          <el-col :span="19">
+            <avue-crud
+              :option="tableOption"
+              :data="dataList"
+              ref="crud"
+              v-model="form"
+              :page.sync="page"
+              @search-change="searchChange"
+              @refresh-change="refreshChange"
+              @selection-change="selectionChange"
+              @on-load="onLoad"
+              @tree-load="treeLoad"
+            >
+            </avue-crud>
+          </el-col>
+        </el-row>
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="portinfoVisible = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="importCorp"
+          :disabled="selectionList.length != 1"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import option from "./configuration/mainList.json";
+import {
+  customerList,
+  getDeptLazyTree
+} from "@/api/basicData/customerInformation";
+
+export default {
+  data() {
+    return {
+      loading: true,
+      dataList: [],
+      tableOption: option,
+      form: {},
+      search: {},
+      treeDeptId: "",
+      treeDeptName: "",
+      height: window.innerHeight - 500,
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 10
+      },
+      treeOption: {
+        nodeKey: "id",
+        lazy: true,
+        treeLoad: function(node, resolve) {
+          const parentId = node.level === 0 ? 0 : node.data.id;
+          getDeptLazyTree(parentId).then(res => {
+            resolve(
+              res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                };
+              })
+            );
+          });
+        },
+        addBtn: false,
+        menu: false,
+        size: "small",
+        props: {
+          labelText: "标题",
+          label: "title",
+          value: "value",
+          children: "children"
+        }
+      },
+      portinfoVisible: false,
+      selectionList: []
+    };
+  },
+  created() {},
+  mounted() {
+    option.height = window.innerHeight - 500;
+  },
+  methods: {
+    init(){
+      this.portinfoVisible=true
+    },
+    closed() {
+      this.$refs.crud.toggleSelection();
+    },
+    importCorp() {
+      this.$emit("importCorp", {
+        id: this.selectionList[0].id,
+        name:this.selectionList[0].cname
+      });
+      this.portinfoVisible = false;
+    },
+    onLoad(page, params = { parentId: 0 }) {
+      let queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+        corpsTypeId: this.treeDeptId
+      });
+      customerList(queryParams).then(res => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        if (this.page.total) {
+          this.tableOption.height = window.innerHeight - 500;
+        } else {
+          this.tableOption.height = window.innerHeight - 200;
+        }
+      });
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    sizeChange(val) {
+      this.page.pageSize = val;
+      this.getList();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getList();
+    },
+    //刷新触发
+    refreshChange() {
+      this.page = {
+        pageSize: 10,
+        pagerCount: 1,
+        total: 0
+      };
+    },
+    saveColumn(row, column) {
+      console.log(row, column);
+    },
+    //列表内展开树节点
+    treeLoad(tree, treeNode, resolve) {
+      const parentId = tree.id;
+      customerList({ parentId: parentId }).then(res => {
+        resolve(res.data.data.records);
+      });
+    },
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      console.log(this.treeDeptId);
+      this.onLoad(this.page);
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss"></style>

+ 0 - 1
src/components/fee-info/config/feeInfo.json

@@ -15,7 +15,6 @@
       "label": "结算单位",
       "prop": "corpId",
       "index": 1,
-      "cell": true,
       "overHidden": true,
       "width": 150
     },

+ 59 - 24
src/components/fee-info/main.vue

@@ -37,12 +37,21 @@
             >删 除</el-button
           >
         </template>
+        <template slot="corpId" slot-scope="{ row }">
+          <customer-dialog
+            v-if="row.$cellEdit"
+            v-model="row.corpName"
+            :cropIndex="index"
+            @getcorpId="getcorpId"
+          ></customer-dialog>
+          <span v-else>{{ row.corpName }}</span>
+        </template>
         <template slot="feeName" slot-scope="{ row, index }">
           <el-button
             size="small"
             type="text"
             @click="rePick(row, index)"
-            :disabled="disabled"
+            :disabled="disabled||!row.$cellEdit"
             class="picker"
             style="padding:4px 10px;float:left"
             >选择</el-button
@@ -135,6 +144,7 @@
         </el-button>
       </span>
     </el-dialog>
+    <crop-dialog ref="cropDialog" @importCorp="importCorp"></crop-dialog>
   </div>
 </template>
 
@@ -144,6 +154,8 @@ import option from "./config/feeList.json";
 import { getDeptLazyTree, customerList } from "@/api/basicData/basicFeesDesc";
 import { delItem } from "@/api/feeInfo/fee-info";
 import { isPercentage, micrometerFormat } from "@/util/validate";
+import customerDialog from "@/components/customer-dialog/main";
+import cropDialog from "@/components/crop-dialog/main";
 import _ from "lodash";
 export default {
   name: "feeInfo",
@@ -216,7 +228,30 @@ export default {
       feeOption
     );
   },
+  components: {
+    customerDialog,
+    cropDialog
+  },
   methods: {
+    importCorp(row) {
+      this.feeData.push({
+        itemId: null,
+        corpId: row.id,
+        corpName: row.name,
+        feeName: null,
+        price: null,
+        unit: null,
+        quantity: null,
+        amount: null,
+        currency: null,
+        exchangeRate: null,
+        remarks: null,
+        $cellEdit: true
+      });
+    },
+    getcorpId(row) {
+      this.feeData[row.index].corpId = row.id;
+    },
     rowDel(row, index) {
       console.log(row, index);
       this.$confirm("确定删除数据?", {
@@ -284,7 +319,9 @@ export default {
         ...row,
         index: index
       };
-      this.rowAdd();
+      this.feeDialog = true;
+      this.option.height = window.innerHeight - 500;
+      this.onLoad(this.page);
     },
     //费用编辑
     rowCell(row, index) {
@@ -296,9 +333,7 @@ export default {
     },
     //新增
     rowAdd() {
-      this.feeDialog = true;
-      this.option.height = window.innerHeight - 500;
-      this.onLoad(this.page);
+      this.$refs.cropDialog.init();
     },
     onLoad(page) {
       this.loading = true;
@@ -357,23 +392,24 @@ export default {
             });
           });
         }
-      } else {
-        this.selectionList.forEach(e => {
-          this.feeData.push({
-            itemId: e.id,
-            corpId: null,
-            feeName: e.cname,
-            price: 0,
-            unit: e.unitno,
-            quantity: 0,
-            amount: 0,
-            currency: e.fcyno,
-            exchangeRate: null,
-            remarks: null,
-            $cellEdit: true
-          });
-        });
-      }
+      } 
+      // else {
+      //   this.selectionList.forEach(e => {
+      //     this.feeData.push({
+      //       itemId: e.id,
+      //       corpId: null,
+      //       feeName: e.cname,
+      //       price: 0,
+      //       unit: e.unitno,
+      //       quantity: 0,
+      //       amount: 0,
+      //       currency: e.fcyno,
+      //       exchangeRate: null,
+      //       remarks: null,
+      //       $cellEdit: true
+      //     });
+      //   });
+      // }
       this.feeDialog = false;
     },
     submitData() {
@@ -424,5 +460,4 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>

+ 5 - 2
src/util/validate.js

@@ -20,8 +20,11 @@ export function isPercentage(val) {
 }
 // 折扣
 export function isDiscount(val) {
-  const num = val ? Number(val) : 0
-  return num + '折'
+  if(Number(val)>0){
+    return Number(val) + '折'
+  }else{
+    return '—'
+  }
 }
 /**
  * Created by jiachenpan on 16/11/18.

+ 12 - 3
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -510,7 +510,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "有效日期",
@@ -769,7 +776,7 @@ export default {
       let amountSum = 0;
       let purchaseAmountSum = 0;
       let grossProfitRate = 0;
-      let grossProfit=0
+      let grossProfit = 0;
       this.data.forEach(e => {
         amountSum = _.add(amountSum, Number(e.amount));
         purchaseAmountSum = _.add(
@@ -786,7 +793,9 @@ export default {
           _.divide(_.subtract(amountSum, purchaseAmountSum), amountSum),
           100
         );
-        this.form.grossProfit=Number(grossProfit?grossProfit:0).toFixed(2);
+        this.form.grossProfit = Number(grossProfit ? grossProfit : 0).toFixed(
+          2
+        );
         this.form.grossProfitRate = Number(
           grossProfitRate ? grossProfitRate : 0
         ).toFixed(2);

+ 10 - 3
src/views/exportTrade/invoice/detailsPage.vue

@@ -324,7 +324,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "出库数量",
@@ -519,7 +526,7 @@ export default {
       }
     },
     taxRateChange(row) {
-      if (Number(row.taxRate)>= 100) {
+      if (Number(row.taxRate) >= 100) {
         row.taxRate = 0;
         this.$message.error("税率不能超过100%");
       }
@@ -608,7 +615,7 @@ export default {
           });
         });
       }
-       this.dialogVisible = false;
+      this.dialogVisible = false;
     },
     closeGoods() {
       this.selectionList = [];

+ 8 - 1
src/views/exportTrade/receipt/detailsPage.vue

@@ -341,6 +341,13 @@ export default {
             type: "date",
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ],
             row: true
           },
           {
@@ -519,7 +526,7 @@ export default {
       }
     },
     taxRateChange(row) {
-      if (Number(row.taxRate)>= 100) {
+      if (Number(row.taxRate) >= 100) {
         row.taxRate = 0;
         this.$message.error("税率不能超过100%");
       }