Browse Source

进口贸易字段更改

lichao 4 years ago
parent
commit
e499b1ffbd

+ 125 - 0
src/views/importTrade/invoice/config/commodity.json

@@ -0,0 +1,125 @@
+
+{
+  "height": "auto",
+  "calcHeight": 80,
+  "tip": false,
+  "addBtn": false,
+  "searchShow": false,
+  "searchShowBtn": false,
+  "menu": false,
+  "searchMenuSpan": 6,
+  "border": true,
+  "index": true,
+  "selection": true,
+  "viewBtn": true,
+  "dialogClickModal": false,
+  "column": [
+    {
+      "label": "商品编码",
+      "prop": "code",
+      "search": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品名称",
+      "prop": "cname",
+      "slot": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品类别",
+      "prop": "goodsTypeId",
+      "dicData": [],
+      "type": "tree",
+      "hide": true,
+      "addDisabled": false,
+      "multiple": true,
+      "props": {
+        "label": "title"
+      },
+      "rules": [{
+        "required": true,
+        "message": " ",
+        "trigger": "click"
+      }]
+    },
+    {
+      "label": "规格编码",
+      "prop": "typeno",
+      "search": true
+    },
+    {
+      "label": "品牌",
+      "prop": "brand",
+      "slot": true
+    },
+    {
+      "label": "花纹",
+      "prop": "brandItem",
+      "slot": true
+    },
+    {
+      "label": "规格尺寸",
+      "prop": "specs",
+      "slot": true
+    },
+    {
+      "label": "产品类别",
+      "prop": "category",
+      "slot": true
+    },
+    {
+      "label": "产品分类",
+      "prop": "categoryitem",
+      "slot": true
+    },
+    {
+      "label": "供应商",
+      "prop": "providers",
+      "slot": true
+    },
+    {
+      "label": "计量单位",
+      "prop": "unit",
+      "slot": true
+    },
+    {
+      "label": "包装单位",
+      "prop": "packgeunit",
+      "slot": true
+    },
+    {
+      "label": "商品图片",
+      "prop": "url",
+      "type": "upload",
+      "listType": "picture-img",
+      "dataType": "string",
+      "action": "/api/blade-resource/oss/endpoint/put-file",
+      "propsHttp": {
+        "res": "data",
+        "url": "link"
+      },
+      "hide": true,
+      "span": 24
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "slot": true
+    }
+  ]
+}

+ 10 - 11
src/views/importTrade/invoice/config/customerContact.json

@@ -5,7 +5,7 @@
   "searchShow": true,
   "addBtn":false,
   "editBtn":false,
-  "addRowBtn":true,
+  "addRowBtn":false,
   "cellBtn":false,
   "cancelBtn":false,
   "refreshBtn": false,
