From dd0838214cd86dcdec93c89687a7e6f457b58dc2 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 02 Jan 2023 11:24:24 +0800
Subject: [PATCH] 修改时间选择变为范围选择;新增发起事务前需完善企业信息

---
 src/const/application/application.js            |   43 ++++++++++----
 src/views/work/process/delayAudit/detail.vue    |    1 
 src/views/work/process/delayAudit/form.vue      |    8 ++
 src/views/enterprise/enterprise.vue             |    8 +-
 src/views/work/process/audit/form.vue           |    8 ++
 src/views/application/application.vue           |   15 +++-
 src/views/work/start.vue                        |   23 +++++++
 src/views/applicationDelay/applicationDelay.vue |    1 
 src/views/work/process/audit/handle.vue         |   10 +++
 src/views/work/process/audit/detail.vue         |    2 
 src/const/applicationDelay/applicationDelay.js  |   40 +++++++++----
 11 files changed, 124 insertions(+), 35 deletions(-)

diff --git a/src/const/application/application.js b/src/const/application/application.js
index 8e9d09d..b8eebcd 100644
--- a/src/const/application/application.js
+++ b/src/const/application/application.js
@@ -55,23 +55,42 @@
           disabled:false,
           rules: [{required: true, trigger: ['blur','change'],validator:mobileValidate}]
         },
+        // {
+        //   label: "通行开始时间",
+        //   prop: "startPassTime",
+        //   type: "date",
+        //   format:'yyyy-MM-dd',
+        //   valueFormat:'yyyy-MM-dd',
+        //   labelWidth:labelWidth,
+        //   disabled:false,
+        //   pickerOptions: {
+        //     disabledDate(time) {
+        //       return time.getTime() < Date.now();
+        //     },
+        //   }
+        // },
+        // {
+        //   label: "通行结束时间",
+        //   prop: "endPassTime",
+        //   type: "date",
+        //   format:'yyyy-MM-dd',
+        //   valueFormat:'yyyy-MM-dd',
+        //   labelWidth:labelWidth,
+        //   disabled:false,
+        // },
         {
-          label: "通行开始时间",
-          prop: "startPassTime",
-          type: "date",
+          label: "通行时间段",
+          prop: "passTime",
+          type: "daterange",
           format:'yyyy-MM-dd',
           valueFormat:'yyyy-MM-dd',
           labelWidth:labelWidth,
           disabled:false,
-        },
-        {
-          label: "通行结束时间",
-          prop: "endPassTime",
-          type: "date",
-          format:'yyyy-MM-dd',
-          valueFormat:'yyyy-MM-dd',
-          labelWidth:labelWidth,
-          disabled:false,
+          pickerOptions: {
+            disabledDate(time) {
+              return time.getTime() < Date.now();
+            },
+          }
         },
         {
           label: "起运机构",
diff --git a/src/const/applicationDelay/applicationDelay.js b/src/const/applicationDelay/applicationDelay.js
index 2605279..7195289 100644
--- a/src/const/applicationDelay/applicationDelay.js
+++ b/src/const/applicationDelay/applicationDelay.js
@@ -42,23 +42,38 @@
       },
       rules: [{required: true, trigger: ['blur','change'],message:'请输入申请编号'}]
     },
