瀏覽代碼

巡更路线

Shannon_mu 3 年之前
父節點
當前提交
a14ff0038e

+ 95 - 49
operationSupport/src/views/patrolManagement/patrolRoute.vue

@@ -1,40 +1,66 @@
 <template>
     <div class="main">
-        <!-- <div class="search">
-            <el-input placeholder="请输入巡更点名称" class="search-input" clearable v-model="mixins_query.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>
+        <template v-if="isLook === 'index'">
+            <div class="search">
+                <el-input
+                    placeholder="请输入巡更点名称"
+                    class="search-input"
+                    clearable
+                    v-model="mixins_query.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-tianjia2" @click="addOrEdit('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="opt">
-                <div class="opt">
-                    <el-tooltip effect="light" placement="bottom" content="编辑">
-                        <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope)"></i>
-                    </el-tooltip>
-                    <el-tooltip effect="light" placement="bottom" content="删除">
-                        <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
+                <div class="search-icon">
+                    <el-tooltip class="item" effect="light" placement="bottom" content="新增">
+                        <i class="zoniot_font zoniot-icon-tianjia2" @click="add()"></i>
                     </el-tooltip>
                 </div>
-            </template>
-        </zz-table> -->
-
-        <!-- <scheduling></scheduling> -->
-        <add-patrol></add-patrol>
+            </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="periodValue"
+                >{{ scope.row.periodType==1?`每周${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)"
+                            ></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>
+        </template>
+        <scheduling v-if="isLook === 'schedu'" @initPage="initPage"></scheduling>
+        <add-patrol v-if="isLook === 'patrol'" @initPage="initPage"></add-patrol>
     </div>
 </template>
 
@@ -52,6 +78,7 @@ export default {
     data() {
         let _this = this;
         return {
+            isLook: 'index', // index , schedu,patrol 主页 日历 添加
             communityArr: [],
             cols: [
                 {
@@ -59,25 +86,21 @@ export default {
                     prop: 'communityName'
                 },
                 {
-                    label: '楼栋',
-                    prop: 'address'
-                },
-                {
-                    label: '单元',
-                    prop: 'repairName'
+                    label: '巡更路线',
+                    prop: 'routeName'
                 },
                 {
-                    label: '巡更点名称',
-                    prop: 'repairPhone'
+                    label: '巡更日期',
+                    prop: 'startDate'
                 },
                 {
-                    label: '位置编号',
-                    prop: 'repairContent'
+                    label: '巡更时间',
+                    prop: 'timePeriod'
                 },
                 {
-                    label: '巡更点二维码',
-                    prop: 'repairFile',
-                    slot: 'repairFile'
+                    label: '巡更周期',
+                    prop: 'periodValue',
+                    slot: 'periodValue'
                 },
 
                 {
@@ -92,29 +115,52 @@ export default {
     },
     created() {
         this.getorgTree();
-        this.mixins_dataUrl = '/sc-community/patrol/point/page';
+        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) => {
+                .then(data => {
                     this.communityArr = data.data;
                     this.$store.commit('setAreaSelect', data.data);
                 })
 
-                .catch(function () {});
+                .catch(function() {});
         },
         getUserList() {
             this.$http.get('/sc-user-center/user/findUserList').then(({ data, status, msg }) => {
                 this.findUser = data;
             });
         },
-        addOrEdit() {}
+        add() {
+            this.isLook = 'patrol';
+        },
+        schedulingEdit() {
+            this.isLook = 'schedu';
+        },
+        initPage() {
+            this.isLook = 'index';
+        }
     }
 };
 </script>

+ 122 - 69
operationSupport/src/views/patrolManagement/popups/addPatrol.vue

@@ -1,10 +1,24 @@
 <template>
     <div class="main">
-        <div class="blockName">{{ !isAdd ? '编辑' : '新增' }}巡更路线(<span class="show-required-icon-star"></span>为必填项)</div>
-        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="formContent">
+        <div class="blockName">
+            {{ !isAdd ? '编辑' : '新增' }}巡更路线(
+            <span class="show-required-icon-star"></span>为必填项)
+        </div>
+        <el-form
+            :model="ruleForm"
+            :rules="rules"
+            ref="ruleForm"
+            label-width="120px"
+            class="formContent"
+        >
             <div class="formContent-item">
                 <el-form-item label="所属社区" prop="communityId">
-                    <el-select class="width100" v-model="ruleForm.communityId" placeholder="所属社区" clearable>
+                    <el-select
+                        class="width100"
+                        v-model="ruleForm.communityId"
+                        placeholder="所属社区"
+                        clearable
+                    >
                         <el-option
                             v-for="(item, index) in $parent.communityArr"
                             :key="index"
@@ -30,8 +44,7 @@
                         :titles="['待选列表', '已选列表']"
                         @change="handleChange"
                         :data="patrolArr"
-                    >
-                    </el-transfer>
+                    ></el-transfer>
                     <map-value :point="targetData"></map-value>
                 </el-form-item>
             </div>
@@ -40,7 +53,7 @@
                     <el-date-picker
                         class="width100"
                         v-model="effectiveDate"
-                        value-format="yyyy-MM-dd "
+                        value-format="yyyy-MM-dd"
                         type="daterange"
                         range-separator="至"
                         start-placeholder="选择开始日期"
@@ -49,21 +62,37 @@
                         :editable="false"
                     ></el-date-picker>
                 </el-form-item>
-                <el-form-item label="巡更时间" prop="communityName">
-                    <div>
-                        <el-time-picker
-                            is-range
-                            v-model="value1"
-                            range-separator="至"
-                            start-placeholder="开始时间"
-                            end-placeholder="结束时间"
-                            placeholder="选择时间范围"
-                        >
-                        </el-time-picker>
-                        <div class="sunm">
+                <el-form-item label="巡更时间" prop="timePeriod">
+                    <div class="timeList" v-for="(item,index) in timePeriod" :key="index">
+                        <el-time-select
+                            placeholder="起始时间"
+                            v-model="item.startTime"
+                            :picker-options="{
+                            start: '00:00',
+                            step: '00:15',
+                            end: '23:30'
+                            }"
+                            @change="timeChange(item,'startTime')"
+                        ></el-time-select>
+                        <el-time-select
+                            placeholder="起始时间"
+                            v-model="item.endTime"
+                            :picker-options="{
+                            start: '00:00',
+                            step: '00:15',
+                            end: '23:30',
+                            minTime: item.startTime
+                            }"
+                            @change="timeChange(item,'endTime')"
+                        ></el-time-select>
+                        <div class="sunm" @click="addTime(index,1)">
                             <i class="zoniot_font zoniot-icon-tianjia1"></i>
                         </div>
-                        <div class="sunm">
+                        <div
+                            class="sunm"
+                            @click="addTime(index,-1)"
+                            v-if="timePeriod.length>1 && index!=0"
+                        >
                             <i class="zoniot_font zoniot-icon-shanjian"></i>
                         </div>
                     </div>
@@ -74,7 +103,7 @@
                         <el-radio :label="2">间隔天数重复</el-radio>
                     </el-radio-group>
 
-                    <el-checkbox-group v-if="ruleForm.periodType == 1" v-model="ruleForm.periodValue">
+                    <el-checkbox-group v-if="ruleForm.periodType == 1" v-model="periodValue">
                         <el-checkbox :label="1">周一</el-checkbox>
                         <el-checkbox :label="2">周二</el-checkbox>
                         <el-checkbox :label="3">周三</el-checkbox>
@@ -85,8 +114,12 @@
                     </el-checkbox-group>
                     <div v-else class="periodValueInput">
                         每隔
-                        <el-input-number v-model="ruleForm.periodValue" controls-position="right" :min="0" :max="30"></el-input-number>
-                        天进行(输入0-30的数字,0代表每天都要进行任务)
+                        <el-input-number
+                            v-model="ruleForm.periodValue"
+                            controls-position="right"
+                            :min="0"
+                            :max="30"
+                        ></el-input-number>天进行(输入0-30的数字,0代表每天都要进行任务)
                     </div>
                 </el-form-item>
                 <el-form-item label="定位距离(m)">
@@ -96,7 +129,12 @@
                     ></el-input>
                 </el-form-item>
                 <el-form-item label="拍照/视频要求">
-                    <el-select class="width100" v-model="ruleForm.cameraSettings" placeholder="请选择拍照/视频要求" clearable>
+                    <el-select
+                        class="width100"
+                        v-model="ruleForm.cameraSettings"
+                        placeholder="请选择拍照/视频要求"
+                        clearable
+                    >
                         <el-option label="是" :value="1"></el-option>
                         <el-option label="否" :value="0"></el-option>
                     </el-select>
@@ -110,8 +148,7 @@
                         v-model="ruleForm.remark"
                         maxlength="300"
                         show-word-limit
-                    >
-                    </el-input>
+                    ></el-input>
                 </el-form-item>
             </div>
         </el-form>
@@ -125,15 +162,6 @@
 import mapValue from './mapValue.vue';
 export default {
     components: { mapValue },
-    props: {
-        params: {
-            type: Object
-        },
-        isAdd: {
-            type: Boolean,
-            default: true
-        }
-    },
     data() {
         return {
             ruleForm: {
@@ -149,6 +177,13 @@ export default {
                 cameraSettings: '',
                 remark: ''
             },
+            periodValue: [],
+            timePeriod: [
+                {
+                    startTime: '',
+                    endTime: ''
+                }
+            ],
             rules: {
                 communityId: [this.$valid.inputRequired('社区名称')],
                 routeName: [this.$valid.inputRequired('巡更路线名称')],
@@ -166,21 +201,41 @@ export default {
         'ruleForm.communityId'(e) {
             this.getPoint(e);
         },
-        'ruleForm.periodValue'(e) {
-            console.log(e);
+        periodValue(e) {
+            this.ruleForm.periodValue = e.join();
         }
     },
     methods: {
         //保存
         addEdit() {
-            this.$refs.ruleForm.validate((valid) => {
-                console.log(this.ruleForm);
+            this.$refs.ruleForm.validate(valid => {
                 if (valid) {
-                    let url = '/sc-community/assets/community/add';
-                    let params = this.ruleForm;
-                    if (!this.isAdd) {
-                        url = '/sc-community/assets/community/update';
-                    }
+                    let url = '/sc-community/patrolRoute/add';
+                    this.ruleForm;
+                    let dotArr = arr => {
+                        let dotObj = [];
+                        arr.map((item, index) => {
+                            dotObj.push({
+                                pointId: item,
+                                order: index
+                            });
+                        });
+                        return dotObj;
+                    };
+
+                    let params = {
+                        communityId: this.ruleForm.communityId,
+                        routeName: this.ruleForm.routeName,
+                        routePointRelationDtos: dotArr(this.ruleForm.routePointRelationDtos),
+                        startDate: this.ruleForm.startDate,
+                        endDate: this.ruleForm.endDate,
+                        timePeriod: this.ruleForm.timePeriod,
+                        periodType: this.ruleForm.periodType,
+                        periodValue: this.ruleForm.periodValue,
+                        positioningDistance: this.ruleForm.positioningDistance,
+                        cameraSettings: this.ruleForm.cameraSettings,
+                        remark: this.ruleForm.remark
+                    };
                     this.$http
                         .post(url, params)
                         .then(({ status, msg }) => {
@@ -195,23 +250,6 @@ export default {
                 }
             });
         },
-        getDetails(id) {
-            let url = '/sc-community/assets/community/find/' + id;
-            this.$http
-                .get(url)
-                .then(({ data, status, msg }) => {
-                    if (0 === status) {
-                        this.ruleForm = data;
-                        this.regionId = [data.provinceId, data.cityId, data.regionId];
-                        this.ruleForm.companyOrgId = data.beCompanyOrgId;
-                        // this.companyOrgId = [null, null, data.companyOrgId];
-                        // this.deptOrgId = [null, null, data.deptOrgId];
-                    } else {
-                        this.$message.error(msg);
-                    }
-                })
-                .catch(() => {});
-        },
         effectiveDateToggle(va) {
             let arr = va;
             if (!arr) {
@@ -220,11 +258,8 @@ export default {
             this.ruleForm.startDate = arr[0];
             this.ruleForm.endDate = arr[1];
         },
-        handlePeriodValue(e) {
-            console.log(e);
-        },
         close() {
-            this.$emit('clerOwnerStatus');
+            this.$emit('initPage');
         },
         getPoint(id) {
             this.$http.get('/sc-community/patrol/point/getPointList', { id, id }).then(({ data, status, msg }) => {
@@ -235,13 +270,25 @@ export default {
             this.$nextTick(() => {
                 this.targetData = this.$refs.transferTude.targetData;
             });
+        },
+        addTime(inx, sun) {
+            if (sun > 0) {
+                this.timePeriod.push({ startTime: '', endTime: '' });
+            } else {
+                this.timePeriod.splice(inx, 1);
+            }
+        },
+        timeChange(itm, str) {
+            if (!!itm['endTime'] && !!itm['startTime']) {
+                let TimeArr = [];
+                this.timePeriod.map((item, index) => {
+                    TimeArr.push(`${item.startTime}-${item.endTime}`);
+                });
+                this.ruleForm.timePeriod = TimeArr.join();
+            }
         }
     },
-    created() {
-        if (!!this.params && !!this.params.id) {
-            this.getDetails(this.params.id);
-        }
-    }
+    created() {}
 };
 </script>
 <style lang='scss' scoped>
@@ -279,5 +326,11 @@ export default {
         cursor: pointer;
         margin-left: 10px;
     }
+    .timeList {
+        margin-bottom: 10px;
+        &:nth-last-child() {
+            margin: 0;
+        }
+    }
 }
 </style>

+ 20 - 9
operationSupport/src/views/patrolManagement/popups/scheduling.vue

@@ -19,16 +19,25 @@
             </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'">
+            <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" @click="add(data, item)">
-                            <template v-for="itx in item.rosterUserDtos"
-                                ><div :key="itx" class="listTime">
-                                    <span>{{ itx.partrolTime }}</span> <span>{{ itx.partolName }}</span>
-                                </div></template
-                            >
+                        <div
+                            :key="index"
+                            v-if="data.day == item.partrolDate"
+                            @click="add(data, item)"
+                        >
+                            <template v-for="itx in item.rosterUserDtos">
+                                <div :key="itx" class="listTime">
+                                    <span>{{ itx.partrolTime }}</span>
+                                    <span>{{ itx.partolName }}</span>
+                                </div>
+                            </template>
                         </div>
                     </template>
                 </div>
@@ -67,7 +76,7 @@ export default {
                 title = '批量排班';
                 isSingle = false;
             }
-            new Promise((resolve) => {
+            new Promise(resolve => {
                 this.$store.dispatch('addPopup', {
                     url: '/patrolManagement/popups/schedulingAdd.vue',
                     width: '450px',
@@ -93,7 +102,9 @@ export default {
         changeMonth(va) {
             console.log(va);
         },
-        goback() {},
+        goback() {
+            this.$emit('initPage');
+        },
         initDate(type) {
             this.monthValue = this.$moment().format(type);
         }