Parcourir la source

修改bug,部门排序

fenghaifu il y a 2 ans
Parent
commit
a7a4981873

BIN
dist.zip


+ 31 - 4
src/views/reportForms/order-statistics/chart/external/departmentChart.vue

@@ -54,7 +54,7 @@ export default {
         // this.queryParam.vendorType = '内部'
         depChart(this.queryParam).then(res => {
           if (res.result) {
-            var dataList = res.result.sort(that.sortByDep);
+            var dataList = this.sortDeal(res.result);
             dataList.forEach(item => {
               this.cdepNameArr.push(item.cdepName)
               this.iquantityArr.push(parseFloat(item.iquantity))
@@ -77,7 +77,7 @@ export default {
       this.queryParam.vendorType = '外部'
       depChart(this.queryParam).then(res => {
         if (res.result) {
-          var dataList = res.result.sort(that.sortByDep);
+          var dataList = this.sortDeal(res.result);
           // console.log('部门统计图数据', res.result)
           dataList.forEach(item => {
             this.cdepNameArr.push(item.cdepName)
@@ -93,10 +93,37 @@ export default {
         })
       })
     },
+    // 排序处理,先去掉中文一到十数字,得到部门,按拼音排序;再按照中文一到十数字
+    sortDeal(jsonList){
+      var zhNum = ['一','二','三','四','五','六','七','八','九', '十'];
+      for (var i=0; i<jsonList.length; i++){
+        var depName = jsonList[i].cdepName;
+        for (var j=0; j<zhNum.length; j++){
+          if (depName.indexOf(zhNum[j])>-1){
+            jsonList[i].numOrder = j+1;
+            jsonList[i].cdepnameTemp = jsonList[i].cdepName.replace(zhNum[j],'');
+            break;
+          }
+        }
+      }
+      jsonList = jsonList.sort(this.sortByDep);
+      var retList = [];
+      for (var i=0; i<jsonList.length;){
+        var subList = jsonList.filter(e=>e.cdepnameTemp == jsonList[i].cdepnameTemp);
+        subList = subList.sort(this.sortByNum);
+        i+=subList.length;
+        retList = retList.concat(subList);
+      }
+      return retList;
+
+    },
     // 根据部门排序
     sortByDep(json1,json2){
-      var ret = json1.cdepName.localeCompare(json2.cdepName)*-1;
-      return ret;
+      return json1.cdepName.localeCompare(json2.cdepnameTemp,'zh-CN');
+    },
+    // 根据数字顺序排序
+    sortByNum(json1, json2){
+      return json1.numOrder-json2.numOrder;
     },
 
     initEcharts() {

+ 31 - 4
src/views/reportForms/order-statistics/chart/interior/departmentChart.vue

@@ -56,7 +56,7 @@ export default {
         depChart(this.queryParam).then(res => {
           // console.log('2', this.queryParam)
           if (res.result) {
-            var dataList = res.result.sort(that.sortByDep);
+            var dataList = this.sortDeal(res.result);
             dataList.forEach(item => {
               this.cdepNameArr.push(item.cdepName)
               this.iquantityArr.push(item.iquantity)
@@ -78,7 +78,7 @@ export default {
       this.queryParam.vendorType = '内部'
       depChart(this.queryParam).then(res => {
         if (res.result) {
-          var dataList = res.result.sort(that.sortByDep);
+          var dataList = this.sortDeal(res.result);
           dataList.forEach(item => {
             this.cdepNameArr.push(item.cdepName)
             this.iquantityArr.push(item.iquantity)
@@ -93,10 +93,37 @@ export default {
         })
       })
     },
+    // 排序处理,先去掉中文一到十数字,得到部门,按拼音排序;再按照中文一到十数字
+    sortDeal(jsonList){
+      var zhNum = ['一','二','三','四','五','六','七','八','九', '十'];
+      for (var i=0; i<jsonList.length; i++){
+        var depName = jsonList[i].cdepName;
+        for (var j=0; j<zhNum.length; j++){
+          if (depName.indexOf(zhNum[j])>-1){
+            jsonList[i].numOrder = j+1;
+            jsonList[i].cdepnameTemp = jsonList[i].cdepName.replace(zhNum[j],'');
+            break;
+          }
+        }
+      }
+      jsonList = jsonList.sort(this.sortByDep);
+      var retList = [];
+      for (var i=0; i<jsonList.length;){
+        var subList = jsonList.filter(e=>e.cdepnameTemp == jsonList[i].cdepnameTemp);
+        subList = subList.sort(this.sortByNum);
+        i+=subList.length;
+        retList = retList.concat(subList);
+      }
+      return retList;
+
+    },
     // 根据部门排序
     sortByDep(json1,json2){
-      var ret = json1.cdepName.localeCompare(json2.cdepName)*-1;
-      return ret;
+      return json1.cdepName.localeCompare(json2.cdepnameTemp,'zh-CN');
+    },
+    // 根据数字顺序排序
+    sortByNum(json1, json2){
+      return json1.numOrder-json2.numOrder;
     },
     initEcharts() {
       const myChart = echarts.init(document.getElementById('departmentChart')) // dark

+ 20 - 14
src/views/shipment-details/addShipDetDrawer.vue

@@ -131,8 +131,8 @@
                 <a-form-model-item prop="isTc">
                   <a-select v-model="record.isTc">
                     <a-select-option value="">请选择</a-select-option>
-                    <a-select-option :value="1">是</a-select-option>
-                    <a-select-option :value="0">否</a-select-option>
+                    <a-select-option value="1">是</a-select-option>
+                    <a-select-option value="0">否</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </template>
@@ -212,10 +212,6 @@
                 >
                   <a href="javascript:void(0);" style="color:red;">删除</a>
                 </a-popconfirm>
-
-                <a-divider type="vertical" />
-
-                <a @click="copy(record)">复制</a>
               </template>
             </a-table>
           </a-form-model>
@@ -530,7 +526,7 @@ export default {
         {
           title: '订单备注',
           dataIndex: 'orderRemarks',
-          width: 160,
+          width: 200,
           customRender: t => ellipsis(t),
           className: 'replacecolor'
         },
@@ -583,18 +579,12 @@ export default {
           scopedSlots: { customRender: 'manualYarnProportion' },
           className: 'replacecolor'
         },
-{
-          title: '分组ID',
-          dataIndex: 'groupId',
-          width: 120,
-          className: 'replacecolor'
-        },
 
         {
           title: '操作',
           dataIndex: 'operation',
           scopedSlots: { customRender: 'operationSlot' },
-          width: 160,
+          width: 100,
           fixed: 'right',
           className: 'replacecolor'
         }
@@ -625,6 +615,7 @@ export default {
     getSon(val) {
       var copyValList = JSON.parse(JSON.stringify(val));
       this.addShipDet.customer = copyValList[0].customerName;
+      console.log(copyValList);
       for (var i in copyValList) {
         copyValList[i]['orderQuantity'] = copyValList[i].quantity
         copyValList[i]['orderRemainingQuantity'] = copyValList[i].surplusNum
@@ -671,6 +662,20 @@ export default {
               return;
             }
           }
+          // 根据inventoryCode,colour,codingRules判断重复物料
+          for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
+            var rowData = newObj.syShippingDetailsItemList[i];
+            for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
+              var nextData = newObj.syShippingDetailsItemList[j];
+              if (rowData.inventoryCode == nextData.inventoryCode &&
+              rowData.colour == nextData.colour &&
+              rowData.codingRules == nextData.codingRules){
+                this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行物料重复,无法保存');
+                return;
+              }
+            }
+          }
+
           addShipmentList(newObj).then(res => {
             if (res.success) {
               this.$message.success('新增成功');
@@ -698,6 +703,7 @@ export default {
       //   }
       // })
     },
+    // 校验复制行数量和不能超订单,根据syOrderDataItemId判断
 
     // 増行
     // handleAddColumn() {

+ 28 - 15
src/views/shipment-details/editShipDetDrawer.vue

@@ -53,7 +53,6 @@
       <a-card :bordered="true" style="margin:10px 0 60px 0">
         <div class="table-operator">
           <a-button type="primary" @click="referOrderDataOpen" icon="ordered-list">参照订单数据</a-button>
-          <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
         </div>
 
         <!-- 子表  :model="form" :rules="validatorRules"-->
@@ -67,7 +66,7 @@
               :data-source="syShippingDetailsItemList"
               :loading="loading"
               :pagination="ipagination"
-              :scroll="{ x: 1500 }"
+              :scroll="{ x: 2800,y:400 }"
               @change="handleTableChange"
             >
               <!-- 款号 输入框 :rules="rules.itemNumber" -->
@@ -148,8 +147,8 @@
                 <a-form-model-item prop="manualYarnFlag">
                   <a-select v-model="record.manualYarnFlag">
                     <a-select-option value="">请选择</a-select-option>
-                    <a-select-option value="1">是</a-select-option>
-                    <a-select-option value="0">否</a-select-option>
+                    <a-select-option :value="1">是</a-select-option>
+                    <a-select-option :value="0">否</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </template>
@@ -173,8 +172,6 @@
                 <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
                   <a href="javascript:void(0);" style="color:red;">删除</a>
                 </a-popconfirm>
-                <a-divider type="vertical" />
-                <a @click="copy(record)">复制</a>
               </span>
             </a-table>
           </a-form-model>
@@ -188,7 +185,7 @@
           bottom: 0,
           width: '100%',
           borderTop: '1px solid #e9e9e9',
-          padding: '10px 16px',
+          padding: '0px 0px',
           background: '#fff',
           textAlign: 'right',
           zIndex: 1
@@ -378,8 +375,9 @@ export default {
         {
           title: '客户名称',
           dataIndex: 'customerName',
-          width: 120,
-          className: 'replacecolor'
+          width: 300,
+          className: 'replacecolor',
+          customRender: t => ellipsis(t),
         },
         {
           title: '汇率',
@@ -416,8 +414,9 @@ export default {
         {
           title: '品牌方',
           dataIndex: 'brandSide',
-          width: 120,
-          className: 'replacecolor'
+          width: 180,
+          className: 'replacecolor',
+          customRender: t => ellipsis(t),
         },
         {
           title: '第三方',
@@ -473,7 +472,7 @@ export default {
         {
           title: '订单备注',
           dataIndex: 'orderRemarks',
-          width: 160,
+          width: 200,
           customRender: t => ellipsis(t),
           className: 'replacecolor'
         },
@@ -517,7 +516,7 @@ export default {
         {
           title: '是否手册纱',
           dataIndex: 'manualYarnFlag',
-          width: 100,
+          width: 140,
           scopedSlots: { customRender: 'manualYarnFlag' },
           className: 'replacecolor'
         },
@@ -540,7 +539,7 @@ export default {
           title: '操作',
           dataIndex: 'operation',
           scopedSlots: { customRender: 'operationSlot' },
-          width: 220,
+          width: 100,
           fixed: 'right',
           className: 'replacecolor'
         }
@@ -591,6 +590,20 @@ export default {
               return;
             }
           }
+          // 根据inventoryCode,colour,codingRules判断重复物料
+          for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
+            var rowData = newObj.syShippingDetailsItemList[i];
+            for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
+              var nextData = newObj.syShippingDetailsItemList[j];
+              if (rowData.inventoryCode == nextData.inventoryCode &&
+              rowData.colour == nextData.colour &&
+              rowData.codingRules == nextData.codingRules){
+                this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行物料重复,无法保存');
+                return;
+              }
+            }
+          }
+
           editById(this.editShipDet).then(res => {
             if (res.success) {
               this.$message.success('编辑成功');
@@ -718,6 +731,6 @@ export default {
   background-color: #f0f2f5;
 }
 /deep/ .ant-drawer-body {
-  padding: 10px;
+  padding: 0px;
 }
 </style>