diff --git a/README.md b/README.md index f443f1e..a791def 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ @@ -45,4 +45,9 @@ FEATURE `2021年12月6日` FEATURE - 增加 封装接口地址 -- 修改 登录账号密码 telpo telpo#1234 \ No newline at end of file +- 修改 登录账号密码 telpo telpo#1234 + +## v1.0.5F +`2021年12月8日` +FEATURE +- 完成 1.告警识别内容 2.通用例外 3.用户例外 4.告警信息查询 模块功能接口调试对接 \ No newline at end of file diff --git a/src/api/alarm-query.js b/src/api/alarm-query.js new file mode 100644 index 0000000..11325c6 --- /dev/null +++ b/src/api/alarm-query.js @@ -0,0 +1,21 @@ +/* + * @Date: 2021-12-07 17:32:38 + * @LastEditors: JinxuChen + * @LastEditTime: 2021-12-07 17:49:01 + * @FilePath: \GpsCardAdmin\src\api\alarm-query.js + * @description: 自动报用设备警告信息查询 + */ +import request from '@/utils/request' +export const APIAlarmQuery = { + getAlarmQuery, +}; +export default APIAlarmQuery; +// 自动报用设备警告信息查询 +function getAlarmQuery(params) { + return request({ + url: '/api/v1/Fence/AreaAlarmQuery', + method: 'post', + data: params, + }); +} + diff --git a/src/api/common-exception.js b/src/api/common-exception.js new file mode 100644 index 0000000..f0773da --- /dev/null +++ b/src/api/common-exception.js @@ -0,0 +1,38 @@ +/* + * @Date: 2021-12-07 17:32:38 + * @LastEditors: JinxuChen + * @LastEditTime: 2021-12-07 17:40:55 + * @FilePath: \GpsCardAdmin\src\api\common-exception.js + * @description: 通用告警关键字 + */ +import request from '@/utils/request' +export const APIExceptionGen = { + getRecognitionGen, + changeRecognitionGen, + delRecognitionGen +}; +export default APIExceptionGen; +// 自动报警通用关键词查询(分页) +function getRecognitionGen(params) { + return request({ + url: '/api/v1/Fence/AreaGeneralFilterQuery', + method: 'post', + data: params, + }); +} +// 新增/编辑自动报通用关键词 +function changeRecognitionGen(params) { + return request({ + url: '/api/v1/Fence/AddAreaGeneralFilter', + method: 'post', + data: params, + }); +} +// 删除系统/通用关键词 +function delRecognitionGen(params) { + return request({ + url: '/api/v1/Fence/DeleteAreaAlarmFilter', + method: 'post', + data: params, + }); +} \ No newline at end of file diff --git a/src/api/off-limits-manage.js b/src/api/off-limits-manage.js index 93db29c..8e2be2e 100644 --- a/src/api/off-limits-manage.js +++ b/src/api/off-limits-manage.js @@ -1,13 +1,16 @@ /* * @Date: 2021-12-06 17:31:43 * @LastEditors: JinxuChen - * @LastEditTime: 2021-12-06 18:07:02 + * @LastEditTime: 2021-12-07 17:55:13 * @FilePath: \GpsCardAdmin\src\api\off-limits-manage.js - * @description: 封装告警识别内容接口 + * @description: 告警识别内容接口 */ import request from '@/utils/request' export const APILimits = { - getRecognition + getRecognition, + changeRecognition, + areaCategoryQuery, + delRecognition }; export default APILimits; @@ -15,7 +18,31 @@ export default APILimits; // 自动报警通用关键词查询 function getRecognition(params) { return request({ - url: '/api/v1/Fence/AreaGeneralFilterQuery', + url: '/api/v1/Fence/AreaSysFilterQuery', + method: 'post', + data: params, + }); +} +// 新增/编辑自动报警通用关键词查询, 通过id判断是新增还是编辑 0是新增 不是0则为编辑 +function changeRecognition(params) { + return request({ + url: '/api/v1/Fence/AddAreaSysFilter', + method: 'post', + data: params, + }); +} +// 删除自动报警通用关键词, +function delRecognition(params) { + return request({ + url: '/api/v1/Fence/DeleteAreaAlarmFilter', + method: 'post', + data: params, + }); +} +// 自动报警分类查询(分页 +function areaCategoryQuery(params) { + return request({ + url: '/api/v1/Fence/AreaCategoryQuery', method: 'post', data: params, }); diff --git a/src/api/user-exception.js b/src/api/user-exception.js new file mode 100644 index 0000000..8dc192b --- /dev/null +++ b/src/api/user-exception.js @@ -0,0 +1,38 @@ +/* + * @Date: 2021-12-07 17:32:38 + * @LastEditors: JinxuChen + * @LastEditTime: 2021-12-08 10:45:21 + * @FilePath: \GpsCardAdmin\src\api\user-exception.js + * @description: 用户告警关键字 + */ +import request from '@/utils/request' +export const APIExceptionUser = { + getRecognitionUser, + changeRecognitionUser, + delRecognitionUser +}; +export default APIExceptionUser; +// 自动报警用户关键词查询(分页) +function getRecognitionUser(params) { + return request({ + url: '/api/v1/Fence/AreaUserFilterQuery', + method: 'post', + data: params, + }); +} +// 新增/编辑自动报用户关键词 +function changeRecognitionUser(params) { + return request({ + url: '/api/v1/Fence/AddAreaUserFilter', + method: 'post', + data: params, + }); +} +// 删除用户关键词 +function delRecognitionUser(params) { + return request({ + url: '/api/v1/Fence/DeleteAreaUserAlarmFilter', + method: 'post', + data: params, + }); +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index e3c286e..8e33793 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ /* * @Date: 2021-11-30 15:35:16 * @LastEditors: JinxuChen - * @LastEditTime: 2021-11-30 17:51:56 + * @LastEditTime: 2021-12-07 10:49:30 * @FilePath: \GpsCardAdmin\src\main.js * @description: */ @@ -21,7 +21,8 @@ import router from './router' import '@/icons' // icon import '@/permission' // permission control - +import transfrom from '@/utils/transfrom'; +Vue.use(transfrom); /** * If you don't want to use mock-server * you want to use MockJs for mock api diff --git a/src/utils/model.js b/src/utils/model.js index 2ae616a..2316e14 100644 --- a/src/utils/model.js +++ b/src/utils/model.js @@ -1,8 +1,8 @@ /* * @Date: 2021-11-30 15:09:25 * @LastEditors: JinxuChen - * @LastEditTime: 2021-12-06 18:29:49 + * @LastEditTime: 2021-12-08 14:55:27 * @FilePath: \GpsCardAdmin\src\utils\model.js * @description: 版本号 */ -export const VersionModel = '1.0.4'; \ No newline at end of file +export const VersionModel = '1.0.5'; \ No newline at end of file diff --git a/src/utils/transfrom.js b/src/utils/transfrom.js new file mode 100644 index 0000000..d46ace8 --- /dev/null +++ b/src/utils/transfrom.js @@ -0,0 +1,16 @@ +/* + * @Date: 2021-12-07 10:45:23 + * @LastEditors: JinxuChen + * @LastEditTime: 2021-12-08 14:57:07 + * @FilePath: \GpsCardAdmin\src\utils\transfrom.js + * @description: 将接口里面的kindId转化为文字 + */ +exports.install = function (Vue, options) { + Vue.prototype.transfromToType = function(value) { + if(value === 1) { + return '关键字' + } else if(value === 2 ) { + return '固定地点' + } + } +} \ No newline at end of file diff --git a/src/views/off-limits-manage/alarm-query/index.vue b/src/views/off-limits-manage/alarm-query/index.vue index 7afad8b..4a2e52d 100644 --- a/src/views/off-limits-manage/alarm-query/index.vue +++ b/src/views/off-limits-manage/alarm-query/index.vue @@ -1,7 +1,7 @@ @@ -40,6 +40,7 @@ { + this.list = res.data.map(m => { + return { + imei: m.serialno, + alarmType: m.typeId, + content: m.address, + createTime: m.createTime || "无", + glat: m.glat, + glng: m.glng, + keyId: m.keyId + }; + }); + this.total = res.count; + }); + } + }, + mounted() { + this.getList(); } }; diff --git a/src/views/off-limits-manage/alarm-recognition/index.vue b/src/views/off-limits-manage/alarm-recognition/index.vue index 60a34db..378f630 100644 --- a/src/views/off-limits-manage/alarm-recognition/index.vue +++ b/src/views/off-limits-manage/alarm-recognition/index.vue @@ -1,7 +1,7 @@ @@ -16,6 +16,7 @@ @click="onAdd" >添加 批量导入 - - - - - - - - + + + 关键字 + 固定地点 + - + - - + + + + + + - + 取消 - 确认 + 确认 @@ -133,7 +128,7 @@ import TopMenu from "@/components/TopMenu"; import TTable from "../../../components/TTable/TTable"; import Pagination from "@/components/Pagination"; import UploadExcelComponent from "@/components/UploadExcel/index.vue"; -import APILimits from '@/api/off-limits-manage' +import APILimits from "@/api/off-limits-manage"; export default { name: "", components: { TTable, TopMenu, Pagination, UploadExcelComponent }, @@ -157,40 +152,14 @@ export default { ], type: "", model: "", - typeOptions: [ - { - value: "1", - label: "类别1" - }, - { - value: "2", - label: "类别1" - }, - { - value: "3", - label: "类别1" - }, - { - value: "4", - label: "类别1" - } - ], - modelOptions: [ - { - value: "1", - label: "类别1" - }, - { - value: "2", - label: "类别1" - } - ], + modelOptions: [], searchValue: "", columns: [ { prop: "type", title: "类型" }, { prop: "model", title: "类别" }, { prop: "content", title: "内容名称" }, { prop: "createTime", title: "创建时间" }, + { prop: "status", title: "状态" }, { action: true, title: "操作", @@ -200,58 +169,153 @@ export default { ] } ], - list: [ - { - type: "关键子", - model: "出走危险", - content: "港口码头", - createTime: "2021-11-30" - } - ], - total: 1, + list: [], + total: 0, page: 1, limit: 10, dialogPvVisible: false, dialogStatus: "", dialogTitle: "修改告警识别内容", form: { - type: "", + typeRadio: 1, model: "", content: "", - createTime: "" + createTime: "", + resource: "", + categoryId: "", + status: true, + id: "" + }, + formRules: { + content: [ + { + required: true, + message: "请输入内容名称", + trigger: "blur" + } + ], + typeRadio: [ + { required: true, message: "请选择类型", trigger: "change" } + ], + model: [ + { required: true, message: "请选择类别", trigger: "change" } + ] }, - dialogUpload: false + formOptions: [], + dialogUpload: false, + loading: false }; }, + watch: { + model(value) { + if (value === "") { + this.getList(); + } + }, + searchValue(value) { + if (value === "") { + this.getList(); + } + } + }, methods: { + // 清空表单 + resetForm() { + this.form = { + typeRadio: 1, + model: "", + content: "", + createTime: "", + resource: "", + categoryId: "", + status: true + }; + }, // 添加 onAdd() { - console.log("add"); - this.form = ""; + this.resetForm(); + /* this.form.typeRadio = 1; */ this.dialogTitle = "添加告警识别内容"; this.dialogPvVisible = true; this.dialogStatus = "add"; + this.form.status = true; + this.getAreaCategoryQuery(); }, - add() { - console.log("add"); + add(formName) { + let reqBody = { + id: 0, + categoryId: this.form.categoryId, + keyword: this.form.content, + status: this.form.status + }; + this.$refs[formName].validate(valid => { + if (valid) { + APILimits.changeRecognition(reqBody).then(res => { + console.log(res); + if (res.code === 0) { + this.dialogPvVisible = false; + this.$message({ + message: "增加成功", + type: "success" + }); + this.getList(); + } + }); + } else { + return false; + } + }); }, // 批量导入, ##注意 ,批量导入格式必须跟表格的一样 onImportBatch() { this.dialogUpload = true; }, // 搜索 - onSearch() {}, + onSearch() { + this.$refs['pages'].currentPage = 1; + this.getList(); + }, // 修改 onUpdate(row) { + console.log("row", row); + this.getAreaCategoryQuery(); this.dialogPvVisible = true; this.dialogStatus = "update"; - this.dialogTitle = "修改告警识别内容"; - this.form = Object.assign({}, row); // copy obj + this.dialogTitle = "修改告警识别内容"; // copy obj + /* this.form = Object.assign({}, row); */ ; + this.form.categoryId = row.categoryId; this.form.createTime = new Date(this.form.createTime); - console.log("修改", row); + this.form.typeRadio = row.kindId; + this.form.model = row.categoryId; + this.form.id = row.id; + this.form.content = row.content; + this.form.status = row.status === '打开' ? true : false; }, - update() { - console.log("update"); + update(formName) { + let reqBody = { + id: this.form.id, //0 是新增 选中的rouw的id是修改 + categoryId: this.form.categoryId, + kindId: this.form.typeRadio, + keyword: this.form.content, + status: this.form.status + }; + this.$refs[formName].validate(valid => { + if (valid) { + APILimits.changeRecognition(reqBody).then(res => { + console.log(res); + if (res.code === 0) { + this.dialogPvVisible = false; + this.$message({ + message: "修改成功", + type: "success" + }); + this.getList(); + } + }); + } else { + return false; + } + }); }, // 删除 onDelete(row) { @@ -262,25 +326,72 @@ export default { type: "warning" }) .then(() => { - this.$message({ - type: "success", - message: "删除成功!" - }); + let reqBody = { + id: row.id, + type: "system" + }; + APILimits.delRecognition(reqBody). + then(res => { + if ((res.code === 0)) { + this.$message({ + type: "success", + message: "删除成功!" + }); + this.getList(); + } else { + this.$message({ + type: "error", + message: "删除失败!" + }); + } + }); }) .catch(() => {}); }, // 获取分页数据 getList() { + this.loading = true; + let reqBody = { + pageNumber: this.page, + begNumber: this.limit, + categoryId: this.model, + keyword: this.searchValue + }; + APILimits.getRecognition(reqBody).then(res => { + this.list = res.data.map(m => { + return { + type: this.transfromToType(m.kindId), + model: m.categoryName, + content: m.keyword, + createTime: m.createTime, + kindId: m.kindId, + categoryId: m.categoryId, + status: m.status === true ? '打开' : '关闭', + id: m.id + }; + }); + this.total = res.count; + }); + this.loading = false; + }, + // 获取分类数据 + getAreaCategoryQuery() { let reqBody = { pageNumber: 1, begNumber: 20, - categoryId: '', - keyword: '', - - } - APILimits.getRecognition(reqBody).then(res => { - console.log("res", res); - /* this.list = res.data; */ + keyword: "" + }; + APILimits.areaCategoryQuery(reqBody).then(res => { + this.formOptions = res.data.map(m => { + return { + value: m.categoryId, + label: + m.categoryName + + "--" + + `${this.transfromToType(m.kindId)}` + }; + }); + this.modelOptions = this.formOptions; }); }, beforeUpload(file) { @@ -299,13 +410,22 @@ export default { handleSuccess({ results, header }) { this.list = results; this.columns = header.map(h => { - return { prop: h, title: h } + return { prop: h, title: h }; }); this.dialogUpload = false; + }, + // 弹窗选择框值变化时 + onSelectChange(value) { + this.form.categoryId = value; + }, + // 页面选择框变化 + outSelecChange(value) { + this.model = value; } }, mounted() { - this.getList() + this.getList(); + this.getAreaCategoryQuery(); } }; diff --git a/src/views/off-limits-manage/common-exception/index.vue b/src/views/off-limits-manage/common-exception/index.vue index 284368e..c9be596 100644 --- a/src/views/off-limits-manage/common-exception/index.vue +++ b/src/views/off-limits-manage/common-exception/index.vue @@ -1,7 +1,7 @@ @@ -17,9 +17,16 @@ >添加 - + - - + + - - + + + + + + - + 取消 - 确认 + 确认 @@ -102,35 +125,21 @@ import TopMenu from "@/components/TopMenu"; import TTable from "../../../components/TTable/TTable"; import Pagination from "@/components/Pagination"; +import APIExceptionGen from "@/api/common-exception"; +import APILimits from "@/api/off-limits-manage"; export default { name: "", components: { TTable, TopMenu, Pagination }, data() { return { - typeOptions: [ - { - value: "1", - label: "类别1" - }, - { - value: "2", - label: "类别1" - }, - { - value: "3", - label: "类别1" - }, - { - value: "4", - label: "类别1" - } - ], - model: '', + model: "", searchValue: "", columns: [ + { prop: "type", title: "类型" }, { prop: "model", title: "类别" }, { prop: "content", title: "内容名称" }, { prop: "createTime", title: "创建时间" }, + { prop: "status", title: "状态" }, { action: true, title: "操作", @@ -140,51 +149,148 @@ export default { ] } ], - list: [ - { - model: "出走危险", - content: "港口码头", - createTime: "2021-11-30" - } - ], + list: [], total: 1, page: 1, limit: 10, type: "error", dialogPvVisible: false, - dialogStatus: '', + dialogStatus: "", dialogTitle: "修改通用例外", + modelOptions: [], //页面下拉框数据 + formOptions: [], //弹窗下拉数据 form: { model: "", content: "", - createTime: "" + createTime: "", + status: true, + id: "" + }, + formRules: { + content: [ + { + required: true, + message: "请输入内容名称", + trigger: "blur" + } + ], + model: [ + { required: true, message: "请选择类别", trigger: "change" } + ] } }; }, + watch: { + model(value) { + if (value === "") { + this.getList(); + } + }, + searchValue(value) { + if (value === "") { + this.getList(); + } + } + }, methods: { + // 清空表单 + resetForm() { + this.form = { + model: "", + content: "", + createTime: "", + categoryId: "", + status: true + }; + }, // 添加 onAdd() { - this.form = ''; - this.dialogTitle = '添加通用例外'; + this.resetForm(); + this.dialogTitle = "添加通用例外"; this.dialogPvVisible = true; - this.dialogStatus = 'add'; + this.dialogStatus = "add"; + this.getAreaCategoryQuery(); }, - add() { - console.log("addd"); + add(formName) { + this.searchValue = ''; + let reqBody = { + id: 0, + categoryId: this.form.categoryId, + keyword: this.form.content, + status: this.form.status, + glat: 0, + glng: 0, + address: "", + postCode: "" + }; + this.$refs[formName].validate(valid => { + if (valid) { + APIExceptionGen.changeRecognitionGen(reqBody).then(res => { + console.log(res); + if (res.code === 0) { + this.dialogPvVisible = false; + this.$message({ + message: "增加成功", + type: "success" + }); + this.getList(); + } + }); + } else { + return false; + } + }); }, // 搜索 - onSearch() {}, + onSearch() { + this.$refs['pages'].currentPage = 1; + this.getList(); + }, // 修改 onUpdate(row) { + console.log(row); this.dialogPvVisible = true; - this.dialogStatus = 'update'; - this.dialogTitle = '修改通用例外'; - this.form = Object.assign({}, row); // copy obj + this.dialogStatus = "update"; + this.dialogTitle = + "修改通用例外"; /* this.form.createTime = new Date(this.form.createTime); */ // copy obj + /* this.form = Object.assign({}, row); */ this.form.categoryId = + row.categoryId; this.form.createTime = new Date(this.form.createTime); - console.log("修改", row); + this.form.typeRadio = row.kindId; + this.form.model = row.categoryId; + this.form.id = row.id; + this.form.content = row.content; + this.form.status = row.status === '打开' ? true : false; }, - update() { + update(formName) { console.log("update"); + let reqBody = { + id: this.form.id, + categoryId: this.form.categoryId, + keyword: this.form.content, + status: this.form.status, + glat: 0, + glng: 0, + address: "", + postCode: "" + }; + this.$refs[formName].validate(valid => { + if (valid) { + APIExceptionGen.changeRecognitionGen(reqBody).then(res => { + console.log(res); + if (res.code === 0) { + this.dialogPvVisible = false; + this.$message({ + message: "修改成功", + type: "success" + }); + this.getList(); + } + }); + } else { + return false; + } + }); }, // 删除 onDelete(row) { @@ -193,15 +299,85 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then(() => { - this.$message({ - type: "success", - message: "删除成功!" - }); - }).catch(() => {}); + }) + .then(() => { + let reqBody = { + id: row.id, + type: "general" + }; + APIExceptionGen.delRecognitionGen(reqBody).then(res => { + if (res.code === 0) { + this.$message({ + type: "success", + message: "删除成功!" + }); + this.getList(); + } else { + this.$message({ + type: "error", + message: "删除失败!" + }); + } + }); + }) + .catch(() => {}); }, // 获取分页数据 - getList() {} + getList() { + let reqBody = { + pageNumber: this.page, + begNumber: this.limit, + categoryId: this.model, + keyword: this.searchValue + }; + APIExceptionGen.getRecognitionGen(reqBody).then(res => { + this.list = res.data.map(m => { + return { + type: this.transfromToType(m.kindId), + model: m.categoryName, + content: m.keyword, + createTime: m.createTime, + kindId: m.kindId, + categoryId: m.categoryId, + status: m.status === true ? '打开' : '关闭', + id: m.id + }; + }); + this.total = res.count; + }); + }, + // 获取类型分类 + getAreaCategoryQuery() { + let reqBody = { + pageNumber: 1, + begNumber: 20, + keyword: "" + }; + APILimits.areaCategoryQuery(reqBody).then(res => { + this.formOptions = res.data.map(m => { + return { + value: m.categoryId, + label: + m.categoryName + + "--" + + `${this.transfromToType(m.kindId)}` + }; + }); + this.modelOptions = this.formOptions; + }); + }, + // 弹窗选择框值变化时 + onSelectChange(value) { + this.form.categoryId = value; + }, + // 页面选择框变化 + outSelecChange(value) { + this.model = value; + } + }, + mounted() { + this.getList(); + this.getAreaCategoryQuery(); } }; diff --git a/src/views/off-limits-manage/user-exception/index.vue b/src/views/off-limits-manage/user-exception/index.vue index d284e49..fd548a2 100644 --- a/src/views/off-limits-manage/user-exception/index.vue +++ b/src/views/off-limits-manage/user-exception/index.vue @@ -1,13 +1,20 @@