Browse Source

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

caojunjie 3 years ago
parent
commit
aa3c75017f

+ 46 - 11
src/components/selectComponent/customerSelect.vue

@@ -7,7 +7,13 @@
         style="border-right: none;width: 100%"
         :disabled="disabled?disabled:false"
         :multiple="configuration.multiple?configuration.multiple:false"
-        :collapse-tags="configuration.collapseTags?configuration.collapseTags:false">
+        :clearable="configuration.clearable?configuration.clearable:false"
+        :collapse-tags="configuration.collapseTags?configuration.collapseTags:false"
+        filterable
+        remote
+        @change="changeName"
+        :remote-method="remoteMethod"
+    >
       <el-option
           v-for="item in configuration.dicData.length !== 0?dicData.length !== 0?dicData:configuration.dicData:dicData"
           :key="item.id"
@@ -41,7 +47,6 @@
                      ref="crud"
                      v-model="form"
                      :page.sync="page"
-                     :before-open="beforeOpen"
                      :before-close="beforeClose"
                      @search-change="searchChange"
                      @search-reset="searchReset"
@@ -115,13 +120,23 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      // 远程模糊查找loading
+      loading: false,
+      queryParams: {
+        size: 10,
+        current: 1
+      },
     }
   },
   created() {
     this.option.searchShow = this.configuration.searchShow ? this.configuration.searchShow : false
+    this.remoteMethod()
   },
   methods: {
+    changeName(){
+      this.$emit('returnBack', this.value)
+    },
     //刷新触发
     refreshChange() {
       this.page = {
@@ -132,6 +147,7 @@ export default {
     },
     //确认导出触发
     confirmSelection() {
+      this.dicData = []
       if (this.configuration.multipleChoices === true) {
         let value = []
         for (let item in this.selection) {
@@ -146,6 +162,7 @@ export default {
       this.selection = []
       this.$emit('returnBack', this.value)
       this.dialogVisible = false
+      this.$emit('receiveList',this.dicData)
     },
     //选中触发
     selectionChange(selection) {
@@ -172,13 +189,6 @@ export default {
       column.addDisabled = true;
       this.$refs.crud.rowAdd();
     },
-    //新增跳转页面
-    beforeOpen(row, index) {
-      this.$router.push({
-        path: "/detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
-    },
     //点击新增时触发
     beforeClose(done) {
       this.parentId = "";
@@ -221,7 +231,32 @@ export default {
       customerList({parentId: parentId}).then(res => {
         resolve(res.data.data.records);
       });
-    }
+    },
+    // 远程模糊查找
+    remoteMethod(query) {
+      if (query !== '') {
+        this.loading = true;
+        this.queryParams = {
+          size: 10,
+          current: 1,
+          cname: query
+        }
+        customerList(this.queryParams).then(res => {
+          this.dicData = res.data.data.records
+          this.loading = false;
+        });
+      } else {
+        this.loading = true
+        this.queryParams = {
+          size: 10,
+          current: 1
+        }
+        customerList(this.queryParams).then(res => {
+          this.dicData = res.data.data.records
+          this.loading = false;
+        });
+      }
+    },
   }
 };
 </script>

+ 25 - 1
src/util/date.js

@@ -43,9 +43,33 @@ export function dateFormat(date, format) {
       if (new RegExp("(" + k + ")").test(format))
         format = format.replace(RegExp.$1,
           RegExp.$1.length === 1 ? o[k] :
-            ("00" + o[k]).substr(("" + o[k]).length));
+          ("00" + o[k]).substr(("" + o[k]).length));
     return format;
   }
   return '';
 
 }
+/**
+ * 获取上月第一天和下月最后一天
+ * type 1为 [yyyy-MM-dd,yyyy-MM-dd]
+ * type 2为 [yyyy-MM-dd 00:00:00,yyyy-MM-dd 23:59:59]
+ * type为空默认2
+ */
+export function defaultDate(type) {
+  type = type ? type : 2
+  const date = new Date();
+  const startDate = new Date(date.getFullYear(), date.getMonth() - 1, 1);
+  const endDate = new Date(date.getFullYear(), date.getMonth() + 2, 0);
+  console.log(dateFormat(startDate, "yyyy-MM-dd"))
+  if (type == 1) {
+    return [
+      dateFormat(startDate, "yyyy-MM-dd"),
+      dateFormat(endDate, "yyyy-MM-dd")
+    ];
+  } else {
+    return [
+      dateFormat(startDate, "yyyy-MM-dd") + " 00:00:00",
+      dateFormat(endDate, "yyyy-MM-dd") + " 23:59:59"
+    ];
+  }
+}

+ 13 - 3
src/views/exportTrade/customerInquiry/index.vue

@@ -15,6 +15,7 @@
         @on-load="onLoad"
         :table-loading="loading"
         @saveColumn="saveColumn"
+        :cell-style="cellStyle"
       >
         <template slot="portOfLoadSearch">
           <port-info v-model="search.portOfLoad" />
@@ -87,6 +88,7 @@
 import option from "./config/mainList.json";
 import { getList, remove } from "@/api/basicData/customerInquiry";
 import detailPage from "./detailsPage.vue";
+import { defaultDate } from "@/util/date";
 export default {
   name: "customerInformation",
   data() {
@@ -115,6 +117,7 @@ export default {
   },
   components: { detailPage },
   async created() {
+    this.search.businesDate=defaultDate()
     /**
      * 已定义全局方法,直接使用,getColumnData获取列数据,参数传值(表格名称,引入的本地JSON的数据定义的名称)
      * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
@@ -142,6 +145,9 @@ export default {
     });
   },
   methods: {
+    cellStyle() {
+      return "padding:0;height:40px;";
+    },
     //删除列表后面的删除按钮触发触发(row, index, done)
     rowDel(row, index, done) {
       this.$confirm("确定删除数据?", {
@@ -192,15 +198,19 @@ export default {
       this.page.pageSize = val;
     },
     onLoad(page, params) {
+      if (this.search.businesDate.length>0) {
+        params={
+          orderStartDate:this.search.businesDate[0],
+          orderEndDate:this.search.businesDate[1],
+        }
+      }
       this.loading = true;
       getList(page.currentPage, page.pageSize, params)
         .then(res => {
           this.dataList = res.data.data.records ? res.data.data.records : [];
           this.page.total = res.data.data.total;
           if (this.page.total) {
-            this.option.height = window.innerHeight - 380;
-          } else {
-            this.option.height = window.innerHeight - 305;
+            this.option.height = window.innerHeight - 420;
           }
         })
         .finally(() => {

+ 11 - 3
src/views/exportTrade/purchaseContract/detailsPage.vue

@@ -40,7 +40,8 @@
               @change="rateChange"
               placeholder="请输入 汇率"
               :disabled="detailData.status == 1"
-              ><template slot="append">%</template></el-input>
+              ><template slot="append">%</template></el-input
+            >
           </template>
         </avue-form>
       </basic-container>
@@ -348,7 +349,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "预计交货日期",
@@ -418,7 +426,7 @@ export default {
             span: 8,
             slot: true,
             row: true,
-            disabled:true
+            disabled: true
           },
           {
             label: "备注",

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

@@ -530,7 +530,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "预交日期",