Преглед изворни кода

完成 1.告警识别内容 2.通用例外 3.用户例外 4.告警信息查询 模块功能接口调试对接

master
2183691628 пре 3 година
родитељ
комит
1d699dfb32
12 измењених фајлова са 940 додато и 227 уклоњено
  1. +7
    -2
      README.md
  2. +21
    -0
      src/api/alarm-query.js
  3. +38
    -0
      src/api/common-exception.js
  4. +31
    -4
      src/api/off-limits-manage.js
  5. +38
    -0
      src/api/user-exception.js
  6. +3
    -2
      src/main.js
  7. +2
    -2
      src/utils/model.js
  8. +16
    -0
      src/utils/transfrom.js
  9. +31
    -6
      src/views/off-limits-manage/alarm-query/index.vue
  10. +218
    -98
      src/views/off-limits-manage/alarm-recognition/index.vue
  11. +235
    -59
      src/views/off-limits-manage/common-exception/index.vue
  12. +300
    -54
      src/views/off-limits-manage/user-exception/index.vue

+ 7
- 2
README.md Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-11-29 11:14:13
* @LastEditors: JinxuChen
* @LastEditTime: 2021-12-06 18:13:14
* @LastEditTime: 2021-12-08 14:55:21
* @FilePath: \GpsCardAdmin\README.md
* @description:
-->
@@ -45,4 +45,9 @@ FEATURE
`2021年12月6日`
FEATURE
- 增加 封装接口地址
- 修改 登录账号密码 telpo telpo#1234
- 修改 登录账号密码 telpo telpo#1234

## v1.0.5F
`2021年12月8日`
FEATURE
- 完成 1.告警识别内容 2.通用例外 3.用户例外 4.告警信息查询 模块功能接口调试对接

+ 21
- 0
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,
});
}


+ 38
- 0
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,
});
}

+ 31
- 4
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,
});

+ 38
- 0
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,
});
}

+ 3
- 2
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


+ 2
- 2
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';
export const VersionModel = '1.0.5';

+ 16
- 0
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 '固定地点'
}
}
}

