Эх сурвалжийг харах

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc_app into V0.0.2

coys 2 жил өмнө
parent
commit
2405c1299c

+ 5 - 7
src/api/public.js

@@ -92,14 +92,12 @@ export function deptTreeList(id) {
     }
   })
 }
-//获取字典
-export function getDict(type){
+
+//根据字典类型查询字典值接口
+export function getDict(dictType) {
   return request({
-    url: '/system/dept/deptTree',
-    method: 'get',
-    params:{
-      id
-    }
+    url: '/system/dict/data/type/' + dictType,
+    method: 'get'
   })
 }
 //通过组织机构ID获取人员

+ 3 - 3
src/components/layouts/index.vue

@@ -1,10 +1,10 @@
 <template>
   <div ref="layouts" :class="{'app-container': !$route.meta.hideTabBar} ">
     <div class="layout-content">
-      <keep-alive v-if="$route.meta.keepAlive">
-        <router-view></router-view>
+      <keep-alive>
+        <router-view v-if="$route.meta.keepAlive"></router-view>
       </keep-alive>
-      <router-view v-else></router-view>
+      <router-view v-if="!$route.meta.keepAlive"></router-view>
     </div>
     <div v-if="!$route.meta.hideTabBar" class="layout-footer">
         <TabBar :data="tabTars" @change="handleChange" />

+ 1 - 0
src/components/nfcPopup/more.vue

@@ -97,6 +97,7 @@ export default {
     show(list){
       this.visible = true;
       this.dataList = list;
+      console.log(211231);
       console.log(this.dataList,'datalist')
     },
     //上传前

+ 1 - 1
src/components/orgTree/index.vue

@@ -61,7 +61,7 @@ export default {
     },
     onSelect(value) {
       this.$emit('change', value.id)
-      this.$emit('change', value)
+      this.$emit('changeItem', value)
     }
   },
   model: {

+ 1 - 1
src/components/selectCell/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="date-cell">
     <van-cell v-if="disabled" :required="required" :title="title" :label="label"/>
-    <van-cell :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
+    <van-cell v-if="!disabled"  :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
     <van-popup v-model="showPicker" round lazy-render position="bottom" :close-on-popstate="true" get-container="#app">
       <van-picker
         v-bind="$attrs"

+ 7 - 7
src/components/upload/index.vue

@@ -47,7 +47,7 @@ export default {
       value:{
         handler(val){
           this.imageList= this.fileList = val.map(v=>{
-          
+
             let imgUrl =
               process.env.NODE_ENV === "development"
                 ?  config.baseUrl + v.path
@@ -58,7 +58,7 @@ export default {
               path:v.path,
             }
           })
-          
+
         },
         deep:true,
         immediate:true
@@ -101,13 +101,13 @@ export default {
             process.env.NODE_ENV === "development"
               ?  config.baseUrl + res.data.url
               : window.origin + res.data.url;
-         
+
           this.imageList.push({ name: res.data.name, url: imgUrl,path:res.data.url});
           this.$emit('input',this.imageList)
-          
+
         }).catch((err) => {
           /*上传失败*/
-          
+
           this.$toast.fail('上传失败')
         });
       },
@@ -117,9 +117,9 @@ export default {
         imageList.forEach(item=>{
           item.imgPath=item.path
           item.path=item.imgPath
-          
+
         })
-        
+
         this.$emit('input',imageList)
       }
     },

+ 120 - 0
src/components/upload/uploader.vue

@@ -0,0 +1,120 @@
+<template>
+    <div>
+        <van-uploader
+          ref="uploader"
+          v-bind="$attrs"
+          v-model="fileList"
+          :before-read="beforeRead"
+          :after-read="afterRead"
+          :max-count="maxCount"
+          @delete="deleteHandler"
+          :max-size="maxSize * 1024*1024"/>
+    </div>
+</template>
+<script>
+import {upload} from "@/api/public";
+import ImageCompressor from "js-image-compressor";
+import {imgUrl} from "@/utils";
+export default {
+    props:{
+      value:{
+        type: Array,
+      },
+      //最大上传数量
+      maxCount:{
+        type: Number,
+        default: 6,
+      },
+      //文件大小,单位MB
+      maxSize:{
+        type: Number,
+        default: 5,
+      },
+
+    },
+    data() {
+      return {
+        fileList:[],
+        //上传之后的图片列表,双向绑定之后覆盖fileList
+        imageList:[]
+      };
+    },
+
+    mounted() {
+
+    },
+    watch:{
+      value:{
+        handler(val){
+          console.log(val,'ttttt')
+          this.fileList = val.map(v=>{
+            v.url = imgUrl(v.imgPath);
+            return v
+          })
+          this.imageList = JSON.parse(JSON.stringify(this.fileList))
+        },
+        immediate:true
+      }
+    },
+    methods: {
+      //上传前压缩
+      beforeRead(file){
+        console.log(file,'图片压缩前')
+        return new Promise((resolve, reject) => {
+            new ImageCompressor({
+              file,
+              quality: 0.6,
+              success: (result) => {
+                //this.$toast('图片压缩成功')
+                console.log(result,'图片压缩后')
+                let imgFile = new File([result], result.name, {
+                  width: result.width,
+                  height: result.height,
+                  type: result.type,
+                });
+                console.log(imgFile,'后')
+                resolve(imgFile);
+              },
+              error: (e) => {
+                console.log('imageError:'+e);
+                this.$toast('图片压缩失败')
+                reject(e);
+              },
+             });
+        });
+      },
+      //上传到服务器
+      afterRead(fileObj){
+        let formData = new FormData();
+        formData.append("file", fileObj.file);
+        upload(formData, "image").then((res) => {
+          /*上传成功*/
+          this.$toast.success('上传成功')
+          console.log( this.fileList, this.imageList,' fileList')
+          this.imageList.push({ name: res.data.name, url: imgUrl(res.data.url),imgPath:res.data.url});
+          this.$emit('input',this.imageList)
+        }).catch((err) => {
+          /*上传失败*/
+          this.$toast.fail('上传失败')
+        });
+      },
+      //删除
+      deleteHandler(){
+        let imageList=JSON.parse(JSON.stringify(this.fileList));
+        console.log(imageList,'imageList')
+        this.$emit('input',imageList)
+      }
+    },
+    model:{
+      prop:'value',
+      event:'input'
+    }
+};
+</script>
+<style lang="scss" scoped>
+  .upload-text{
+    font-size: 18px;
+    color: #999;
+    margin-top: 5px;
+  }
+</style>

+ 8 - 6
src/store/index.js

@@ -8,11 +8,13 @@ import app from './modules/app'
 Vue.use(Vuex)
 
 const store = new Vuex.Store({
-  modules: {
-    user,
-    app
-  },
-  getters
-})
+    modules: {
+      user,
+      app
+    },
+    getters,
+  }
+)
 
 export default store
