Browse Source

修改国内贸易

lichao 4 years ago
parent
commit
2828bda5f8
20 changed files with 696 additions and 210 deletions
  1. 2 1
      src/components/selectComponent/customerSelect.vue
  2. 2 2
      src/views/businessManagement/deliveryNotice/configuration/advantageProject.json
  3. 2 1
      src/views/businessManagement/deliveryNotice/configuration/customerContact.json
  4. 11 1
      src/views/businessManagement/deliveryNotice/configuration/mainList.json
  5. 128 33
      src/views/businessManagement/deliveryNotice/detailsPageEdit.vue
  6. 19 5
      src/views/businessManagement/deliveryNotice/index.vue
  7. 2 2
      src/views/businessManagement/purchaseOrder/configuration/advantageProject.json
  8. 22 6
      src/views/businessManagement/purchaseOrder/configuration/customerContact.json
  9. 12 1
      src/views/businessManagement/purchaseOrder/configuration/mainList.json
  10. 162 27
      src/views/businessManagement/purchaseOrder/detailsPageEdit.vue
  11. 28 8
      src/views/businessManagement/purchaseOrder/index.vue
  12. 2 2
      src/views/businessManagement/receipt/configuration/advantageProject.json
  13. 2 1
      src/views/businessManagement/receipt/configuration/customerContact.json
  14. 17 1
      src/views/businessManagement/receipt/configuration/mainList.json
  15. 109 30
      src/views/businessManagement/receipt/detailsPageEdit.vue
  16. 32 6
      src/views/businessManagement/receipt/index.vue
  17. 4 3
      src/views/businessManagement/salesOrder/configuration/advantageProject.json
  18. 2 2
      src/views/businessManagement/salesOrder/configuration/customerContact.json
  19. 137 77
      src/views/businessManagement/salesOrder/detailsPageEdit.vue
  20. 1 1
      src/views/businessManagement/salesOrder/index.vue

+ 2 - 1
src/components/selectComponent/customerSelect.vue

@@ -1,5 +1,5 @@
 <template>
-  <span class="select-component">
+  <span class="select-component" style="display: flex">
     <el-select
         v-model="value"
         size="small"
@@ -145,6 +145,7 @@ export default {
       this.selection = []
       this.$emit('returnBack',this.value)
       this.dialogVisible = false
+      this.$emit('receiveList',this.dicData)
     },
     //选中触发
     selectionChange(selection){

+ 2 - 2
src/views/businessManagement/deliveryNotice/configuration/advantageProject.json

@@ -12,7 +12,7 @@
   "cancelBtn":false,
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "refreshBtn": false,
   "selection": true,
   "menuWidth": 300,
@@ -105,7 +105,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入备注",
           "trigger": "blur"
         }

+ 2 - 1
src/views/businessManagement/deliveryNotice/configuration/customerContact.json