+ 31
- 6
src/views/off-limits-manage/alarm-query/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-11-30 09:44:24
* @LastEditors: JinxuChen
* @LastEditTime: 2021-12-01 14:30:07
* @LastEditTime: 2021-12-08 14:57:44
* @FilePath: \GpsCardAdmin\src\views\off-limits-manage\alarm-query\index.vue
* @description:
-->
@@ -40,6 +40,7 @@
<pagination
v-show="total>0"
:total="total"
ref="pages"
:page.sync="page"
:limit.sync="limit"
@pagination="getList"
@@ -51,6 +52,7 @@
import TopMenu from "@/components/TopMenu";
import TTable from "../../../components/TTable/TTable";
import Pagination from "@/components/Pagination";
import APIAlarmQuery from "@/api/alarm-query";
export default {
name: "",
components: { TTable, TopMenu, Pagination },
@@ -72,7 +74,7 @@ export default {
{ prop: "alarmType", title: "告警类别" },
{ prop: "imei", title: "设备IMEI" },
{ prop: "alarmAddress", title: "告警地址/经纬度" },
{ prop: "createTime", title: "创建时间" },
{ prop: "createTime", title: "创建时间" }
/* {
action: true,
title: "操作",
@@ -83,15 +85,15 @@ export default {
],
list: [
{
alarmType: '出走风险',
alarmType: "出走风险",
imei: "141152552521",
alarmAddress: "广东省佛山市南海区",
createTime: "2021-11-30"
}
],
total: 1,
total: 0,
page: 1,
limit: 10,
limit: 10
};
},
methods: {
@@ -106,7 +108,30 @@ export default {
console.log("删除", row);
},
// 获取分页数据
getList() {}
getList() {
let reqBody = {
pageNumber: this.page,
begNumber: this.limit,
imei: this.searchValue
};
APIAlarmQuery.getAlarmQuery(reqBody).then(res => {
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();
}
};
</script>


+ 218
- 98
src/views/off-limits-manage/alarm-recognition/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-11-30 09:44:24
* @LastEditors: JinxuChen
* @LastEditTime: 2021-12-06 18:28:18
* @LastEditTime: 2021-12-08 10:37:15
* @FilePath: \GpsCardAdmin\src\views\off-limits-manage\alarm-recognition\index.vue
* @description:
-->
@@ -16,6 +16,7 @@
@click="onAdd"
>添加</el-button>
<el-button
v-show="false"
class="filter-item"
style="margin-left: 10px;"
type="primary"
@@ -23,27 +24,14 @@
@click="onImportBatch"
>批量导入</el-button>
<!-- 下拉 -->
<!-- 类型 -->
<el-select
v-model="type"
placeholder="类型"
style="width: 130px; margin-left: 10px;"
filterable
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
class="filter-item"
></el-option>
</el-select>
<!-- 类别 -->
<el-select
v-model="model"
placeholder="类别"
style="width: 130px; margin-left: 10px;"
filterable
@change="outSelecChange"
clearable
>
<el-option
v-for="item in modelOptions"
@@ -60,6 +48,7 @@
style="width: 200px; margin-left: 10px;"
class="filter-item"
@keyup.enter.native="onSearch"
clearable
/>
<el-button
class="filter-item"
@@ -75,33 +64,31 @@
v-show="total>0"
:total="total"
:page.sync="page"
ref="pages"
:limit.sync="limit"
@pagination="getList"
/>
<el-dialog :visible.sync="dialogPvVisible" :title="dialogTitle">
<el-form
ref="dataForm"
v-model="form"
ref="form"
:rules="formRules"
:model="form"
label-position="left"
label-width="70px"
style="width: 400px; margin-left:50px;"
style="width: 400px;"
>
<!-- 类型 -->
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" class="filter-item" filterable>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-form-item label="类型" prop="typeRadio" v-show="false">
<el-radio-group v-model="form.typeRadio">
<el-radio :label="1" border>关键字</el-radio>
<el-radio :label="2" border>固定地点</el-radio>
</el-radio-group>
</el-form-item>
<!-- 类别 -->
<el-form-item label="类别" prop="model">
<el-select v-model="form.model" class="filter-item" filterable>
<el-select v-model="form.model" class="filter-item" @change="onSelectChange">
<el-option
v-for="item in modelOptions"
v-for="item in formOptions"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -109,17 +96,25 @@
</el-select>
</el-form-item>
<!-- 内容名称 -->
<el-form-item label="内容名称" prop="content">
<el-input v-model="form.content" />
<el-form-item label="内容名称" prop="content" label-width="80px">
<el-input v-model="form.content" style="width: 80%"/>
</el-form-item>
<!-- 状态 -->
<el-form-item label="状态" prop="status" required>
<el-switch v-model="form.status" active-text="打开" inactive-text="关闭"></el-switch>
</el-form-item>
<!-- 创建时间 -->
<el-form-item label="创建时间" prop="timestamp">
<el-form-item label="创建时间" prop="timestamp" v-show="false">
<el-date-picker v-model="form.createTime" type="datetime" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="error" @click="dialogPvVisible = false">取消</el-button>
<el-button type="primary" @click="dialogStatus === 'update' ? update() : add()">确认</el-button>
<el-button
type="primary"
:loading="loading"
@click="dialogStatus === 'update' ? update('form') : add('form')"
>确认</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="dialogUpload">
@@ -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();
}
};
</script>


+ 235
- 59
src/views/off-limits-manage/common-exception/index.vue Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2021-11-30 09:44:24
* @LastEditors: JinxuChen
* @LastEditTime: 2021-12-01 17:32:44
* @LastEditTime: 2021-12-08 14:14:18
* @FilePath: \GpsCardAdmin\src\views\off-limits-manage\common-exception\index.vue
* @description:
-->
@@ -17,9 +17,16 @@
>添加</el-button>
<!-- 下拉 -->
<!-- 类别 -->
<el-select v-model="model" placeholder="类别" style="width: 130px; margin-left: 10px;" filterable>
<el-select
v-model="model"
placeholder="类别"
style="width: 130px; margin-left: 10px;"
filterable
@change="outSelecChange"
clearable
>
<el-option
v-for="item in typeOptions"
v-for="item in modelOptions"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -33,6 +40,7 @@
style="width: 200px; margin-left: 10px;"
class="filter-item"
@keyup.enter.native="onSearch"
clearable
/>
<el-button
class="filter-item"
@@ -58,23 +66,31 @@
<pagination
v-show="total>0"
:total="total"
ref="pages"
:page.sync="page"
:limit.sync="limit"
@pagination="getList"
/>
<el-dialog :visible.sync="dialogPvVisible" :title="dialogTitle">
<el-form
ref="dataForm"
v-model="form"
ref="form"
:rules="formRules"
:model="form"
label-position="left"
label-width="70px"
style="width: 400px; margin-left:50px;"
style="width: 400px;"
>
<!-- 类别 -->
<el-form-item label="类别" prop="type">
<el-select v-model="form.model" class="filter-item" filterable>
<el-form-item label="类别" prop="model">
<el-select
v-model="form.model"
class="filter-item"
filterable
@change="onSelectChange"
clearable
>
<el-option
v-for="item in typeOptions"
v-for="item in formOptions"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -82,17 +98,24 @@
</el-select>
</el-form-item>
<!-- 内容名称 -->
<el-form-item label="内容名称" prop="content">
<el-input v-model="form.content" />
<el-form-item label="内容名称" prop="content" label-width="80px" clearable>
<el-input v-model="form.content" style="width: 80%" />
</el-form-item>
<!-- 状态 -->
<el-form-item label="状态" prop="status" required>
<el-switch v-model="form.status" active-text="打开" inactive-text="关闭"></el-switch>
</el-form-item>
<!-- 创建时间 -->
<el-form-item label="创建时间" prop="timestamp">
<el-form-item label="创建时间" prop="timestamp" v-show="false">
<el-date-picker v-model="form.createTime" type="datetime" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="error" @click="dialogPvVisible = false">取消</el-button>
<el-button type="primary" @click="dialogStatus === 'update' ? update() : add()">确认</el-button>
<el-button
type="primary"
@click="dialogStatus === 'update' ? update('form') : add('form')"
>确认</el-button>
</span>
</el-dialog>
</div>
@@ -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();
}
};
</script>


+ 300
- 54
src/views/off-limits-manage/user-exception/index.vue Прегледај датотеку

@@ -1,13 +1,20 @@
<!--
* @Date: 2021-11-30 09:44:24
* @LastEditors: JinxuChen
* @LastEditTime: 2021-12-01 17:35:09
* @LastEditTime: 2021-12-08 14:45:22
* @FilePath: \GpsCardAdmin\src\views\off-limits-manage\user-exception\index.vue
* @description:
-->
<template>
<div class="app-container">
<div class="filter-container">
<el-button
class="filter-item"
style="margin-left: 10px;"
type="primary"
icon="el-icon-circle-plus"
@click="onAdd"
>添加</el-button>
<!-- 搜索 -->
<el-input
v-model="searchValue"
@@ -15,6 +22,7 @@
style="width: 200px; margin-left: 10px;"
class="filter-item"
@keyup.enter.native="onSearch"
clearable
/>
<el-button
class="filter-item"
@@ -35,39 +43,82 @@
style="width: 100%;"
@sort-change="sortChange"
></el-table>-->
<TTable :tableData="list" :columns="columns" @update="onUpdate" @delete="onDelete" @transform="onTransform"></TTable>
<TTable
:tableData="list"
:columns="columns"
@update="onUpdate"
@delete="onDelete"
@transform="onTransform"
></TTable>
<!-- 分页 -->
<pagination
v-show="total>0"
:total="total"
ref="pages"
:page.sync="page"
:limit.sync="limit"
@pagination="getList"
/>
<!-- 修改弹窗 -->
<el-dialog :visible.sync="dialogPvVisible" :title="dialogTitle">
<el-form
ref="dataForm"
v-model="form"
ref="form"
:model="form"
:rules="formRules"
label-position="left"
label-width="70px"
style="width: 400px; margin-left:50px;"
style="width: 400px"
>
<!-- 内容名称 -->
<el-form-item label="IMEI" prop="imei">
<el-input v-model="form.imei" />
<!-- IMEI -->
<el-form-item label="IMEI" prop="imei" label-width="80px">
<el-input v-model="form.imei" style="width: 80%" clearable />
</el-form-item>
<!-- 内容名称 -->
<el-form-item label="内容名称" prop="title">
<el-input v-model="form.content" />
<el-form-item label="内容名称" prop="content" label-width="80px">
<el-input v-model="form.content" style="width: 80%" clearable />
</el-form-item>
<!-- 状态 -->
<el-form-item label="状态" prop="status" required>
<el-switch v-model="form.status" active-text="打开" inactive-text="关闭"></el-switch>
</el-form-item>
<!-- 创建时间 -->
<el-form-item label="创建时间" prop="timestamp">
<el-form-item label="创建时间" prop="timestamp" v-show="false">
<el-date-picker v-model="form.createTime" type="datetime" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="error" @click="dialogPvVisible = false">取消</el-button>
<el-button type="primary" @click="dialogStatus === 'update' ? update() : add()">确认</el-button>
<el-button
type="primary"
@click="dialogStatus === 'update' ? update('form') : add('form')"
>确认</el-button>
</span>
</el-dialog>
<!-- 转通用弹窗 -->
<el-dialog :visible.sync="dialogTrans" :title="dialogTransTitle">
<p>请选择要转换的类别:</p>
<!-- <el-radio v-model="radio1" label="1" border>关键字</el-radio>
<el-radio v-model="radio1" label="2" border>固定地点</el-radio>-->
<!-- 类别 -->
<el-select
v-model="model"
placeholder="类别"
style="width: 130px; margin-left: 10px;"
filterable
@change="outSelecChange"
clearable
>
<el-option
v-for="item in modelOptions"
:key="item.value"
:label="item.label"
:value="item.value"
class="filter-item"
></el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button type="error" @click="dialogTrans = false">取消</el-button>
<el-button type="primary" @click="onTransConfirm">确认</el-button>
</span>
</el-dialog>
</div>
@@ -77,69 +128,175 @@
import TopMenu from "@/components/TopMenu";
import TTable from "../../../components/TTable/TTable";
import Pagination from "@/components/Pagination";
import APIExceptionUser from "@/api/user-exception";
import APIExceptionGen from "@/api/common-exception";
import APILimits from "@/api/off-limits-manage";
export default {
name: "",
components: { TTable, TopMenu, Pagination },
data() {
return {
model: "",
modelOptions: [
{
value: "1",
label: "类别1"
},
{
value: "2",
label: "类别1"
}
],
model: "", //下拉框的值
content: "", //内容
modelOptions: [],
searchValue: "",
columns: [
{ prop: "imei", title: "IMEI" },
{ prop: "content", title: "内容名称" },
{ prop: "createTime", title: "创建时间" },
{ prop: "status", title: "状态" },
{
action: true,
title: "操作",
actions: [
{ fnName: "update", title: "修改", type: "primary" },
{ fnName: "delete", title: "删除", type: "error" },
{ fnName: "transform", title: "转通用", type: "primary" }
{
fnName: "transform",
title: "转通用",
type: "primary"
}
]
}
],
list: [
{
imei: "141152552521",
model: "出走危险",
content: "港口码头",
createTime: "2021-11-30"
}
],
total: 1,
list: [],
total: 0,
page: 1,
limit: 10,
dialogPvVisible: false,
dialogStatus: "",
dialogTitle: "修改用户例外",
dialogTrans: false,
dialogTransTitle: "转通用例外",
form: {
imei: "",
content: "",
createTime: ""
createTime: "",
status: true
},
radio1: "1",
formRules: {
content: [
{
required: true,
message: "请输入内容名称",
trigger: "blur"
}
],
imei: [
{
required: true,
message: "请输入imei",
trigger: "blur"
}
]
}
};
},
watch: {
searchValue(value) {
if (value === "") {
this.form.imei = "";
this.getList();
}
}
},
methods: {
// 清空表单
resetForm() {
this.form = {
model: "",
content: "",
createTime: "",
categoryId: "",
status: true
};
},
// 增加
onAdd() {
this.resetForm();
this.dialogTitle = "添加通用例外";
this.dialogPvVisible = true;
this.dialogStatus = "add";
},
add(formName) {
this.searchValue = "";
let reqBody = {
keyId: 0,
imei: this.form.imei,
keyword: this.form.content,
status: this.form.status,
glat: 0,
glng: 0,
address: "",
postCode: ""
};
this.$refs[formName].validate(valid => {
if (valid) {
APIExceptionUser.changeRecognitionUser(reqBody).then(
res => {
console.log(res);
if (res.code === 0) {
this.dialogPvVisible = false;
this.$message({
message: "增加成功",
type: "success"
});
this.form.imei = "";
this.getList();
}
}
);
} else {
return false;
}
});
},
// 搜索
onSearch() {},
onSearch() {
this.$refs["pages"].currentPage = 1;
this.getList();
},
// 修改
onUpdate(row) {
this.dialogPvVisible = true;
this.dialogStatus = 'update';
this.dialogTitle = '修改用户例外';
this.dialogStatus = "update";
this.dialogTitle = "修改用户例外";
this.form = Object.assign({}, row); // copy obj
this.form.createTime = new Date(this.form.createTime);
console.log("修改", row);
this.form.status = row.status === "打开" ? true : false;
},
update(formName) {
let reqBody = {
keyId: this.form.keyId,
imei: this.form.imei,
keyword: this.form.content,
status: this.form.status,
glat: 0,
glng: 0,
address: "",
postCode: ""
};
this.$refs[formName].validate(valid => {
if (valid) {
APIExceptionUser.changeRecognitionUser(reqBody).then(
res => {
console.log(res);
if (res.code === 0) {
this.dialogPvVisible = false;
this.$message({
message: "修改成功",
type: "success"
});
this.form.imei = "";
this.getList();
}
}
);
} else {
return false;
}
});
},
// 删除
onDelete(row) {
@@ -147,28 +304,117 @@ export default {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$message({
type: "success",
message: "删除成功!"
});
}).catch(() => {});
})
.then(() => {
let reqBody = {
keyId: row.keyId,
imei: row.imei
};
APIExceptionUser.delRecognitionUser(reqBody).then(res => {
if (res.code === 0) {
this.$message({
type: "success",
message: "删除成功!"
});
this.getList();
} else {
this.$message({
type: "error",
message: "删除失败!"
});
}
});
})
.catch(() => {});
},
// 转通用例外
// 转通用例外 todo 待接口说明
onTransform(row) {
this.$confirm("是否转到通用列外?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
console.log("row", row);
this.dialogTrans = true;
this.content = row.content;
},
// 确定转通用例外
onTransConfirm() {
let reqBody = {
id: 0,
categoryId: this.model,
keyword: this.content,
status: true,
glat: 0,
glng: 0,
address: "",
postCode: ""
};
if (this.model != "") {
APIExceptionGen.changeRecognitionGen(reqBody).then(res => {
console.log(res);
if (res.code === 0) {
this.dialogTrans = false;
this.$message({
message: "增加成功",
type: "success"
});
this.getList();
}
});
} else {
this.$message({
type: "success",
message: "转移成功!"
message: "请选择一个类别!",
type: "error"
});
}).catch(() => {});
}
},
// 获取分页数据
getList() {}
getList() {
let reqBody = {
pageNumber: this.page,
begNumber: this.limit,
type: "system",
imei: this.form.imei,
keyword: this.searchValue
};
APIExceptionUser.getRecognitionUser(reqBody).then(res => {
this.list = res.data.map(m => {
return {
imei: m.imei,
content: m.keyword,
createTime: m.createTime || "无",
glat: m.glat,
glng: m.glng,
keyId: m.keyId,
status: m.status === true ? "打开" : "关闭"
};
});
this.total = res.count;
});
},
// 获取类型分类
getAreaCategoryQuery() {
let reqBody = {
pageNumber: 1,
begNumber: 20,
keyword: ""
};
APILimits.areaCategoryQuery(reqBody).then(res => {
this.modelOptions = res.data.map(m => {
return {
value: m.categoryId,
label:
m.categoryName +
"--" +
`${this.transfromToType(m.kindId)}`
};
});
});
},
outSelecChange(value) {
this.model = value;
console.log("model", this.model);
}
},
mounted() {
this.getList();
this.getAreaCategoryQuery();
}
};
</script>


Loading…
Откажи
Сачувај