+

+ 70 - 54
src/store/modules/app.js

@@ -1,60 +1,76 @@
-import { deptTreeSelect, handsheDeptTreeSelect } from '@/api/public'
-const state = {
-  //用户名
-  userName: null,
-  //机构id
-  orgId:null,
-  //用户id
-  id:null,
-  //机构名称
-  orgName:null,
-  //用户机构树
-  orgTree: [],
-  //行社机构树
-  depTree: [],
-}
-const mutations = {
-  SET_USER_NAME(state, name) {
-    state.userName = name;
+import { deptTreeSelect, handsheDeptTreeSelect,getDict } from '@/api/public'
+export default {
+  state: {
+    //用户名
+    userName: null,
+    //机构id
+    orgId: null,
+    //用户id
+    id: null,
+    //机构名称
+    orgName: null,
+    //用户机构树
+    orgTree: [],
+    //行社机构树
+    depTree: [],
+    //字典
+    dicts: {}
   },
-  SET_ORGTREE: (state, val) => {
-    state.orgTree = val
+  mutations : {
+    SET_USER_NAME(state, name) {
+      state.userName = name;
+    },
+    SET_ORGTREE: (state, val) => {
+      state.orgTree = val
+    },
+    SET_DEPTREE: (state, val) => {
+      state.depTree = val
+    },
+    SET_DICT_ITEM(state, {key, value}) {
+      console.log(value,'val' )
+      state.dicts[key] = value;
+    }
   },
-  SET_DEPTREE: (state, val) => {
-    state.depTree = val
-  }
-}
-const actions = {
-  //获取用户机构树
-  getOrgTree({ commit, state }){
-    return new Promise((resolve, reject) => {
-      deptTreeSelect().then(res => {
-        commit('SET_ORGTREE', res.data)
-        resolve(res)
-      }).catch(error => {
-        reject(error)
+  actions : {
+    //获取字典
+    getDicts({commit, state}, key) {
+      return new Promise((resolve, reject) => {
+        if (state.dicts[key]) {
+          resolve(state.dicts[key]);
+        } else {
+          getDict(key).then(res => {
+            console.log(res.data,'ressssss')
+            commit('SET_DICT_ITEM', {key, value: res.data});
+            console.log(state.dicts,'dict')
+            resolve(res.data);
+          }).catch(error => {
+            reject(error)
+          })
+        }
       })
-    })
-  },
+    },
+    //获取用户机构树
+    getOrgTree({commit, state}) {
+      return new Promise((resolve, reject) => {
+        deptTreeSelect().then(res => {
+          commit('SET_ORGTREE', res.data)
+          resolve(res)
+        }).catch(error => {
+          reject(error)
+        })
+      })
+    },
 
-  //获取行社机构树
-  getDepTree({ commit, state }){
-    return new Promise((resolve, reject) => {
-      handsheDeptTreeSelect().then(res => {
-        commit('SET_DEPTREE', res.data)
-        resolve(res)
-      }).catch(error => {
-        reject(error)
+    //获取行社机构树
+    getDepTree({commit, state}) {
+      return new Promise((resolve, reject) => {
+        handsheDeptTreeSelect().then(res => {
+          commit('SET_DEPTREE', res.data)
+          resolve(res)
+        }).catch(error => {
+          reject(error)
+        })
       })
-    })
-  },
-  // 设置name
-  // setUserName({ commit }, name) {
-  //   commit('SET_USER_INFO', name)
-  // }
-}
-export default {
-  state,
-  mutations,
-  actions
+    },
+  }
 }

+ 18 - 0
src/utils/date.js

@@ -39,3 +39,21 @@ export function newDateTime(time) {
   var ss = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds()
   return y + '-' + m+'-'+d+' '+hh+mm+ss
 }
+
+
+// 时间比较
+export function timeCheck(arr) {
+  let srcs = arr.filter((s) => s);
+  for (let i = srcs.length - 1; i > 0; i--) {
+    let a = timeToNumber(srcs[i]);
+    let b = timeToNumber(srcs[i - 1]);
+    if (a <= b) {
+      return false;
+    }
+  }
+  return true;
+}
+
+function timeToNumber(src) {
+  return src.replace(":", "") * 1;
+}

+ 2 - 21
src/utils/globalMixins.js

@@ -31,28 +31,9 @@ export default {
     //根据字典类型获取字典值
     getDictHandler(dictType,callBack) {
       getDict( dictType ).then(res => {
-        let { code, data, msg } = res
-        if (code == 200) {
-            callBack(data)
-        }
+        let { data } = res
+        callBack(data)
       })
     },
-    //根据字典类型获取字典值,返回字典label
-    getDicts(s,dict){
-      console.log(this[dict],dict);
-      //判断内存中是否有该字典,没有就去获取
-      if( !this[dict]){
-        getDict( dict ).then(res => {
-          let { code, data } = res;
-          if (code == 200) {
-            this.observers[dict] = data;
-            //this[dict] = data;
-            //return  this[dict].find(v=> s == v.dictValue).dictLabel;
-          }
-        })
-      }else {
-        return  this[dict].find(v=> s == v.dictValue).dictLabel;
-      }
-    },
   }
 }

+ 1 - 0
src/views/home/isMy.vue

@@ -7,6 +7,7 @@
 <script>
 import TopBar from '@/components/TopBar'
 export default {
+  name: 'isMy',
   components: { TopBar },
   data() {
     return {

+ 2 - 2
src/views/home/menu.vue

@@ -5,7 +5,7 @@
       <div class="menu-list-item" v-for="(v,i) in menuList" :key="i">
         <p @click="onclick">{{v.meta.title}}</p>
         <van-grid border :column-num="3">
-          <van-grid-item v-for="(item,index) in v.children" :key="index" :icon="item.meta.icon" :text="item.meta.title" :to="item.path" />
+          <van-grid-item v-for="(item,index) in v.children" :key="index" :icon="imgUrl(item.meta.icon)" :text="item.meta.title" :to="item.path" />
         </van-grid>
 <!--          <li v-for="(item,index) in v.list" :key="index">-->
 <!--            <div></div>-->
@@ -21,6 +21,7 @@ import TopBar from "@/components/TopBar";
 import { mapGetters } from 'vuex'
 import {getMenu} from "@/api/public";
 export default {
+  name: 'menus',
   components:{TopBar},
   data() {
     return {
@@ -36,7 +37,6 @@ export default {
   methods: {
     getMenuList(){
       getMenu().then(res=>{
-        console.log(res,'res')
         this.menuList = res.data
       })
     },

+ 1 - 0
src/views/home/works.vue

@@ -8,6 +8,7 @@
 import TopBar from '@/components/TopBar'
 import {mapGetters} from "vuex";
 export default {
+  name: 'works',
   components: { TopBar },
 }
 

+ 2 - 2
src/views/login.vue

@@ -47,8 +47,8 @@ export default {
     return {
       wechat: `${this.$cdn}/wx/640.gif`,
       formData:{
-        username:'admin',
-        password:'Admin1234',
+        username:'',
+        password:'',
       },
       pattern: /\d{6}/,
       checked:false

+ 6 - 6
src/views/menu/LZRegister/api.js

@@ -252,7 +252,7 @@ export const json = {
             "status": 0,
             "pointId": "1698145599043850242",
             "areaId": "1698144115199733762",
-            "nfcid": "1698157595877437442",
+            "nfcId": "1698157595877437442",
             "nfcScanStatus": null,
             "scanMethod": null,
             "img": null
@@ -294,7 +294,7 @@ export const json = {
                     "status": 0,
                     "pointId": "1698145599043850242",
                     "areaId": "1698144115199733762",
-                    "nfcid": "1698157595877437442",
+                    "nfcId": "1698157595877437442",
                     "nfcScanStatus": null,
                     "scanMethod": null,
                     "img": null
@@ -614,7 +614,7 @@ export const json = {
             "status": 0,
             "pointId": "1698158477981442050",
             "areaId": "1698144217020657665",
-            "nfcid": "1698157746641694721",
+            "nfcId": "1698157746641694721",
             "nfcScanStatus": 1,
             "scanMethod": 0,
             "img": ""
@@ -627,7 +627,7 @@ export const json = {
             "status": 0,
             "pointId": "1698158477981442050",
             "areaId": "1698144217020657665",
-            "nfcid": "1698157669047070722",
+            "nfcId": "1698157669047070722",
             "nfcScanStatus": 1,
             "scanMethod": 1,
             "img": "/statatisc/abc/1.jpg"
@@ -669,7 +669,7 @@ export const json = {
                     "status": 0,
                     "pointId": "1698158477981442050",
                     "areaId": "1698144217020657665",
-                    "nfcid": "1698157746641694721",
+                    "nfcId": "1698157746641694721",
                     "nfcScanStatus": 1,
                     "scanMethod": 0,
                     "img": ""
@@ -682,7 +682,7 @@ export const json = {
                     "status": 0,
                     "pointId": "1698158477981442050",
                     "areaId": "1698144217020657665",
-                    "nfcid": "1698157669047070722",
+                    "nfcId": "1698157669047070722",
                     "nfcScanStatus": 1,
                     "scanMethod": 1,
                     "img": "/statatisc/abc/1.jpg"

+ 51 - 32
src/views/menu/LZRegister/edit.vue

@@ -4,27 +4,27 @@
     <div class="page-container">
       <!--   基本信息   -->
       <div class="card" v-if="taskInfo">
-        <van-panel :title="taskInfo.title"  :status="getDicts(taskInfo.status,'resumption_status')">
+        <van-panel :title="taskInfo.title"  :status="getDicts(taskInfo.status)">
           <van-cell title="日期时间" :value="rangDate(taskInfo.planstarttime,taskInfo.planendtime)" />
           <van-collapse :border="false" v-model="activeNames">
-            <van-collapse-item title="履职内容" :name="1">
-              <van-cell title="检查内容:" :value="allCheckNum" />
+            <van-collapse-item title="履职总览" :name="1">
               <van-cell title="NFC:"  >
                 <template #extra>
                   <p class="flex-box">
-                    <span >已扫 {{taskInfo.areaScanY}}</span>
-                    <span >未扫 {{taskInfo.areaScanN}}</span>
+                    <span >已扫 {{taskInfo.nfcScanY}}</span>
+                    <span >未扫 {{taskInfo.nfcScanN}}</span>
                   </p>
                 </template>
               </van-cell>
-              <van-cell title="检查区域:">
+              <van-cell title="履职项:">
                 <template #extra>
                   <p class="flex-box">
-                    <span >已查 {{taskInfo.nfcScanY}}</span>
-                    <span >未查 {{taskInfo.nfcScanN}}</span>
+                    <span >已查  {{taskInfo.areaScanY}}</span>
+                    <span >未查  {{taskInfo.areaScanN}}</span>
                   </p>
                 </template>
               </van-cell>
+              <van-cell title="履职内容:" :value="allCheckNum" />
             </van-collapse-item>
           </van-collapse>
         </van-panel>
@@ -54,7 +54,7 @@
 
             </van-cell>
             <van-cell v-show="nfcImage.length > 0" :border="false" >
-              <div v-if="v.img" class="nfc-img" v-for="v in nfcImage" :key="v.img">
+              <div v-if="v.img" class="nfc-img" v-for="(v,i) in nfcImage" :key="v.img" @click="preViewNFC(i)">
                 <img :src="imgUrl(v.img)" alt="" >
                 <span>{{v.checkName}}</span>
               </div>
@@ -125,7 +125,7 @@
                   </template>
                 </van-cell>
                 <van-cell-group v-show="item.resvalue">
-                  <select-cell required :disabled="!enable" title="整改期限" v-model="item.rectificationDeadline"  :dict="'rectification_deadline'" />
+                  <select-cell required :disabled="!enable" title="整改期限" v-model="item.rectificationDeadline"  :data-list="dayList" />
                   <van-field
                     required
                     v-model="item.resremark"
@@ -137,7 +137,7 @@
                   <div class="upload-box" >
                     <uploader :maxCount="5" v-if="enable" v-model="item.imgData"/>
                     <van-cell v-else>
-                      <div class="nfc-img van-hairline--surround" v-for="v in item.imgData" :key="v.id">
+                      <div class="nfc-img van-hairline--surround" v-for="(v,i) in item.imgData" :key="v.imgPath" @click="clickWarnImage(item.imgData,i)">
                         <img :src="imgUrl(v.imgPath)" alt="" >
                         <span>{{v.checkName}}</span>
                       </div>
@@ -166,6 +166,10 @@
       </fieldset>
     </div>
 
+<!--    <van-image-preview v-model="showPreView" :images="preViewImages.images" :startPosition="preViewImages.startPosition">-->
+<!--      <template v-slot:index>第{{ index }}页</template>-->
+<!--    </van-image-preview>-->
+
     <!--  nfc弹窗  -->
     <nfc-popup v-if="enable" ref="NfcPopup" @change="changeNfcImg"></nfc-popup>
   </div>
@@ -175,10 +179,13 @@
 import NavBar from '@/components/NavBar';
 import SelectCell from '@/components/selectCell';
 import DateCell from '@/components/dateCell';
-import Uploader from '@/components/upload';
+import Uploader from '@/components/upload/uploader';
 import NfcPopup from '@/components/nfcPopup/more';
 import {taskDetails,saveTaskData} from "@/views/menu/LZRegister/api";
 import {formatDate} from "@/filters/filter";
+import {getDict} from "@/api/toConsult";
+import {imgUrl} from "@/utils";
+import { ImagePreview } from 'vant';
 export default {
   components:{NavBar,SelectCell,DateCell,Uploader,NfcPopup},
   data(){
@@ -207,23 +214,42 @@ export default {
       //nfc图片
       nfcImage:[],
       enable:false,
+      stateList:[],
+      dayList:[],
+      preViewImages:{
+        images:[],
+        startPosition:0
+      },
+      showPreView:false,
     }
   },
+  created() {
+    getDict( 'resumption_status' ).then(res => {
+      let { data } = res
+      this.stateList = data;
+    })
+    getDict( 'rectification_deadline' ).then(res => {
+      let { data } = res
+      this.dayList = data;
+    })
+  },
   mounted() {
     this.getData();
   },
-  computed:{
-  },
-  // watch:{
-  //   NFCList(){
-  //     if(!this.NFCList) return;
-  //     let arr = this.NFCList.filter(item=>{
-  //       return item.status == 0;
-  //     })
-  //     this.NFCNum = arr.length;
-  //   },
-  // },
   methods:{
+    clickWarnImage(arr,i){
+      this.preViewImages.images = arr.map(v=>imgUrl(v.imgPath));
+      this.preViewImages.startPosition = i;
+      ImagePreview(this.preViewImages)
+    },
+    preViewNFC(i){
+      this.preViewImages.images = this.nfcImage.map(v=>imgUrl(v.img));
+      this.preViewImages.startPosition = i;
+      ImagePreview(this.preViewImages)
+    },
+    getDicts(s){
+      return this.stateList.find(v=> s == v.dictValue)?.dictLabel;
+    },
     //初始化数据
     getData() {
       let data = {
@@ -246,7 +272,6 @@ export default {
         this.areaList = res.data.taskarealist;
         this.activeArea(this.areaList[0],0);
         this.getAllCheckItemNum();
-        console.log(res)
       })
     },
     //保存数据
@@ -276,13 +301,10 @@ export default {
       //验证必填项
       let arr = pointdata.filter(v=>{
         if(v.resvalue === 1 ){
-          console.log(v,'验证')
           return !v.resremark || !v.rectificationDeadline
         }
       })
       if(arr.length) return this.$toast(`${arr[0].areaname}-${arr[0].itemname}:信息不完整请填写`);
-
-      console.log(this.nfcImage,'this.nfcImage')
       let data = {
         dateTime:new Date(),
         isSubmit:0,
@@ -306,7 +328,6 @@ export default {
         })
       });
       this.allCheckNum = num;
-      console.log(num,'num1111')
     },
     //点击区域
     clickArea(area,index){
@@ -317,7 +338,6 @@ export default {
       //设置选中样式
       this.$nextTick(()=>{
         let doms = document.getElementsByClassName('check-area');
-        console.log(doms,'doms')
         Array.prototype.forEach.call(doms,item=>{
           item.classList.remove('active');
         })
@@ -338,7 +358,6 @@ export default {
           this.nfcImage.push(v)
         }
       });
-      console.log(this.nfcImage,'nfcImage')
       //获取当前区域检查项数量
       this.getCheckItemNum();
       //获取当前区域nfc数量
@@ -531,8 +550,8 @@ export default {
       left: 0;
       display: block;
       width: 100%;
-      background-color: rgba(0,0,0,.1 );
-      color: #aaa;
+      background-color: rgba(0,0,0,.2 );
+      color: #eaeaea;
       font-size: 20px;
       overflow: hidden;
       text-overflow: ellipsis;

+ 16 - 7
src/views/menu/LZRegister/index.vue

@@ -119,8 +119,10 @@ import DatePicker from '@/components/DatePicker';
 import {mapGetters} from "vuex";
 import {dataList} from "./api";
 import dayjs from "dayjs";
+import {getDict} from "@/api/toConsult";
 
 export default {
+  name: 'lvzhi',
   components:{NavBar,DatePicker},
   data(){
     return{
@@ -142,10 +144,15 @@ export default {
       },
       //配置子页面路径
       path:'/lz-edit',
-      //字典表
-      dicts: ['resumption_status'],
+
     }
   },
+  created() {
+    getDict( 'resumption_status' ).then(res => {
+      let { data } = res
+      this.stateList = data;
+    })
+  },
   mounted() {
     this.container = this.$refs.container;
     this.initDatalist();
@@ -154,14 +161,18 @@ export default {
   computed:{
     ...mapGetters(['orgName','orgId','roleList']),
   },
-  watch:{
-
+  beforeRouteEnter(to,from,next){
+    next(vm=>{
+      vm.getDatalist();
+    })
   },
   methods:{
+    getDicts(s){
+      return this.stateList.find(v=> s == v.dictValue)?.dictLabel;
+    },
     handleScroll(e){
       let scrollTop = document.getElementById('lz-container').scrollTop;
       this.$refs.DatePicker.showPicker = false;
-      console.log(scrollTop,'555')
     },
     //格式化时间范围
     formatTime(start,end,format){
@@ -176,7 +187,6 @@ export default {
         roleId:roleIds,
       }
       dataList(data).then(res=>{
-        console.log(res,'ressss')
         this.setData(res);
       })
     },
@@ -189,7 +199,6 @@ export default {
         roleId:roleIds,
       }
       dataList(data).then(res=>{
-        console.log(res,'ressssssssss')
         this.setData(res);
       })
     },

+ 19 - 45
src/views/menu/workTime/index.vue

@@ -2,7 +2,7 @@
   <div class="works-time">
     <nav-bar></nav-bar>
     <div class="form-box">
-      <org-tree v-model="formData.orgId" @change="orgChange"></org-tree>
+      <org-tree v-model="formData.orgId"></org-tree>
       <!--   选择日期   -->
       <van-collapse v-model="activeCalendar">
         <van-collapse-item title="日期" :label="formData.ymdDate" name="1">
@@ -28,20 +28,8 @@
 
       <!--  选择时间    -->
       <van-cell-group >
-        <date-cell :disabled="formData.isDisabled || !formData.isEnable" title="营业开始" v-model="formData.workTime" date-type="time"></date-cell>
-        <date-cell :disabled="formData.isDisabled || !formData.isEnable" title="营业结束" v-model="formData.workOffTime" date-type="time"></date-cell>
-<!--        <van-cell title="开始时间" is-link  :label="formData.workTime" @click="formData.isDisabled?null:showTimePopup(1)"/>-->
-<!--        <van-cell title="结束时间" is-link  :label="formData.workOffTime"  @click="formData.isDisabled?null:showTimePopup(0)"/>-->
-        <van-popup v-model="showTime" round  position="bottom" >
-          <van-datetime-picker
-            v-model="selectedTime"
-            type="time"
-            min-hour="0"
-            max-hour="23"
-            @confirm="datePickerConfirm"
-            :columns-order="['hour', 'minute']"
-          />
-        </van-popup>
+        <date-cell :disabled="formData.isDisabled || !formData.isEnable" title="营业开始" v-model="formData.openTime" @change="startChange" date-type="time"></date-cell>
+        <date-cell :disabled="formData.isDisabled || !formData.isEnable" title="营业结束" @change="endChange" v-model="formData.closeTime" date-type="time"></date-cell>
       <!--   操作     -->
       </van-cell-group>
       <van-cell center title="是否复制到全月" v-if="!formData.isDisabled">
@@ -63,6 +51,7 @@ import DateCell from '@/components/dateCell';
 import {mapGetters} from "vuex";
 import {deptTreeList} from "@/api/public";
 import {editWorkTime} from "@/views/menu/workTime/api";
+import {timeCheck} from "@/utils/date"
 import {dataList} from "@/views/menu/educationStatistics/api";
 export default {
   components:{NavBar,Calendar,OrgTree,DateCell},
@@ -105,16 +94,10 @@ export default {
     ...mapGetters(['orgName','orgId']),
   },
   methods:{
-    orgChange(){
-      // let data = {
-      //   ...this.query
-      // }
-      // data.date = `${this.query.date}-01`;
-      // if(!this.query.orgId) return this.$toast('请选择机构');
-      // dataList(data).then(res=>{
-      //   this.dataList = res.data;
-      // })
+    startChange(){
+
     },
+    endChange(){},
     //切换状态
     changeRadio(s){
       this.formData.isEnable = s;
@@ -128,15 +111,6 @@ export default {
       this.$refs.calendar.copyMouth(this.formData);
       this.isCopy = true;
     },
-    //根据状态切换选择时间
-    datePickerConfirm(date){
-      if(this.timeFlag) {
-        this.formData.workTime = date;
-      }else{
-        this.formData.workOffTime = date;
-      }
-      this.showTime = false;
-    },
     //获取机构树
     getTreeList(){
       deptTreeList(this.orgId).then(res=>{
@@ -157,22 +131,14 @@ export default {
       this.showOrg = false;
       this.fieldValue = selectedOptions.map((option) => option.text).join('/');
     },
-    //显示日历
-    showCalendar(){
-      this.calendar = !this.calendar;
-    },
     //显示机构选择
     showPopup() {
       this.showOrg = true;
     },
-    //显示时间选择
-    showTimePopup(key){
-      this.timeFlag = key;
-      this.showTime = true;
-    },
     //提交
     onsubmit(){
       if(!this.formData.orgId) return this.$toast('请选择机构');
+
       if(this.isCopy){
         let data = {
           orgIdList:[this.formData.orgId],
@@ -184,6 +150,15 @@ export default {
           this.isCopy = false;
         })
       }else {
+        if(this.formData.isEnable === null){
+          return this.$toast('请选择营业状态');
+        }else {
+          if(this.formData.isEnable){
+            if(!this.formData.openTime) return this.$toast('请选择开始时间');
+            if(!this.formData.closeTime) return this.$toast('请选择结束时间');
+            if(!timeCheck([this.formData.workTime,this.formData.workOffTime])) return this.$toast('开始时间不能大于结束时间');
+          }
+        }
         let data = {
           orgIdList:[this.formData.orgId],
           workTimeList:[this.formData]
@@ -198,11 +173,10 @@ export default {
     //日期选择
     onChange(day){
       this.selectDate = day;
-      console.log(this.selectDate,'this.date')
       this.formData.ymdDate = this.selectDate.ymdDate;
       this.formData.isEnable = this.selectDate.isEnable;
-      this.formData.workTime = this.selectDate.workTime;
-      this.formData.workOffTime = this.selectDate.workOffTime;
+      this.formData.openTime = this.selectDate.openTime;
+      this.formData.closeTime = this.selectDate.closeTime;
       this.formData.isDisabled = this.selectDate.isDisabled;
     },
   }