新增违规类型配置
This commit is contained in:
@@ -53,4 +53,65 @@ export const update = query => {
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
};
|
||||
// 违规类型列表接口
|
||||
export const pageFun = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 违规类型列表接口
|
||||
export const listFun = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 违规类型添加接口
|
||||
export const addFun = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/add',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 编辑
|
||||
export const updateFun = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/update',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 删除
|
||||
export const delFun = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/del',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 添加违规记录
|
||||
export const addRecord = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/addRecord',
|
||||
method: 'post',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 违规类查询
|
||||
export const listRecord = query => {
|
||||
return request({
|
||||
url: '/admin/familyMember/violation/listRecord',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 导出
|
||||
export const exportFamilyMember = query => {
|
||||
window.location.href = `/admin/family/manage/exportFamilyMember?${genQueryParam(query)}`;
|
||||
return;
|
||||
};
|
||||
|
@@ -33,7 +33,7 @@
|
||||
>查询</el-button
|
||||
>
|
||||
<!-- 导出按钮 -->
|
||||
<el-button class="primary" type="primary" @click="getData()"
|
||||
<el-button class="primary" type="primary" @click="exportFamilyMemberFun()"
|
||||
>导出</el-button
|
||||
>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否违规">
|
||||
<template v-slot="scope">{{ scope.row.enable ? "是" : "否" }}</template>
|
||||
<template v-slot="scope">{{ scope.row.violationNum }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="300">
|
||||
<template v-slot="scope">
|
||||
@@ -83,10 +83,11 @@
|
||||
>违规警告</el-button
|
||||
>
|
||||
<el-button
|
||||
@click="dialogTableVisible = true"
|
||||
@click="listRecordFun(scope.row)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="default"
|
||||
:disabled="scope.row.violationNum == 0 ? 'disabled' : ''"
|
||||
>警告详情</el-button
|
||||
>
|
||||
</template>
|
||||
@@ -164,9 +165,9 @@
|
||||
<el-select v-model="violationObj.nowValue" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in violationObj.options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -175,7 +176,9 @@
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="violationDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="add()"> 确认 </el-button>
|
||||
<el-button type="primary" @click="add(violationObj)">
|
||||
确认
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -195,7 +198,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { pageFamilyMember } from "@/api/nobleman/nobleman";
|
||||
import {
|
||||
pageFamilyMember,
|
||||
listFun,
|
||||
addRecord,
|
||||
listRecord,
|
||||
exportFamilyMember,
|
||||
} from "@/api/nobleman/nobleman";
|
||||
// @ts-ignore
|
||||
import { dateFormat } from "@/utils/system-helper";
|
||||
// @ts-ignore
|
||||
@@ -224,7 +233,8 @@ export default {
|
||||
nick: "",
|
||||
time: "",
|
||||
nowValue: "",
|
||||
options: [{ value: "选项1", label: "黄金糕" }],
|
||||
options: [],
|
||||
familyMemberId: null,
|
||||
},
|
||||
// 分页
|
||||
total: 10, //总页数
|
||||
@@ -234,6 +244,9 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getData();
|
||||
listFun().then((res) => {
|
||||
this.violationObj.options = res.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 查询接口
|
||||
@@ -261,14 +274,92 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 导出
|
||||
exportFamilyMemberFun() {
|
||||
this.loading = true;
|
||||
let time = this.inquire.time;
|
||||
let startTime = "";
|
||||
let endTime = "";
|
||||
if (time && time.length > 0) {
|
||||
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
|
||||
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
exportFamilyMember({
|
||||
erbanNo: this.inquire.userId,
|
||||
familyName: this.inquire.nick,
|
||||
startDate: startTime,
|
||||
endDate: endTime,
|
||||
pageNum: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
}).then((res) => {
|
||||
});
|
||||
},
|
||||
// 违规警告
|
||||
warnClick(val) {
|
||||
console.log(val.row);
|
||||
var obj = val.row;
|
||||
this.violationObj.id = val.row.erbanNo;
|
||||
this.violationObj.nick = val.row.nick;
|
||||
this.violationObj.familyMemberId = val.row.familyMemberId;
|
||||
this.violationDialog = true;
|
||||
},
|
||||
add(val) {
|
||||
var num = this.violationObj.options.map((item, i) => {
|
||||
return this.violationObj.nowValue == item.id ? i : null;
|
||||
});
|
||||
let time = dateFormat(this.violationObj.time, "yyyy-MM-dd hh:mm:ss");
|
||||
addRecord({
|
||||
familyMemberId: this.violationObj.familyMemberId,
|
||||
violationId: this.violationObj.nowValue,
|
||||
date: time,
|
||||
content: this.violationObj.options[num].content,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.getData();
|
||||
this.violationDialog = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
listRecordFun(val) {
|
||||
let time = this.inquire.time;
|
||||
let startTime = "";
|
||||
let endTime = "";
|
||||
if (time && time.length > 0) {
|
||||
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
|
||||
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
listRecord({
|
||||
familyMemberId: val.familyMemberId,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.dialogTableVisible = true;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange() {
|
||||
this.getData();
|
||||
|
@@ -10,9 +10,9 @@
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="x" align="center" label="违规类型" />
|
||||
<el-table-column prop="x" align="center" label="警告内容" />
|
||||
<el-table-column align="center" label="操作" >
|
||||
<el-table-column prop="type" align="center" label="违规类型" />
|
||||
<el-table-column prop="content" align="center" label="警告内容" />
|
||||
<el-table-column align="center" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="ediClick(scope)"
|
||||
@@ -100,7 +100,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {} from "@/api/nobleman/nobleman";
|
||||
import { pageFun, updateFun, delFun, addFun } from "@/api/nobleman/nobleman";
|
||||
// @ts-ignore
|
||||
import { dateFormat } from "@/utils/system-helper";
|
||||
// @ts-ignore
|
||||
@@ -125,6 +125,7 @@ export default {
|
||||
addObj: {
|
||||
violationType: "",
|
||||
violationContent: "",
|
||||
id: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -134,10 +135,88 @@ export default {
|
||||
methods: {
|
||||
// 查询接口
|
||||
getData() {
|
||||
// this.loading = true;
|
||||
// this.total = res.data.total;
|
||||
// this.tableData = res.data.rows;
|
||||
// this.loading = false;
|
||||
this.loading = true;
|
||||
pageFun({
|
||||
pageNum: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.total = res.data.total;
|
||||
this.tableData = res.data.rows;
|
||||
this.loading = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 新增
|
||||
add() {
|
||||
this.titleDialog = "新增违规类型";
|
||||
this.addObj.violationType = "";
|
||||
this.addObj.violationContent = "";
|
||||
this.addObj.types = 1;
|
||||
this.addDialog = true;
|
||||
},
|
||||
// 编辑
|
||||
ediClick(val) {
|
||||
this.titleDialog = "编辑违规类型";
|
||||
this.addObj.violationType = val.row.type;
|
||||
this.addObj.violationContent = val.row.content;
|
||||
this.addObj.id = val.row.id;
|
||||
this.addObj.types = 2;
|
||||
this.addDialog = true;
|
||||
},
|
||||
// 二次确认新增&编辑
|
||||
addDialogClick() {
|
||||
if (this.addObj.types == 1) {
|
||||
addFun({
|
||||
type: this.addObj.violationType,
|
||||
content: this.addObj.violationContent,
|
||||
id: this.addObj.id,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.getData();
|
||||
this.addDialog = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updateFun({
|
||||
type: this.addObj.violationType,
|
||||
content: this.addObj.violationContent,
|
||||
id: this.addObj.id,
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.getData();
|
||||
this.addDialog = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 删除按钮
|
||||
del(val) {
|
||||
@@ -146,26 +225,24 @@ export default {
|
||||
},
|
||||
// 二次确认删除
|
||||
delClick() {
|
||||
delFun({ id: this.delDate.id }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
this.getData();
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
this.delDialog = false;
|
||||
},
|
||||
// 新增
|
||||
add() {
|
||||
this.titleDialog = "新增违规类型";
|
||||
this.addObj.violationType = "";
|
||||
this.addObj.violationContent = "";
|
||||
this.addDialog = true;
|
||||
},
|
||||
// 编辑
|
||||
ediClick(val) {
|
||||
this.titleDialog = "编辑违规类型";
|
||||
this.addObj.violationType = "1";
|
||||
this.addObj.violationContent = "1";
|
||||
this.addDialog = true;
|
||||
},
|
||||
// 二次确认新增&编辑
|
||||
addDialogClick() {
|
||||
this.addDialog = false;
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange() {
|
||||
this.getData();
|
||||
|
Reference in New Issue
Block a user