@@ -17,11 +17,10 @@
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
-  "addBtnText": "新增明细",
   "column":[
     {
       "label": "提单号",
-      "prop": "fMblno",
+      "prop": "billNo",
       "index": 1,
       "width":100,
       "cell": true,
@@ -34,7 +33,7 @@
       ]
     },{
       "label": "合同号",
-      "prop": "contractNo",
+      "prop": "contractNumber",
       "index": 1,
       "width":100,
       "cell": true,
@@ -47,7 +46,7 @@
       ]
     },{
       "label": "货物品种",
-      "prop": "goodsVariety",
+      "prop": "priceCategory",
       "index": 2,
       "width":100,
       "cell": true,
@@ -60,7 +59,7 @@
       ]
     },{
       "label": "货物详情",
-      "prop": "goodsDetail",
+      "prop": "cname",
       "index": 3,
       "width":100,
       "cell": true,
@@ -73,7 +72,7 @@
       ]
     },{
       "label": "件数",
-      "prop": "number",
+      "prop": "actualQuantity",
       "index": 4,
       "width":100,
       "cell": true,
@@ -86,7 +85,7 @@
       ]
     },{
       "label": "发票净重(吨)",
-      "prop": "netWeight",
+      "prop": "invoiceWeight",
       "index": 5,
       "width":100,
       "cell": true,
@@ -99,7 +98,7 @@
       ]
     },{
       "label": "码单重量(吨)",
-      "prop": "codeList",
+      "prop": "billWeight",
       "index": 6,
       "width":100,
       "cell": true,
@@ -125,7 +124,7 @@
       ]
     },{
       "label": "合同金额",
-      "prop": "amount",
+      "prop": "contractAmount",
       "index": 6,
       "width":100,
       "cell": true,
@@ -151,7 +150,7 @@
       ]
     },{
       "label": "备注",
-      "prop": "remark",
+      "prop": "remarks",
       "index": 7,
       "width":100,
       "cell": true,

+ 7 - 13
src/views/importTrade/invoice/config/mainList.json

@@ -31,49 +31,43 @@
             "width":100
         },{
             "label": "发货日期",
-            "prop": "date",
+            "prop": "businessDate",
             "search": true,
             "index": 3,
             "width":100
         },{
         "label": "业务员",
-        "prop": "salesmanId",
+        "prop": "saleman",
         "search": true,
         "index": 4,
         "width":100
       },{
         "label": "销售公司",
-        "prop": "a",
+        "prop": "salesCompany",
         "search": true,
         "index": 5,
         "width":100
       },{
         "label": "工厂/贸易商名称",
-        "prop": "b",
+        "prop": "corpId",
         "search": true,
         "index": 6,
         "width":100
       },{
         "label": "仓库名称",
-        "prop": "c",
+        "prop": "storageId",
         "search": true,
         "index": 7,
         "width":100
       },{
-        "label": "销售单价",
-        "prop": "d",
-        "search": true,
-        "index": 8,
-        "width":100
-      },{
         "label": "发票重量",
-        "prop": "e",
+        "prop": "invoiceWeight",
         "search": true,
         "index": 9,
         "width":100
       },{
         "label": "备注",
-        "prop": "f",
+        "prop": "deliveryRemarks",
         "search": false,
         "index": 10,
         "width":100

+ 208 - 73
src/views/importTrade/invoice/detailsPageEdit.vue

@@ -47,8 +47,11 @@
             @row-save="rowSave"
             @row-click="handleRowClick"
             @row-update="rowUpdate"
-            @row-del="rowDel">
+            @row-del="rowDel"
+          >
             <template slot="code" slot-scope="{row,index}">
+              <span style="float: left;padding-top: 2px">{{ row.code }}</span>
+              <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
             </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
@@ -59,24 +62,75 @@
               </el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
-              <el-button type="warning"
-                         icon="el-icon-download"
+              <el-button type="primary"
+                         icon="el-icon-plus"
                          size="small"
-              >导 出</el-button>
-              <el-button type="info"
-                         icon="el-icon-printer"
-                         size="small"
-              >打 印</el-button>
+                         @click="commoditySelection"
+              >新增
+              </el-button>
             </template>
           </avue-crud>
         </basic-container>
       </el-form>
     </div>
+
+    <el-dialog
+      title="导入商品"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="dialogVisible"
+      width="80%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false">
+      <el-row style="height: 0;">
+        <el-col :span="5">
+          <div>
+            <el-scrollbar>
+              <basic-container>
+                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+              </basic-container>
+            </el-scrollbar>
+          </div>
+        </el-col>
+        <el-col :span="19">
+          <basic-container>
+            <avue-crud :option="optionTwo"
+                       :table-loading="loading"
+                       :data="data"
+                       ref="crud"
+                       @refresh-change="refreshChange"
+                       @selection-change="selectionChange"
+                       :page.sync="page"
+                       @on-load="onLoad"></avue-crud>
+          </basic-container>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="dialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
+          <el-button type="primary" @click="importChoice" v-if="commodityData === true"
+                     :disabled="tableData.length !== 1">导入</el-button>
+        </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import customerContact from "./config/customerContact.json"
+import {detailInvoiceList,
+  submitInvoiceList,
+  removeGoodsItem,} from "@/api/importTrade/invoice"
+import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
+import commodity from "./config/commodity.json"
+import {
+  typeSave, detail,
+  corpstypeTree,
+  corpsattn,
+  corpsbank,
+  corpsitem,
+  getList
+} from "@/api/basicData/deliveryNotice"
 
 export default {
   name: "detailsPageEdit",
@@ -94,7 +148,7 @@ export default {
             prop: 'sysNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -104,34 +158,30 @@ export default {
             prop: 'orderNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '发货日期',
-            prop: 'date',
+            prop: 'businessDate',
             type:'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '业务员',
-            prop: 'salesman',
-            type:'select',
-            dicData: [
-              {value: 1, label: '张三'},
-              {value: 2, label: '李四'},
-              {value: 3, label: '王五'},
-            ],
+            prop: 'saleman',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -139,71 +189,52 @@ export default {
           }, {
             label: '销售公司',
             prop: 'salesCompany',
-            type:'select',
-            dicData: [
-              {value: 1, label: '测试公司'},
-              {value: 2, label: '途宝'},
-            ],
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '工厂/贸易商名称',
-            prop: 'factory',
-            type:'select',
-            dicData: [
-              {value: 1, label: '大厂'},
-              {value: 2, label: '小厂'},
-            ],
+            prop: 'corpId',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '仓库名称',
-            prop: 'warehouse',
-            type:'select',
-            dicData: [
-              {value: 1, label: '大库'},
-              {value: 2, label: '小库'},
-            ],
-            rules: [
-              {
-                required: true,
-                message: ' ',
-                trigger: 'blur'
-              }
-            ]
-          }, {
-            label: '销售单价',
-            prop: 'd',
+            prop: 'storageId',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
-          }, {
+          },  {
             label: '发票重量',
-            prop: 'e',
+            prop: 'invoiceWeight',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '备注',
-            prop: 'f',
+            prop: 'deliveryRemarks',
             span: 24,
             mock: {
               type: 'county'
@@ -211,27 +242,51 @@ export default {
           }
         ]
       },
+      dialogVisible: false,
+      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
+              }
+            }))
+          });
+        },
+        treeDeptId: '',
+        addBtn: false,
+        menu: false,
+        size: 'small',
+        props: {
+          labelText: '标题',
+          label: 'title',
+          value: 'value',
+          children: 'children'
+        }
+      },
+      optionTwo: commodity,
+      loading: false,
+      data: [],
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      commodityData: false,
+      tableData: [],
     }
   },
   created() {
     if (this.$route.query.id) {
-      this.form = {
-        id: 1,
-        sysNo: 2021101501,
-        orderNo: '001',
-        date: '2021-10-15',
-        salesman: 1,
-        salesCompany: 1,
-        factory: 1,
-        warehouse: 1,
-        d: '10.33',
-        e: '12',
-        f: null
-      }
-      this.contactsData = [
-        {fMblno: '2021101501', contractNo: '001', goodsVariety: '水泥', goodsDetail: '印度', number: 30, netWeight: 12, codeList: 20, price: 20, amount: 600, taxRate: '0.03', remark: ''},
-        {fMblno: '2021101502', contractNo: '001', goodsVariety: '巴西棉', goodsDetail: '巴西', number: 10, netWeight: 12, codeList: 20, price: 7, amount: 70, taxRate: '0.03', remark: '测试啊测试'},
-      ]
+      let id = this.$route.query.id.replace(/\"/g, "")
+      detailInvoiceList(id).then(res => {
+        this.form = res.data.data;
+        this.contactsData = this.form.deliveryItemsList
+      })
     }
   },
   methods: {
@@ -264,7 +319,7 @@ export default {
       }).then(() => {
         //商品判断是否需要调用删除接口
         if (row.id) {
-          corpsattn(row.id).then(res => {
+          removeGoodsItem(row.id).then(res => {
             this.$message({
               type: "success",
               message: "操作成功!"
@@ -284,12 +339,92 @@ export default {
     editCustomer() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          this.backToList()
+          let submitDto = {
+            deliveryItemsList: [],
+            deliveryFeesList: [],
+            deliveryFilesList: []
+          };
+          submitDto = Object.assign({}, submitDto, this.form)
+          submitDto.deliveryItemsList = this.contactsData
+          submitInvoiceList(submitDto).then(res => {
+            this.backToList()
+          })
         } else {
           return false;
         }
       });
     },
+    //点击商品明细选择触发
+    commodityChoice(row) {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = true
+      this.choiceIndexT = row.$index
+    },
+    //商品新增触发
+    commoditySelection() {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
+    //导入页左商品类型查询
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    //刷新触发
+    refreshChange() {
+      this.treeDeptId = '';
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    //选中触发
+    selectionChange(list) {
+      console.log(list);
+      this.tableData = list
+    },
+    //确认导入触发
+    importGoods() {
+      // this.contactsData = this.contactsData.concat(this.tableData)
+      if (this.tableData.length > 0) {
+        for (let item in this.tableData) {
+          console.log(this.tableData[item])
+          this.tableData[item].itemId = this.tableData[item].id
+          this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
+          delete this.tableData[item].goodsTypeName
+          delete this.tableData[item].id
+          delete this.tableData[item].status
+          delete this.tableData[item].isDeleted
+          this.$refs.crudContact.rowCellAdd(this.tableData[item]);
+          this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
+        }
+      }
+      this.tableData = []
+      this.dialogVisible = false
+    },
+    //导入商品触发
+    importChoice() {
+      if (this.tableData.length === 1) {
+        this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
+        this.contactsData[this.choiceIndexT].code = this.tableData[0].code
+        this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
+        this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
+        this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
+        this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
+      }
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
+    //商品列表查询
+    onLoad(page, params = {}) {
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
+        console.log(res)
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+      });
+    },
     //返回列表
     backToList() {
       this.$router.$avueRouter.closeTag();

+ 11 - 25
src/views/importTrade/invoice/index.vue

@@ -16,8 +16,7 @@
                @current-change="currentChange"
                @size-change="sizeChange"
                @refresh-change="refreshChange"
-               @on-load="onLoad"
-               @tree-load="treeLoad">
+               @on-load="onLoad">
       <template slot-scope="scope" slot="menu">
         <el-button
           type="text"
@@ -48,6 +47,8 @@
 <script>
 import option from "./config/mainList.json";
 import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
+import {selectInvoiceList,
+  removeInvoiceList,} from "@/api/importTrade/invoice"
 
 export default {
   name: "customerInformation",
@@ -56,10 +57,7 @@ export default {
       form: {},
       option: option,
       parentId: 0,
-      dataList: [
-        {id: 0, sysNo: 2021101801, orderNo: '001', date: '2021-10-18', salesmanId: '张三',a:'测试公司',b:'大厂',c:'小库',d:20,e:12.44,f:''},
-        {id: 1, sysNo: 2021101802, orderNo: '002', date: '2021-10-18', salesmanId: '李四',a:'测试公司',b:'大厂',c:'小库',d:20,e:12.44,f:''},
-      ],
+      dataList: [],
       page: {
         pageSize: 10,
         pagerCount: 5,
@@ -68,8 +66,6 @@ export default {
     }
   },
   created() {
-    console.log('wangbadan')
-    // this.onLoad()
   },
   methods: {
     //删除列表后面的删除按钮触发触发(row, index, done)
@@ -79,15 +75,14 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        // return deleteDetails(row.id);
-        return this.dataList.splice(index, 1)
+        return removeInvoiceList(row.id);
       }).then(() => {
         this.$message({
           type: "success",
           message: "操作成功!"
         });
         this.page.currentPage = 1;
-        this.onLoad(this.page, {parentId: 0});
+        this.onLoad(this.page);
       });
     },
     //修改时的修改按钮点击触发
@@ -178,24 +173,15 @@ export default {
     refreshChange() {
       console.log('1')
     },
-    onLoad(page, params = {parentId: 0}) {
+    onLoad(page, params) {
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,
-        billType:'CG',
-        corpsTypeId: this.treeDeptId
       })
-      // customerList(queryParams).then(res => {
-      //   this.dataList = res.data.data.records
-      //   this.page.total = res.data.data.total
-      // })
-    },
-    //树桩列点击展开触发
-    treeLoad(tree, treeNode, resolve) {
-      const parentId = tree.id;
-      customerList({parentId: parentId}).then(res => {
-        resolve(res.data.data.records);
-      });
+      selectInvoiceList(queryParams).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+      })
     },
   }
 }

+ 125 - 0
src/views/importTrade/receipt/config/commodity.json

@@ -0,0 +1,125 @@
+
+{
+  "height": "auto",
+  "calcHeight": 80,
+  "tip": false,
+  "addBtn": false,
+  "searchShow": false,
+  "searchShowBtn": false,
+  "menu": false,
+  "searchMenuSpan": 6,
+  "border": true,
+  "index": true,
+  "selection": true,
+  "viewBtn": true,
+  "dialogClickModal": false,
+  "column": [
+    {
+      "label": "商品编码",
+      "prop": "code",
+      "search": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品名称",
+      "prop": "cname",
+      "slot": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品类别",
+      "prop": "goodsTypeId",
+      "dicData": [],
+      "type": "tree",
+      "hide": true,
+      "addDisabled": false,
+      "multiple": true,
+      "props": {
+        "label": "title"
+      },
+      "rules": [{
+        "required": true,
+        "message": " ",
+        "trigger": "click"
+      }]
+    },
+    {
+      "label": "规格编码",
+      "prop": "typeno",
+      "search": true
+    },
+    {
+      "label": "品牌",
+      "prop": "brand",
+      "slot": true
+    },
+    {
+      "label": "花纹",
+      "prop": "brandItem",
+      "slot": true
+    },
+    {
+      "label": "规格尺寸",
+      "prop": "specs",
+      "slot": true
+    },
+    {
+      "label": "产品类别",
+      "prop": "category",
+      "slot": true
+    },
+    {
+      "label": "产品分类",
+      "prop": "categoryitem",
+      "slot": true
+    },
+    {
+      "label": "供应商",
+      "prop": "providers",
+      "slot": true
+    },
+    {
+      "label": "计量单位",
+      "prop": "unit",
+      "slot": true
+    },
+    {
+      "label": "包装单位",
+      "prop": "packgeunit",
+      "slot": true
+    },
+    {
+      "label": "商品图片",
+      "prop": "url",
+      "type": "upload",
+      "listType": "picture-img",
+      "dataType": "string",
+      "action": "/api/blade-resource/oss/endpoint/put-file",
+      "propsHttp": {
+        "res": "data",
+        "url": "link"
+      },
+      "hide": true,
+      "span": 24
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "slot": true
+    }
+  ]
+}

+ 10 - 11
src/views/importTrade/receipt/config/customerContact.json

@@ -5,7 +5,7 @@
   "searchShow": true,
   "addBtn":false,
   "editBtn":false,
-  "addRowBtn":true,
+  "addRowBtn":false,
   "cellBtn":false,
   "cancelBtn":false,
   "refreshBtn": false,
@@ -17,11 +17,10 @@
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
-  "addBtnText": "新增明细",
   "column":[
     {
       "label": "提单号",
-      "prop": "fMblno",
+      "prop": "billNo",
       "index": 1,
       "width":100,
       "cell": true,
@@ -34,7 +33,7 @@
       ]
     },{
       "label": "合同号",
-      "prop": "contractNo",
+      "prop": "contractNumber",
       "index": 1,
       "width":100,
       "cell": true,
@@ -47,7 +46,7 @@
       ]
     },{
       "label": "货物品种",
-      "prop": "goodsVariety",
+      "prop": "priceCategory",
       "index": 2,
       "width":100,
       "cell": true,
@@ -60,7 +59,7 @@
       ]
     },{
       "label": "货物详情",
-      "prop": "goodsDetail",
+      "prop": "cname",
       "index": 3,
       "width":100,
       "cell": true,
@@ -73,7 +72,7 @@
       ]
     },{
       "label": "件数",
-      "prop": "number",
+      "prop": "actualQuantity",
       "index": 4,
       "width":100,
       "cell": true,
@@ -86,7 +85,7 @@
       ]
     },{
       "label": "发票净重(吨)",
-      "prop": "netWeight",
+      "prop": "invoiceWeight",
       "index": 5,
       "width":100,
       "cell": true,
@@ -99,7 +98,7 @@
       ]
     },{
       "label": "码单重量(吨)",
-      "prop": "codeList",
+      "prop": "billWeight",
       "index": 6,
       "width":100,
       "cell": true,
@@ -125,7 +124,7 @@
       ]
     },{
       "label": "合同金额",
-      "prop": "amount",
+      "prop": "contractAmount",
       "index": 6,
       "width":100,
       "cell": true,
@@ -151,7 +150,7 @@
       ]
     },{
       "label": "备注",
-      "prop": "remark",
+      "prop": "remarks",
       "index": 7,
       "width":100,
       "cell": true,

+ 58 - 64
src/views/importTrade/receipt/config/mainList.json

@@ -15,68 +15,62 @@
     "menuWidth": 300,
     "dialogClickModal": false,
     "searchLabelWidth": 100,
-    "column":[
-      {
-        "label": "系统号",
-        "prop": "sysNo",
-        "search": true,
-        "index": 1,
-        "width":100
-      },
-      {
-        "label": "合同号",
-        "prop": "orderNo",
-        "search": true,
-        "index": 2,
-        "width":100
-      },{
-        "label": "收货日期",
-        "prop": "date",
-        "search": true,
-        "index": 3,
-        "width":100
-      },{
-        "label": "业务员",
-        "prop": "salesmanId",
-        "search": true,
-        "index": 4,
-        "width":100
-      },{
-        "label": "销售公司",
-        "prop": "a",
-        "search": true,
-        "index": 5,
-        "width":100
-      },{
-        "label": "工厂/贸易商名称",
-        "prop": "b",
-        "search": true,
-        "index": 6,
-        "width":100
-      },{
-        "label": "仓库名称",
-        "prop": "c",
-        "search": true,
-        "index": 7,
-        "width":100
-      },{
-        "label": "销售单价",
-        "prop": "d",
-        "search": true,
-        "index": 8,
-        "width":100
-      },{
-        "label": "发票重量",
-        "prop": "e",
-        "search": true,
-        "index": 9,
-        "width":100
-      },{
-        "label": "备注",
-        "prop": "f",
-        "search": false,
-        "index": 10,
-        "width":100
-      }
-    ]
+  "column":[
+    {
+      "label": "系统号",
+      "prop": "sysNo",
+      "search": true,
+      "index": 1,
+      "width":100
+    },
+    {
+      "label": "合同号",
+      "prop": "orderNo",
+      "search": true,
+      "index": 2,
+      "width":100
+    },{
+      "label": "收货日期",
+      "prop": "businessDate",
+      "search": true,
+      "index": 3,
+      "width":100
+    },{
+      "label": "业务员",
+      "prop": "saleman",
+      "search": true,
+      "index": 4,
+      "width":100
+    },{
+      "label": "销售公司",
+      "prop": "salesCompany",
+      "search": true,
+      "index": 5,
+      "width":100
+    },{
+      "label": "工厂/贸易商名称",
+      "prop": "corpId",
+      "search": true,
+      "index": 6,
+      "width":100
+    },{
+      "label": "仓库名称",
+      "prop": "storageId",
+      "search": true,
+      "index": 7,
+      "width":100
+    },{
+      "label": "发票重量",
+      "prop": "invoiceWeight",
+      "search": true,
+      "index": 9,
+      "width":100
+    },{
+      "label": "备注",
+      "prop": "deliveryRemarks",
+      "search": false,
+      "index": 10,
+      "width":100
+    }
+  ]
 }