+    // {
+    //   label: "通行开始时间",
+    //   labelWidth:labelWidth,
+    //   prop: "delayStartTime",
+    //   type: "date",
+    //   format:'yyyy-MM-dd',
+    //   valueFormat:'yyyy-MM-dd',
+    //   disabled:false,
+    // },
+    // {
+    //   label: "通行结束时间",
+    //   labelWidth:labelWidth,
+    //   prop: "delayEndTime",
+    //   type: "date",
+    //   format:'yyyy-MM-dd',
+    //   valueFormat:'yyyy-MM-dd',
+    //   disabled:false,
+    // },
     {
-      label: "通行开始时间",
-      labelWidth:labelWidth,
-      prop: "delayStartTime",
-      type: "date",
+      label: "通行时间段",
+      prop: "passTime",
+      type: "daterange",
       format:'yyyy-MM-dd',
       valueFormat:'yyyy-MM-dd',
-      disabled:false,
-    },
-    {
-      label: "通行结束时间",
       labelWidth:labelWidth,
-      prop: "delayEndTime",
-      type: "date",
-      format:'yyyy-MM-dd',
-      valueFormat:'yyyy-MM-dd',
       disabled:false,
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() < Date.now();
+        },
+      },
+      rules: [{required: true, trigger: ['blur','change'],message:'请输入通行时间段'}]
     },
     {
       label: "起运机构",
@@ -123,6 +138,7 @@
       prop: "remark",
       type: "textarea",
       minRows:2,
+      hide: true
     },
     {
       label: "办理进度",
diff --git a/src/views/application/application.vue b/src/views/application/application.vue
index d1ccf9e..ad8a897 100644
--- a/src/views/application/application.vue
+++ b/src/views/application/application.vue
@@ -33,9 +33,6 @@
         <el-button icon="el-icon-tickets" :size="size" :type="type" @click="polishApplication(row.id)">补正</el-button>
         <el-button v-if="permit" icon="el-icon-tickets" :size="size" :type="type">受 理</el-button>
         <el-button v-if="permit" icon="el-icon-tickets" :size="size" :type="type" @click="rejectApplication(row)">不予受理</el-button>
-<!--        <el-button icon="el-icon-delete" :size="size" :type="type">车辆变更</el-button>-->
-<!--        <el-button icon="el-icon-delete" :size="size" :type="type">延 期</el-button>-->
-<!--        <el-button icon="el-icon-delete" :size="size" :type="type">撤 销</el-button>-->
       </template>
       <!--按钮自定义-End-->
 
@@ -100,6 +97,16 @@
       },
       permit(){
         return this.userInfo.role_name == 'admin' || this.userInfo.role_name == 'administrator' ? true:false
+      }
+    },
+    watch:{
+      'form.passTime':{
+        handler(newVal){
+          if (newVal){
+            this.form.startPassTime = newVal[0]
+            this.form.endPassTime = newVal[1]
+          }
+        }
       }
     },
     methods: {
@@ -234,7 +241,7 @@
         let catId = car.id
         let goods = this.form.goodsEntity
         let goodsId = goods.id
-        this.form.endPassTime = basic.endPassTime
+        this.form.passTime = [basic.startPassTime,basic.endPassTime]
         let form = this.form
         //保留原form中的字段
         let common = Object.assign({},form)
diff --git a/src/views/applicationDelay/applicationDelay.vue b/src/views/applicationDelay/applicationDelay.vue
index 10081c7..7fb4f3a 100644
--- a/src/views/applicationDelay/applicationDelay.vue
+++ b/src/views/applicationDelay/applicationDelay.vue
@@ -183,6 +183,7 @@
           //转换数据类型
           this.data.forEach(e=>{
             e.status = e.status.toString()
+            e.passTime = [e.delayStartTime,e.delayEndTime]
           })
 
           this.loading = false;
diff --git a/src/views/enterprise/enterprise.vue b/src/views/enterprise/enterprise.vue
index 1ae37fe..23f6289 100644
--- a/src/views/enterprise/enterprise.vue
+++ b/src/views/enterprise/enterprise.vue
@@ -79,8 +79,8 @@
         return this.userInfo.role_name == 'admin' || this.userInfo.role_name == 'administrator' ? true:false
       }
     },
-    created() {
-      if (this.permit){
+    mounted() {
+      if (!this.permit){
         this.getEnterpriseDetailByUserId()
       }
     },
@@ -219,8 +219,8 @@
           if (res.data.code == 200){
             this.form = res.data.data
             this.form.account = this.userInfo.account
-            const group = this.findObject(this.option.group,"account");
-            group.disabled = true
+            const account = this.findObject(this.option.group,"account");
+            account.disabled = true
           }
         })
       }
diff --git a/src/views/work/process/audit/detail.vue b/src/views/work/process/audit/detail.vue
index f8349e6..7d08bce 100644
--- a/src/views/work/process/audit/detail.vue
+++ b/src/views/work/process/audit/detail.vue
@@ -109,7 +109,7 @@
       let catId = car.id
       let goods = this.form.goodsEntity
       let goodsId = goods.id
-      this.form.endPassTime = basic.endPassTime
+      this.form.passTime = [basic.startPassTime,basic.endPassTime]
       let form = this.form
       //保留原form中的字段
       let common = Object.assign({},form)
