Hwt 2 лет назад
Родитель
Сommit
96ae72224d

+ 1 - 1
operationSupport/src/views/newWorkBench/template/leftAssembly.vue

@@ -376,7 +376,7 @@ export default {
         },
         {
           data_id: 31,
-          title: '巡检人员任务执行情况',
+          title: '巡检任务完成率',
           type: 7,
           imgPng: require('@assets/img/formulation/img_bing+baifenbi@2x.png'),
           imgIcon: require('@assets/img/formulation/tag_1x@2x.png'),

+ 203 - 142
operationSupport/src/views/patrolManagement/components/weekContent.vue

@@ -1,157 +1,218 @@
 <template >
-    <div class="scheduling-table-body">
-        <div class="weeb-body" v-for="(its, inx) in timeObjArr" :key="inx">
-            <template v-for="(item, index) in its">
-                <div
-                    class="task"
-                    :class="resultTime(keyValues(inx), item) ? 'disabled' : ''"
-                    v-if="intersectionDay(keyValues(inx), item, inx)"
-                    :key="index"
-                >
-                    <div class="task-content">
-                        <div class="task-content-title">{{ item.routeName }}</div>
-                        <div class="task-content-time">{{ item.times }}</div>
-                        <div class="task-set" v-if="matchingTime(keyValues(inx), item).isActive">
-                            <span @click="resultTime(keyValues(inx), item) ? null : addItem(keyValues(inx), item)">
-                                {{ matchingTime(keyValues(inx), item).partolName }}</span
-                            >
-                        </div>
-                        <div class="task-set" v-else-if="!resultTime(keyValues(inx), item)">
-                            <span @click="addItem(keyValues(inx), item)">设置</span>
-                        </div>
-                    </div>
-                </div>
-            </template>
+  <div class="scheduling-table-body">
+    <div
+      class="weeb-body"
+      v-for="(its, inx) in timeObjArr"
+      :key="inx"
+    >
+      <template v-for="(item, index) in its">
+        <div
+          class="task"
+          :class="resultTime(keyValues(inx), item) ? 'disabled' : ''"
+          v-if="intersectionDay(keyValues(inx), item, inx)"
+          :key="index"
+        >
+          <div class="task-content">
+            <div class="task-content-title">{{ item.routeName }}</div>
+            <div class="task-content-time">{{ item.times }}</div>
+            <div
+              class="task-set"
+              v-if="matchingTime(keyValues(inx), item).isActive"
+            >
+              <!-- addItem(keyValues(inx), item) -->
+              <!-- addItem(keyValues(inx), item,'1',matchingTime(keyValues(inx), item).currentUsers,matchingTime(keyValues(inx), item).recordId) -->
+              <span @click="resultTime(keyValues(inx), item) ? null : addItem(keyValues(inx), item,'1',matchingTime(keyValues(inx), item).currentUsers,matchingTime(keyValues(inx), item).recordId)">
+                {{ matchingTime(keyValues(inx), item).partolName }}</span>
+            </div>
+            <div
+              class="task-set"
+              v-else-if="!resultTime(keyValues(inx), item)"
+            >
+              <span @click="addItem(keyValues(inx), item,'2')">设置</span>
+              <!-- <span @click="addItem(keyValues(inx), item)">设置</span> -->
+            </div>
+          </div>
         </div>
+      </template>
     </div>
+  </div>
 </template>
 <script>
 export default {
-    props: {
-        timeObj: {
-            type: Object,
-            default: () => {
-                return {
-                    monday: '',
-                    tuesday: '',
-                    wednesday: '',
-                    thursday: '',
-                    friday: '',
-                    saturday: '',
-                    sunday: ''
-                };
-            }
-        },
-        timeObjArr: {
-            type: Array,
-            default: () => {
-                return [[], [], [], [], [], [], []];
-            }
-        },
-        calendarData: {
-            type: Array,
-            default: () => []
-        },
-        findUser: {
-            type: Array,
-            default: () => []
-        }
+  props: {
+    timeObj: {
+      type: Object,
+      default: () => {
+        return {
+          monday: '',
+          tuesday: '',
+          wednesday: '',
+          thursday: '',
+          friday: '',
+          saturday: '',
+          sunday: ''
+        };
+      }
     },
-    data() {
-        return {};
+    timeObjArr: {
+      type: Array,
+      default: () => {
+        return [[], [], [], [], [], [], []];
+      }
     },
-    methods: {
-        addItem(itemTime, item) {
-            new Promise((resolve) => {
-                this.$store.dispatch('addPopup', {
-                    url: '/patrolManagement/popups/weekEditAdd.vue',
-                    width: '450px',
-                    height: '300px',
-                    props: {
-                        callback: resolve,
-                        findUser: this.findUser,
-                        dateDe: itemTime,
-                        item: item
-                    },
-                    title: '排班'
-                });
-            }).then(() => {
-                this.$emit('getList', {
-                    startTime: `${this.timeObj.monday} 00:00:00`,
-                    endTime: `${this.timeObj.sunday} 23:59:59`
-                });
-            });
-        },
-        //对比 现在时间 选择的时间至灰处理
-        resultTime(tis, item) {
-            let thisTime = this.$moment().format('YYYY-MM-DD') + ' 00:00:00';
-            let itemTime = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
-            return this.$moment(thisTime).valueOf() > this.$moment(itemTime).valueOf();
-        },
-        intersectionDay(tis, item, index) {
-            let startDate = this.$moment(item.startDate).format('YYYY-MM-DD HH:mm:ss');
-            let endDate = this.$moment(item.endDate).format('YYYY-MM-DD HH:mm:ss');
-            let thisDate = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
-            let vra = item.periodValue.split(',').sort();
-            //每周几
-            if (item.periodType == 1) {
-                return (
-                    this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
-                    this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
-                    vra.includes(vra[index])
-                );
-                //每隔几天
-            } else if (item.periodType == 2) {
-                let oneDay = 86400000;
-                // 第一天重合
-                if (this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf() == 0 || item.periodValue == 0) {
-                    return true;
-                } else {
-                    return (
-                        this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
-                        this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
-                        ((this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf()) / oneDay) %
-                            (Number(item.periodValue) + 1) ==
-                            0
-                    );
-                }
+    calendarData: {
+      type: Array,
+      default: () => []
+    },
+    findUser: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data () {
+    return {
+      currentUsers: ''
+    };
+  },
+  methods: {
+    addItem (itemTime, item, distinguish, currentUsers, recordId) {
+      debugger
+      new Promise((resolve) => {
+        this.$store.dispatch('addPopup', {
+          url: '/patrolManagement/popups/weekEditAdd.vue',
+          width: '450px',
+          height: '370px',
+          props: {
+            callback: resolve,
+            findUser: this.findUser,
+            dateDe: itemTime,
+            item: item,
+            distinguish: distinguish,
+            recordId: recordId,
+            currentUsers: currentUsers
+          },
+          title: '排班'
+        });
+      }).then(() => {
+        this.$emit('getList', {
+          startTime: `${this.timeObj.monday} 00:00:00`,
+          endTime: `${this.timeObj.sunday} 23:59:59`
+        });
+      });
+    },
+    // addItem(itemTime, item) {
+    //     new Promise((resolve) => {
+    //         this.$store.dispatch('addPopup', {
+    //             url: '/patrolManagement/popups/weekEditAdd.vue',
+    //             width: '450px',
+    //             height: '300px',
+    //             props: {
+    //                 callback: resolve,
+    //                 findUser: this.findUser,
+    //                 dateDe: itemTime,
+    //                 item: item
+    //             },
+    //             title: '排班'
+    //         });
+    //     }).then(() => {
+    //         this.$emit('getList', {
+    //             startTime: `${this.timeObj.monday} 00:00:00`,
+    //             endTime: `${this.timeObj.sunday} 23:59:59`
+    //         });
+    //     });
+    // },
+    //对比 现在时间 选择的时间至灰处理
+    resultTime (tis, item) {
+      let thisTime = this.$moment().format('YYYY-MM-DD') + ' 00:00:00';
+      let itemTime = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
+      return this.$moment(thisTime).valueOf() > this.$moment(itemTime).valueOf();
+    },
+    intersectionDay (tis, item, index) {
+      let startDate = this.$moment(item.startDate).format('YYYY-MM-DD HH:mm:ss');
+      let endDate = this.$moment(item.endDate).format('YYYY-MM-DD HH:mm:ss');
+      let thisDate = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
+      let vra = item.periodValue.split(',').sort();
+      //每周几
+      if (item.periodType == 1) {
+        return (
+          this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
+          this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
+          vra.includes(vra[index])
+        );
+        //每隔几天
+      } else if (item.periodType == 2) {
+        let oneDay = 86400000;
+        // 第一天重合
+        if (this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf() == 0 || item.periodValue == 0) {
+          return true;
+        } else {
+          return (
+            this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
+            this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
+            ((this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf()) / oneDay) %
+            (Number(item.periodValue) + 1) ==
+            0
+          );
+        }
+      }
+    },
+    // 对比已设置内容
+    matchingTime (tis, item) {
+      let objs = {
+        isActive: false
+      };
+      this.calendarData.map((items) => {
+        if (tis == items.partrolDate) {
+          items.rosterUserDtos.map((isv, index) => {
+            // console.log('4444', items.rosterUserDtos);
+            if (items.rosterUserDtos.length == (index + 1)) {
+              //   console.log('444', isv.currentUsers)
+              this.currentUsers = isv.currentUsers;
             }
-        },
-        // 对比已设置内容
-        matchingTime(tis, item) {
-            let objs = {
-                isActive: false
-            };
-            this.calendarData.map((items) => {
-                if (tis == items.partrolDate) {
-                    items.rosterUserDtos.map((isv) => {
-                        if (isv.id == item.id && isv.partrolTime == item.times) {
-                            objs.isActive = true;
-                            Object.assign(objs, isv);
-                        }
-                    });
-                }
-            });
-            return objs;
-        },
-        keyValues(index) {
-            if (index == 0) {
-                return this.timeObj.monday;
-            } else if (index == 1) {
-                return this.timeObj.tuesday;
-            } else if (index == 2) {
-                return this.timeObj.wednesday;
-            } else if (index == 3) {
-                return this.timeObj.thursday;
-            } else if (index == 4) {
-                return this.timeObj.friday;
-            } else if (index == 5) {
-                return this.timeObj.saturday;
-            } else if (index == 6) {
-                return this.timeObj.sunday;
+            if (isv.id == item.id && isv.partrolTime == item.times) {
+              objs.isActive = true;
+              Object.assign(objs, isv);
             }
+          });
         }
+      });
+      return objs;
+    },
+    // matchingTime (tis, item) {
+    //   let objs = {
+    //     isActive: false
+    //   };
+    //   this.calendarData.map((items) => {
+    //     if (tis == items.partrolDate) {
+    //       items.rosterUserDtos.map((isv) => {
+    //         if (isv.id == item.id && isv.partrolTime == item.times) {
+    //           objs.isActive = true;
+    //           Object.assign(objs, isv);
+    //         }
+    //       });
+    //     }
+    //   });
+    //   console.log('数据', objs)
+    //   return objs;
+    // },
+    keyValues (index) {
+      if (index == 0) {
+        return this.timeObj.monday;
+      } else if (index == 1) {
+        return this.timeObj.tuesday;
+      } else if (index == 2) {
+        return this.timeObj.wednesday;
+      } else if (index == 3) {
+        return this.timeObj.thursday;
+      } else if (index == 4) {
+        return this.timeObj.friday;
+      } else if (index == 5) {
+        return this.timeObj.saturday;
+      } else if (index == 6) {
+        return this.timeObj.sunday;
+      }
     }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 214 - 150
operationSupport/src/views/patrolManagement/patrolRoute.vue

@@ -1,52 +1,116 @@
 <template>
-    <div class="main">
-        <template v-if="isLook === 'index'">
-            <div class="search">
-                <el-input placeholder="请输入巡更点名称" class="search-input" clearable v-model="mixins_query.route_name"></el-input>
-                <el-select v-model="mixins_query.communityId" placeholder="请选择所属社区" clearable>
-                    <el-option v-for="(item, index) in communityArr" :key="index" :label="item.communityName" :value="item.id"></el-option>
-                </el-select>
-                <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询</el-button>
+  <div class="main">
+    <template v-if="isLook === 'index'">
+      <div class="search">
+        <el-input
+          placeholder="请输入巡更点名称"
+          class="search-input"
+          clearable
+          v-model="mixins_query.route_name"
+        ></el-input>
+        <el-select
+          v-model="mixins_query.communityId"
+          placeholder="请选择所属社区"
+          clearable
+        >
+          <el-option
+            v-for="(item, index) in communityArr"
+            :key="index"
+            :label="item.communityName"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+        <el-button
+          type="primary"
+          class="search-btn"
+          @click="mixins_search"
+          icon="el-icon-search"
+        >查询</el-button>
 
-                <div class="search-icon">
-                    <el-tooltip class="item" effect="light" placement="bottom" content="排班">
-                        <i class="zoniot_font zoniot-icon-piliangshenhe" @click="weekEdit()"></i>
-                    </el-tooltip>
-                    <el-tooltip class="item" effect="light" placement="bottom" content="新增">
-                        <i class="zoniot_font zoniot-icon-tianjia2" @click="add()"></i>
-                    </el-tooltip>
-                </div>
-            </div>
-            <zz-table
-                :cols="cols"
-                :settings="{ showIndex: true, stripe: true }"
-                :loading="mixins_onQuery"
-                :data="mixins_list"
-                :pageset="mixins_pageset"
-                @page-change="pageChange"
+        <div class="search-icon">
+          <el-tooltip
+            class="item"
+            effect="light"
+            placement="bottom"
+            content="排班"
+          >
+            <i
+              class="zoniot_font zoniot-icon-piliangshenhe"
+              @click="weekEdit()"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            class="item"
+            effect="light"
+            placement="bottom"
+            content="新增"
+          >
+            <i
+              class="zoniot_font zoniot-icon-tianjia2"
+              @click="add()"
+            ></i>
+          </el-tooltip>
+        </div>
+      </div>
+      <zz-table
+        :cols="cols"
+        :settings="{ showIndex: true, stripe: true }"
+        :loading="mixins_onQuery"
+        :data="mixins_list"
+        :pageset="mixins_pageset"
+        @page-change="pageChange"
+      >
+        <template
+          slot-scope="scope"
+          slot="startDate"
+        >
+          {{ checkDateType(scope.row.startDate) }}{{ '至' + checkDateType(scope.row.endDate) }}</template>
+        <template
+          slot-scope="scope"
+          slot="periodValue"
+        >{{scope.row.periodType == 1 ? `每周${periodValueType(scope.row.periodValue)}` : scope.row.periodValue == 0 ? `每天` : `每隔${scope.row.periodValue}天`}}</template>
+        <template
+          slot-scope="scope"
+          slot="opt"
+        >
+          <div class="opt">
+            <el-tooltip
+              effect="light"
+              placement="bottom"
+              content="排班"
             >
-                <template slot-scope="scope" slot="startDate">
-                    {{ checkDateType(scope.row.startDate) }}{{ '至' + checkDateType(scope.row.endDate) }}</template
-                >
-                <template slot-scope="scope" slot="periodValue">{{
-                    scope.row.periodType == 1 ? `每周${periodValueType(scope.row.periodValue)}` : `每隔${scope.row.periodValue}天`
-                }}</template>
-                <template slot-scope="scope" slot="opt">
-                    <div class="opt">
-                        <el-tooltip effect="light" placement="bottom" content="排班">
-                            <i class="zoniot_font zoniot-icon-shenhe" @click="schedulingEdit(scope.row)"></i>
-                        </el-tooltip>
-                        <el-tooltip effect="light" placement="bottom" content="删除">
-                            <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
-                        </el-tooltip>
-                    </div>
-                </template>
-            </zz-table>
+              <i
+                class="zoniot_font zoniot-icon-shenhe"
+                @click="schedulingEdit(scope.row)"
+              ></i>
+            </el-tooltip>
+            <el-tooltip
+              effect="light"
+              placement="bottom"
+              content="删除"
+            >
+              <i
+                class="zoniot_font zoniot-icon-shanchu redText"
+                @click="deleteOne(scope.row.id)"
+              ></i>
+            </el-tooltip>
+          </div>
         </template>
-        <scheduling v-if="isLook === 'schedu'" @initPage="initPage"></scheduling>
-        <add-patrol v-if="isLook === 'patrol'" @initPage="initPage"></add-patrol>
-        <week-edit-page v-if="isLook === 'weekEd'" @initPage="initPage"></week-edit-page>
-    </div>
+      </zz-table>
+    </template>
+    <scheduling
+      v-if="isLook === 'schedu'"
+      @initPage="initPage"
+    ></scheduling>
+    <add-patrol
+      v-if="isLook === 'patrol'"
+      @initPage="initPage"
+    ></add-patrol>
+    <week-edit-page
+      v-if="isLook === 'weekEd'"
+      @initPage="initPage"
+    ></week-edit-page>
+  </div>
 </template>
 
 <script>
@@ -55,121 +119,121 @@ import scheduling from './popups/scheduling.vue';
 import addPatrol from './popups/addPatrol.vue';
 import weekEditPage from './popups/weekEdit.vue';
 export default {
-    mixins: [list],
-    name: 'patrolManagement',
-    components: {
-        scheduling,
-        addPatrol,
-        weekEditPage
-    },
-    data() {
-        let _this = this;
-        return {
-            isLook: 'index', // index , schedu,patrol 主页 日历 添加
-            communityArr: [],
-            cols: [
-                {
-                    label: '所属社区',
-                    prop: 'communityName'
-                },
-                {
-                    label: '巡更路线',
-                    prop: 'routeName'
-                },
-                {
-                    label: '巡更日期',
-                    prop: 'startDate',
-                    slot: 'startDate'
-                },
-                {
-                    label: '巡更时间',
-                    prop: 'timePeriod'
-                },
-                {
-                    label: '巡更周期',
-                    prop: 'periodValue',
-                    slot: 'periodValue'
-                },
-
-                {
-                    label: '操作',
-                    prop: 'id',
-                    slot: 'opt'
-                }
-            ],
-            findUser: [],
-            thisObj: {},
-            mixins_post: 'post'
-        };
-    },
-    created() {
-        this.getorgTree();
-        this.mixins_dataUrl = '/sc-community/patrolRoute/page';
-        this.mixins_query = {};
-        this.mixins_search();
-        this.getUserList();
-    },
-    mounted() {},
-    methods: {
-        deleteOne(id) {
-            this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
-                .then(() => {
-                    this.$http.get('/sc-community/patrolRoute/delete', { id: id }).then(({ status, data, msg }) => {
-                        if (0 === status) {
-                            this.$message({
-                                type: 'success',
-                                message: '删除成功!'
-                            });
-                            this.mixins_search();
-                        }
-                    });
-                })
-                .catch(() => {});
+  mixins: [list],
+  name: 'patrolManagement',
+  components: {
+    scheduling,
+    addPatrol,
+    weekEditPage
+  },
+  data () {
+    let _this = this;
+    return {
+      isLook: 'index', // index , schedu,patrol 主页 日历 添加
+      communityArr: [],
+      cols: [
+        {
+          label: '所属社区',
+          prop: 'communityName'
         },
-        getorgTree() {
-            this.$http
-                .get('/sc-community/assets/community/list')
-                .then((data) => {
-                    this.communityArr = data.data;
-                    this.$store.commit('setAreaSelect', data.data);
-                })
-
-                .catch(function () {});
+        {
+          label: '巡更路线',
+          prop: 'routeName'
         },
-        getUserList() {
-            this.$http.get('/sc-user-center/user/findUserList').then(({ data, status, msg }) => {
-                this.findUser = data;
-            });
+        {
+          label: '巡更日期',
+          prop: 'startDate',
+          slot: 'startDate'
         },
-        add() {
-            this.isLook = 'patrol';
+        {
+          label: '巡更时间',
+          prop: 'timePeriod'
         },
-        schedulingEdit(row) {
-            this.thisObj = row;
-            this.isLook = 'schedu';
+        {
+          label: '巡更周期',
+          prop: 'periodValue',
+          slot: 'periodValue'
         },
-        weekEdit() {
-            this.isLook = 'weekEd';
-        },
-        initPage() {
-            this.isLook = 'index';
-            this.thisObj = {};
-            this.mixins_search();
-        },
-        periodValueType(value) {
-            if (!!value) {
-                return value.split(',').sort().toString();
-            }
-            return '--';
-        },
-        checkDateType(time) {
-            return !!time ? this.$moment(new Date(time)).format('YYYY-MM-DD') : '--';
+
+        {
+          label: '操作',
+          prop: 'id',
+          slot: 'opt'
         }
+      ],
+      findUser: [],
+      thisObj: {},
+      mixins_post: 'post'
+    };
+  },
+  created () {
+    this.getorgTree();
+    this.mixins_dataUrl = '/sc-community/patrolRoute/page';
+    this.mixins_query = {};
+    this.mixins_search();
+    this.getUserList();
+  },
+  mounted () { },
+  methods: {
+    deleteOne (id) {
+      this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
+        .then(() => {
+          this.$http.get('/sc-community/patrolRoute/delete', { id: id }).then(({ status, data, msg }) => {
+            if (0 === status) {
+              this.$message({
+                type: 'success',
+                message: '删除成功!'
+              });
+              this.mixins_search();
+            }
+          });
+        })
+        .catch(() => { });
+    },
+    getorgTree () {
+      this.$http
+        .get('/sc-community/assets/community/list')
+        .then((data) => {
+          this.communityArr = data.data;
+          this.$store.commit('setAreaSelect', data.data);
+        })
+
+        .catch(function () { });
+    },
+    getUserList () {
+      this.$http.get('/sc-user-center/user/findUserList').then(({ data, status, msg }) => {
+        this.findUser = data;
+      });
+    },
+    add () {
+      this.isLook = 'patrol';
+    },
+    schedulingEdit (row) {
+      this.thisObj = row;
+      this.isLook = 'schedu';
+    },
+    weekEdit () {
+      this.isLook = 'weekEd';
+    },
+    initPage () {
+      this.isLook = 'index';
+      this.thisObj = {};
+      this.mixins_search();
+    },
+    periodValueType (value) {
+      if (!!value) {
+        return value.split(',').sort().toString();
+      }
+      return '--';
+    },
+    checkDateType (time) {
+      return !!time ? this.$moment(new Date(time)).format('YYYY-MM-DD') : '--';
     }
+  }
 };
 </script>
 <style scoped lang='scss'>
-.main{
+.main {
     height: 100%;
 }
 </style>

+ 311 - 274
operationSupport/src/views/patrolManagement/popups/scheduling.vue

@@ -1,295 +1,332 @@
 <template>
-    <div class="scheduling">
-        <div class="search">
-            <el-date-picker
-                v-model="monthValue"
-                value-format="yyyy-MM-dd"
-                type="month"
-                placeholder="选择时间"
-                :clearable="false"
-            ></el-date-picker>
-            <div class="search-icon">
-                <el-tooltip effect="light" placement="bottom" content="批量排班">
-                    <i class="zoniot_font zoniot-icon-piliangshenhe" @click="add()"></i>
-                </el-tooltip>
-                <el-tooltip effect="light" placement="bottom" content="返回">
-                    <i class="zoniot_font zoniot-icon-fanhui" @click="goback()"></i>
-                </el-tooltip>
-            </div>
-        </div>
-        <el-calendar first-day-of-week="7" v-model="monthValue">
-            <template slot="dateCell" slot-scope="{ date, data }" v-if="data.type === 'current-month'">
-                <div class="showDateDay">{{ date | dateNewType }}</div>
-                <div class="schedulingUser">
-                    <template v-for="(item, index) in calendarData">
-                        <div :key="index" v-if="data.day == item.partrolDate">
-                            <template v-for="(itx, inxs) in item.rosterUserDtos">
-                                <div :key="inxs" class="listTime" v-if="thisDayOfStaDay(data)">
-                                    <span>{{ itx.partrolTime }}</span>
-                                    <span>{{ itx.partolName }}</span>
-                                </div>
-                            </template>
-                            <template
-                                v-if="
+  <div class="scheduling">
+    <div class="search">
+      <el-date-picker
+        v-model="monthValue"
+        value-format="yyyy-MM-dd"
+        type="month"
+        placeholder="选择时间"
+        :clearable="false"
+      ></el-date-picker>
+      <div class="search-icon">
+        <el-tooltip
+          effect="light"
+          placement="bottom"
+          content="批量排班"
+        >
+          <i
+            class="zoniot_font zoniot-icon-piliangshenhe"
+            @click="add()"
+          ></i>
+        </el-tooltip>
+        <el-tooltip
+          effect="light"
+          placement="bottom"
+          content="返回"
+        >
+          <i
+            class="zoniot_font zoniot-icon-fanhui"
+            @click="goback()"
+          ></i>
+        </el-tooltip>
+      </div>
+    </div>
+    <el-calendar
+      first-day-of-week="7"
+      v-model="monthValue"
+    >
+      <template
+        slot="dateCell"
+        slot-scope="{ date, data }"
+        v-if="data.type === 'current-month'"
+      >
+        <div class="showDateDay">{{ date | dateNewType }}</div>
+        <div class="schedulingUser">
+          <template v-for="(item, index) in calendarData">
+            <div
+              :key="index"
+              v-if="data.day == item.partrolDate"
+            >
+              <template v-for="(itx, inxs) in item.rosterUserDtos">
+                <div
+                  :key="inxs"
+                  class="listTime"
+                  v-if="thisDayOfStaDay(data)"
+                >
+                  <span>{{ itx.partrolTime }}</span>
+                  <span>{{ itx.partolName }}</span>
+                </div>
+              </template>
+              <template v-if="
                                     date.getTime() <= $moment(zeroTetracosa(thisObj.endDate)).valueOf() &&
                                     thisTimeFF(data, item.rosterUserDtos)
-                                "
-                            >
-                                <!-- 每周那几天 -->
-                                <span v-if="thisObj.periodType == 1">
-                                    <template
-                                        v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '') && thisDayOfStaDay(data)"
-                                    >
-                                        <div class="pointSet" @click="addItem(date, data, item)">点击设置</div>
-                                    </template>
-                                </span>
-                                <!-- 每隔N天 -->
-                                <span v-else>
-                                    <template v-if="timeAddDay(thisObj, thisObj.periodValue, data)">
-                                        <div class="pointSet" @click="addItem(date, data, item)">点击设置</div>
-                                    </template>
-                                </span>
-                            </template>
-                        </div>
-                    </template>
-                    <!-- 时间范围内且没有排班 -->
-                    <template
-                        v-if="
+                                ">
+                <!-- 每周那几天 -->
+                <span v-if="thisObj.periodType == 1">
+                  <template v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '') && thisDayOfStaDay(data)">
+                    <div
+                      class="pointSet"
+                      @click="addItem(date, data, item,1)"
+                    >点击设置</div>
+                  </template>
+                </span>
+                <!-- 每隔N天 -->
+                <span v-else>
+                  <template v-if="timeAddDay(thisObj, thisObj.periodValue, data)">
+                    <div
+                      class="pointSet"
+                      @click="addItem(date, data, item,2)"
+                    >点击设置</div>
+                  </template>
+                </span>
+              </template>
+            </div>
+          </template>
+          <!-- 时间范围内且没有排班 -->
+          <template v-if="
                             date.getTime() <= $moment(zeroTetracosa(thisObj.endDate)).valueOf() &&
                             thisTimeNull(data, thisObj.timePeriod) &&
                             !trueArr.includes(data.day)
-                        "
-                    >
-                        <!-- 每周那几天 -->
-                        <span v-if="thisObj.periodType == 1">
-                            <template v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '') && thisDayOfStaDay(data)">
-                                <div class="pointSet" @click="add(data)">点击设置</div>
-                            </template>
-                        </span>
-                        <!-- 每隔N天 -->
-                        <span v-else>
-                            <template v-if="timeAddDay(thisObj, thisObj.periodValue, data)">
-                                <div class="pointSet" @click="add(data)">点击设置</div>
-                            </template>
-                        </span>
-                    </template>
-                </div>
-            </template>
-        </el-calendar>
-    </div>
+                        ">
+            <!-- 每周那几天 -->
+            <span v-if="thisObj.periodType == 1">
+              <template v-if="periodValueType(thisObj.periodValue).includes(date.getDay() + '') && thisDayOfStaDay(data)">
+                <div
+                  class="pointSet"
+                  @click="add(data)"
+                >点击设置</div>
+              </template>
+            </span>
+            <!-- 每隔N天 -->
+            <span v-else>
+              <template v-if="timeAddDay(thisObj, thisObj.periodValue, data)">
+                <div
+                  class="pointSet"
+                  @click="add(data)"
+                >点击设置</div>
+              </template>
+            </span>
+          </template>
+        </div>
+      </template>
+    </el-calendar>
+  </div>
 </template>
 <script>
 export default {
-    data() {
-        return {
-            monthValue: '',
-            findUser: [],
-            thisObj: {},
-            calendarData: [],
-            indexThis: 0,
-            trueArr: [] //已有设置时间集合
-        };
+  data () {
+    return {
+      monthValue: '',
+      findUser: [],
+      thisObj: {},
+      calendarData: [],
+      indexThis: 0,
+      trueArr: [] //已有设置时间集合
+    };
+  },
+  filters: {
+    dateNewType (val) {
+      return val.getDate();
+    }
+  },
+  watch: {
+    monthValue (e) {
+      try {
+        let timeArr = e.split('-');
+        let time = new Date(timeArr[0], Number(timeArr[1]), 0);
+        this.getShiftInformation({
+          patrolRouteId: this.thisObj.id,
+          startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
+          endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
+        });
+      } catch { }
+    }
+  },
+  methods: {
+    zeroTetracosa (val) {
+      if (!!val) {
+        return this.$moment(val).format('YYYY-MM-DD') + ' 23:59:59';
+      }
+      return val;
     },
-    filters: {
-        dateNewType(val) {
-            return val.getDate();
-        }
+    add (dateDe) {
+      let title = '排班',
+        isSingle = true;
+      if (dateDe == undefined) {
+        title = '批量排班';
+        isSingle = false;
+      }
+
+      new Promise((resolve) => {
+        this.$store.dispatch('addPopup', {
+          url: '/patrolManagement/popups/schedulingAdd.vue',
+          width: '450px',
+          height: '300px',
+          props: {
+            callback: resolve,
+            findUser: this.findUser,
+            dateDe,
+            thisObj: this.thisObj,
+            isSingle: isSingle
+          },
+          title: title
+        });
+      }).then(() => {
+        let newTime = this.$moment(this.monthValue).format('YYYY-MM-DD');
+        let timeArr = newTime.split('-');
+        let time = new Date(timeArr[0], Number(timeArr[1]), 0);
+        this.getShiftInformation({
+          patrolRouteId: this.thisObj.id,
+          startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
+          endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
+        });
+      });
     },
-    watch: {
-        monthValue(e) {
-            try {
-                let timeArr = e.split('-');
-                let time = new Date(timeArr[0], Number(timeArr[1]), 0);
-                this.getShiftInformation({
-                    patrolRouteId: this.thisObj.id,
-                    startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
-                    endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
-                });
-            } catch {}
-        }
+    addItem (da, dateDe, onj, index) {
+      console.log('测试', da, dateDe, onj, index)
+      new Promise((resolve) => {
+        this.$store.dispatch('addPopup', {
+          url: '/patrolManagement/popups/schedulingAdd.vue',
+          width: '450px',
+          height: '300px',
+          props: {
+            callback: resolve,
+            findUser: this.findUser,
+            dateDe,
+            onj,
+            index,
+            thisObj: this.thisObj,
+            isSingle: true
+          },
+          title: '排班'
+        });
+      }).then(() => {
+        let newTime = this.$moment(this.monthValue).format('YYYY-MM-DD');
+        let timeArr = newTime.split('-');
+        let time = new Date(timeArr[0], Number(timeArr[1]), 0);
+        this.getShiftInformation({
+          patrolRouteId: this.thisObj.id,
+          startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
+          endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
+        });
+      });
     },
-    methods: {
-        zeroTetracosa(val) {
-            if (!!val) {
-                return this.$moment(val).format('YYYY-MM-DD') + ' 23:59:59';
-            }
-            return val;
-        },
-        add(dateDe) {
-            let title = '排班',
-                isSingle = true;
-            if (dateDe == undefined) {
-                title = '批量排班';
-                isSingle = false;
-            }
-
-            new Promise((resolve) => {
-                this.$store.dispatch('addPopup', {
-                    url: '/patrolManagement/popups/schedulingAdd.vue',
-                    width: '450px',
-                    height: '300px',
-                    props: {
-                        callback: resolve,
-                        findUser: this.findUser,
-                        dateDe,
-                        thisObj: this.thisObj,
-                        isSingle: isSingle
-                    },
-                    title: title
-                });
-            }).then(() => {
-                let newTime = this.$moment(this.monthValue).format('YYYY-MM-DD');
-                let timeArr = newTime.split('-');
-                let time = new Date(timeArr[0], Number(timeArr[1]), 0);
-                this.getShiftInformation({
-                    patrolRouteId: this.thisObj.id,
-                    startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
-                    endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
-                });
-            });
-        },
-        addItem(da, dateDe, onj) {
-            new Promise((resolve) => {
-                this.$store.dispatch('addPopup', {
-                    url: '/patrolManagement/popups/schedulingAdd.vue',
-                    width: '450px',
-                    height: '300px',
-                    props: {
-                        callback: resolve,
-                        findUser: this.findUser,
-                        dateDe,
-                        onj,
-                        thisObj: this.thisObj,
-                        isSingle: true
-                    },
-                    title: '排班'
-                });
-            }).then(() => {
-                let newTime = this.$moment(this.monthValue).format('YYYY-MM-DD');
-                let timeArr = newTime.split('-');
-                let time = new Date(timeArr[0], Number(timeArr[1]), 0);
-                this.getShiftInformation({
-                    patrolRouteId: this.thisObj.id,
-                    startTime: `${timeArr[0]}-${timeArr[1]}-01 00:00:00`,
-                    endTime: `${timeArr[0]}-${timeArr[1]}-${time.getDate()} 23:59:59`
-                });
-            });
-        },
-        goback() {
-            this.$emit('initPage');
-        },
-        initDate(type) {
-            this.monthValue = this.$moment().format(type);
-        },
-        getShiftInformation(obj) {
-            this.$http.post('/sc-community/patrolRoute/getShiftInformation', obj).then(({ data, status, msg }) => {
-                if (!!data) {
-                    this.calendarData = [];
-                    let calendarData = [],
-                        trueArr = [];
-                    for (let inx in data) {
-                        let rosterUserDtos = [];
-                        data[inx].map((item) => {
-                            rosterUserDtos.push({
-                                partrolTime: item.patrolTime,
-                                partolName: item.partolName,
-                                patrolUserId: item.patrolUserId
-                            });
-                        });
-                        trueArr.push(this.$moment(inx).format('YYYY-MM-DD'));
-                        calendarData.push({
-                            partrolDate: this.$moment(inx).format('YYYY-MM-DD'),
-                            rosterUserDtos: rosterUserDtos
-                        });
-                    }
-                    this.calendarData = calendarData;
-                    this.trueArr = trueArr;
-                    this.indexThis = 0;
-                    this.$forceUpdate();
-                }
+    goback () {
+      this.$emit('initPage');
+    },
+    initDate (type) {
+      this.monthValue = this.$moment().format(type);
+    },
+    getShiftInformation (obj) {
+      this.$http.post('/sc-community/patrolRoute/getShiftInformation', obj).then(({ data, status, msg }) => {
+        if (!!data) {
+          this.calendarData = [];
+          let calendarData = [],
+            trueArr = [];
+          for (let inx in data) {
+            let rosterUserDtos = [];
+            data[inx].map((item) => {
+              rosterUserDtos.push({
+                partrolTime: item.patrolTime,
+                partolName: item.partolName,
+                patrolUserId: item.patrolUserId,
+                currentUsers: item.currentUsers,
+              });
             });
-        },
-        periodValueType(value) {
-            if (!!value) {
-                let vra = value.split(',').sort();
-                vra.map((item, index) => {
-                    if (item == 7) {
-                        vra[index] = '0';
-                    }
-                });
-                return vra;
-            }
-            return [];
-        },
-        timeAddDay(val, sunDay, d) {
-            let sum = sunDay || 0;
-            let bb = false;
-            if (!!val && !!sunDay) {
-                if (this.indexThis <= 30) {
-                    this.indexThis++;
-                }
-                let { startDate } = val;
-                let thisD = this.$moment(d.day + ' 00:00:00').valueOf();
-                if (this.thisTimeTypeShow(this.$moment(startDate).valueOf(), Number(sum)).includes(thisD)) {
-                    bb = true;
-                }
-            }
-            return bb;
-        },
-        thisTimeTypeShow(kai, sum) {
-            // 零点计算 sum天得+1
-            let oneDay = 86400000,
-                indU = [];
-            for (let x = 0; x <= 16; x++) {
-                indU.push(kai + x * (sum + 1) * oneDay);
-            }
-            return indU;
-        },
-        thisTimeNull(s, item) {
-            let thisDate = this.$moment(new Date());
-            let sur = false;
-            if (!!item) {
-                let timePot = item.split('-');
-                timePot.map((its) => {
-                    if (this.$moment(`${s.day} ${its}:00`).valueOf() > thisDate.valueOf()) {
-                        sur = true;
-                        return sur;
-                    }
-                });
-            }
-
-            return sur;
-        },
-        thisDayOfStaDay(data) {
-            let startDate = this.$moment(this.thisObj.startDate).valueOf();
-            let thisDate = this.$moment(data.day + ' 00:00:00').valueOf();
-            return startDate <= thisDate;
-        },
-        thisTimeFF(s, arr) {
-            let thisDate = this.$moment(new Date());
-            let sur = false;
-            arr.map((item, index) => {
-                let timePot = item.partrolTime.split('-');
-                timePot.map((its) => {
-                    if (this.$moment(`${s.day} ${its}:00`).valueOf() > thisDate.valueOf()) {
-                        sur = true;
-                        return sur;
-                    }
-                });
-                return sur;
+            trueArr.push(this.$moment(inx).format('YYYY-MM-DD'));
+            calendarData.push({
+              partrolDate: this.$moment(inx).format('YYYY-MM-DD'),
+              rosterUserDtos: rosterUserDtos
             });
-            return sur;
+          }
+          this.calendarData = calendarData;
+          this.trueArr = trueArr;
+          this.indexThis = 0;
+          this.$forceUpdate();
         }
+      });
     },
-    created() {
-        this.initDate('YYYY-MM-DD');
+    periodValueType (value) {
+      if (!!value) {
+        let vra = value.split(',').sort();
+        vra.map((item, index) => {
+          if (item == 7) {
+            vra[index] = '0';
+          }
+        });
+        return vra;
+      }
+      return [];
     },
-    mounted() {
-        this.findUser = this.$parent.findUser;
-        this.thisObj = this.$parent.thisObj;
-        this.thisObj.periodType == 1;
-        this.$el.querySelector('div.el-calendar__header').remove();
+    timeAddDay (val, sunDay, d) {
+      let sum = sunDay || 0;
+      let bb = false;
+      if (!!val && !!sunDay) {
+        if (this.indexThis <= 30) {
+          this.indexThis++;
+        }
+        let { startDate } = val;
+        let thisD = this.$moment(d.day + ' 00:00:00').valueOf();
+        if (this.thisTimeTypeShow(this.$moment(startDate).valueOf(), Number(sum)).includes(thisD)) {
+          bb = true;
+        }
+      }
+      return bb;
+    },
+    thisTimeTypeShow (kai, sum) {
+      // 零点计算 sum天得+1
+      let oneDay = 86400000,
+        indU = [];
+      for (let x = 0; x <= 16; x++) {
+        indU.push(kai + x * (sum + 1) * oneDay);
+      }
+      return indU;
+    },
+    thisTimeNull (s, item) {
+      let thisDate = this.$moment(new Date());
+      let sur = false;
+      if (!!item) {
+        let timePot = item.split('-');
+        timePot.map((its) => {
+          if (this.$moment(`${s.day} ${its}:00`).valueOf() > thisDate.valueOf()) {
+            sur = true;
+            return sur;
+          }
+        });
+      }
+
+      return sur;
+    },
+    thisDayOfStaDay (data) {
+      let startDate = this.$moment(this.thisObj.startDate).valueOf();
+      let thisDate = this.$moment(data.day + ' 00:00:00').valueOf();
+      return startDate <= thisDate;
+    },
+    thisTimeFF (s, arr) {
+      let thisDate = this.$moment(new Date());
+      let sur = false;
+      arr.map((item, index) => {
+        let timePot = item.partrolTime.split('-');
+        timePot.map((its) => {
+          if (this.$moment(`${s.day} ${its}:00`).valueOf() > thisDate.valueOf()) {
+            sur = true;
+            return sur;
+          }
+        });
+        return sur;
+      });
+      return sur;
     }
+  },
+  created () {
+    this.initDate('YYYY-MM-DD');
+  },
+  mounted () {
+    this.findUser = this.$parent.findUser;
+    this.thisObj = this.$parent.thisObj;
+    this.thisObj.periodType == 1;
+    this.$el.querySelector('div.el-calendar__header').remove();
+  }
 };
 </script>
 <style scoped lang='scss'>

+ 176 - 154
operationSupport/src/views/patrolManagement/popups/schedulingAdd.vue

@@ -1,164 +1,186 @@
 <template>
-    <el-form class="timeNewStyle" label-width="100px" :model="formData" :rules="formRules" ref="formRu">
-        <el-form-item label="巡更日期" v-if="!params.isSingle" prop="partrolDate">
-            <el-date-picker
-                v-model="formData.partrolDate"
-                value-format="yyyy-MM-dd"
-                type="daterange"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-                :picker-options="pickerOptions"
-            ></el-date-picker>
-        </el-form-item>
-        <el-form-item label="巡更日期" v-else>{{ thisDay.day | dateText }}</el-form-item>
-        <template v-for="(item, index) in timePeriod">
-            <el-form-item :label="item.partrolTime" :key="index">
-                <el-cascader
-                    :ref="`userName`"
-                    v-model="item.partolUserId"
-                    :props="defaultProps"
-                    :options="findUser"
-                    @change="findUserToggle(index)"
-                ></el-cascader>
-            </el-form-item>
-        </template>
-    </el-form>
+  <el-form
+    class="timeNewStyle"
+    label-width="100px"
+    :model="formData"
+    :rules="formRules"
+    ref="formRu"
+  >
+    <el-form-item
+      label="巡更日期33"
+      v-if="!params.isSingle"
+      prop="partrolDate"
+    >
+      <el-date-picker
+        v-model="formData.partrolDate"
+        value-format="yyyy-MM-dd"
+        type="daterange"
+        start-placeholder="开始日期"
+        end-placeholder="结束日期"
+        :picker-options="pickerOptions"
+      ></el-date-picker>
+    </el-form-item>
+    <el-form-item
+      label="巡更日期44"
+      v-else
+    >{{ thisDay.day | dateText }}</el-form-item>
+    <template v-for="(item, index) in timePeriod">
+      <el-form-item
+        :label="item.partrolTime"
+        :key="index"
+      >
+        <el-cascader
+          :ref="`userName`"
+          v-model="item.partolUserId"
+          :props="defaultProps"
+          :options="findUser"
+          @change="findUserToggle(index)"
+        ></el-cascader>
+      </el-form-item>
+    </template>
+  </el-form>
 </template>
 <script>
 export default {
-    props: ['params'],
-    data() {
-        const _this = this;
-        return {
-            timePeriod: [],
-            findUser: [],
-            thisDay: {},
-            defaultProps: {
-                value: 'id', // 唯一标识
-                label: 'label', // 标签显示
-                children: 'children',
-                multiple: true,
-                emitPath: false
-            },
-            formData: {
-                partrolDate: []
-            },
-            formRules: {
-                partrolDate: [this.$valid.selectRequired('时间段')]
-            },
-            pickerOptions: {
-                disabledDate(time) {
-                    // console.log(_this.$moment(_this.params.thisObj.startDate).format('YYYY-MM-DD'));
-                    let startDate = _this.$moment(_this.params.thisObj.startDate).valueOf();
-                    let endDate = _this.$moment(_this.params.thisObj.endDate).valueOf();
-                    return time.getTime() > endDate || time.getTime() < startDate;
-                }
-            }
-        };
-    },
-    filters: {
-        dateText(va) {
-            if (!!va) {
-                let timeAr = va.split('-');
-                return `${timeAr[0]}年${timeAr[1]}月${timeAr[2]}日`;
-            } else {
-                return '';
-            }
+  props: ['params'],
+  data () {
+    const _this = this;
+    return {
+      timePeriod: [],
+      findUser: [],
+      thisDay: {},
+      defaultProps: {
+        value: 'id', // 唯一标识
+        label: 'label', // 标签显示
+        children: 'children',
+        multiple: true,
+        emitPath: false
+      },
+      formData: {
+        partrolDate: []
+      },
+      formRules: {
+        partrolDate: [this.$valid.selectRequired('时间段')]
+      },
+      pickerOptions: {
+        disabledDate (time) {
+          // console.log(_this.$moment(_this.params.thisObj.startDate).format('YYYY-MM-DD'));
+          let startDate = _this.$moment(_this.params.thisObj.startDate).valueOf();
+          let endDate = _this.$moment(_this.params.thisObj.endDate).valueOf();
+          return time.getTime() > endDate || time.getTime() < startDate;
         }
+      }
+    };
+  },
+  filters: {
+    dateText (va) {
+      if (!!va) {
+        let timeAr = va.split('-');
+        return `${timeAr[0]}年${timeAr[1]}月${timeAr[2]}日`;
+      } else {
+        return '';
+      }
+    }
+  },
+  methods: {
+    findUserToggle (index) {
+      // let thisObj = this.$refs[`userName${index}`][0].getCheckedNodes()[0];
+      // this.timePeriod[index].partolName = thisObj.label;
     },
-    methods: {
-        findUserToggle(index) {
-            // let thisObj = this.$refs[`userName${index}`][0].getCheckedNodes()[0];
-            // this.timePeriod[index].partolName = thisObj.label;
-        },
-        submit() {
-            let selectAll = this.$refs[`userName`];
-            let rosterUserDtos = [];
-            selectAll.map((item, index) => {
-                let partolNames = [],
-                    partolUserIds = [];
-                item.getCheckedNodes().map((items) => {
-                    if (items.level !== 1 && items.children.length == 0) {
-                        partolNames.push(items.label);
-                        partolUserIds.push(items.value);
-                    }
-                });
-                rosterUserDtos.push({
-                    partolName: partolNames.join(','),
-                    partolUserId: partolUserIds.join(','),
-                    partrolTime: this.timePeriod[index].partrolTime
-                });
-            });
-            if (!this.params.isSingle) {
-                this.$refs['formRu'].validate((valid) => {
-                    if (valid) {
-                        this.add(rosterUserDtos);
-                    }
-                });
-            } else {
-                this.add(rosterUserDtos);
-            }
-        },
-        add(rosterUserDtos) {
-            let data = this.params.thisObj;
-            let initData = {
-                communityId: data.communityId,
-                patrolRouteId: data.id,
-                periodType: data.periodType,
-                periodValue: data.periodValue,
-                // rosterUserDtos: this.timePeriod,
-                rosterUserDtos: rosterUserDtos,
-                partrolDate: this.thisDay.day,
-                startDate: data.startDate,
-                endDate: data.endDate
-            };
-            if (!this.params.isSingle) {
-                initData.partrolDate = this.formData.partrolDate[0];
-                initData.partrolEndDate = this.formData.partrolDate[1];
-            }
-            var loading = this.$loading();
-            this.$http
-                .post('/sc-community/patrolRoute/roster', initData)
-                .then(({ data, status, msg }) => {
-                    if (status == 0) {
-                        this.$message.success(msg);
-                        this.params.callback();
-                        this.$emit('close');
-                    } else {
-                        this.$message.error(msg);
-                    }
-                    loading.close();
-                })
-                .catch(() => {
-                    loading.close();
-                });
-        }
+    submit () {
+      let selectAll = this.$refs[`userName`];
+      let rosterUserDtos = [];
+      selectAll.map((item, index) => {
+        let partolNames = [],
+          partolUserIds = [];
+        item.getCheckedNodes().map((items) => {
+          if (items.level !== 1 && items.children.length == 0) {
+            partolNames.push(items.label);
+            partolUserIds.push(items.value);
+          }
+        });
+        rosterUserDtos.push({
+          partolName: partolNames.join(','),
+          partolUserId: partolUserIds.join(','),
+          partrolTime: this.timePeriod[index].partrolTime
+        });
+      });
+      if (!this.params.isSingle) {
+        this.$refs['formRu'].validate((valid) => {
+          if (valid) {
+            this.add(rosterUserDtos);
+          }
+        });
+      } else {
+        this.add(rosterUserDtos);
+      }
     },
-    created() {
-        this.findUser = this.params.findUser;
-        if (!!this.params.dateDe) {
-            this.thisDay = this.params.dateDe;
-        }
-        if (!!this.params.onj) {
-            this.params.onj.rosterUserDtos.map((item) => {
-                this.timePeriod.push({
-                    partolName: item.partolName,
-                    partolUserId: item.patrolUserId,
-                    partrolTime: item.partrolTime
-                });
-            });
-        } else if (!!this.params.thisObj) {
-            let arrs = this.params.thisObj.timePeriod.split(',');
-            arrs.map((item) => {
-                this.timePeriod.push({
-                    partolName: '',
-                    partolUserId: '',
-                    partrolTime: item
-                });
-            });
-        }
-    },
-    mounted() {}
+    add (rosterUserDtos) {
+      let data = this.params.thisObj;
+      let initData = {
+        communityId: data.communityId,
+        patrolRouteId: data.id,
+        periodType: data.periodType,
+        periodValue: data.periodValue,
+        // rosterUserDtos: this.timePeriod,
+        rosterUserDtos: rosterUserDtos,
+        partrolDate: this.thisDay.day,
+        startDate: data.startDate,
+        endDate: data.endDate
+      };
+      if (!this.params.isSingle) {
+        initData.partrolDate = this.formData.partrolDate[0];
+        initData.partrolEndDate = this.formData.partrolDate[1];
+      }
+      var loading = this.$loading();
+      this.$http
+        .post('/sc-community/patrolRoute/roster', initData)
+        .then(({ data, status, msg }) => {
+          if (status == 0) {
+            this.$message.success(msg);
+            this.params.callback();
+            this.$emit('close');
+          } else {
+            this.$message.error(msg);
+          }
+          loading.close();
+        })
+        .catch(() => {
+          loading.close();
+        });
+    }
+  },
+  created () {
+    this.findUser = this.params.findUser;
+    if (!!this.params.dateDe) {
+      this.thisDay = this.params.dateDe;
+    }
+    if (!!this.params.onj) {
+      let resList;
+      if (this.params.index == 1) {
+        resList = (this.params.onj.rosterUserDtos[0].currentUsers).split(',');
+      }
+      this.params.onj.rosterUserDtos.map((item) => {
+        this.timePeriod.push({
+          partolName: item.partolName,
+          //   partolUserId: item.patrolUserId,
+          partolUserId: resList,
+          partrolTime: item.partrolTime
+        });
+      });
+    } else if (!!this.params.thisObj) {
+      let arrs = this.params.thisObj.timePeriod.split(',');
+      arrs.map((item) => {
+        this.timePeriod.push({
+          partolName: '',
+          partolUserId: '',
+          partrolTime: item
+        });
+      });
+    }
+
+  },
+  mounted () { }
 };
 </script>
 <style scoped lang='scss'>

+ 151 - 137
operationSupport/src/views/patrolManagement/popups/weekEdit.vue

@@ -1,154 +1,168 @@
 <template>
-    <div class="scheduling">
-        <div class="search">
-            <el-date-picker
-                v-model="monthValue"
-                value-format="yyyy-MM-dd"
-                format="yyyy 年 第 WW 周"
-                :picker-options="{ firstDayOfWeek: 1 }"
-                type="week"
-                placeholder="选择周"
-                :clearable="false"
-                @change="weekChange"
-            ></el-date-picker>
-            <div class="search-icon">
-                <el-tooltip effect="light" placement="bottom" content="返回">
-                    <i class="zoniot_font zoniot-icon-fanhui" @click="goback()"></i>
-                </el-tooltip>
-            </div>
-        </div>
-        <div class="scheduling-table">
-            <div class="scheduling-table-head">
-                <div class="head-week">周一 {{ $moment(timeObj.monday).format('M/DD') }}</div>
-                <div class="head-week">周二 {{ $moment(timeObj.tuesday).format('M/DD') }}</div>
-                <div class="head-week">周三 {{ $moment(timeObj.wednesday).format('M/DD') }}</div>
-                <div class="head-week">周四 {{ $moment(timeObj.thursday).format('M/DD') }}</div>
-                <div class="head-week">周五 {{ $moment(timeObj.friday).format('M/DD') }}</div>
-                <div class="head-week">周六 {{ $moment(timeObj.saturday).format('M/DD') }}</div>
-                <div class="head-week">周日 {{ $moment(timeObj.sunday).format('M/DD') }}</div>
-            </div>
-            <week-content :timeObj="timeObj" :timeObjArr="timeObjArr" :calendarData="calendarData" :findUser="findUser" @getList="getShiftInformation"></week-content>
-        </div>
+  <div class="scheduling">
+    <div class="search">
+      <el-date-picker
+        v-model="monthValue"
+        value-format="yyyy-MM-dd"
+        format="yyyy 年 第 WW 周"
+        :picker-options="{ firstDayOfWeek: 1 }"
+        type="week"
+        placeholder="选择周"
+        :clearable="false"
+        @change="weekChange"
+      ></el-date-picker>
+      <div class="search-icon">
+        <el-tooltip
+          effect="light"
+          placement="bottom"
+          content="返回"
+        >
+          <i
+            class="zoniot_font zoniot-icon-fanhui"
+            @click="goback()"
+          ></i>
+        </el-tooltip>
+      </div>
     </div>
+    <div class="scheduling-table">
+      <div class="scheduling-table-head">
+        <div class="head-week">周一 {{ $moment(timeObj.monday).format('M/DD') }}</div>
+        <div class="head-week">周二 {{ $moment(timeObj.tuesday).format('M/DD') }}</div>
+        <div class="head-week">周三 {{ $moment(timeObj.wednesday).format('M/DD') }}</div>
+        <div class="head-week">周四 {{ $moment(timeObj.thursday).format('M/DD') }}</div>
+        <div class="head-week">周五 {{ $moment(timeObj.friday).format('M/DD') }}</div>
+        <div class="head-week">周六 {{ $moment(timeObj.saturday).format('M/DD') }}</div>
+        <div class="head-week">周日 {{ $moment(timeObj.sunday).format('M/DD') }}</div>
+      </div>
+      <week-content
+        :timeObj="timeObj"
+        :timeObjArr="timeObjArr"
+        :calendarData="calendarData"
+        :findUser="findUser"
+        @getList="getShiftInformation"
+      ></week-content>
+    </div>
+  </div>
 </template>
 <script>
 import weekContent from '../components/weekContent.vue';
 export default {
-    components: {
-        weekContent
-    },
-    data() {
-        return {
-            monthValue: '',
-            findUser: [],
-            calendarData: [],
-            timeObj: {
-                monday: '',
-                tuesday: '',
-                wednesday: '',
-                thursday: '',
-                friday: '',
-                saturday: '',
-                sunday: ''
-            },
-            timeObjArr: [[], [], [], [], [], [], []]
-        };
-    },
-    filters: {
-        dateNewType(val) {
-            return val.getDate();
-        }
-    },
-    watch: {
-        monthValue(e) {
-            this.timeObj.monday = this.$moment(e).day(1).format('YYYY-MM-DD');
-            this.timeObj.tuesday = this.$moment(e).day(2).format('YYYY-MM-DD');
-            this.timeObj.wednesday = this.$moment(e).day(3).format('YYYY-MM-DD');
-            this.timeObj.thursday = this.$moment(e).day(4).format('YYYY-MM-DD');
-            this.timeObj.friday = this.$moment(e).day(5).format('YYYY-MM-DD');
-            this.timeObj.saturday = this.$moment(e).day(6).format('YYYY-MM-DD');
-            this.timeObj.sunday = this.$moment(e).day(7).format('YYYY-MM-DD');
+  components: {
+    weekContent
+  },
+  data () {
+    return {
+      monthValue: '',
+      findUser: [],
+      calendarData: [],
+      timeObj: {
+        monday: '',
+        tuesday: '',
+        wednesday: '',
+        thursday: '',
+        friday: '',
+        saturday: '',
+        sunday: ''
+      },
+      timeObjArr: [[], [], [], [], [], [], []]
+    };
+  },
+  filters: {
+    dateNewType (val) {
+      return val.getDate();
+    }
+  },
+  watch: {
+    monthValue (e) {
+      this.timeObj.monday = this.$moment(e).day(1).format('YYYY-MM-DD');
+      this.timeObj.tuesday = this.$moment(e).day(2).format('YYYY-MM-DD');
+      this.timeObj.wednesday = this.$moment(e).day(3).format('YYYY-MM-DD');
+      this.timeObj.thursday = this.$moment(e).day(4).format('YYYY-MM-DD');
+      this.timeObj.friday = this.$moment(e).day(5).format('YYYY-MM-DD');
+      this.timeObj.saturday = this.$moment(e).day(6).format('YYYY-MM-DD');
+      this.timeObj.sunday = this.$moment(e).day(7).format('YYYY-MM-DD');
 
-            this.getTaskList({
-                startDate: `${this.timeObj.monday}`,
-                endDate: `${this.timeObj.sunday}`
-            });
-            this.getShiftInformation({
-                startTime: `${this.timeObj.monday} 00:00:00`,
-                endTime: `${this.timeObj.sunday} 23:59:59`
-            });
-        }
+      this.getTaskList({
+        startDate: `${this.timeObj.monday}`,
+        endDate: `${this.timeObj.sunday}`
+      });
+      this.getShiftInformation({
+        startTime: `${this.timeObj.monday} 00:00:00`,
+        endTime: `${this.timeObj.sunday} 23:59:59`
+      });
+    }
+  },
+  methods: {
+    goback () {
+      this.$emit('initPage');
     },
-    methods: {
-        goback() {
-            this.$emit('initPage');
-        },
-        // 获取 已排版
-        getShiftInformation(obj) {
-            this.$http.post('/sc-community/patrolRoute/getShiftInformation', obj).then(({ data, status, msg }) => {
-                if (!!data) {
-                    let calendarData = [];
-                    for (let inx in data) {
-                        let rosterUserDtos = [];
-                        data[inx].map((item) => {
-                            rosterUserDtos.push({
-                                partrolTime: item.patrolTime,
-                                partolName: item.partolName,
-                                id: item.id,
-                                patrolUserId: item.patrolUserId
-                            });
-                        });
-                        calendarData.push({
-                            partrolDate: this.$moment(inx).format('YYYY-MM-DD'),
-                            rosterUserDtos: rosterUserDtos
-                        });
-                    }
-                    this.calendarData = calendarData;
-                    this.$forceUpdate();
-                }
+    // 获取 已排版
+    getShiftInformation (obj) {
+      this.$http.post('/sc-community/patrolRoute/getShiftInformation', obj).then(({ data, status, msg }) => {
+        if (!!data) {
+          let calendarData = [];
+          for (let inx in data) {
+            let rosterUserDtos = [];
+            data[inx].map((item) => {
+              rosterUserDtos.push({
+                partrolTime: item.patrolTime,
+                partolName: item.partolName,
+                id: item.id,
+                patrolUserId: item.patrolUserId,
+                currentUsers: item.currentUsers,
+              });
             });
-        },
-        // 获取周任务
-        getTaskList(obj) {
-            this.timeObjArr = [[], [], [], [], [], [], []];
-            this.$http.post('/sc-community/patrolRoute/list', obj).then(({ data, status, msg }) => {
-                if (!!data) {
-                    data.map((item, index) => {
-                        this.pushTimeRout(item);
-                    });
-                }
-                this.$forceUpdate();
+            calendarData.push({
+              partrolDate: this.$moment(inx).format('YYYY-MM-DD'),
+              rosterUserDtos: rosterUserDtos
             });
-        },
-        // 路线分配
-        pushTimeRout(data) {
-            let thisDay = data.periodValue.split(',').sort();
-            let timePeriod = data.timePeriod.split(',');
-
-            //每周
-            if (data.periodType == 1) {
-                timePeriod.map((items) => {
-                    thisDay.map((item, index) => {
-                        this.timeObjArr[item - 1].push(Object.assign({ times: items }, data));
-                    });
-                });
-            }
-            //每隔几天
-            else if (data.periodType == 2) {
-                timePeriod.map((items) => {
-                    this.timeObjArr.map((item, index) => {
-                        item.push(Object.assign({ times: items }, data));
-                    });
-                });
-            }
+          }
+          this.calendarData = calendarData;
+          this.$forceUpdate();
         }
+      });
     },
-    created() {
-        this.monthValue = this.$moment().startOf('weeks').format('YYYY-MM-DD');
+    // 获取周任务
+    getTaskList (obj) {
+      this.timeObjArr = [[], [], [], [], [], [], []];
+      this.$http.post('/sc-community/patrolRoute/list', obj).then(({ data, status, msg }) => {
+        if (!!data) {
+          data.map((item, index) => {
+            this.pushTimeRout(item);
+          });
+        }
+        this.$forceUpdate();
+      });
     },
-    mounted() {
-        this.findUser = this.$parent.findUser;
+    // 路线分配
+    pushTimeRout (data) {
+      let thisDay = data.periodValue.split(',').sort();
+      let timePeriod = data.timePeriod.split(',');
+
+      //每周
+      if (data.periodType == 1) {
+        timePeriod.map((items) => {
+          thisDay.map((item, index) => {
+            this.timeObjArr[item - 1].push(Object.assign({ times: items }, data));
+          });
+        });
+      }
+      //每隔几天
+      else if (data.periodType == 2) {
+        timePeriod.map((items) => {
+          this.timeObjArr.map((item, index) => {
+            item.push(Object.assign({ times: items }, data));
+          });
+        });
+      }
     }
+  },
+  created () {
+    this.monthValue = this.$moment().startOf('weeks').format('YYYY-MM-DD');
+  },
+  mounted () {
+    this.findUser = this.$parent.findUser;
+  }
 };
 </script>
 <style scoped lang='scss'>

+ 122 - 109
operationSupport/src/views/patrolManagement/popups/weekEditAdd.vue

@@ -1,120 +1,133 @@
 <template>
-    <el-form class="timeNewStyle" :model="timePeriod" :rules="formRules" ref="formRu">
-        <el-form-item label="巡更日期">{{ thisDay.day | dateText }}</el-form-item>
-        <el-form-item :label="timePeriod.partrolTime" prop="partolUserId">
-            <el-cascader
-                :ref="`userName`"
-                v-model="timePeriod.partolUserId"
-                :props="defaultProps"
-                :options="findUser"
-                :show-all-levels="false"
-                @change="findUserToggle()"
-            >
-            </el-cascader>
-        </el-form-item>
-    </el-form>
+  <el-form
+    class="timeNewStyle"
+    :model="timePeriod"
+    :rules="formRules"
+    ref="formRu"
+  >
+    <el-form-item label="巡更日期22">{{ thisDay.day | dateText }}</el-form-item>
+    <el-form-item
+      :label="timePeriod.partrolTime"
+      prop="partolUserId"
+    >
+      <el-cascader
+        :ref="`userName`"
+        v-model="timePeriod.partolUserId"
+        :props="defaultProps"
+        :options="findUser"
+        :show-all-levels="false"
+        @change="findUserToggle()"
+      >
+      </el-cascader>
+    </el-form-item>
+  </el-form>
 </template>
 <script>
 export default {
-    props: ['params'],
-    data() {
-        return {
-            timePeriod: {},
-            findUser: [],
-            thisDay: {},
-            defaultProps: {
-                value: 'id', // 唯一标识
-                label: 'label', // 标签显示
-                multiple: true,
-                emitPath: false
-            },
-            timePeriod: {
-                partolUserId: '',
-                partolName: '',
-                partrolTime: ''
-            },
-            formRules: {
-                partolUserId: [this.$valid.selectRequired('巡更人')]
-            }
-        };
+  props: ['params'],
+  data () {
+    return {
+      timePeriod: {},
+      findUser: [],
+      thisDay: {},
+      defaultProps: {
+        value: 'id', // 唯一标识
+        label: 'label', // 标签显示
+        multiple: true,
+        emitPath: false
+      },
+      timePeriod: {
+        partolUserId: '',
+        partolName: '',
+        partrolTime: ''
+      },
+      formRules: {
+        partolUserId: [this.$valid.selectRequired('巡更人')]
+      }
+    };
+  },
+  filters: {
+    dateText (va) {
+      if (!!va) {
+        let timeAr = va.split('-');
+        return `${timeAr[0]}年${timeAr[1]}月${timeAr[2]}日`;
+      } else {
+        return '';
+      }
+    }
+  },
+  methods: {
+    findUserToggle () {
+      // let thisObj = this.$refs[`userName`].getCheckedNodes()[0];
+      // this.timePeriod.partolName = thisObj.label;
     },
-    filters: {
-        dateText(va) {
-            if (!!va) {
-                let timeAr = va.split('-');
-                return `${timeAr[0]}年${timeAr[1]}月${timeAr[2]}日`;
-            } else {
-                return '';
+    submit () {
+      this.$refs['formRu'].validate((valid) => {
+        if (valid) {
+          let selectAll = this.$refs[`userName`].getCheckedNodes();
+          let partolNames = [],
+            partolUserIds = [];
+          selectAll.map((item) => {
+            if (item.level !== 1 && item.children.length == 0) {
+              partolNames.push(item.label);
+              partolUserIds.push(item.value);
             }
+          });
+          this.add(partolNames, partolUserIds);
         }
+      });
     },
-    methods: {
-        findUserToggle() {
-            // let thisObj = this.$refs[`userName`].getCheckedNodes()[0];
-            // this.timePeriod.partolName = thisObj.label;
-        },
-        submit() {
-            this.$refs['formRu'].validate((valid) => {
-                if (valid) {
-                    let selectAll = this.$refs[`userName`].getCheckedNodes();
-                    let partolNames = [],
-                        partolUserIds = [];
-                    selectAll.map((item) => {
-                        if (item.level !== 1 && item.children.length == 0) {
-                            partolNames.push(item.label);
-                            partolUserIds.push(item.value);
-                        }
-                    });
-                    this.add(partolNames, partolUserIds);
-                }
-            });
-        },
-        add(names, ids) {
-            let data = this.params.item;
-            let initData = {
-                communityId: data.communityId,
-                patrolRouteId: data.id,
-                periodType: data.periodType,
-                periodValue: data.periodValue,
-                rosterUserDtos: [
-                    {
-                        partolName: names.join(','),
-                        partolUserId: ids.join(','),
-                        partrolTime: data.times
-                    }
-                ],
-                partrolDate: this.thisDay.day,
-                startDate: data.startDate,
-                endDate: data.endDate
-            };
-            var loading = this.$loading();
-            this.$http
-                .post('/sc-community/patrolRoute/roster', initData)
-                .then(({ data, status, msg }) => {
-                    if (status == 0) {
-                        this.$message.success(msg);
-                        this.params.callback();
-                        this.$emit('close');
-                    } else {
-                        this.$message.error(msg);
-                    }
-                    loading.close();
-                })
-                .catch(() => {
-                    loading.close();
-                });
-        }
-    },
-    created() {
-        this.findUser = this.params.findUser;
-        this.thisDay.day = this.params.dateDe;
-        this.timePeriod = {
-            partolName: '',
-            partolUserId: '',
-            partrolTime: this.params.item.times
-        };
-    },
-    mounted() {}
+    add (names, ids) {
+      let data = this.params.item;
+      let initData = {
+        communityId: data.communityId,
+        patrolRouteId: data.id,
+        periodType: data.periodType,
+        periodValue: data.periodValue,
+        rosterUserDtos: [
+          {
+            partolName: names.join(','),
+            partolUserId: ids.join(','),
+            partrolTime: data.times
+          }
+        ],
+        partrolDate: this.thisDay.day,
+        startDate: data.startDate,
+        endDate: data.endDate
+      };
+      var loading = this.$loading();
+      this.$http
+        .post('/sc-community/patrolRoute/roster', initData)
+        .then(({ data, status, msg }) => {
+          if (status == 0) {
+            this.$message.success(msg);
+            this.params.callback();
+            this.$emit('close');
+          } else {
+            this.$message.error(msg);
+          }
+          loading.close();
+        })
+        .catch(() => {
+          loading.close();
+        });
+    }
+  },
+  created () {
+    debugger;
+    console.log('测试', this.params);
+    this.findUser = this.params.findUser;
+    this.thisDay.day = this.params.dateDe;
+    this.timePeriod = {
+      partolName: '',
+      partolUserId: '',
+      partrolTime: this.params.item.times
+    };
+    if (this.params.distinguish == 1) {
+      this.timePeriod.partolUserId = (this.params.currentUsers).split(',');
+    }
+  },
+  mounted () { }
 };
 </script>
 <style scoped lang='scss'>