From 9d8c91442eaf41bcce7dd2209535a9aabfbbd02a Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 02 Aug 2024 13:24:39 +0800
Subject: [PATCH] 三色任务与自查任务

---
 src/api/task/customTask.js                      |   49 ++++
 src/views/publicSecurity/keynotePlaceManage.vue |    2 
 src/views/place/components/baseAllInfo.vue      |    7 
 src/views/task/customTask/index.vue             |  602 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 657 insertions(+), 3 deletions(-)

diff --git a/src/api/task/customTask.js b/src/api/task/customTask.js
new file mode 100644
index 0000000..a288069
--- /dev/null
+++ b/src/api/task/customTask.js
@@ -0,0 +1,49 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-customTask/customTask/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-customTask/customTask/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-customTask/customTask/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-customTask/customTask/save',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-customTask/customTask/update',
+    method: 'post',
+    data: row
+  })
+}
\ No newline at end of file
diff --git a/src/views/place/components/baseAllInfo.vue b/src/views/place/components/baseAllInfo.vue
index 100aa41..068570f 100644
--- a/src/views/place/components/baseAllInfo.vue
+++ b/src/views/place/components/baseAllInfo.vue
@@ -203,8 +203,11 @@
               }, ],
             },
             {
+              collapseTags: true,
+              maxCollapseTags: 3,
+              collapseTagsTooltip: true,
+              multiple: true,
               span: 5,
-              label: "",
               labelWidth: 20,
               prop: "smallLabel",
               type: "select",
@@ -1191,4 +1194,4 @@
       justify-content: center;
     }
   }
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/publicSecurity/keynotePlaceManage.vue b/src/views/publicSecurity/keynotePlaceManage.vue
index a0cdeea..d79bcf9 100644
--- a/src/views/publicSecurity/keynotePlaceManage.vue
+++ b/src/views/publicSecurity/keynotePlaceManage.vue
@@ -854,7 +854,7 @@
             })
           }
           data.records.forEach(item => {
-            if (item.signaturePath.length > 0) {
+            if (item.signaturePath && item.signaturePath.length > 0) {
               var urls = []
               var names = item.signaturePath.split(",")
               names.forEach(name => {
diff --git a/src/views/task/customTask/index.vue b/src/views/task/customTask/index.vue
new file mode 100644
index 0000000..b7992fe
--- /dev/null
+++ b/src/views/task/customTask/index.vue
@@ -0,0 +1,602 @@
+<!-- e 呼即办 -->
+<template>
+  <basic-container>
+    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
+      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
+      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+
+      <template slot-scope="{row, size}" slot="menu">
+        <el-button size="small" type="text" icon="el-icon-edit" plain @click="handleEdit(row)">编辑
+        </el-button>
+
+        <el-button size="small" type="text" icon="el-icon-delete" plain @click="rowDel(row)">删除
+        </el-button>
+
+        <el-button :size="size" type="text" icon="el-icon-video-pause" @click="handleEnable(row,1)">停止
+        </el-button>
+        <el-button :size="size" type="text" icon="el-icon-video-play" @click.stop="handleEnable(row,2)">启用
+        </el-button>
+      </template>
+
+      <!--   <template slot="menu" slot-scope="{row, size, index}">
+        <el-button size="small" type="text" icon="el-icon-share" plain @click="share(row)">分享
+        </el-button>
+      </template> -->
+
+      <!--   <template slot-scope="{row, size}" slot="phone">
+        <el-button :size="size" type="text" @click="showStringDispose(row, 'phoneflag')"
+          v-text="textDispose(row, 'phoneflag', 'phone')">
+        </el-button>
+      </template> -->
+
+
+
+      <!-- <template slot-scope="{type, disabled}" slot="sceneGeoForm">
+        <el-button type="primary" style="font-size: 14px;  border: none;" icon="el-icon-map-location"
+          @click="openMap()">获取位置</el-button>
+
+        <avue-input-map style="position: fixed; top: -11111111111111px;" ref="avueInputMap" :params="form.params"
+          placeholder="请选择地图" v-model="form.sceneGeo"></avue-input-map>
+      </template> -->
+
+    </avue-crud>
+
+    <el-dialog title="编辑" append-to-body :visible.sync="editPopup" center @close="editClose">
+      <avue-form ref="formRef" :option="option" v-model="editForm" @submit="handleSubmit">
+
+        <template slot-scope="{type, disabled}" slot="sceneGeo">
+          <el-button type="primary" style="font-size: 14px;  border: none;" icon="el-icon-map-location"
+            @click="openMapTwo()">获取位置</el-button>
+
+          <avue-input-map style="position: fixed; top: -11111111111111px;" ref="avueInputMapTwo"
+            :params="editForm.params" placeholder="请选择地图" v-model="editForm.sceneGeo"></avue-input-map>
+        </template>
+
+      </avue-form>
+
+    </el-dialog>
+
+    <el-dialog title="分享" append-to-body :visible.sync="sharePopup" center @close="popupClose">
+      <div style="display: flex; justify-content: center; ">
+        <el-radio-group v-model="circleRadio">
+          <el-radio :label="0">邻里圈</el-radio>
+          <el-radio :label="1">协同圈</el-radio>
+        </el-radio-group>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="sharePopup = false">取 消</el-button>
+        <el-button type="primary" @click="shareCircle()">确 定</el-button>
+      </span>
+    </el-dialog>
+  </basic-container>
+</template>
+
+<script>
+  // import {
+  //   setToken,
+  //   setRefreshToken,
+  //   removeToken,
+  //   removeRefreshToken,
+  // } from "@/util/auth";
+  import {
+    getList,
+    remove,
+    update,
+    add,
+    getDetail,
+    synchronizeData
+  } from "@/api/task/customTask"
+  // import {
+  //   add as circleAdd,
+  // } from "@/api/circle/circle"
+  // import {
+  //   getList as getHouseList,
+  //   getDetatil as getHouseDetail
+  // } from "@/api/doorplateAddress/doorplateAddress.js"
+  // import {
+  //   getDept
+  // } from "@/api/system/dept"
+  import {
+    mapGetters
+  } from "vuex"
+  import website from '@/config/website'
+  //   import AvueMap from "avue-plugin-map";
+  export default {
+    data() {
+      return {
+        editPopup: false,
+        form: {},
+        editForm: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0,
+        },
+        datetime: "",
+        selectionList: [],
+        sharePopup: false,
+        circleRadio: 0,
+        shareCircleRow: {},
+        option: {
+          labelWidth: 130,
+          searchShow: true,
+          searchMenuSpan: 3,
+          menuWidth: 360,
+          delBtn: false,
+          editBtn: false,
+          height: "auto",
+          calcHeight: 54,
+          dialogWidth: 950,
+          tip: false,
+          border: true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [{
+              label: "任务名称",
+              prop: "name",
+            },
+            {
+              label: "任务类型",
+              prop: "taskType",
+              type: "select",
+              value: "1",
+              dicData: [{
+                label: "走访任务",
+                value: "0"
+              }, {
+                label: "自查任务",
+                value: "1"
+              }],
+            }, {
+              label: "人员标签",
+              prop: "labelId",
+              type: "tree",
+              parent: false,
+              dicUrl: "/api/blade-label/label/getLabelList?parentId=1000",
+              props: {
+                label: "name",
+                value: "id",
+              },
+            }, {
+              label: "标签颜色",
+              prop: "labelColor",
+              type: "select",
+              value: "green",
+              dicData: [{
+                  label: "绿",
+                  value: "green",
+                },
+                {
+                  label: "黄",
+                  value: "yellow",
+                },
+                {
+                  label: "红",
+                  value: "red",
+                },
+              ],
+            }, {
+              label: "任务计划",
+              prop: "cron",
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/tree?code=task_plan",
+              props: {
+                label: "title",
+                value: "remark",
+              },
+            }, {
+              span: 7,
+              label: "场所标签",
+              prop: "placeLabel",
+              labelWidth: 120,
+              type: "select",
+              dicUrl: "/api/blade-category/category/getCategory?level=2",
+              cascader: ["placeSmallLabel"],
+              props: {
+                label: "categoryName",
+                value: "categoryNo",
+              },
+              dataType: "string",
+              hide: true,
+              rules: [{
+                required: true,
+                message: "请输入场所标签",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              span: 5,
+              label: "",
+              labelWidth: 20,
+              prop: "placeSmallLabel",
+              type: "select",
+              dicUrl: "/api/blade-category/category/getCategory?parentNo={{placeLabel}}",
+              props: {
+                label: "categoryName",
+                value: "categoryNo",
+              },
+              dataType: "string",
+              hide: true,
+            }, {
+              label: "九小类型",
+              prop: "nineType",
+              searchSpan: 4,
+              dataType: "number",
+              type: "select",
+              width: 100,
+              editDisabled: true,
+              dicUrl: "/api/blade-system/dict-biz/tree?code=nineType",
+              props: {
+                label: "title",
+                value: "key",
+              },
+              search: true,
+              searchLabelWidth: 46,
+            },
+            {
+              label: "状态",
+              prop: "taskStatus",
+              type: "select",
+              value: "1",
+              dicData: [{
+                  label: "停止",
+                  value: "1",
+                },
+                {
+                  label: "启用",
+                  value: "2",
+                }
+              ],
+            }, {
+              label: "创建时间",
+              prop: "createTime",
+            },
+          ],
+        },
+        data: [],
+        dept: {},
+      }
+    },
+    watch: {
+      "form.sceneGeo": {
+        // form是表单或者表格绑定的数据集,v-model='form'
+        handler(val) {
+          if (typeof val == "object") {
+            console.log("*****11**********" + val)
+            console.log("*****789111**********" + !val)
+            if (val.length <= 0) {
+              return
+            }
+            console.log("*****789**********" + val)
+
+            var arr = val
+            //经纬度替换
+            this.form.sceneGeoLat = arr[1]
+            this.form.sceneGeoLng = arr[0]
+            this.form.location = arr[2]
+          }
+        },
+      },
+
+      "editForm.sceneGeo": {
+        // form是表单或者表格绑定的数据集,v-model='form'
+        handler(val) {
+          if (typeof val == "object") {
+            if (val.length <= 0) {
+              return
+            }
+            console.log("*****789**********" + val)
+            console.log("*****78910**********" + !val)
+
+            var arr = val
+            //经纬度替换
+            this.editForm.sceneGeoLat = arr[1]
+            this.editForm.sceneGeoLng = arr[0]
+            this.editForm.location = arr[2]
+          }
+        },
+      },
+    },
+
+    computed: {
+      ...mapGetters(["permission", "userInfo"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.eCallEvent_add, true),
+          viewBtn: this.vaildData(this.permission.eCallEvent_view, true),
+          delBtn: this.vaildData(this.permission.eCallEvent_delete, true),
+          editBtn: this.vaildData(this.permission.eCallEvent_edit, true),
+        }
+      },
+      ids() {
+        let ids = []
+        this.selectionList.forEach((ele) => {
+          ids.push(ele.id)
+        })
+        return ids.join(",")
+      },
+      textDispose() {
+        return (row, flag, type) => {
+          if (row[flag] || row[type] == null) {
+            return row[type]
+          } else {
+            if (type == 'principalIdCard') {
+              return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
+            } else {
+              return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
+            }
+          }
+        }
+      }
+    },
+    methods: {
+      // 启用 停止
+      handleEnable(row, status) {
+        var temstr = ""
+        if (status == 2) {
+          temstr = "启动"
+        } else {
+          temstr = "停止"
+        }
+        this.$confirm("是否确定" + temstr + "当前任务?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            if (status == 2) {
+              row.taskStatus = 2
+              return update(row)
+            } else {
+              row.taskStatus = 1
+              return update(row)
+            }
+          })
+          .then(() => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+            this.$refs.crud.toggleSelection()
+          })
+      },
+      getDeptInfo() {
+        getDept(this.userInfo.dept_id).then(res => {
+          this.dept = res.data.data
+          this.form.issueOrigin = res.data.data.sort
+          // console.log("*********res.data.data*************" + JSON.stringify(res.data.data))
+        })
+      },
+      openMap() {
+        this.$refs.avueInputMap.box = true
+        console.log(this.$refs.avueInputMap)
+      },
+      openMapTwo() {
+        this.$refs.avueInputMapTwo.box = true
+        console.log(this.$refs.avueInputMap)
+      },
+
+      showStringDispose(row, type) {
+        row[type] = !row[type]
+      },
+
+      locationDispose(data) {
+        return {
+          longitude: data[0],
+          latitude: data[1],
+          sceneAddr: data[2]
+        }
+      },
+
+      rowSave(row, done, loading) {
+        add(row).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+
+      handleSubmit(form, done) {
+        update(form).then(
+          () => {
+            this.onLoad(this.page)
+            this.editPopup = false
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+          })
+      },
+      searchReset() {
+        this.query = {}
+        this.onLoad(this.page)
+      },
+      searchChange(params, done) {
+        this.query = params
+        this.page.currentPage = 1
+        this.onLoad(this.page, params)
+        done()
+      },
+      selectionChange(list) {
+        this.selectionList = list
+      },
+      selectionClear() {
+        this.selectionList = []
+        this.$refs.crud.toggleSelection()
+      },
+
+      share(row) {
+        console.table(row)
+        this.shareCircleRow = row
+        this.sharePopup = true
+      },
+      // 分享圈子
+      shareCircle() {
+        this.sharePopup = false
+        let param = {}
+        param.circleType = this.circleRadio
+        param.houseCode = this.shareCircleRow.addressCode
+        param.circleImages = this.shareCircleRow.imageUrls
+        param.communityCode = this.shareCircleRow.communityCode
+        param.circleText = "标题:" + this.shareCircleRow.issueTitle + " 内容: " + this.shareCircleRow.issueContent
+        param.evenType = 3
+        param.eventId = this.shareCircleRow.id
+        circleAdd(param).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+      popupClose() {
+        this.sharePopup = false
+      },
+      handleEdit(row) {
+        getDetail(row.id).then((res) => {
+          this.editForm = res.data.data
+          this.editPopup = true
+        })
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据")
+          return
+        }
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            return remove(this.ids)
+          })
+          .then(() => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            this.$refs.crud.toggleSelection()
+          })
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then((res) => {
+            this.form = res.data.data
+          })
+        }
+        // con
+        done()
+      },
+      currentChange(currentPage) {
+        this.page.currentPage = currentPage
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query)
+      },
+      onLoad(page, params = {}) {
+        const {
+          dateTime
+        } = this.query
+        let values = {
+          ...params,
+        }
+        if (dateTime) {
+          values = {
+            ...params,
+            startTime: dateTime[0],
+            endTime: dateTime[1],
+            ...this.query,
+          }
+          values.dateTime = null
+        }
+        this.loading = true
+        // this.getDeptInfo();
+
+        getList(page.currentPage, page.pageSize, values).then((res) => {
+          const data = res.data.data
+          this.page.total = data.total
+          this.data = data.records
+
+          this.loading = false
+          this.selectionClear()
+        })
+
+        // synchronizeData().then((res) => {
+
+        // })
+      }
+    },
+  }
+</script>
+
+<style>
+  .avue-upload__icon {
+    line-height: 6;
+  }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3