diff --git a/src/views/work/process/audit/form.vue b/src/views/work/process/audit/form.vue
index 032e807..c034384 100644
--- a/src/views/work/process/audit/form.vue
+++ b/src/views/work/process/audit/form.vue
@@ -25,6 +25,14 @@
   computed: {
     ...mapGetters(["permission", 'userInfo']),
   },
+  watch:{
+    'form.passTime':{
+      handler(newVal){
+        this.form.startPassTime = newVal[0]
+        this.form.endPassTime = newVal[1]
+      }
+    }
+  },
   created() {
     this.controlOption('open')
     this.processDefinitionId = this.$route.params.processDefinitionId;
diff --git a/src/views/work/process/audit/handle.vue b/src/views/work/process/audit/handle.vue
index fdb9618..f57eabb 100644
--- a/src/views/work/process/audit/handle.vue
+++ b/src/views/work/process/audit/handle.vue
@@ -263,6 +263,14 @@
       cloneForm:{},
     }
   },
+  watch:{
+    'form.passTime':{
+      handler(newVal){
+        this.form.startPassTime = newVal[0]
+        this.form.endPassTime = newVal[1]
+      }
+    }
+  },
   created() {
     this.init();
   },
@@ -460,7 +468,7 @@
       let catId = car.id
       let goods = this.form.goodsEntity
       let goodsId = goods.id
-      this.form.endPassTime = basic.endPassTime
+      this.form.passTime = [basic.startPassTime,basic.endPassTime]
       let form = this.form
       //保留原form中的字段
       let common = Object.assign({}, form)
diff --git a/src/views/work/process/delayAudit/detail.vue b/src/views/work/process/delayAudit/detail.vue
index 107b078..2631440 100644
--- a/src/views/work/process/delayAudit/detail.vue
+++ b/src/views/work/process/delayAudit/detail.vue
@@ -75,6 +75,7 @@
         const data = res.data;
         if (data.success) {
           this.form = data.data;
+          this.form.passTime = [this.form.delayStartTime,this.form.delayEndTime]
         }
       })
     },
diff --git a/src/views/work/process/delayAudit/form.vue b/src/views/work/process/delayAudit/form.vue
index 8d9a8f8..a9826f6 100644
--- a/src/views/work/process/delayAudit/form.vue
+++ b/src/views/work/process/delayAudit/form.vue
@@ -29,6 +29,14 @@
       option: option
     }
   },
+  watch:{
+    'form.passTime':{
+      handler(newVal){
+        this.form.delayStartTime = newVal[0]
+        this.form.delayEndTime = newVal[1]
+      }
+    }
+  },
   created() {
     this.processDefinitionId = this.$route.params.processDefinitionId;
   },
diff --git a/src/views/work/start.vue b/src/views/work/start.vue
index 006aab3..1ff58a9 100644
--- a/src/views/work/start.vue
+++ b/src/views/work/start.vue
@@ -58,6 +58,7 @@
   import {mapGetters} from "vuex";
   import {startList} from "@/api/work/work";
   import {flowCategory, flowRoute} from "@/util/flow";
+  import {getDetailByUserId} from "@/api/enterprise/enterprise";
 
   export default {
     data() {
@@ -151,7 +152,7 @@
       }
     },
     computed: {
-      ...mapGetters(["permission", "flowRoutes"]),
+      ...mapGetters(["permission", "flowRoutes","userInfo"]),
       ids() {
         let ids = [];
         this.selectionList.forEach(ele => {
@@ -159,6 +160,12 @@
         });
         return ids.join(",");
       },
+      permit(){
+        return this.userInfo.role_name == 'admin' || this.userInfo.role_name == 'administrator' ? true:false
+      },
+    },
+    created() {
+      this.getEnterpriseDetailByUserId()
     },
     methods: {
       searchReset() {
@@ -208,6 +215,20 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      getEnterpriseDetailByUserId(){
+        getDetailByUserId(this.userInfo.user_id).then(res=>{
+          if (res.data.code == 200){
+            if (res.data.data && !this.permit){
+              this.$alert('请先完善企业信息', '提示', {
+                confirmButtonText: '确定',
+                callback: ()=>{
+                  this.$router.push("/enterprise/enterprise")
+                }
+              });
+            }
+          }
+        })
       }
     }
   };

--
Gitblit v1.9.3