+ 203 - 73
src/views/importTrade/receipt/detailsPageEdit.vue

@@ -47,8 +47,11 @@
             @row-save="rowSave"
             @row-click="handleRowClick"
             @row-update="rowUpdate"
-            @row-del="rowDel">
+            @row-del="rowDel"
+          >
             <template slot="code" slot-scope="{row,index}">
+              <span style="float: left;padding-top: 2px">{{ row.code }}</span>
+              <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
             </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
@@ -59,24 +62,70 @@
               </el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
-              <el-button type="warning"
-                         icon="el-icon-download"
+              <el-button type="primary"
+                         icon="el-icon-plus"
                          size="small"
-              >导 出</el-button>
-              <el-button type="info"
-                         icon="el-icon-printer"
-                         size="small"
-              >打 印</el-button>
+                         @click="commoditySelection"
+              >新增
+              </el-button>
             </template>
           </avue-crud>
         </basic-container>
       </el-form>
     </div>
+
+    <el-dialog
+      title="导入商品"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="dialogVisible"
+      width="80%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false">
+      <el-row style="height: 0;">
+        <el-col :span="5">
+          <div>
+            <el-scrollbar>
+              <basic-container>
+                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+              </basic-container>
+            </el-scrollbar>
+          </div>
+        </el-col>
+        <el-col :span="19">
+          <basic-container>
+            <avue-crud :option="optionTwo"
+                       :table-loading="loading"
+                       :data="data"
+                       ref="crud"
+                       @refresh-change="refreshChange"
+                       @selection-change="selectionChange"
+                       :page.sync="page"
+                       @on-load="onLoad"></avue-crud>
+          </basic-container>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="dialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
+          <el-button type="primary" @click="importChoice" v-if="commodityData === true"
+                     :disabled="tableData.length !== 1">导入</el-button>
+        </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import customerContact from "./config/customerContact.json"
+import commodity from "../invoice/config/commodity.json";
+import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
+import {detailReceiptList,
+  submitReceiptList,
+  removeGoodsItem,} from "@/api/importTrade/receipt"
+import {
+  getList
+} from "@/api/basicData/deliveryNotice"
 
 export default {
   name: "detailsPageEdit",
@@ -94,7 +143,7 @@ export default {
             prop: 'sysNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -104,34 +153,30 @@ export default {
             prop: 'orderNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '收货日期',
-            prop: 'date',
+            prop: 'businessDate',
             type:'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '业务员',
-            prop: 'salesman',
-            type:'select',
-            dicData: [
-              {value: 1, label: '张三'},
-              {value: 2, label: '李四'},
-              {value: 3, label: '王五'},
-            ],
+            prop: 'saleman',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -139,71 +184,52 @@ export default {
           }, {
             label: '销售公司',
             prop: 'salesCompany',
-            type:'select',
-            dicData: [
-              {value: 1, label: '测试公司'},
-              {value: 2, label: '途宝'},
-            ],
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '工厂/贸易商名称',
-            prop: 'factory',
-            type:'select',
-            dicData: [
-              {value: 1, label: '大厂'},
-              {value: 2, label: '小厂'},
-            ],
+            prop: 'corpId',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '仓库名称',
-            prop: 'warehouse',
-            type:'select',
-            dicData: [
-              {value: 1, label: '大库'},
-              {value: 2, label: '小库'},
-            ],
-            rules: [
-              {
-                required: true,
-                message: ' ',
-                trigger: 'blur'
-              }
-            ]
-          }, {
-            label: '销售单价',
-            prop: 'd',
+            prop: 'storageId',
+            // type:'select',
+            dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
-          }, {
+          },  {
             label: '发票重量',
-            prop: 'e',
+            prop: 'invoiceWeight',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '备注',
-            prop: 'f',
+            prop: 'deliveryRemarks',
             span: 24,
             mock: {
               type: 'county'
@@ -211,27 +237,51 @@ export default {
           }
         ]
       },
+      dialogVisible: false,
+      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
+              }
+            }))
+          });
+        },
+        treeDeptId: '',
+        addBtn: false,
+        menu: false,
+        size: 'small',
+        props: {
+          labelText: '标题',
+          label: 'title',
+          value: 'value',
+          children: 'children'
+        }
+      },
+      optionTwo: commodity,
+      loading: false,
+      data: [],
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      commodityData: false,
+      tableData: [],
     }
   },
   created() {
     if (this.$route.query.id) {
-      this.form = {
-        id: 1,
-        sysNo: 2021101501,
-        orderNo: '001',
-        date: '2021-10-15',
-        salesman: 1,
-        salesCompany: 1,
-        factory: 1,
-        warehouse: 1,
-        d: '10.33',
-        e: '12',
-        f: null
-      }
-      this.contactsData = [
-        {fMblno: '2021101501', contractNo: '001', goodsVariety: '水泥', goodsDetail: '印度', number: 30, netWeight: 12, codeList: 20, price: 20, amount: 600, taxRate: '0.03', remark: ''},
-        {fMblno: '2021101502', contractNo: '001', goodsVariety: '巴西棉', goodsDetail: '巴西', number: 10, netWeight: 12, codeList: 20, price: 7, amount: 70, taxRate: '0.03', remark: '测试啊测试'},
-      ]
+      let id = this.$route.query.id.replace(/\"/g, "")
+      detailReceiptList(id).then(res => {
+        this.form = res.data.data;
+        this.contactsData = this.form.deliveryItemsList
+      })
     }
   },
   methods: {
@@ -264,7 +314,7 @@ export default {
       }).then(() => {
         //商品判断是否需要调用删除接口
         if (row.id) {
-          corpsattn(row.id).then(res => {
+          removeGoodsItem(row.id).then(res => {
             this.$message({
               type: "success",
               message: "操作成功!"
@@ -284,12 +334,92 @@ export default {
     editCustomer() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          this.backToList()
+          let submitDto = {
+            deliveryItemsList: [],
+            deliveryFeesList: [],
+            deliveryFilesList: []
+          };
+          submitDto = Object.assign({}, submitDto, this.form)
+          submitDto.deliveryItemsList = this.contactsData
+          submitReceiptList(submitDto).then(res => {
+            this.backToList()
+          })
         } else {
           return false;
         }
       });
     },
+    //点击商品明细选择触发
+    commodityChoice(row) {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = true
+      this.choiceIndexT = row.$index
+    },
+    //商品新增触发
+    commoditySelection() {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
+    //导入页左商品类型查询
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    //刷新触发
+    refreshChange() {
+      this.treeDeptId = '';
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    //选中触发
+    selectionChange(list) {
+      console.log(list);
+      this.tableData = list
+    },
+    //确认导入触发
+    importGoods() {
+      // this.contactsData = this.contactsData.concat(this.tableData)
+      if (this.tableData.length > 0) {
+        for (let item in this.tableData) {
+          console.log(this.tableData[item])
+          this.tableData[item].itemId = this.tableData[item].id
+          this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
+          delete this.tableData[item].goodsTypeName
+          delete this.tableData[item].id
+          delete this.tableData[item].status
+          delete this.tableData[item].isDeleted
+          this.$refs.crudContact.rowCellAdd(this.tableData[item]);
+          this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
+        }
+      }
+      this.tableData = []
+      this.dialogVisible = false
+    },
+    //导入商品触发
+    importChoice() {
+      if (this.tableData.length === 1) {
+        this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
+        this.contactsData[this.choiceIndexT].code = this.tableData[0].code
+        this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
+        this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
+        this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
+        this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
+      }
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
+    //商品列表查询
+    onLoad(page, params = {}) {
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
+        console.log(res)
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+      });
+    },
     //返回列表
     backToList() {
       this.$router.$avueRouter.closeTag();

+ 11 - 25
src/views/importTrade/receipt/index.vue

@@ -16,8 +16,7 @@
                @current-change="currentChange"
                @size-change="sizeChange"
                @refresh-change="refreshChange"
-               @on-load="onLoad"
-               @tree-load="treeLoad">
+               @on-load="onLoad">
       <template slot-scope="scope" slot="menu">
         <el-button
           type="text"
@@ -48,6 +47,8 @@
 <script>
 import option from "./config/mainList.json";
 import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
+import {selectReceiptList,
+  removeReceiptList,} from "@/api/importTrade/receipt"
 
 export default {
   name: "customerInformation",
@@ -56,11 +57,7 @@ export default {
       form: {},
       option: option,
       parentId: 0,
-      dataList: [
-        {id: 0, sysNo: 2021101501, orderNo: '001', date: '2021-10-15', salesmanId: '张三',a:'测试公司',b:'大厂',c:'小库',d:20,e:12.44,f:''},
-        {id: 1, sysNo: 2021101502, orderNo: '002', date: '2021-10-15', salesmanId: '李四',a:'测试公司',b:'大厂',c:'小库',d:20,e:12.44,f:''},
-        {id: 2, sysNo: 2021101503, orderNo: '003', date: '2021-10-15', salesmanId: '王五',a:'测试公司',b:'大厂',c:'小库',d:20,e:12.44,f:''},
-      ],
+      dataList: [],
       page: {
         pageSize: 10,
         pagerCount: 5,
@@ -69,7 +66,6 @@ export default {
     }
   },
   created() {
-    console.log('wangbadan')
     // this.onLoad()
   },
   methods: {
@@ -80,15 +76,14 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        // return deleteDetails(row.id);
-        return this.dataList.splice(index, 1)
+        return removeReceiptList(row.id);
       }).then(() => {
         this.$message({
           type: "success",
           message: "操作成功!"
         });
         this.page.currentPage = 1;
-        this.onLoad(this.page, {parentId: 0});
+        this.onLoad(this.page);
       });
     },
     //修改时的修改按钮点击触发
@@ -179,24 +174,15 @@ export default {
     refreshChange() {
       console.log('1')
     },
-    onLoad(page, params = {parentId: 0}) {
+    onLoad(page, params) {
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,
-        billType:'CG',
-        corpsTypeId: this.treeDeptId
       })
-      // customerList(queryParams).then(res => {
-      //   this.dataList = res.data.data.records
-      //   this.page.total = res.data.data.total
-      // })
-    },
-    //树桩列点击展开触发
-    treeLoad(tree, treeNode, resolve) {
-      const parentId = tree.id;
-      customerList({parentId: parentId}).then(res => {
-        resolve(res.data.data.records);
-      });
+      selectReceiptList(queryParams).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+      })
     },
   }
 }

+ 125 - 0
src/views/purchase/contract/config/commodity.json

@@ -0,0 +1,125 @@
+
+{
+  "height": "auto",
+  "calcHeight": 80,
+  "tip": false,
+  "addBtn": false,
+  "searchShow": false,
+  "searchShowBtn": false,
+  "menu": false,
+  "searchMenuSpan": 6,
+  "border": true,
+  "index": true,
+  "selection": true,
+  "viewBtn": true,
+  "dialogClickModal": false,
+  "column": [
+    {
+      "label": "商品编码",
+      "prop": "code",
+      "search": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品名称",
+      "prop": "cname",
+      "slot": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品类别",
+      "prop": "goodsTypeId",
+      "dicData": [],
+      "type": "tree",
+      "hide": true,
+      "addDisabled": false,
+      "multiple": true,
+      "props": {
+        "label": "title"
+      },
+      "rules": [{
+        "required": true,
+        "message": " ",
+        "trigger": "click"
+      }]
+    },
+    {
+      "label": "规格编码",
+      "prop": "typeno",
+      "search": true
+    },
+    {
+      "label": "品牌",
+      "prop": "brand",
+      "slot": true
+    },
+    {
+      "label": "花纹",
+      "prop": "brandItem",
+      "slot": true
+    },
+    {
+      "label": "规格尺寸",
+      "prop": "specs",
+      "slot": true
+    },
+    {
+      "label": "产品类别",
+      "prop": "category",
+      "slot": true
+    },
+    {
+      "label": "产品分类",
+      "prop": "categoryitem",
+      "slot": true
+    },
+    {
+      "label": "供应商",
+      "prop": "providers",
+      "slot": true
+    },
+    {
+      "label": "计量单位",
+      "prop": "unit",
+      "slot": true
+    },
+    {
+      "label": "包装单位",
+      "prop": "packgeunit",
+      "slot": true
+    },
+    {
+      "label": "商品图片",
+      "prop": "url",
+      "type": "upload",
+      "listType": "picture-img",
+      "dataType": "string",
+      "action": "/api/blade-resource/oss/endpoint/put-file",
+      "propsHttp": {
+        "res": "data",
+        "url": "link"
+      },
+      "hide": true,
+      "span": 24
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "slot": true
+    }
+  ]
+}

+ 192 - 0
src/views/purchase/contract/config/customerContact.json

@@ -0,0 +1,192 @@
+{
+  "lazy": true,
+  "tip": false,
+  "simplePage": true,
+  "searchShow": true,
+  "addBtn":false,
+  "editBtn":false,
+  "addRowBtn":false,
+  "cellBtn":false,
+  "cancelBtn":false,
+  "refreshBtn": false,
+  "searchMenuSpan": 6,
+  "dialogWidth": "60%",
+  "tree": true,
+  "border": true,
+  "index": true,
+  "selection": true,
+  "menuWidth": 300,
+  "dialogClickModal": false,
+  "column":[
+    {
+      "label": "提单号",
+      "prop": "billNO",
+      "index": 1,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": true,
+          "message": "请输入提单号",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "货物品种",
+      "prop": "priceCategory",
+      "index": 2,
+      "width":100,
+      "cell": false,
+      "rules": [
+        {
+          "required": true,
+          "message": "请输入货物品种",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "货物详情",
+      "prop": "cname",
+      "index": 3,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "箱号",
+      "prop": "containerNo",
+      "index": 4,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "件数",
+      "prop": "purchaseQuantity",
+      "index": 5,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "发票净重(吨)",
+      "prop": "invoiceWeight",
+      "index": 6,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "码单重量(吨)",
+      "prop": "billWeight",
+      "index": 7,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "单价",
+      "prop": "price",
+      "index": 8,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "合同金额",
+      "prop": "amount",
+      "index": 9,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
+      "label": "税率",
+      "prop": "taxRate",
+      "index": 10,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    }, {
+      "label": "币别",
+      "prop": "currency",
+      "index": 11,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    }, {
+      "label": "汇率",
+      "prop": "exchangeRate",
+      "index": 12,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    }, {
+      "label": "备注",
+      "prop": "remarks",
+      "index": 13,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    }
+  ]
+}

+ 1 - 1
src/views/purchase/contract/config/mainList.json

@@ -21,7 +21,7 @@
     "column":[
         {
             "label": "合同日期",
-            "prop": "businessDate",
+            "prop": "businesDate",
             "search": true,
             "index": 1,
             "width":100

+ 283 - 54
src/views/purchase/contract/detailsPage.vue

@@ -39,35 +39,34 @@
         <containerTitle title="采购明细"></containerTitle>
         <basic-container style="margin-bottom: 10px">
           <avue-crud
-            :option="detailedList"
-            :data="detailedData"
-            ref="detailedList"
-            @row-save="rowSaveProject"
-            @row-update="rowUpdateProject"
-            @row-del="rowDelProject"
+            :option="customerContact"
+            v-model="contactsForm"
+            :data="contactsData"
+            ref="crudContact"
+            @row-save="rowSave"
+            @row-click="handleRowClick"
+            @row-update="rowUpdate"
+            @row-del="rowDel"
           >
+            <template slot="code" slot-scope="{row,index}">
+              <span style="float: left;padding-top: 2px">{{ row.code }}</span>
+              <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
+            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                 type="text"
                 size="small"
-                @click="rowCellDetailed(row,index)"
-              >{{row.$cellEdit?'保存':'修改'}}</el-button>
-              <el-button
-                type="text"
-                size="small"
-                @click="sendHandle"
-                v-if="!row.$cellEdit"
-              >发货</el-button>
+                @click="rowCell(row,index)"
+              >{{ row.$cellEdit ? '保存' : '修改' }}
+              </el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
-              <el-button type="warning"
-                         icon="el-icon-download"
-                         size="small"
-              >导 出</el-button>
-              <el-button type="info"
-                         icon="el-icon-printer"
+              <el-button type="primary"
+                         icon="el-icon-plus"
                          size="small"
-              >打 印</el-button>
+                         @click="commoditySelection"
+              >新增
+              </el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -118,6 +117,45 @@
     </div>
 
     <el-dialog
+      title="导入商品"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="dialogVisible"
+      width="80%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false">
+      <el-row style="height: 0;">
+        <el-col :span="5">
+          <div>
+            <el-scrollbar>
+              <basic-container>
+                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+              </basic-container>
+            </el-scrollbar>
+          </div>
+        </el-col>
+        <el-col :span="19">
+          <basic-container>
+            <avue-crud :option="optionTwo"
+                       :table-loading="loading"
+                       :data="data"
+                       ref="crud"
+                       @refresh-change="refreshChange"
+                       @selection-change="selectionChange"
+                       :page.sync="page"
+                       @on-load="onLoad"></avue-crud>
+          </basic-container>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="dialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
+          <el-button type="primary" @click="importChoice" v-if="commodityData === true"
+                     :disabled="tableData.length !== 1">导入</el-button>
+        </span>
+    </el-dialog>
+    <el-dialog
       title="导入费用"
       append-to-body
       class="el-dialogDeep"
@@ -160,11 +198,24 @@
 </template>
 
 <script>
-import detailedList from './config/detailedList.json'
+import customerContact from "./config/customerContact.json"
 import uploadList from './config/uploadList.json'
 import advantageProject from "./config/advantageProject.json"
 import {getDeptLazyTree,customerList} from "@/api/basicData/basicFeesDesc";
 import optionTwoCost from "./config/mainListCost.json"
+import {detailListData,
+  submitData,} from "@/api/importTrade/purchase";
+import commodity from "./config/commodity.json"
+import {
+  typeSave, detail, deleteDetails,
+  corpstypeTree,
+  corpsattn,
+  corpsbank,
+  corpsfiles,
+  corpsitem,
+  getList,
+  getDeptLazyTreeS
+} from "@/api/basicData/configuration"
 
 export default {
   name: "detailsPage",
@@ -172,10 +223,46 @@ export default {
     return {
       form: {},
       disabled: false,
-      // 明细配置
-      detailedList: detailedList,
-      // 明细数据
-      detailedData: [],
+      customerContact: customerContact,
+      contactsForm: {},
+      contactsData: [],
+      dialogVisible:false,
+      commodityData: false,
+      tableData: [],
+      optionTwo: commodity,
+      loading: false,
+      data: [],
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      treeDeptId: '',
+      treeOption: {
+        nodeKey: 'id',
+        lazy: true,
+        treeLoad: function (node, resolve) {
+          const parentId = (node.level === 0) ? 0 : node.data.id;
+          getDeptLazyTreeS(parentId).then(res => {
+            console.log(res.data.data)
+            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'
+        }
+      },
       // 合同上传数据
       uploadList: uploadList,
       // 合同数据
@@ -238,7 +325,29 @@ export default {
             ]
           }, {
             label: '到港日期',
-            prop: 'arrivalDate',
+            prop: 'dateOfArrival',
+            type:'datetime',
+            rules: [
+              {
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },{
+            label: '要求发货日期',
+            prop: 'requiredDeliveryDate',
+            type:'datetime',
+            rules: [
+              {
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          }, {
+            label: '要求到货日期',
+            prop: 'requiredArrivalDate',
             type:'datetime',
             rules: [
               {
@@ -250,11 +359,11 @@ export default {
           }, {
             label: '供应商',
             prop: 'corpId',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -262,11 +371,11 @@ export default {
           }, {
             label: '业务员',
             prop: 'salesName',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -276,18 +385,18 @@ export default {
             prop: 'orderNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '合同日期',
-            prop: 'businessDate',
+            prop: 'businesDate',
             type:'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -295,11 +404,11 @@ export default {
           }, {
             label: '合同类型',
             prop: 'orderType',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -307,11 +416,11 @@ export default {
           }, {
             label: '采购商',
             prop: 'purchaserId',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -319,11 +428,11 @@ export default {
           }, {
             label: '付款方式',
             prop: 'paymentType',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -334,7 +443,7 @@ export default {
             type:'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -345,7 +454,7 @@ export default {
             type:'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -355,7 +464,7 @@ export default {
             prop: 'orderAmount',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -365,7 +474,7 @@ export default {
             prop: 'rmbAmount',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -375,7 +484,7 @@ export default {
             prop: 'advancePayment',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -385,7 +494,7 @@ export default {
             prop: 'salesPrice',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -395,7 +504,7 @@ export default {
             prop: 'currency',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -405,7 +514,7 @@ export default {
             prop: 'exchangeRate',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -415,7 +524,7 @@ export default {
             prop: 'contractWeight',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -425,7 +534,7 @@ export default {
             prop: 'billWeight',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -435,7 +544,7 @@ export default {
             prop: 'settlmentAmount',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -454,6 +563,13 @@ export default {
   },
   created() {
     if (this.$route.query.id) {
+      let id = this.$route.query.id.replace(/\"/g, "")
+      detailListData(id).then(res => {
+        this.form = res.data.data;
+        this.detailedData = res.data.data.itemsVOList
+        this.advantageProjectData = res.data.data.orderFeesList
+        this.bankOfDepositData = res.data.data.orderFilesList
+      })
     }
   },
   methods: {
@@ -461,15 +577,128 @@ export default {
     editCustomer() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
+          let submitDto = {
+            itemsVOList: [],
+            orderFeesList: [],
+            orderFilesList: []
+          };
+          submitDto = Object.assign({}, submitDto, this.form)
+          submitDto.itemsVOList = this.contactsData
+          submitDto.orderFeesList = this.advantageProjectData
+          submitDto.orderFilesList = this.bankOfDepositData
+          submitData(submitDto).then(res => {})
           this.backToList()
         } else {
           return false;
         }
       });
     },
-    // 采购明细编辑
-    rowCellDetailed(row, index) {
-      this.$refs.detailedList.rowCell(row, index)
+    //新增商品明细保存触发
+    rowSave(row, done, loading) {
+      // this.contactsData.push(row)
+      done()
+    },
+    //修改商品信息触发
+    rowUpdate(row, index, done, loading) {
+      done(row);
+    },
+    //删除商品信息触发
+    rowDel(row, index, donerowDel) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        //商品判断是否需要调用删除接口
+        if (row.id) {
+          corpsattn(row.id).then(res => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.contactsData.splice(index, 1);
+          })
+        } else {
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.contactsData.splice(index, 1);
+        }
+      })
+    },
+    //点击商品明细选择触发
+    commodityChoice(row) {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = true
+      this.choiceIndexT = row.$index
+    },
+    //商品编辑
+    rowCell(row, index) {
+      this.$refs.crudContact.rowCell(row, index)
+    },
+    //商品新增触发
+    commoditySelection() {
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
+    //点击行可编辑
+    handleRowClick(row, event, column) {
+    },
+    //刷新触发
+    refreshChange() {
+      this.treeDeptId = '';
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    //选中触发
+    selectionChange(list) {
+      this.tableData = list
+    },
+    //导入页左商品类型查询
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
+        console.log(res)
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+      });
+    },
+    //确认导入触发
+    importGoods() {
+      // this.contactsData = this.contactsData.concat(this.tableData)
+      if (this.tableData.length > 0) {
+        for (let item in this.tableData) {
+          console.log(this.tableData[item])
+          this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
+          this.tableData[item].itemId = this.tableData[item].id
+          delete this.tableData[item].id
+          this.$refs.crudContact.rowCellAdd(this.tableData[item]);
+          this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
+        }
+      }
+      this.tableData = []
+      this.dialogVisible = false
+    },
+    //导入商品触发
+    importChoice() {
+      if (this.tableData.length === 1) {
+        this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
+        this.contactsData[this.choiceIndexT].code = this.tableData[0].code
+        this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
+        this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
+        this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
+        this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
+      }
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
     },
     //其他费用编辑
     rowCellTwo(row, index) {

+ 7 - 9
src/views/purchase/contract/index.vue

@@ -69,7 +69,7 @@
 
 <script>
 import option from "./config/mainList.json";
-import {selectPurchaseList} from "@/api/importTrade/purchase"
+import {selectPurchaseList,detailListData} from "@/api/importTrade/purchase";
 
 export default {
   name: "index",
@@ -198,14 +198,12 @@ export default {
         current: page.currentPage,
       })
       selectPurchaseList(queryParams).then(res => {
-        console.log(res)
-        this.dataList = res.data.records
-        // this.dataList = res.data.data.records
-        // this.page.total = res.data.data.total
-      })
-      this.dataList.forEach(item => {
-        this.$set(item,'insideList',[])
-        this.$set(item,'loading', true)
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+        this.dataList.forEach(item => {
+          this.$set(item,'insideList',[])
+          this.$set(item,'loading', true)
+        })
       })
     },
     //表格展开触发

+ 16 - 16
src/views/salesManagement/salesContract/config/importInventory.json

@@ -20,13 +20,13 @@
   "column":[
     {
       "label": "提单号",
-      "prop": "billNO",
+      "prop": "billNo",
       "index": 1,
       "width":100,
-      "cell": false,
+      "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入提单号",
           "trigger": "blur"
         }
@@ -36,20 +36,20 @@
       "prop": "orgOrderNo",
       "index": 2,
       "width":100,
-      "cell": false,
+      "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入合同号",
           "trigger": "blur"
         }
       ]
     },{
       "label": "货物品种",
-      "prop": "c",
+      "prop": "priceCategory",
       "index": 3,
       "width":100,
-      "cell": true,
+      "cell": false,
       "rules": [
         {
           "required": false,
@@ -59,10 +59,10 @@
       ]
     },{
       "label": "货物详情",
-      "prop": "d",
+      "prop": "cname",
       "index": 4,
       "width":100,
-      "cell": true,
+      "cell": false,
       "rules": [
         {
           "required": false,
@@ -72,7 +72,7 @@
       ]
     },{
       "label": "件数",
-      "prop": "storageQuantity",
+      "prop": "actualQuantity",
       "index": 5,
       "width":100,
       "cell": true,
@@ -91,7 +91,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入发票净重(吨)",
           "trigger": "blur"
         }
@@ -104,7 +104,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入码单重量(吨)",
           "trigger": "blur"
         }
@@ -117,7 +117,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入单价",
           "trigger": "blur"
         }
@@ -130,7 +130,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入合同金额",
           "trigger": "blur"
         }
@@ -143,7 +143,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入税率",
           "trigger": "blur"
         }
@@ -156,7 +156,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入备注",
           "trigger": "blur"
         }

+ 210 - 42
src/views/salesManagement/salesContract/detailsPage.vue

@@ -43,7 +43,10 @@
             v-model="importInventoryForm"
             :data="importInventoryData"
             ref="importInventory"
-            @click="openDetailed"
+            @row-save="rowSaveList"
+            @row-update="rowUpdateList"
+            @row-del="rowDelList"
+            @selection-change="productSelection"
           >
             <template slot="menuLeft" slot-scope="{size}">
               <el-button type="primary"
@@ -59,11 +62,24 @@
                          icon="el-icon-printer"
                          size="small"
               >打 印</el-button>
+              <el-button type="warning"
+                         icon="el-icon-plus"
+                         size="small"
+                         :disabled="selection.length < 1"
+                         @click="generateShipmentD">生成发货单
+              </el-button>
             </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                 type="text"
                 size="small"
+                @click="rowCell(row,index)"
+              >{{ row.$cellEdit ? '保存' : '修改' }}
+              </el-button>
+              <el-button
+                type="text"
+                size="small"
+                v-if="!row.$cellEdit"
                 @click="sendHandle"
               >发货</el-button>
             </template>
@@ -205,6 +221,21 @@ import advantageProject from "./config/advantageProject.json";
 import optionTwoCost from "./config/mainListCost.json";
 import {getDeptLazyTree,getDeptLazyTreeTwo, customerList} from "@/api/basicData/basicFeesDesc";
 import commodity from "./config/commodity.json"
+import {
+  typeSave, detail, deleteDetails,
+  corpstypeTree,
+  corpsattn,
+  corpsbank,
+  corpsfiles,
+  corpsitem,
+  getList,
+  detailList
+} from "@/api/basicData/configuration"
+import {detailSaleList,
+  submitData,
+  goodsListRemove,
+  feesListRemove,
+  updateListRemove,} from "@/api/importTrade/salesContract"
 
 export default {
   name: "detailsPage",
@@ -232,19 +263,19 @@ export default {
             prop: 'orderNo',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '订单日期',
-            prop: 'businessDate',
+            prop: 'businesDate',
             type:'datetime',
             data: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -252,11 +283,11 @@ export default {
           }, {
             label: '业务员',
             prop: 'salesName',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -264,11 +295,11 @@ export default {
           }, {
             label: '销售公司',
             prop: 'belongToCorpId',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -276,11 +307,11 @@ export default {
           }, {
             label: '工厂/贸易商名称',
             prop: 'corpId',
-            type:'select',
+            // type:'select',
             dicData: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -290,17 +321,17 @@ export default {
             prop: 'commissionRate',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '发票号(PI)',
-            prop: 'proformaInvoice',
+            prop: 'proformInvoice',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -310,7 +341,7 @@ export default {
             prop: 'portOfLoad',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -321,7 +352,7 @@ export default {
             prop: 'portOfDestination',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -332,7 +363,7 @@ export default {
             prop: 'packageRemarks',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -344,7 +375,7 @@ export default {
             type: 'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -352,11 +383,11 @@ export default {
           },
           {
             label: '客户首付日期',
-            prop: 'b5',
+            prop: 'advanceCollectionDate',
             type: 'datetime',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -364,10 +395,10 @@ export default {
           },
           {
             label: '首付比例',
-            prop: 'b6',
+            prop: 'downPayment',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -378,7 +409,7 @@ export default {
             prop: 'advancePayment',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -390,7 +421,7 @@ export default {
             data: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -401,7 +432,7 @@ export default {
             data: [],
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -411,7 +442,7 @@ export default {
             prop: 'billWeight',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -421,17 +452,17 @@ export default {
             prop: 'currency',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
             label: '汇率',
-            prop: 'exChangeRate',
+            prop: 'exchangeRate',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -453,7 +484,7 @@ export default {
             prop: 'orderAmount',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -463,7 +494,7 @@ export default {
             prop: 'settlmentAmount',
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -556,6 +587,7 @@ export default {
         total: 0
       },
       tableDataCost: [],
+      treeDeptId: '',
       treeDeptIdCost: '',
       choiceIndex: '',
       // 合同上传数据
@@ -567,28 +599,96 @@ export default {
       optionTwo: commodity,
       loading: false,
       data: [],
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      tableData: [],
+      commodityData: false,
+      selection: [],
     }
   },
   created() {
     if (this.$route.query.id) {
+      let id = this.$route.query.id.replace(/\"/g, "")
+      detailSaleList(id).then(res => {
+        this.form = res.data.data;
+        this.importInventoryData = this.form.orderItemsList
+        this.advantageProjectData = this.form.orderFeesList
+        this.bankOfDepositData = this.form.orderFilesList
+      })
     }
   },
   methods: {
     editCustomer() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          this.backToList()
+          let submitDto = {
+            orderItemsList: [],
+            orderFeesList: [],
+            orderFilesList: []
+          };
+          submitDto = Object.assign({}, submitDto, this.form)
+          submitDto.orderItemsList = this.importInventoryData
+          submitDto.orderFeesList = this.advantageProjectData
+          submitDto.orderFilesList = this.bankOfDepositData
+          submitData(submitDto).then(res => {
+            console.log(res)
+            this.backToList()
+          })
         } else {
           return false;
         }
       });
     },
+    //商品选中触发
+    productSelection(selection){
+      this.selection = selection
+    },
+    //生成发货单
+    generateShipmentD(){
+      let lsit = []
+      for (let item in this.selection){
+        if (!this.selection[item].id){
+          return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            this.editCustomer()
+          }).catch(() => {
+            this.$message({
+              type: 'info',
+              message: '已取消'
+            });
+          });
+        }else {
+          lsit.push(this.selection[item].id)
+        }
+      }
+      let data = {
+        id:this.form.id,
+        orderItemIds: lsit
+      }
+      generateShipment(data).then(res=>{
+        console.log(res.data.data)
+        this.$router.push({
+          path: "deliveryNotice_detailsPageEdit",
+          query: {form: JSON.stringify(res.data.data)},
+        });
+      })
+    },
     //商品明细导入
     newDetails(){
-      this.dialogCommodity = !this.dialogCommodity
+      this.dialogVisible = !this.dialogVisible
+    },
+    //商品编辑
+    rowCell(row, index) {
+      console.log(row)
+      // row.$cellEdit = !row.$cellEdit
+      this.$refs.importInventory.rowCell(row, index)
     },
-    // 导入库存新增明细
-    openDetailed() {},
     //其他费用编辑
     rowCellTwo(row, index) {
       console.log(row)
@@ -645,6 +745,22 @@ export default {
       this.pageCost.currentPage = 1;
       this.onLoadCost(this.pageCost);
     },
+    //确认导入触发
+    importGoods() {
+      if (this.tableData.length > 0) {
+        for (let item in this.tableData) {
+          console.log(this.tableData[item])
+          this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
+          delete this.tableData[item].goodsTypeName
+          this.tableData[item].itemId = this.tableData[item].id
+          delete this.tableData[item].id
+          this.$refs.importInventory.rowCellAdd(this.tableData[item]);
+          this.$refs.importInventory.rowCell(this.tableData[item], this.importInventoryData.length - 1)
+        }
+      }
+      this.tableData = []
+      this.dialogVisible = false
+    },
     //选中触发
     selectionChange(list) {
       this.tableData = list
@@ -653,6 +769,12 @@ export default {
     selectionChangeCost(list){
       this.tableDataCost = list
     },
+    //导入页左商品类型查询
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
     //费用导入触发
     importCost(){
       // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
@@ -669,6 +791,19 @@ export default {
       this.tableDataCost = []
       this.dialogCost = false
     },
+    //导入商品触发
+    importChoice() {
+      if (this.tableData.length === 1) {
+        this.importInventoryData[this.choiceIndexT].cname = this.tableData[0].cname
+        this.importInventoryData[this.choiceIndexT].code = this.tableData[0].code
+        this.importInventoryData[this.choiceIndexT].typeno = this.tableData[0].typeno
+        this.importInventoryData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
+        this.importInventoryData[this.choiceIndexT].itemId = this.tableData[0].id
+        this.importInventoryData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
+      }
+      this.dialogVisible = !this.dialogVisible
+      this.commodityData = false
+    },
     //费用编辑导入触发
     choiceCost(){
       if (this.tableDataCost.length === 1){
@@ -696,7 +831,7 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id){
-          corpsbank(row.id).then(res=>{
+          updateListRemove(row.id).then(res=>{
             this.$message({
               type: "success",
               message: "操作成功!"
@@ -713,6 +848,39 @@ export default {
       })
     },
     //新增明细保存触发
+    rowSaveList(row, done, loading){
+      // this.advantageProjectData.push(row)
+      done()
+    },
+    //修改明细触发
+    rowUpdateList(row, index, done, loading) {
+      done(row);
+    },
+    //删除商品明细触发
+    rowDelList(row, index, donerowDel) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id){
+          goodsListRemove(row.id).then(res=>{
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.importInventoryData.splice(index, 1);
+          })
+        }else {
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.importInventoryData.splice(index, 1);
+        }
+      })
+    },
+    //新增明细保存触发
     rowSaveProject(row, done, loading){
       // this.advantageProjectData.push(row)
       done()
@@ -729,13 +897,13 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id){
-          // corpsitem(row.id).then(res=>{
-          //   this.$message({
-          //     type: "success",
-          //     message: "操作成功!"
-          //   });
-          //   this.detailedData.splice(index, 1);
-          // })
+          feesListRemove(row.id).then(res=>{
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.advantageProjectData.splice(index, 1);
+          })
         }else {
           this.$message({
             type: "success",

+ 25 - 25
src/views/salesManagement/salesContract/index.vue

@@ -25,12 +25,12 @@
           :data="scope.row.insideList"
           v-loading="scope.row.loading"
         >
-          <el-table-column  label="提单号" prop="fMblno" align="center" show-overflow-tooltip width="100"></el-table-column>
-          <el-table-column  label="货物品种" prop="goodsVariety" align="center" show-overflow-tooltip width="100"></el-table-column>
-          <el-table-column  label="件数" prop="number" align="center" show-overflow-tooltip width="100"></el-table-column>
+          <el-table-column  label="提单号" prop="billNO" align="center" show-overflow-tooltip width="100"></el-table-column>
+          <el-table-column  label="货物名称" prop="cname" align="center" show-overflow-tooltip width="100"></el-table-column>
+          <el-table-column  label="件数" prop="actualQuantity" align="center" show-overflow-tooltip width="100"></el-table-column>
           <el-table-column  label="销售价格" prop="price" align="center" show-overflow-tooltip width="100"></el-table-column>
-          <el-table-column  label="销售数量" prop="purchaseNo" align="center" show-overflow-tooltip width="100"></el-table-column>
-          <el-table-column  label="码单数量" prop="codeListNo" align="center" show-overflow-tooltip width="100"></el-table-column>
+          <el-table-column  label="销售数量" prop="actualQuantity" align="center" show-overflow-tooltip width="100"></el-table-column>
+          <el-table-column  label="码单数量" prop="billWeight" align="center" show-overflow-tooltip width="100"></el-table-column>
           <el-table-column  label="是否发货" prop="isSend" align="center" show-overflow-tooltip width="100"></el-table-column>
           <el-table-column  label="付款金额" prop="amount" align="center" show-overflow-tooltip width="100"></el-table-column>
         </el-table>
@@ -64,15 +64,14 @@
 
 <script>
 import option from "./config/mainList.json";
+import {selectSaleList,removeList,detailSaleList} from "@/api/importTrade/salesContract"
 
 export default {
   name: "index",
   data() {
     return {
       option: option,
-      dataList: [
-        {id:1,Business_date: '2021-10-19', OrderNo: 'HT2021101901', Corpid:'一家公司', Purchaserid: '大厂',Accounts_collection_date:'8000',arrival_date:'美元/6.4369',Order_amount:'是',Currency:'张三',banks: '正常', remark: ''}
-      ],
+      dataList: [],
       page: {
         pageSize: 10,
         pagerCount: 5,
@@ -90,14 +89,14 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        return deleteDetails(row.id);
+        return removeList(row.id);
       }).then(() => {
         this.$message({
           type: "success",
           message: "操作成功!"
         });
         this.page.currentPage = 1;
-        this.onLoad(this.page, {parentId: 0});
+        this.onLoad(this.page);
       });
     },
     //修改时的修改按钮点击触发
@@ -187,27 +186,28 @@ export default {
     refreshChange() {
       console.log('1')
     },
-    onLoad(page, params = {parentId: 0}) {
+    onLoad(page, params) {
       let queryParams = Object.assign({}, params, {
-        pageSize: page.pageSize,
-        pageNum: page.currentPage,
-        corpsTypeId: this.treeDeptId
+        size: page.pageSize,
+        current: page.currentPage,
       })
-      // customerList(queryParams).then(res => {
-      //   this.dataList = res.data.data.records
-      //   this.page.total = res.data.data.total
-      // })
-      this.dataList.forEach(item => {
-        this.$set(item,'insideList',[])
-        this.$set(item,'loading', true)
+      selectSaleList(queryParams).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+        this.dataList.forEach(item => {
+          this.$set(item,'insideList',[])
+          this.$set(item,'loading', true)
+        })
       })
     },
     //表格展开触发
     expandChange(row, expendList) {
-      this.dataList[0].insideList = [
-        {fMblno: '101801',goodsVariety:'巴西棉',number:800,purchaseNo: 1.90,codeListNo: 1.11,price: 10,amount:1000,isSend:'是'}
-      ];
-      setTimeout((() => {this.dataList[0].loading = false}), 1000)
+      if (row.loading == true) {
+        detailSaleList(row.id).then(res => {
+          row.dataList = res.data.data.orderItemsList
+          row.loading = false;
+        })
+      }
     },
   },
 }