@@ -13,7 +13,7 @@
   "dialogWidth": "60%",
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
@@ -21,6 +21,7 @@
     {
       "label": "排序",
       "prop": "sort",
+      "type": "number",
       "index": 1,
       "width":100,
       "cell": true,

+ 11 - 1
src/views/businessManagement/deliveryNotice/configuration/mainList.json

@@ -80,14 +80,24 @@
             "index": 8,
             "width":100
         },{
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
+        "format": "yyyy-MM-dd",
+        "valueFormat": "yyyy-MM-dd",
             "label": "出库日期",
             "prop": "businessDate",
             "search": true,
             "index": 8,
             "width":100
         },{
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
+            "format": "yyyy-MM-dd",
+            "valueFormat": "yyyy-MM-dd",
             "label": "制单时间",
-            "prop": "updateTime",
+            "prop": "createTime",
             "search": true,
             "index": 8,
             "width":100

+ 128 - 33
src/views/businessManagement/deliveryNotice/detailsPageEdit.vue

@@ -9,14 +9,14 @@
       </div>
       <el-button
         class="el-button--small-yh add-customer-btn"
-        type="success" style="right: 140px;">
+        type="success" style="right: 140px;" @click="copyOrder">
         复制新单
       </el-button>
       <el-button
           class="el-button--small-yh add-customer-btn"
           type="primary"
           :disabled="disabled"
-          @click="editCustomer"
+          @click="editCustomer(false)"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
     </div>
@@ -30,8 +30,13 @@
                 <!--                <avue-input-tree v-if="item.prop === 'corpsTypeId'"  leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
                 <!--                ></avue-input-tree>-->
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
-                                size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
-                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
+                                size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled"/>
+                <selectComponent v-else-if="item.prop === 'corpId' || item.prop === 'salesCompany'" v-model="form[item.prop]"
+                                 :configuration="configuration"/>
+                <el-select v-else-if="item.prop === 'deliveryStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%">
+                  <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue" size="small"></el-option>
+                </el-select>
+                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -67,6 +72,7 @@
                          @click="commoditySelection"
               >新增
               </el-button>
+              <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -124,13 +130,14 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeGoods">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
             <el-scrollbar>
               <basic-container>
-                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+                <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
               </basic-container>
             </el-scrollbar>
           </div>
@@ -163,7 +170,8 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeFees">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -212,18 +220,27 @@ import advantageProject from "./configuration/advantageProject.json"
 import bankOfDeposit from "./configuration/bankOfDeposit.json"
 import commodity from "./configuration/commodity.json"
 import optionTwoCost from "./configuration/mainListCost.json"
-import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
+import {getDeptLazyTree,getDeptLazyTreeTwo, customerList} from "@/api/basicData/basicFeesDesc";
 
 export default {
   name: "detailsPage",
   data() {
     return {
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
+      },
       form: {},
       data: [],
       loadingCost: false,
       choiceData: false,
       commodityData: false,
       dataCost: [],
+      treeDataGoods: [],
+      treeData: [],
       choiceIndex: '',
       dialogCost: false,
       treeDeptId: '',
@@ -271,7 +288,7 @@ export default {
         lazy: true,
         treeLoad: function (node, resolve) {
           const parentId = (node.level === 0) ? 0 : node.data.id;
-          getDeptLazyTree(parentId).then(res => {
+          getDeptLazyTreeTwo(parentId).then(res => {
             resolve(res.data.data.map(item => {
               return {
                 ...item,
@@ -308,15 +325,16 @@ export default {
           {
             label: '系统编号',//发货通知(点击)
             prop: 'sysNo',
+            disabled: true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
             ]
           }, {
-            label: '客户名称',
+            label: '客户名称',
             prop: 'corpId',
             rules: [
               {
@@ -327,7 +345,7 @@ export default {
             ]
           }, {
             label: '单据状态',
-            prop: 'status',
+            prop: 'deliveryStatus',
             rules: [
               {
                 required: true,
@@ -337,7 +355,7 @@ export default {
             ]
           }, {
             label: '所属公司',
-            prop: 'salesCompany',
+            prop: 'salesCompany', //salesCompany
             rules: [
               {
                 required: true,
@@ -410,6 +428,7 @@ export default {
             label: '制单时间',
             type: 'datetime',
             prop: 'createTime',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -436,28 +455,41 @@ export default {
             }
           }
         ]
-      }
+      },
+      statusOption: [],
     }
   },
   //初始化查询
   created() {
+    this.getWorkDicts("order_status").then(res => {
+      this.statusOption = res.data.data
+    })
     if (this.$route.query.id) {
       let id = this.$route.query.id.replace(/\"/g, "")
-      detail(id).then(res => {
-        console.log(res.data.data)
-        this.form = res.data.data;
-        this.contactsData = this.form.deliveryItemsList
-        this.advantageProjectData = this.form.deliveryFeesList
-        this.bankOfDepositData = this.form.deliveryFilesList
-        delete this.form.deliveryItemsList
-        delete this.form.deliveryFeesList
-        delete this.form.deliveryFilesList
-      });
+      this.queryData(id)
     }else if (this.$route.query.form){
       this.form = JSON.parse(this.$route.query.form);
+      delete this.form.createTime
       delete this.form.id
+      delete this.form.sysNo
       this.contactsData = this.form.orderItemsList
       delete this.form.orderItemsList
+      this.configuration.dicData = this.form.corpName
+      delete this.form.corpName
+      this.$set(this.form, 'deliveryStatus', '录入')
+      if (this.form.belongToCorpList) {
+        this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
+        delete this.form.belongToCorpId
+        this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
+      }
+      delete this.form.belongToCorpList
+      this.contactsData.forEach(item => {
+        delete item.id
+        delete item.pid
+      })
+    } else if (this.$route.query.copyId) {
+      let id = this.$route.query.copyId.replace(/\"/g, "")
+      this.queryData(id, true)
     }
   },
   watch: {
@@ -475,6 +507,41 @@ export default {
     }
   },
   methods: {
+    queryData(id, isCopy = false) {
+      detail(id).then(res => {
+        console.log(res.data.data)
+        this.form = res.data.data;
+        this.contactsData = this.form.deliveryItemsList
+        this.advantageProjectData = this.form.deliveryFeesList
+        this.bankOfDepositData = this.form.deliveryFilesList
+        this.configuration.dicData = this.form.corpName
+        if (this.form.companyName) {
+          this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
+        }
+        console.log(this.form.corpName)
+        delete this.form.deliveryItemsList
+        delete this.form.deliveryFeesList
+        delete this.form.deliveryFilesList
+        delete this.form.corpName
+        delete this.form.companyName
+        if (isCopy) {
+          delete this.form.sysNo
+          delete this.form.id
+          this.contactsData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.advantageProjectData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.bankOfDepositData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+        }
+      });
+    },
     //点击行可编辑
     handleRowClick(row, event, column) {
       console.log(row.$index)
@@ -538,7 +605,6 @@ export default {
     },
     //费用导入触发
     importCost() {
-      console.log('111111')
       // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
       if (this.tableDataCost.length > 0) {
         for (let item in this.tableDataCost) {
@@ -573,6 +639,14 @@ export default {
       this.tableData = []
       this.dialogVisible = false
     },
+    closeGoods() {
+      this.treeDataGoods = [];
+      this.treeDeptId = "";
+    },
+    closeFees() {
+      this.treeDeptIdCost = "";
+      this.treeData = [];
+    },
     //选中触发
     selectionChange(list) {
       console.log(list);
@@ -740,7 +814,7 @@ export default {
       })
     },
     //修改提交触发
-    editCustomer() {
+    editCustomer(isBack = false) {
       console.log(this.form)
       this.$refs["form"].validate((valid) => {
         if (valid) {
@@ -755,21 +829,42 @@ export default {
           this.form.billType = 'FH'
           typeSave(this.form).then(res => {
             this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-            //成功关闭此页面回到列表页
-            // this.backToList()
+            this.disabled = false
+            if (isBack) {
+              //成功关闭此页面回到列表页
+              this.$router.$avueRouter.closeTag();
+              this.$router.push({
+                path: '/businessManagement/deliveryNotice/index',
+                query: {}
+              });
+            } else {
+              this.queryData(res.data.data.id)
+            }
           })
         } else {
           return false;
         }
       });
     },
+    //复制新单
+    copyOrder() {
+      this.queryData(this.form.id, true)
+    },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: '/businessManagement/deliveryNotice/index',
-        query: {}
-      });
+      this.$confirm("是否保存当前页面?", "提示", {
+        confirmButtonText: "保存",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.editCustomer(true)
+      }).catch(() => {
+        this.$router.$avueRouter.closeTag();
+        this.$router.push({
+          path: '/businessManagement/deliveryNotice/index',
+          query: {}
+        });
+      })
     }
   }
 }

+ 19 - 5
src/views/businessManagement/deliveryNotice/index.vue

@@ -19,8 +19,8 @@
                @on-load="onLoad"
                @tree-load="treeLoad">
       <template slot="menuLeft" slot-scope="{size}">
-        <el-button type="success" :size="size">复制新单</el-button>
-        <el-button type="info" :size="size">导出报表</el-button>
+        <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制新单</el-button>
+        <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
       </template>
       <template slot-scope="scope" slot="menu">
         <el-button
@@ -65,7 +65,12 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      selection: [],
     }
   },
   created() {
@@ -145,6 +150,14 @@ export default {
         query: {id: JSON.stringify(row.id)},
       });
     },
+    // 复制新单
+    copyOrder() {
+      const id = this.selection[0].id;
+      this.$router.push({
+        path: "/deliveryNotice_detailsPageEdit",
+        query: {copyId: JSON.stringify(id)},
+      });
+    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";
@@ -163,8 +176,9 @@ export default {
     searchReset() {
       console.log('1')
     },
-    selectionChange() {
-      console.log('1')
+    selectionChange(list) {
+      this.selection = list;
+      this.single = list.length !== 1;
     },
     currentChange() {
       console.log('1')

+ 2 - 2
src/views/businessManagement/purchaseOrder/configuration/advantageProject.json

@@ -12,7 +12,7 @@
   "cancelBtn":false,
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "refreshBtn": false,
   "selection": true,
   "menuWidth": 300,
@@ -105,7 +105,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入备注",
           "trigger": "blur"
         }

+ 22 - 6
src/views/businessManagement/purchaseOrder/configuration/customerContact.json

@@ -13,7 +13,7 @@
   "dialogWidth": "60%",
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
@@ -21,6 +21,7 @@
     {
       "label": "排序",
       "prop": "sort",
+      "type": "number",
       "index": 1,
       "width":100,
       "cell": true,
@@ -32,8 +33,8 @@
         }
       ]
     },{
-      "label": "类别",
-      "prop": "cname",
+      "label": "商品类别",
+      "prop": "priceCategory",
       "index": 1,
       "width":100,
       "cell": false,
@@ -45,6 +46,19 @@
         }
       ]
     },{
+      "label": "商品名称",
+      "prop": "cname",
+      "index": 1,
+      "width":100,
+      "cell": false,
+      "rules": [
+        {
+          "required": true,
+          "message": "请输入商品名称",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "编码",
       "prop": "code",
       "index": 2,
@@ -88,7 +102,8 @@
       "prop": "orderQuantity",
       "index": 5,
       "width":100,
-      "cell": true,
+      "cell": false,
+      "slot": true,
       "rules": [
         {
           "required": false,
@@ -127,7 +142,8 @@
       "prop": "price",
       "index": 6,
       "width":100,
-      "cell": true,
+      "cell": false,
+      "slot": true,
       "rules": [
         {
           "required": false,
@@ -140,7 +156,7 @@
       "prop": "amount",
       "index": 6,
       "width":100,
-      "cell": true,
+      "cell": false,
       "rules": [
         {
           "required": false,

+ 12 - 1
src/views/businessManagement/purchaseOrder/configuration/mainList.json

@@ -42,6 +42,12 @@
             "index": 4,
             "width":100
         },{
+            "type": "select",
+            "dicUrl": "/api/blade-system/dict-biz/dictionary?code=payment_term",
+            "props": {
+              "label": "dictValue",
+              "value": "dictKey"
+            },
             "label": "付款方式",
             "prop": "paymentType",
             "search": true,
@@ -66,8 +72,13 @@
             "index": 8,
             "width":100
         },{
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
             "label": "要求到货日期",
-            "prop": "RequiredArrivalDate",
+            "prop": "requiredArrivalDate",
+            "format": "yyyy-MM-dd",
+            "valueFormat": "yyyy-MM-dd",
             "search": true,
             "index": 8,
             "width":100

+ 162 - 27
src/views/businessManagement/purchaseOrder/detailsPageEdit.vue

@@ -9,14 +9,14 @@
       </div>
       <el-button
         class="el-button--small-yh add-customer-btn"
-        type="success" style="right: 140px;">
+        type="success" style="right: 140px;" @click="copyOrder">
         复制新单
       </el-button>
       <el-button
           class="el-button--small-yh add-customer-btn"
           type="primary"
           :disabled="disabled"
-          @click="editCustomer"
+          @click="editCustomer(false)"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
     </div>
@@ -31,7 +31,12 @@
                 <!--                ></avue-input-tree>-->
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
-                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
+                <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
+                  <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
+                </el-select>
+                <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
+                                 :configuration="configuration"/>
+                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -48,6 +53,24 @@
               @row-update="rowUpdate"
               @row-del="rowDel"
           >
+            <template slot="orderQuantity" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.orderQuantity"
+                oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'                size="small"
+                @input="changeContractAmt(row)"
+              ></el-input>
+              <span v-else>{{ row.orderQuantity }}</span>
+            </template>
+            <template slot="price" slot-scope="{ row }">
+              <el-input
+                v-if="row.$cellEdit"
+                v-model="row.price"
+                oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'                size="small"
+                @input="changeContractAmt(row)"
+              ></el-input>
+              <span v-else>{{ row.price }}</span>
+            </template>
             <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>
@@ -67,6 +90,7 @@
                          @click="commoditySelection"
               >新增
               </el-button>
+              <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -124,13 +148,14 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeGoods">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
             <el-scrollbar>
               <basic-container>
-                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+                <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
               </basic-container>
             </el-scrollbar>
           </div>
@@ -163,7 +188,8 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeFees">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -338,7 +364,8 @@ import {
   corpsbank,
   corpsitem,
   getList,
-  getDeptLazyTreeS
+  getDeptLazyTreeS,
+  getSysNo
 } from "@/api/basicData/purchaseOrder"
 import customerContact from "./configuration/customerContact.json"
 import advantageProject from "./configuration/advantageProject.json"
@@ -351,6 +378,13 @@ export default {
   name: "detailsPage",
   data() {
     return {
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
+      },
       form: {},
       data: [],
       loadingCost: false,
@@ -375,6 +409,8 @@ export default {
       contactsForm: {},
       optionTwo: commodity,
       optionTwoCost: optionTwoCost,
+      treeDataGoods: [],
+      treeData: [],
       treeOptionCost: {
         nodeKey: 'id',
         lazy: true,
@@ -442,9 +478,10 @@ export default {
           {
             label: '系统编号',
             prop: 'sysNo',
+            disabled: true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -539,23 +576,26 @@ export default {
             }
           }
         ]
-      }
+      },
+      paymentOption: [],
     }
   },
   //初始化查询
   created() {
+    this.getWorkDicts("payment_term").then(res => {
+      this.paymentOption = res.data.data
+    })
     if (this.$route.query.id) {
       let id = this.$route.query.id.replace(/\"/g, "")
-      detail(id).then(res => {
-        console.log(res.data.data.itemsVOList)
-        this.form = res.data.data;
-        this.contactsData = this.form.itemsVOList
-        this.advantageProjectData = this.form.orderFeesList
-        this.bankOfDepositData = this.form.orderFilesList
-        delete this.form.itemsVOList
-        delete this.form.orderFeesList
-        delete this.form.orderFilesList
-      });
+      this.queryData(id)
+    } else if(this.$route.query.copyId) {
+      let id = this.$route.query.copyId.replace(/\"/g, "")
+      this.queryData(id, true)
+    } else {
+      let prefix = 'GN'
+      getSysNo(prefix).then(res => {
+        this.$set(this.form, 'sysNo', res.data.data)
+      })
     }
   },
   watch: {
@@ -573,6 +613,55 @@ export default {
     }
   },
   methods: {
+    // 明细查询
+    queryData(id, isCopy = false) {
+      detail(id).then(res => {
+        console.log(res.data.data)
+        this.form = res.data.data;
+        if (!this.form.itemsVOList) {
+          this.contactsData = []
+        } else {
+          this.contactsData = this.form.itemsVOList
+        }
+        if (!this.form.orderFeesList) {
+          this.advantageProjectData = []
+        } else {
+          this.advantageProjectData = this.form.orderFeesList
+        }
+        if (!this.form.orderFilesList) {
+          this.bankOfDepositData = []
+        } else {
+          this.bankOfDepositData = this.form.orderFilesList
+        }
+        this.configuration.dicData = this.form.corpsName
+        delete this.form.itemsVOList
+        delete this.form.orderFeesList
+        delete this.form.orderFilesList
+        delete this.form.corpsName
+        if (isCopy) {
+          delete this.form.sysNo;
+          delete this.form.id
+          getSysNo('GN').then(res => {
+            this.$set(this.form, 'sysNo', res.data.data)
+          })
+          this.contactsData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.advantageProjectData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.bankOfDepositData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+        }
+      });
+    },
+    copyOrder() {
+      this.queryData(this.form.id, true)
+    },
     //点击行可编辑
     handleRowClick(row, event, column) {
       console.log(row.$index)
@@ -619,6 +708,10 @@ export default {
         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.contactsData[this.choiceIndexT].orderQuantity = 0
+        this.contactsData[this.choiceIndexT].price = 0
+        this.contactsData[this.choiceIndexT].amount = 0
       }
       this.dialogVisible = !this.dialogVisible
       this.commodityData = false
@@ -658,7 +751,11 @@ export default {
         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].id
+          this.$set(this.tableData[item], 'orderQuantity', 0)
+          this.tableData[item].price = 0
+          this.tableData[item].amount = 0
           this.$refs.crudContact.rowCellAdd(this.tableData[item]);
           this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
         }
@@ -666,6 +763,14 @@ export default {
       this.tableData = []
       this.dialogVisible = false
     },
+    closeGoods() {
+      this.treeDataGoods = [];
+      this.treeDeptId = "";
+    },
+    closeFees() {
+      this.treeDeptIdCost = "";
+      this.treeData = [];
+    },
     //选中触发
     selectionChange(list) {
       console.log(list);
@@ -832,8 +937,20 @@ export default {
         }
       })
     },
+    // 计算费用
+    changeContractAmt(row) {
+      let orderQuantity = 0;
+      let price = 0;
+      if (row.price) {
+        price = row.price;
+      }
+      if (row.orderQuantity) {
+        orderQuantity = row.orderQuantity;
+      }
+      this.$set(row, "amount", Number(orderQuantity) * Number(price)).toFixed(2);
+    },
     //修改提交触发
-    editCustomer() {
+    editCustomer(isBack = false) {
       console.log(this.form)
       this.$refs["form"].validate((valid) => {
         if (valid) {
@@ -846,10 +963,20 @@ export default {
           }
           this.disabled = true
           this.form.billType = 'CG'
+          this.$set(this.form, 'tradeType', 'GN')
           typeSave(this.form).then(res => {
             this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-            //成功关闭此页面回到列表页
-            // this.backToList()
+            this.disabled = false
+            if (isBack) {
+              //成功关闭此页面回到列表页
+              this.$router.$avueRouter.closeTag();
+              this.$router.push({
+                path: '/businessManagement/purchaseOrder/index',
+                query: {}
+              });
+            } else {
+              this.queryData(res.data.data)
+            }
           })
         } else {
           return false;
@@ -858,11 +985,19 @@ export default {
     },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: '/businessManagement/purchaseOrder/index',
-        query: {}
-      });
+      this.$confirm("是否保存当前页面?", "提示", {
+        confirmButtonText: "保存",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.editCustomer(true)
+      }).catch(() => {
+        this.$router.$avueRouter.closeTag();
+        this.$router.push({
+          path: '/businessManagement/purchaseOrder/index',
+          query: {}
+        });
+      })
     }
   }
 }

+ 28 - 8
src/views/businessManagement/purchaseOrder/index.vue

@@ -17,8 +17,8 @@
                @on-load="onLoad"
                @tree-load="treeLoad">
       <template slot="menuLeft" slot-scope="{size}">
-        <el-button type="success" :size="size">复制新单</el-button>
-        <el-button type="info" :size="size">导出报表</el-button>
+        <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制新单</el-button>
+        <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
       </template>
       <template slot-scope="scope" slot="menu">
         <el-button
@@ -63,11 +63,15 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      selection: [],
     }
   },
   created() {
-    console.log('wangbadan')
     // this.onLoad()
   },
   methods: {
@@ -124,6 +128,14 @@ export default {
         query: {id: JSON.stringify(row.id)},
       });
     },
+    // 复制新单
+    copyOrder() {
+      const id = this.selection[0].id;
+      this.$router.push({
+        path: "/purchaseOrder_detailsPageEdit",
+        query: {copyId: JSON.stringify(id)},
+      });
+    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";
@@ -142,8 +154,9 @@ export default {
     searchReset() {
       console.log('1')
     },
-    selectionChange() {
-      console.log('1')
+    selectionChange(list) {
+      this.selection = list;
+      this.single = list.length !== 1;
     },
     currentChange() {
       console.log('1')
@@ -154,8 +167,15 @@ export default {
     refreshChange() {
       console.log('1')
     },
-    onLoad(page, params = {parentId: 0}) {
-      let queryParams = Object.assign({}, params, {
+    onLoad(page, params) {
+      if (params) {
+        if (params.requiredArrivalDate) {
+          this.$set(params, 'requiredArrivalStartDate', params.requiredArrivalDate[0]+ " " + "00:00:00")
+          this.$set(params, 'requiredArrivalEndDate', params.requiredArrivalDate[1]+ " " + "23:59:59")
+          this.$delete(params,'requiredArrivalDate')
+        }
+      }
+      let queryParams = Object.assign({tradeType: 'GN'}, params, {
         size: page.pageSize,
         current: page.currentPage,
         // billType:'CG',

+ 2 - 2
src/views/businessManagement/receipt/configuration/advantageProject.json

@@ -12,7 +12,7 @@
   "cancelBtn":false,
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "refreshBtn": false,
   "selection": true,
   "menuWidth": 300,
@@ -105,7 +105,7 @@
       "cell": true,
       "rules": [
         {
-          "required": true,
+          "required": false,
           "message": "请输入备注",
           "trigger": "blur"
         }

+ 2 - 1
src/views/businessManagement/receipt/configuration/customerContact.json

@@ -13,7 +13,7 @@
   "dialogWidth": "60%",
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
@@ -21,6 +21,7 @@
     {
       "label": "排序",
       "prop": "sort",
+      "type": "number",
       "index": 1,
       "width":100,
       "cell": true,

+ 17 - 1
src/views/businessManagement/receipt/configuration/mainList.json

@@ -24,6 +24,12 @@
             "width":100
         },
         {
+            "type": "select",
+            "dicUrl": "/api/blade-system/dict-biz/dictionary?code=procurement_method",
+            "props": {
+              "label": "dictValue",
+              "value": "dictKey"
+            },
             "label": "采购方式",
             "prop": "purchaseMode",
             "search": true,
@@ -72,14 +78,24 @@
             "index": 8,
             "width":100
         },{
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
             "label": "入库日期",
+        "format": "yyyy-MM-dd",
+        "valueFormat": "yyyy-MM-dd",
             "prop": "businessDate",
             "search": true,
             "index": 8,
             "width":100
         },{
+            "type": "date",
+            "unlinkPanels": true,
+            "searchRange": true,
+        "format": "yyyy-MM-dd",
+        "valueFormat": "yyyy-MM-dd",
             "label": "制单时间",
-            "prop": "updateTime",
+            "prop": "createTime",
             "search": true,
             "index": 8,
             "width":100

+ 109 - 30
src/views/businessManagement/receipt/detailsPageEdit.vue

@@ -9,14 +9,14 @@
       </div>
       <el-button
         class="el-button--small-yh add-customer-btn"
-        type="success" style="right: 140px;">
+        type="success" style="right: 140px;" @click="copyOrder">
         复制新单
       </el-button>
       <el-button
           class="el-button--small-yh add-customer-btn"
           type="primary"
           :disabled="disabled"
-          @click="editCustomer"
+          @click="editCustomer(false)"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
     </div>
@@ -31,7 +31,12 @@
                 <!--                ></avue-input-tree>-->
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
-                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
+                <selectComponent v-else-if="item.prop === 'corpId' || item.prop === 'salesCompany'" v-model="form[item.prop]"
+                                 :configuration="configuration"/>
+                <el-select v-else-if="item.prop === 'purchaseMode'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
+                  <el-option v-for="(item,index) in procurementMethodOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
+                </el-select>
+                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -67,6 +72,7 @@
                          @click="commoditySelection"
               >新增
               </el-button>
+              <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -124,13 +130,14 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeGoods">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
             <el-scrollbar>
               <basic-container>
-                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+                <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
               </basic-container>
             </el-scrollbar>
           </div>
@@ -163,7 +170,8 @@
         width="80%"
         :close-on-click-modal="false"
         :destroy-on-close="true"
-        :close-on-press-escape="false">
+        :close-on-press-escape="false"
+        @close="closeFees">
       <el-row style="height: 0;">
         <el-col :span="5">
           <div>
@@ -345,12 +353,19 @@ import advantageProject from "./configuration/advantageProject.json"
 import bankOfDeposit from "./configuration/bankOfDeposit.json"
 import commodity from "./configuration/commodity.json"
 import optionTwoCost from "./configuration/mainListCost.json"
-import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
+import {getDeptLazyTree, customerList,getDeptLazyTreeTwo} from "@/api/basicData/basicFeesDesc";
 
 export default {
   name: "detailsPage",
   data() {
     return {
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
+      },
       form: {},
       data: [],
       loadingCost: false,
@@ -375,6 +390,8 @@ export default {
       contactsForm: {},
       optionTwo: commodity,
       optionTwoCost: optionTwoCost,
+      treeData: [],
+      treeDataGoods: [],
       treeOptionCost: {
         nodeKey: 'id',
         lazy: true,
@@ -404,7 +421,7 @@ export default {
         lazy: true,
         treeLoad: function (node, resolve) {
           const parentId = (node.level === 0) ? 0 : node.data.id;
-          getDeptLazyTree(parentId).then(res => {
+          getDeptLazyTreeTwo(parentId).then(res => {
             resolve(res.data.data.map(item => {
               return {
                 ...item,
@@ -441,9 +458,10 @@ export default {
           {
             label: '系统编号',//发货通知(点击)
             prop: 'sysNo',
+            disabled: true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: ' ',
                 trigger: 'blur'
               }
@@ -521,7 +539,6 @@ export default {
           },{
             label: '入库数量',
             prop: 'totalQuantity',
-            type: 'datetime',
             rules: [
               {
                 required: true,
@@ -553,33 +570,32 @@ export default {
           }, {
             label: "入库单备注",
             span: 24,
-            prop: "orderRemark",
+            prop: "deliveryRemarks",
             mock: {
               type: 'county'
             }
           }
         ]
-      }
+      },
+      statusOption: [],
+      procurementMethodOption: []
     }
   },
   //初始化查询
   created() {
+    this.getWorkDicts("procurement_method").then(res => {
+      this.procurementMethodOption = res.data.data
+    })
     if (this.$route.query.id) {
       let id = this.$route.query.id.replace(/\"/g, "")
-      detail(id).then(res => {
-        console.log(res.data.data)
-        this.form = res.data.data;
-        this.contactsData = this.form.deliveryItemsList
-        this.advantageProjectData = this.form.deliveryFeesList
-        this.bankOfDepositData = this.form.deliveryFilesList
-        delete this.form.deliveryItemsList
-        delete this.form.deliveryFeesList
-        delete this.form.deliveryFilesList
-      });
+      this.queryData(id)
     }else if (this.$route.query.form){
       this.form = JSON.parse(this.$route.query.form);
       this.contactsData = this.form.orderItemsList
       delete this.form.orderItemsList
+    } else if (this.$route.query.copyId) {
+      let id = this.$route.query.copyId.replace(/\"/g, "")
+      this.queryData(id, true)
     }
   },
   watch: {
@@ -597,6 +613,44 @@ export default {
     }
   },
   methods: {
+    queryData(id, isCopy = false) {
+      detail(id).then(res => {
+        console.log(res.data.data)
+        this.form = res.data.data;
+        this.contactsData = this.form.deliveryItemsList
+        this.advantageProjectData = this.form.deliveryFeesList
+        this.bankOfDepositData = this.form.deliveryFilesList
+        this.configuration.dicData = this.form.corpName
+        if (this.form.companyName) {
+          this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
+        }
+        delete this.form.deliveryItemsList
+        delete this.form.deliveryFeesList
+        delete this.form.deliveryFilesList
+        delete this.form.corpName
+        delete this.form.companyName
+        console.log(this.configuration.dicData)
+        if (isCopy) {
+          delete this.form.id
+          delete this.form.sysNo
+          this.contactsData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.advantageProjectData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+          this.bankOfDepositData.forEach(item => {
+            delete item.id
+            delete item.pid
+          })
+        }
+      });
+    },
+    copyOrder() {
+      this.queryData(this.form.id, true)
+    },
     //点击行可编辑
     handleRowClick(row, event, column) {
       console.log(row.$index)
@@ -694,6 +748,14 @@ export default {
       this.tableData = []
       this.dialogVisible = false
     },
+    closeGoods() {
+      this.treeDataGoods = [];
+      this.treeDeptId = "";
+    },
+    closeFees() {
+      this.treeDeptIdCost = "";
+      this.treeData = [];
+    },
     //选中触发
     selectionChange(list) {
       console.log(list);
@@ -861,7 +923,7 @@ export default {
       })
     },
     //修改提交触发
-    editCustomer() {
+    editCustomer(isBack = false) {
       console.log(this.form)
       this.$refs["form"].validate((valid) => {
         if (valid) {
@@ -875,8 +937,17 @@ export default {
           this.disabled = true
           typeSave(this.form).then(res => {
             this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-            //成功关闭此页面回到列表页
-            // this.backToList()
+            this.disabled = false
+            if (isBack) {
+              //成功关闭此页面回到列表页
+              this.$router.$avueRouter.closeTag();
+              this.$router.push({
+                path: '/businessManagement/receipt/index',
+                query: {}
+              });
+            } else {
+              this.queryData(res.data.data.id)
+            }
           })
         } else {
           return false;
@@ -885,11 +956,19 @@ export default {
     },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: '/businessManagement/receipt/index',
-        query: {}
-      });
+      this.$confirm("是否保存当前页面?", "提示", {
+        confirmButtonText: "保存",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.editCustomer(true)
+      }).catch(() => {
+        this.$router.$avueRouter.closeTag();
+        this.$router.push({
+          path: '/businessManagement/receipt/index',
+          query: {}
+        });
+      })
     }
   }
 }

+ 32 - 6
src/views/businessManagement/receipt/index.vue

@@ -19,8 +19,8 @@
                @on-load="onLoad"
                @tree-load="treeLoad">
       <template slot="menuLeft" slot-scope="{size}">
-        <el-button type="success" :size="size">复制新单</el-button>
-        <el-button type="info" :size="size">导出报表</el-button>
+        <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制新单</el-button>
+        <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
       </template>
       <template slot-scope="scope" slot="menu">
         <el-button
@@ -65,7 +65,12 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      selection: [],
     }
   },
   created() {
@@ -146,6 +151,14 @@ export default {
         query: {id: JSON.stringify(row.id)},
       });
     },
+    // 复制新单
+    copyOrder() {
+      const id = this.selection[0].id;
+      this.$router.push({
+        path: "/receipt_detailsPageEdit",
+        query: {copyId: JSON.stringify(id)},
+      });
+    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";
@@ -164,8 +177,9 @@ export default {
     searchReset() {
       console.log('1')
     },
-    selectionChange() {
-      console.log('1')
+    selectionChange(list) {
+      this.selection = list;
+      this.single = list.length !== 1;
     },
     currentChange() {
       console.log('1')
@@ -176,7 +190,19 @@ export default {
     refreshChange() {
       console.log('1')
     },
-    onLoad(page, params = {parentId: 0}) {
+    onLoad(page, params) {
+      if (params) {
+        if (params.businessDate) {
+          this.$set(params, 'businessStartDate', params.businessDate[0]+ " " + "00:00:00")
+          this.$set(params, 'businessEndDate', params.businessDate[1]+ " " + "23:59:59")
+          this.$delete(params,'businessDate')
+        }
+        if (params.createTime) {
+          this.$set(params, 'createStartTime', params.createTime[0]+ " " + "00:00:00")
+          this.$set(params, 'createEndTime', params.createTime[1]+ " " + "23:59:59")
+          this.$delete(params,'createTime')
+        }
+      }
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,

+ 4 - 3
src/views/businessManagement/salesOrder/configuration/advantageProject.json

@@ -12,7 +12,7 @@
   "cancelBtn":false,
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "refreshBtn": false,
   "selection": true,
   "menuWidth": 300,
@@ -48,8 +48,9 @@
       "label": "国内支付方",
       "prop": "corpId",
       "index": 3,
-      "width":100,
-      "cell": true,
+      "width":260,
+      "cell": false,
+      "slot": true,
       "rules": [
         {
           "required": false,

+ 2 - 2
src/views/businessManagement/salesOrder/configuration/customerContact.json

@@ -13,7 +13,7 @@
   "dialogWidth": "60%",
   "tree": true,
   "border": true,
-  "index": true,
+  "index": false,
   "selection": true,
   "menuWidth": 300,
   "dialogClickModal": false,
@@ -169,7 +169,7 @@
       "prop": "amount",
       "index": 6,
       "width":100,
-      "cell": true,
+      "cell": false,
       "rules": [
         {
           "required": false,

+ 137 - 77
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -2,6 +2,7 @@
   <div class="borderless">
     <div class="customer-head">
       <div class="customer-back">
+        <!--        <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
         <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
                    @click="backToList">返回列表
         </el-button>
@@ -14,7 +15,8 @@
       <el-button
           class="el-button--small-yh add-customer-btn"
           type="primary"
-          @click="editCustomer"
+          :disabled="disabled"
+          @click="editCustomer(false)"
       >{{ form.id ? '确认修改' : '确认新增' }}
       </el-button>
     </div>
@@ -29,10 +31,11 @@
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
                 <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
                                  :configuration="configuration"/>
-                <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable size="small" style="width: 100%">
+                <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
                   <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
                 </el-select>
-                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
+                <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
+                <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -42,9 +45,13 @@
           <el-row>
             <el-col v-for="(item,index) in contactInformation.column" :key="index" :span="item.span?item.span:8">
               <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
-                <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
+                <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled"/>
                 <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="configuration"/>
                 <el-input v-else-if="(item.prop === 'advancePayment') || (item.prop === 'settlmentAmount')" v-model="form[item.prop]" size="small" autocomplete="off" @change="computedCost"></el-input>
+                <el-select v-else-if="item.prop === 'orderStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
+                  <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
+                </el-select>
+                <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
                 <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
               </el-form-item>
             </el-col>
@@ -71,9 +78,8 @@
               <el-input
                 v-if="row.$cellEdit"
                 v-model="row.orderQuantity"
-                size="small"
-                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-                @change="quantityChange(row)"
+                oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'                size="small"
+                @input="quantityChange(row)"
               ></el-input>
               <span v-else>{{ row.orderQuantity }}</span>
             </template>
@@ -82,8 +88,7 @@
                 v-if="row.$cellEdit"
                 v-model="row.price"
                 size="small"
-                oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-                @change="priceChange(row)"
+                oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'                @input="priceChange(row)"
               ></el-input>
               <span v-else>{{ row.price }}</span>
             </template>
@@ -112,6 +117,7 @@
                          :disabled="selection.length < 1"
                          @click="generateShipmentD">生成发货单
               </el-button>
+              <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -130,6 +136,13 @@
               <span style="float: left;padding-top: 2px">{{ row.code }}</span>
               <el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
             </template>
+            <template slot="corpId" slot-scope="{ row }">
+              <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
+                               :configuration="configuration" @receiveList="receiveList"/>
+              <span v-else>
+                <span v-for="item in corpNameOption" v-if="item.id == row.corpId">{{ item.cname }}</span>
+              </span>
+            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                   type="text"
@@ -176,7 +189,7 @@
           <div>
             <el-scrollbar>
               <basic-container>
-                <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+                <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
               </basic-container>
             </el-scrollbar>
           </div>
@@ -454,13 +467,12 @@ import {
   policyColumn
 } from "@/api/basicData/basicFeesDesc";
 import _ from "lodash";
-//业务字典
-import { getDictionary } from "@/api/system/dictbiz";
 
 export default {
   name: "detailsPage",
   data() {
     return {
+      disabled: false,
       form: {},
       configuration: {
         multipleChoices: false,
@@ -478,6 +490,7 @@ export default {
       commodityData: false,
       dataCost: [],
       treeDataPolicy: [],
+      treeDataGoods: [],
       choiceIndex: '',
       dialogCost: false,
       treeDeptId: '',
@@ -615,9 +628,9 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '应收账款',
-            prop: 'debitAmount',
+          },  {
+            label: '溢付款',
+            prop: 'overPayment',
             rules: [
               {
                 required: false,
@@ -625,9 +638,9 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '单据状态',
-            prop: 'status',
+          },{
+            label: '应收账款',
+            prop: 'debitAmount',
             rules: [
               {
                 required: false,
@@ -636,8 +649,8 @@ export default {
               }
             ]
           }, {
-            label: '溢付款',
-            prop: 'overPayment',
+            label: '已收款',
+            prop: 'settlmentAmount',
             rules: [
               {
                 required: false,
@@ -646,8 +659,9 @@ export default {
               }
             ]
           }, {
-            label: '应收预付款',
-            prop: 'advancePayment',
+            label: '应收未收款',
+            prop: 'accountsReceivable',//无
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -656,8 +670,8 @@ export default {
               }
             ]
           }, {
-            label: '已收款',
-            prop: 'settlmentAmount',
+            label: '应收预付款',
+            prop: 'advancePayment',
             rules: [
               {
                 required: false,
@@ -666,9 +680,8 @@ export default {
               }
             ]
           }, {
-            label: '应收未收款',
-            prop: 'accountsReceivable',//无
-            disabled: true,
+            label: '保证金',
+            prop: 'deposit',
             rules: [
               {
                 required: false,
@@ -677,8 +690,8 @@ export default {
               }
             ]
           }, {
-            label: '保证金',
-            prop: 'deposit',
+            label: '逾期账款',
+            prop: 'overDueAccounts',
             rules: [
               {
                 required: false,
@@ -687,8 +700,8 @@ export default {
               }
             ]
           }, {
-            label: '逾期账款',
-            prop: 'overDueAccounts',
+            label: '所属公司',
+            prop: 'belongToCorpId',
             rules: [
               {
                 required: false,
@@ -718,10 +731,9 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '制单日期',
-            prop: 'createTime',
-            type: 'datetime',
+          },  {
+            label: '毛利率',
+            prop: 'grossProfitRate',
             rules: [
               {
                 required: false,
@@ -730,8 +742,8 @@ export default {
               }
             ]
           }, {
-            label: '制单人',
-            prop: 'createUserName',
+            label: '毛利额',
+            prop: 'grossProfit',
             rules: [
               {
                 required: false,
@@ -740,8 +752,8 @@ export default {
               }
             ]
           }, {
-            label: '毛利率',
-            prop: 'grossProfitRate',
+            label: '历史运费(元/条)',
+            prop: 'freightAmountHistory',
             rules: [
               {
                 required: false,
@@ -750,8 +762,9 @@ export default {
               }
             ]
           }, {
-            label: '毛利额',
-            prop: 'grossProfit',
+            label: '到货日期',
+            prop: 'arrivalDate',
+            type: 'datetime',
             rules: [
               {
                 required: false,
@@ -760,8 +773,9 @@ export default {
               }
             ]
           }, {
-            label: '所属公司',
-            prop: 'belongToCorpId',
+            label: '预收款日期',
+            type: 'datetime',
+            prop: 'advanceCollectionDate',
             rules: [
               {
                 required: false,
@@ -770,8 +784,8 @@ export default {
               }
             ]
           }, {
-            label: '历史运费(元/条)',
-            prop: 'freightAmountHistory',
+            label: '积分倍数',
+            prop: 'pointMutiple',
             rules: [
               {
                 required: false,
@@ -780,9 +794,8 @@ export default {
               }
             ]
           }, {
-            label: '到货日期',
-            prop: 'arrivalDate',
-            type: 'datetime',
+            label: '单据状态',
+            prop: 'orderStatus',
             rules: [
               {
                 required: false,
@@ -790,10 +803,11 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '预收款日期',
+          },{
+            label: '制单日期',
+            prop: 'createTime',
             type: 'datetime',
-            prop: 'advanceCollectionDate',
+            disabled:true,
             rules: [
               {
                 required: false,
@@ -802,8 +816,10 @@ export default {
               }
             ]
           }, {
-            label: '积分倍数',
-            prop: 'pointMutiple',
+            label: '制单人',
+            prop: 'createUserName',
+            disabled: true,
+            span: 24,
             rules: [
               {
                 required: false,
@@ -811,9 +827,11 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
+          },{
             label: '特别提醒',
             prop: 'specialRemarks',
+            type: 'textarea',
+            span: 24,
             rules: [
               {
                 required: false,
@@ -950,6 +968,7 @@ export default {
             ]
           }, {
             label: "订单备注",
+            type: 'textarea',
             span: 24,
             prop: "orderRemark",
             mock: {
@@ -959,10 +978,19 @@ export default {
         ]
       },
       paymentOption: [],
+      statusOption: [],
+      corpNameOption: [],
     }
   },
   //初始化查询
   created() {
+    this.getWorkDicts("payment_term").then(res => {
+      this.paymentOption = res.data.data
+    })
+    this.getWorkDicts("order_status").then(res => {
+      this.statusOption = res.data.data
+    })
+    this.$set(this.form, 'orderStatus', '录入')
     if (this.$route.query.id) {
       let id = this.$route.query.id.replace(/\"/g, "")
       this.queryData(id)
@@ -971,12 +999,6 @@ export default {
       let id = this.$route.query.copyId.replace(/\"/g, "")
       this.queryData(id, true)
     }
-    const params = {
-      code : "affair_payment_term"
-    }
-    getDictionary(params).then(res => {
-      this.paymentOption = res.data.data
-    })
   },
   watch: {
     '$route'(to, from) {
@@ -1001,8 +1023,20 @@ export default {
         this.advantageProjectData = this.form.orderFeesList
         this.bankOfDepositData = this.form.orderFilesList
         this.configuration.dicData = this.form.corpName
-        this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
-        // delete this.form.orderItemsList
+        if (this.form.belongToCorpList) {
+          this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
+        }
+        let feesData = []
+        this.form.orderFeesList.forEach(item => {
+          let a = {
+            cname: item.corpName,
+            id: item.corpId
+          }
+          feesData.push(a)
+        })
+        this.configuration.dicData = this.configuration.dicData.concat(feesData)
+        this.corpNameOption = this.configuration.dicData
+        delete this.form.orderItemsList
         delete this.form.orderFeesList
         delete this.form.orderFilesList
         delete this.form.corpName
@@ -1099,6 +1133,11 @@ export default {
       console.log(row)
       this.choiceIndex = row.$index
     },
+    //
+    receiveList(data){
+      console.log(data)
+      this.corpNameOption = this.corpNameOption.concat(data)
+    },
     //点击商品明细选择触发
     commodityChoice(row) {
       this.dialogVisible = !this.dialogVisible
@@ -1116,6 +1155,9 @@ export default {
         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.contactsData[this.choiceIndexT].orderQuantity = 0
+        this.contactsData[this.choiceIndexT].price = 0
+        this.contactsData[this.choiceIndexT].amount = 0
       }
       this.dialogVisible = !this.dialogVisible
       this.commodityData = false
@@ -1155,6 +1197,10 @@ export default {
           this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
           delete this.tableData[item].goodsTypeName
           this.tableData[item].itemId = this.tableData[item].id
+          // this.tableData[item].orderQuantity = 0
+          this.$set(this.tableData[item], 'orderQuantity', 0)
+          this.tableData[item].price = 0
+          this.tableData[item].amount = 0
           delete this.tableData[item].id
           this.$refs.crudContact.rowCellAdd(this.tableData[item]);
           this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
@@ -1164,7 +1210,7 @@ export default {
       this.dialogVisible = false
     },
     closeGoods() {
-      this.tableData = [];
+      this.treeDataGoods = [];
       this.treeDeptId = "";
     },
     closeFees() {
@@ -1378,7 +1424,7 @@ export default {
       })
     },
     //修改提交触发
-    editCustomer() {
+    editCustomer(isBack = false) {
       console.log(this.form)
       this.$refs["form"].validate((valid) => {
         if (valid) {
@@ -1390,11 +1436,20 @@ export default {
             this.form.corpsTypeId = this.form.corpsTypeId.join(",")
           }
           this.form.billType = 'XS'
+          this.disabled = true
           typeSave(this.form).then(res => {
             this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-            this.queryData(res.data.data.id)
-            //成功关闭此页面回到列表页
-            // this.backToList()
+            this.disabled = false
+            if (isBack) {
+              //成功关闭此页面回到列表页
+              this.$router.$avueRouter.closeTag();
+              this.$router.push({
+                path: '/businessManagement/salesOrder/index',
+                query: {}
+              });
+            } else {
+              this.queryData(res.data.data.id)
+            }
           })
         } else {
           return false;
@@ -1416,30 +1471,35 @@ export default {
       this.$set(this.form, "accountsReceivable", Number(advancePayment) - Number(settlmentAmount)).toFixed(2);
     },
     quantityChange(row) {
-      console.log(row)
       if (!row.orderQuantity) {
         row.orderQuantity = 0;
       } else {
         // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
-        this.$set(row,"amount",_.multiply(row.price, row.orderQuantity).toFixed(2))
-
+        row.amount = (row.price * row.orderQuantity).toFixed(2)
       }
     },
     priceChange(row) {
       if (!row.price) {
         row.price = 0;
       } else {
-        // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
-        this.$set(row,"amount",_.multiply(row.price, row.orderQuantity).toFixed(2))
+        row.amount = (row.price * row.orderQuantity).toFixed(2)
       }
     },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: '/businessManagement/salesOrder/index',
-        query: {}
-      });
+      this.$confirm("是否保存当前页面?", "提示", {
+        confirmButtonText: "保存",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.editCustomer(true)
+      }).catch(() => {
+        this.$router.$avueRouter.closeTag();
+        this.$router.push({
+          path: '/businessManagement/salesOrder/index',
+          query: {}
+        });
+      })
     }
   }
 }

+ 1 - 1
src/views/businessManagement/salesOrder/index.vue

@@ -22,7 +22,7 @@
                @tree-load="treeLoad">
       <template slot="menuLeft" slot-scope="{size}">
         <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制新单</el-button>
-        <el-button type="info" :size="size">导出报表</el-button>
+        <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
       </template>
       <template slot-scope="scope" slot="menu">
         <el-button