From 9ccde974b85157aee21943ca8aa718f7093985bc Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 09 一月 2023 17:25:50 +0800
Subject: [PATCH] 网格管理
---
src/store/system/orgGrid/index.js | 21 +
src/views/operate/writManager/writTemplate/index.vue | 2
src/store/index.js | 4
src/views/systemSetting/device/grid/components/components/dialogForm.vue | 208 +++++++++++
src/views/layout/components/Main/index.vue | 88 ++--
src/views/systemSetting/device/grid/components/components/map.vue | 84 ++++
src/views/systemSetting/device/grid/components/main/index.vue | 632 ++++++++++++++++------------------
src/api/system/orgGrid.js | 20 +
8 files changed, 678 insertions(+), 381 deletions(-)
diff --git a/src/api/system/orgGrid.js b/src/api/system/orgGrid.js
new file mode 100644
index 0000000..1294368
--- /dev/null
+++ b/src/api/system/orgGrid.js
@@ -0,0 +1,20 @@
+import http from '@/http'
+
+export default {
+ // 鑾峰彇鍒楄〃
+ getOrgGridList: (params) => {
+ return http.get('/sccg/org_grid/query', params);
+ },
+ // 鏂板
+ saveOrgGrid: (params) => {
+ return http.post('/sccg/org_grid/add', params);
+ },
+ // 缂栬緫
+ updateOrgGrid: (params) => {
+ return http.put('/sccg/org_grid/update', params);
+ },
+ // 鍒犻櫎
+ deleteOrgGrid: (id) => {
+ return http.delete('/sccg/org_grid/delete/' + id);
+ },
+};
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
index 21bd090..8751761 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -4,6 +4,7 @@
import logs from "./logs"
import loudspeaker from './system/loudspeaker'
import handheldTerminal from './system/handheldTerminal'
+import orgGrid from './system/orgGrid'
import shortMessage from './operate/managenment/shortMessage'
import statistics from './intelligentPatrol/statistics'
import writ from './operate/writ'
@@ -21,6 +22,7 @@
loudspeaker,
handheldTerminal,
statistics,
- writ
+ writ,
+ orgGrid
}
})
\ No newline at end of file
diff --git a/src/store/system/orgGrid/index.js b/src/store/system/orgGrid/index.js
new file mode 100644
index 0000000..7c8b981
--- /dev/null
+++ b/src/store/system/orgGrid/index.js
@@ -0,0 +1,21 @@
+import orgGridApi from "@/api/system/orgGrid";
+export default {
+ namespaced: true,
+ state: {
+ userInfo: {},
+ },
+ actions: {
+ getOrgGridList(context, params) {
+ return orgGridApi.getOrgGridList(params);
+ },
+ saveOrgGrid(context, params) {
+ return orgGridApi.saveOrgGrid(params);
+ },
+ updateOrgGrid(context, params) {
+ return orgGridApi.updateOrgGrid(params);
+ },
+ deleteOrgGrid(context, id) {
+ return orgGridApi.deleteOrgGrid(id);
+ },
+ },
+};
\ No newline at end of file
diff --git a/src/views/layout/components/Main/index.vue b/src/views/layout/components/Main/index.vue
index 5f670e6..72c381d 100644
--- a/src/views/layout/components/Main/index.vue
+++ b/src/views/layout/components/Main/index.vue
@@ -54,221 +54,221 @@
link: '/system/userSetting/department',
},
{
- id: 4,
+ id: 5,
label: '鑷畾涔夎彍鍗�',
link: '/system/platform/mySetting',
},
{
- id: 4,
+ id: 6,
label: 'logo绠$悊',
link: '/system/platform/portalSetting',
},
{
- id: 4,
+ id: 7,
label: '椹鹃┒鑸辩鐞�',
link: '/system/platform/cockpitManage',
},
{
- id: 5,
+ id: 8,
label: '鍗″彛璁惧绠$悊',
link: '/system/device/bayonet',
},
{
- id: 6,
+ id: 9,
label: '鐐逛綅绠$悊',
link: '/system/device/point',
},
{
- id: 6,
+ id: 10,
label: '缃戞牸绠$悊',
link: '/system/device/grid',
},
{
- id: 6,
+ id: 11,
label: '闊虫煴璁惧绠$悊',
link: '/system/device/loudspeaker',
},
{
- id: 6,
+ id: 12,
label: '鎵嬫寔璁惧绠$悊',
link: '/system/device/handheldTerminal',
},
]
},
{
- id: 7,
+ id: 13,
title: '杩愯惀绠$悊',
children: [
{
- id: 8,
+ id: 14,
label: '杩濊浜嬮」璁剧疆',
link: '/operate/baseSetting/violation',
},
{
- id: 9,
+ id: 15,
label: '杩濆缓浜嬮」璁剧疆',
link: '/operate/baseSetting/illegalBuild',
},
{
- id: 10,
+ id: 16,
label: '鎴戠殑寰呭姙',
link: '/operate/myWait',
},
{
- id: 11,
+ id: 17,
label: '妗堜欢鏌ヨ',
link: '/operate/viewEvent',
},
{
- id: 13,
+ id: 18,
label: '闂ㄥ墠涓夊寘',
link: '/operate/fivepack/threepackage',
},
{
- id: 14,
+ id: 19,
label: '搴楅摵绠$悊',
link: '/operate/fivepack/shop',
},
{
- id: 15,
+ id: 20,
label: '杞﹁締绠$悊',
link: '/operate/car/carIndex',
},
{
- id: 15,
+ id: 21,
label: '杞ㄨ抗鍒嗘瀽(鎵ф硶杞�)',
link: '/operate/car/lawTrajectory',
},
{
- id: 15,
+ id: 22,
label: '杞ㄨ抗鍒嗘瀽(娓e湡杞�)',
link: '/operate/car/soilTrajectory',
},
{
- id: 16,
+ id: 23,
label: '鍥剧墖绠$悊',
link: '/operate/images',
},
{
- id: 17,
+ id: 24,
label: '瑙嗛绠$悊',
link: '/operate/videoControl',
},
{
- id: 17,
+ id: 25,
label: '鏂囦功绠$悊',
link: '/operate/writManagement/writ',
},
{
- id: 17,
+ id: 26,
label: '鏂囦功妯℃澘绠$悊',
link: '/operate/writManagement/writTemplate',
},
{
- id: 18,
+ id: 27,
label: '娑堟伅绠$悊',
link: '/operate/message/messageIndex',
}, {
- id: 18,
+ id: 28,
label: '鏍忕洰绠$悊',
link: '/operate/message/mycontrol',
},
{
- id: 19,
+ id: 29,
label: '鐭俊绠$悊',
link: '/operate/sms/smsIndex',
}, {
- id: 19,
+ id: 30,
label: '鐭俊妯℃澘绠$悊',
link: '/operate/sms/smsTemplate',
},
{
- id: 20,
+ id: 31,
label: '鏃ュ織绠$悊',
link: '/operate/log',
},
]
},
{
- id: 21,
+ id: 32,
title: '浜嬮」澶勭疆绠$悊',
children: [
{
- id: 24,
+ id: 33,
label: '妗堜欢姹�',
link: '/operate/casepool/pool',
}, {
- id: 24,
+ id: 34,
label: '宸蹭笂鎶ュ埌甯�',
link: '/operate/casepool/escalation',
}, {
- id: 24,
+ id: 35,
label: '璋冨害绠$悊',
link: '/operate/casepool/dispatch',
}, {
- id: 24,
+ id: 36,
label: '鍦ㄥ涔犵鐞�',
link: '/operate/casepool/learn',
}, {
- id: 24,
+ id: 37,
label: '鏆備笉澶勭悊',
link: '/operate/casepool/notDeal',
},
]
},
{
- id: 23,
+ id: 38,
title: '瀹℃牳绠$悊',
children: [
{
- id: 24,
+ id: 39,
label: '瀹℃牳绠$悊',
link: '/operate/management/myIndex',
},
{
- id: 25,
+ id: 40,
label: '鐭俊瀹℃牳绠$悊',
link: '/operate/management/managementMessage',
},
]
},
{
- id: 23,
+ id: 41,
title: '瑙嗛宸℃煡',
children: [
{
- id: 24,
+ id: 42,
label: '瑙嗛宸℃煡',
link: '/video',
},
]
},
{
- id: 23,
+ id: 43,
title: '鏅鸿兘宸℃煡',
children: [
{
- id: 24,
+ id: 44,
label: '棰勮鐮斿垽',
link: '/studyJudge',
},
{
- id: 25,
+ id: 45,
label: '杩濊妫�绱�',
link: '/illegalSearch',
},
{
- id: 26,
+ id: 46,
label: '瓒嬪娍鍒嗘瀽',
link: '/trendAnalysis',
},
{
- id: 27,
+ id: 47,
label: '杩濈珷缁熻',
link: '/trendAnalysis',
},
{
- id: 28,
+ id: 48,
label: '杩濇硶缁熻',
link: '/typeStatistics',
},
diff --git a/src/views/operate/writManager/writTemplate/index.vue b/src/views/operate/writManager/writTemplate/index.vue
index 542fedb..535561e 100644
--- a/src/views/operate/writManager/writTemplate/index.vue
+++ b/src/views/operate/writManager/writTemplate/index.vue
@@ -129,7 +129,7 @@
this.getWritTemplateList({
currentPage,
pageSize,
- state: context,
+ name: context,
}).then((res) => {
this.list = res.records;
this.totalNum = res.total;
diff --git a/src/views/systemSetting/device/grid/components/components/dialogForm.vue b/src/views/systemSetting/device/grid/components/components/dialogForm.vue
new file mode 100644
index 0000000..3f2ca32
--- /dev/null
+++ b/src/views/systemSetting/device/grid/components/components/dialogForm.vue
@@ -0,0 +1,208 @@
+<template>
+ <div class="create">
+ <main>
+ <div class="mainContent">
+ <el-form
+ ref="formRef"
+ label-width="140px"
+ :rules="createRules"
+ autoComplete="on"
+ :model="form"
+ label-position="right"
+ >
+ <el-form-item class="optionItem" label="鍖哄煙鍚嶇О:" prop="name">
+ <el-input
+ v-model="form.name"
+ placeholder="璇峰~鍐欏尯鍩熷悕绉�"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item class="optionItem" label="鎵�灞炵綉鏍煎憳:" prop="worker">
+ <el-input
+ v-model="form.worker"
+ placeholder="璇峰~鍐欐墍灞炵綉鏍煎憳"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item class="optionItem" label="鑱旂郴鏂瑰紡:" prop="contact">
+ <el-input
+ v-model="form.contact"
+ placeholder="璇峰~鍐欒仈绯绘柟寮�"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item class="optionItem" label="璐d换鍖哄煙:" prop="area">
+ <el-input
+ v-model="form.area"
+ placeholder="璇峰~鍐欒矗浠诲尯鍩�"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item class="optionItem" label="鎻忚堪:" prop="description">
+ <el-input type="textarea"
+ v-model="form.description"
+ placeholder="璇峰~鍐欐弿杩�"
+ :rows="4"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item class="optionItem" label="璐d换鍖哄煙:" prop="region">
+ <Map
+ style="width: 400px; height: 300px"
+ :region="form.region"
+ ></Map>
+ </el-form-item>
+ <el-form-item>
+ <div class="optionBtn">
+ <el-button
+ type="primary"
+ class="btn submit"
+ @click.native.prevent="handleUpdate"
+ >纭
+ </el-button>
+ </div>
+ </el-form-item>
+ </el-form>
+ </div>
+ </main>
+ </div>
+</template>
+ <script>
+import Map from "./map.vue";
+
+import { createNamespacedHelpers } from "vuex";
+const { mapActions } = createNamespacedHelpers("orgGrid");
+
+export default {
+ components: { Map },
+ data() {
+ const checkName = (rule, value, callback) => {
+ if (value) {
+ callback();
+ } else {
+ callback(new Error("鍚嶇О涓嶈兘涓虹┖"));
+ }
+ };
+
+ return {
+ form: {
+ name: "",
+ worker: "",
+ contact: "",
+ area: "",
+ description: "",
+ region: "",
+ },
+ createRules: {
+ name: [
+ {
+ required: true,
+ trigger: "blur",
+ validator: checkName,
+ },
+ ],
+ },
+ selectOrg: {
+ orgsid: [],
+ },
+ mylabel: "",
+ departList: [],
+ defaultProps: {
+ children: "children",
+ label: "departName",
+ },
+ };
+ },
+ created() {
+ // 鍒濆鍖栨暟鎹�
+ this.form = this.info;
+ },
+
+ watch: {
+ info(newVal) {
+ this.form = newVal; //瀵圭埗缁勪欢浼犺繃鏉ョ殑鍊艰繘琛岀洃鍚紝濡傛灉鏀瑰彉涔熷瀛愮粍浠跺唴閮ㄧ殑鍊艰繘琛屾敼鍙�
+ },
+ },
+ methods: {
+ ...mapActions(["saveOrgGrid", "updateOrgGrid"]),
+ // 淇敼鎵ф硶杞�
+ handleUpdate() {
+ this.$refs.formRef.validate((valid) => {
+ if (valid) {
+ const { form } = this;
+ if (form.id > 0) {
+ this.updateOrgGrid(form).then((res) => {
+ this.$message({
+ type: "success",
+ message: "淇敼鎴愬姛",
+ });
+ this.$emit("closeDialog", { flag: false, index: 1 });
+ });
+ } else {
+ this.saveOrgGrid(form).then((res) => {
+ this.$message({
+ type: "success",
+ message: "淇濆瓨鎴愬姛",
+ });
+ this.$emit("closeDialog", { flag: false, index: 1 });
+ });
+ }
+ } else {
+ return false;
+ }
+ });
+ },
+ },
+ props: ["info", "closeDialog"],
+};
+</script>
+ <style lang="scss" scoped>
+.create {
+ border-radius: 1px;
+ // background-color: #09152f;
+
+ main {
+ // border: 1px solid #fff;
+ text-align: left;
+ padding: 0 55px;
+ // background-color: #09152f;
+ padding-bottom: 50px;
+
+ .mainContent {
+ display: flex;
+ justify-content: center;
+ padding-top: 50px;
+
+ .el-form-item__content {
+ width: 400px;
+
+ .el-select {
+ width: 100%;
+ }
+ }
+
+ .optionHandleSp {
+ display: flex;
+
+ .areaNumber,
+ .moreNumber {
+ flex: 1;
+ }
+
+ .telNumber {
+ flex: 2;
+ }
+ }
+
+ .optionBtn {
+ display: flex;
+ margin-top: 20px;
+
+ .btn {
+ padding: 12px 50px;
+ }
+ }
+ }
+ }
+}
+</style>
\ No newline at end of file
diff --git a/src/views/systemSetting/device/grid/components/components/map.vue b/src/views/systemSetting/device/grid/components/components/map.vue
new file mode 100644
index 0000000..0a4fd03
--- /dev/null
+++ b/src/views/systemSetting/device/grid/components/components/map.vue
@@ -0,0 +1,84 @@
+<template>
+ <div id="container"></div>
+</template>
+<script>
+import AMapLoader from "@amap/amap-jsapi-loader";
+export default {
+ data() {
+ return {
+ map: null,
+ _point: { x: "119.27179890", y: "28.59027084" },
+ _zoom: 15,
+ };
+ },
+ created() {
+ },
+ methods: {
+ locationMap() {
+ const that = this;
+ that.map.setZoomAndCenter(that.zoom, [that.point.x, that.point.y]);
+ if (that.mark) {
+ // 鍒涘缓涓�涓� Marker 瀹炰緥锛�
+ var marker = new AMap.Marker({
+ position: new AMap.LngLat(that._point.x, that._point.y), // 缁忕含搴﹀璞★紝涔熷彲浠ユ槸缁忕含搴︽瀯鎴愮殑涓�缁存暟缁刐116.39, 39.9]
+ title: that.mark.title,
+ });
+
+ // 灏嗗垱寤虹殑鐐规爣璁版坊鍔犲埌宸叉湁鐨勫湴鍥惧疄渚嬶細
+ that.map.add(marker);
+ marker.on('click',function(e){
+ console.log('666')
+ that.$emit('fatherMethod')
+ // that.$parent.fatherMethod();
+
+ })
+ }
+
+ },
+ },
+ mounted() {
+ const that = this;
+ AMapLoader.load({
+ key: "091ade377d4db40f68cc78cb9658ce8d", // 鐢宠濂界殑Web绔紑鍙戣�匥ey锛岄娆¤皟鐢� load 鏃跺繀濉�
+ version: "2.0", // 鎸囧畾瑕佸姞杞界殑 JSAPI 鐨勭増鏈紝缂虹渷鏃堕粯璁や负 1.4.15
+ plugins: [], // 闇�瑕佷娇鐢ㄧ殑鐨勬彃浠跺垪琛紝濡傛瘮渚嬪昂'AMap.Scale'绛�
+ })
+ .then((AMap) => {
+ that.map = new AMap.Map("container");
+ that.locationMap();
+ })
+ .catch((e) => {
+ console.log(e);
+ });
+ // const that = this;
+ // debugger
+ // that.map.setZoomAndCenter(that._zoom, [that._point.x, that._point.y]);
+ // if (that.mark) {
+ // // 鍒涘缓涓�涓� Marker 瀹炰緥锛�
+ // var marker = new AMap.Marker({
+ // position: new AMap.LngLat(that._point.x, that._point.y), // 缁忕含搴﹀璞★紝涔熷彲浠ユ槸缁忕含搴︽瀯鎴愮殑涓�缁存暟缁刐116.39, 39.9]
+ // title: that.mark.title,
+ // });
+
+ // // 灏嗗垱寤虹殑鐐规爣璁版坊鍔犲埌宸叉湁鐨勫湴鍥惧疄渚嬶細
+ // that.map.add(marker);
+ // }
+ },
+ watch: {
+ point(newval, oldval) {
+ this._point = newval;
+ this.locationMap();
+ },
+ zoom(newval, oldval) {
+ this._zoom = newval;
+ },
+ },
+ props: ["point", "zoom", "mark"],
+};
+</script>
+<style lang="scss" scoped>
+#container {
+ width: 100%;
+ height: 100%;
+}
+</style>
diff --git a/src/views/systemSetting/device/grid/components/main/index.vue b/src/views/systemSetting/device/grid/components/main/index.vue
index 91d7c26..6bcbe6e 100644
--- a/src/views/systemSetting/device/grid/components/main/index.vue
+++ b/src/views/systemSetting/device/grid/components/main/index.vue
@@ -1,351 +1,232 @@
<template>
- <div class="mainContent">
- <!-- <div class="aside">
- <department-aside />
- </div> -->
- <div class="grid-content">
- <!-- 鏁版嵁灞曠ず -->
- <el-table ref="multipleTable"
- :header-cell-style="{'font-weight':'650','line-height':'45px'}"
- :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"
- @selection-change="tableChange">
- <el-table-column type="selection" min-width="5">
- </el-table-column>
- <el-table-column label="鐢ㄦ埛ID" min-width="6">
- <template slot-scope="scope">{{ scope.row.id }}</template>
- </el-table-column>
- <el-table-column prop="nickName" label="鐢ㄦ埛鍚嶇О" min-width="10">
- </el-table-column>
- <el-table-column prop="username" label="鎵�灞炲鍚�" min-width="8">
- </el-table-column>
- <el-table-column prop="mobile" label="鑱旂郴鏂瑰紡" min-width="7">
- </el-table-column>
- <el-table-column prop="note" label="鎵�灞炶鑹�" min-width="8">
- <template slot-scope="scope">
- <span>{{filterRole(scope.row.roles)}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="jobTitle" label="鎵�灞炶亴鍔�" min-width="8">
- </el-table-column>
- <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="10">
- <template slot-scope="scope">
- <span>{{changeTime(scope.row)}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="鍚敤" min-width="5">
- <template slot-scope="scope">
- <!-- @change="handleChangeStatus(scope.row)" -->
- <el-switch class="switchStyle" v-model="scope.row.status"
- active-color="#3fef9a" inactive-color="#000212" disabled>
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="operation" label="鎿嶄綔" min-width="20">
- </el-table-column>
- </el-table>
- <!-- 鏌ョ湅椤甸潰 -->
- <el-dialog :visible.sync="dialogView" width="45%" v-if="dialogView"
- title="鏌ョ湅鐢ㄦ埛淇℃伅">
- <MyView :userInfo=userInfo></MyView>
- </el-dialog>
- <!-- 淇敼椤甸潰 -->
- <el-dialog :visible.sync="dialogUpdate" width="45%" v-if="dialogUpdate"
- :title="updateFlag ? flag.role ? '淇敼鐢ㄦ埛瑙掕壊淇℃伅' : flag.depart ? '淇敼鐢ㄦ埛閮ㄩ棬淇℃伅': '淇敼鐢ㄦ埛瀵嗙爜' :''"
- :before-close="handleClose">
- <updateUser :updateFlag="updateFlag" :userInfo=userInfo :flag=flag @closeDialog="closeDialog"
- :getUserList="getUserList" v-if="!flag.password" />
- <MyPwd v-else :userInfo=userInfo @closeDialog="closeDialog"></MyPwd>
- </el-dialog>
- <!-- tools -->
- <div class="tools">
- <div class="funs">
- <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox>
- <el-checkbox v-model="unsame" @change="disSame(tableData)">鍙嶉��</el-checkbox>
- <el-select v-model="myIdx" placeholder="鎵归噺鎿嶄綔" @change="selectChange">
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"
- :disabled="item.disabled">
- </el-option>
- </el-select>
+ <div class="mainContent">
+ <!-- <div class="aside">
+ <department-aside />
+ </div> -->
+ <div class="grid-content">
+ <header>
+ <div class="headerContent">
+ <div class="search">
+ <span>绛涢�夋潯浠�:</span>
+ <el-input v-model="context" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
+ <div class="findBtn">
+ <el-button type="primary" @click="getList()">鏌ヨ</el-button>
+ </div>
</div>
- <el-pagination class="pagination" background :current-page="currentPage" layout="prev, pager, next" :total="totalNum"
- :page-size="pageSize" @current-change="changeCurrentPage" @prev-click="handlePrev"
- @next-click="handleNext">
+ </div>
+ <div class="main-title">
+ <el-button
+ class="el-icon-plus button-addition"
+ type="primary"
+ @click="handleAdd()"
+ >娣诲姞</el-button
+ >
+ </div>
+ </header>
+ <!-- 鏁版嵁灞曠ず -->
+ <el-table
+ ref="multipleTable"
+ :header-cell-style="{ 'font-weight': '650', 'line-height': '45px' }"
+ :data="tableData"
+ style="width: 100%"
+ :row-class-name="tableRowClassName"
+ @selection-change="tableChange"
+ >
+ <el-table-column type="selection" min-width="5"> </el-table-column>
+
+ <el-table-column prop="name" label="鍖哄煙鍚嶇О" min-width="10">
+ </el-table-column>
+ <el-table-column prop="worker" label="鎵�灞炵綉鏍煎憳" min-width="8">
+ </el-table-column>
+ <el-table-column prop="contact" label="鑱旂郴鏂瑰紡" min-width="7">
+ </el-table-column>
+ <el-table-column prop="area" label="璐d换鍖哄煙" min-width="8">
+ </el-table-column>
+ <el-table-column prop="description" label="鎻忚堪" min-width="20">
+ </el-table-column>
+ <el-table-column prop="operation" label="鎿嶄綔" min-width="5">
+ <template slot-scope="scope">
+ <div class="operation">
+ <span @click="handleEdit(scope.row)">缂栬緫</span>
+ <span class="line">|</span>
+ <span @click="handleDelete(scope.row)">鍒犻櫎</span>
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <el-dialog
+ :visible.sync="dialogUpdate"
+ width="45%"
+ v-if="dialogUpdate"
+ title="缃戞牸淇℃伅"
+ :before-close="handleClose"
+ >
+ <MyView :info="handheldGrid" @closeDialog="handleCallBack"></MyView>
+ </el-dialog>
+
+ <!-- tools -->
+ <div class="tools">
+ <div class="funs"></div>
+ <div class="pagination">
+ <el-pagination
+ background
+ :current-page="currentPage"
+ layout="prev, pager, next"
+ :total="totalNum"
+ :page-size="pageSize"
+ @current-change="changeCurrentPage"
+ @prev-click="handlePrev"
+ @next-click="handleNext"
+ >
</el-pagination>
</div>
</div>
</div>
+ </div>
</template>
<script>
-import helper from '@/utils/mydate'
+import helper from "@/utils/mydate";
+import { createNamespacedHelpers } from "vuex";
import departmentAside from "@/views/operate/fivepack/threepack/components/aside";
+import MyView from "../components/dialogForm.vue";
+const { mapActions } = createNamespacedHelpers("orgGrid");
export default {
- components: { departmentAside },
- data() {
- return {
- tableData: [],
- search: "",
- dialogUpdate: false,
- dialogView:false,
- updateFlag: false,
- userInfo: '',
- totalNum: 0,
- pageSize: 10,
- currentPage: 1,
- renderFlag: false,
- flag: {
- role: false,
- password: false,
- depart: false,
- },
- all: false,
- unsame: false,
- myIdx: 0,
- preMyIdx: 0,
- options: [
- {
- value: 0,
- label: '鎵归噺鎿嶄綔',
- disabled: true,
- },
- {
- value: 1,
- label: '鎵归噺鍚敤',
- },
- {
- value: 2,
- label: '鎵归噺绂佺敤',
- },
- {
- value: 3,
- label: '鎵归噺鍒犻櫎',
- }
- ],
- tempList: []
- }
+ components: { departmentAside, MyView },
+ data() {
+ return {
+ tableData: [],
+ context: "",
+ dialogUpdate: false,
+ dialogView: false,
+ updateFlag: false,
+ userInfo: "",
+ totalNum: 0,
+ pageSize: 10,
+ currentPage: 1,
+ renderFlag: false,
+ flag: {
+ role: false,
+ password: false,
+ depart: false,
+ },
+ all: false,
+ unsame: false,
+ myIdx: 0,
+ preMyIdx: 0,
+ tempList: [],
+ handheldGrid: {},
+ };
+ },
+ created() {
+ this.getList();
+ },
+ methods: {
+ ...mapActions(["getOrgGridList", "deleteOrgGrid"]),
+ tableChange(list) {
+ this.tempList = [];
+ list.forEach((item) => {
+ this.tempList.push(item.id);
+ });
+ this.all = list.length === this.tableData.length;
},
- created() {
- this.getUserList();
+ changeTime({ createTime }) {
+ return helper(createTime);
},
- methods: {
- async selectChange(list) {
- if (this.tempList.length !== 0) {
- this.preMyIdx = list;
- if (list === 3) {
- await this.mulDelte(this.tempList);
- } else if (list === 2) {
- await this.mulUpdateStatus(this.tempList, 0);
- } else {
- await this.mulUpdateStatus(this.tempList, 1);
- }
- this.myIdx = 0;
- } else {
- this.myIdx = this.preMyIdx;
- this.$message({
- type: 'warning',
- message: '鎮ㄨ繕娌¢�変腑浠讳綍鏁版嵁',
- })
- }
- },
- tableChange(list) {
- this.tempList = [];
- list.forEach(item => {
- this.tempList.push(item.id);
- })
- this.all = list.length === this.tableData.length;
- },
- // 鎵归噺鍒犻櫎鐢ㄦ埛淇℃伅
- mulDelte(idArr) {
- this.$confirm("鎮ㄧ‘瀹氳杩涜鎵归噺鍒犻櫎鐢ㄦ埛鍚�?")
- .then(_ => {
- this.$axios({
- method: 'post',
- url: 'sccg/admin/deleteBatch?ids=' + idArr,
- })
- .then(res => {
- if (res.code === 200) {
- this.$message({
- type: 'success',
- message: '鍒犻櫎鐢ㄦ埛淇℃伅鎴愬姛',
- })
- this.getUserList();
- } else {
- this.$message({
- type: 'error',
- message: res.message
- })
- }
- })
- })
- .catch(err => { })
- },
- // 鎵归噺淇敼璐﹀彿
- mulUpdateStatus(idArr, flag) {
- this.$confirm(flag === 1 ? "鎮ㄧ‘瀹氳杩涜鎵归噺鍚敤鐢ㄦ埛鍚�?" : '鎮ㄧ‘瀹氳杩涜鎵归噺绂佺敤鐢ㄦ埛鍚�?')
- .then(_ => {
- this.$axios({
- method: 'post',
- url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status=' + flag,
- })
- .then(res => {
- if (res.code === 200) {
- this.$message({
- type: 'success',
- message: '鏇存敼鐢ㄦ埛鐘舵�佹垚鍔�',
- })
- this.getUserList();
- } else {
- this.$message({
- type: 'error',
- message: res.message
- })
- }
- })
- })
- .catch(err => { })
- },
- changeTime({ createTime }) {
- return helper(createTime);
- },
- selectAll() {
- this.$refs.multipleTable.toggleAllSelection();
- },
- disSame(list) {
- list.forEach(row => {
- this.$refs.multipleTable.toggleRowSelection(row)
- })
- },
- // 鍒犻櫎鐢ㄦ埛
- handleDelete({ id }) {
- this.$confirm('纭鍒犻櫎锛�').then(_ => {
- this.$axios({
- method: 'post',
- url: 'sccg/admin/delete/' + id,
- }).then(res => {
- this.$message({
- message: res.message,
- type: 'success'
- })
- this.getUserList();
- })
- }).catch(_ => { })
- },
- closeDialog({ flag }) {
- this.dialogUpdate = flag;
- this.getUserList();
- },
- handleClose(done) {
- if (this.updateFlag) {
- this.$confirm('纭鍏抽棴锛�')
- .then(_ => {
- this.dialogUpdate = false;
- this.updateFlag = false;
- done();
- })
- .catch(_ => { });
- }else{
- done();
- }
- },
- // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠�
- changeCurrentPage(page) {
- this.currentPage = page;
- this.getUserList();
- },
- // 涓婁竴椤电偣鍑讳簨浠�
- handlePrev(page) {
- this.currentPage = page;
- this.getUserList();
- },
- // 涓嬩竴椤电偣鍑讳簨浠�
- handleNext(page) {
- this.currentPage = page;
- this.getUserList();
- },
- // 淇敼瑙掕壊
- handleChangeRole(obj, mykey) {
- this.dialogUpdate = true;
- this.updateFlag = true;
- for (let key in this.flag) {
- if (key === mykey) {
- this.flag[key] = true;
- } else {
- this.flag[key] = false;
- }
- }
- this.userInfo = obj;
- },
- // 淇敼鐢ㄦ埛鐘舵��
- handleChangeStatus(obj) {
- let { id, status } = obj;
- status === true ? status = 1 : status = 0;
- this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => {
- })
- },
- // 鑾峰彇鐢ㄦ埛鍒楄〃
- getUserList() {
- const that = this;
- const { currentPage, pageSize, search } = this;
- // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭�佺敤鎴锋煡璇�(鏆傛椂鏀寔鐢佃瘽鍙风爜)
- this.$axios.get(`sccg/admin/list?keyword=${search}¤t=${currentPage}&pageSize=${pageSize}`).then(res => {
- if (res.code === 200) {
- res.data.records.forEach(item => {
- item.status === 1 ? item.status = true : item.status = false;
- })
- that.totalNum = res.data.total;
- that.tableData = res.data.records;
- this.renderFlag = true;
- }
- })
- },
- // 鏌ョ湅鐢ㄦ埛淇℃伅(涓嶅彲淇敼)
- handleFind(rowData) {
- this.dialogView = true;
- this.userInfo = rowData;
- },
- // 璁剧疆琛ㄦ牸鏂戦┈绾�
- tableRowClassName({ row, rowIndex }) {
- if ((rowIndex + 1) % 2 === 0) {
- return 'warning-row';
- } else {
- return 'success-row';
- }
- },
- // 澶勭悊鐢ㄦ埛鎵�灞炶鑹�
- filterRole(arr){
- let str = '';
- if(arr.length === 0){
- return;
- }
- arr.forEach((item,index)=>{
- if(item!==null){
- if(index<arr.length-1){
- str+=item.name +',';
- }else{
- str+=item.name;
- }
- }
- })
- return str;
- }
+ disSame(list) {
+ list.forEach((row) => {
+ this.$refs.multipleTable.toggleRowSelection(row);
+ });
},
- props: ['refresh', 'keyword', 'resetFresh'],
- watch: {
- refresh: {
- handler(newValue, oldValue) {
- if (newValue) {
- this.search = '';
- if (this.keyword !== '') {
- this.search = this.keyword;
- }
- this.currentPage = 1;
- this.getUserList();
- this.$emit('resetFresh', { flag: false })
- }
- },
- immediate: true
- }
- }
-}
+ handleCallBack({ flag }) {
+ this.dialogUpdate = false;
+ this.getList();
+ },
+ handleClose(done) {
+ if (this.updateFlag) {
+ this.$confirm("纭鍏抽棴锛�")
+ .then((_) => {
+ this.dialogUpdate = false;
+ this.updateFlag = false;
+ done();
+ })
+ .catch((_) => {});
+ } else {
+ done();
+ }
+ },
+ // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠�
+ changeCurrentPage(page) {
+ this.currentPage = page;
+ this.getList();
+ },
+ // 涓婁竴椤电偣鍑讳簨浠�
+ handlePrev(page) {
+ this.currentPage = page;
+ this.getList();
+ },
+ // 涓嬩竴椤电偣鍑讳簨浠�
+ handleNext(page) {
+ this.currentPage = page;
+ this.getList();
+ },
+ // 鑾峰彇鍒楄〃
+ getList() {
+ const that = this;
+ const { currentPage, pageSize, context } = this;
+ this.getOrgGridList({
+ currentPage,
+ pageSize,
+ name: context,
+ })
+ .then((res) => {
+ if (res.code === 200) {
+ res.data.records.forEach((item) => {
+ item.status === 1 ? (item.status = true) : (item.status = false);
+ });
+ that.totalNum = res.data.total;
+ that.tableData = res.data.records;
+ this.renderFlag = true;
+ }
+ });
+ },
+ handleAdd() {
+ this.handheldGrid = {
+ id: 0,
+ name: "",
+ worker: "",
+ contact: "",
+ area: "",
+ description: "",
+ region: "",
+ };
+ this.dialogUpdate = true;
+ },
+ handleEdit(row) {
+ this.handheldGrid = row;
+ this.dialogUpdate = true;
+ },
+ handleDelete(row) {
+ this.$confirm("纭鍒犻櫎锛�").then((_) => {
+ this.deleteOrgGrid(row.id).then((res) => {
+ this.$message({
+ type: "success",
+ message: "鍒犻櫎鎴愬姛锛�",
+ });
+ this.getList();
+ });
+ });
+ },
+ // 璁剧疆琛ㄦ牸鏂戦┈绾�
+ tableRowClassName({ row, rowIndex }) {
+ if ((rowIndex + 1) % 2 === 0) {
+ return "warning-row";
+ } else {
+ return "success-row";
+ }
+ },
+ },
+};
</script>
<style lang="scss" scoped>
.mainContent {
@@ -381,4 +262,85 @@
}
}
}
+
+header {
+ background-color: white;
+ display: flex;
+ .headerContent {
+ padding: 10px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .search {
+ display: flex;
+ justify-content: flex-start;
+ line-height: 2;
+
+ span {
+ flex: 1;
+ }
+
+ .el-input {
+ flex: 2;
+ color: #1d3f57;
+ }
+ .el-select {
+ flex: 1;
+ }
+ .el-date-editor {
+ flex: 1;
+ }
+ }
+
+ .findBtn {
+ line-height: 100px;
+ margin-left: 15px;
+ display: flex;
+ align-items: center;
+ margin-top: -2px;
+
+ .el-button {
+ padding: 12px 25px;
+ border-radius: 20px;
+ }
+ }
+ ::v-deep .el-form {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+
+ .el-form-item {
+ width: 30%;
+ }
+
+ .el-form-item__label {
+ color: #4b9bb7;
+ }
+ }
+ }
+}
+
+.operation {
+ display: flex;
+
+ .line {
+ padding: 0 5px;
+ }
+
+ span:hover {
+ cursor: pointer;
+ }
+}
+
+.main-title {
+ line-height: 20px;
+ padding: 10px 20px;
+ margin-left: auto;
+ border-radius: 20px;
+ .el-button {
+ padding: 12px 25px;
+ border-radius: 20px;
+ }
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0