一键升学对接完成,设备日志列表对接完成
This commit is contained in:
+51
-1
@@ -453,10 +453,42 @@ export default {
|
||||
icon: 'el-icon-cpu',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// path: '/attendanceMachineEquipmentManagement',
|
||||
// name: 'attendanceMachineEquipmentManagement',
|
||||
// component: 'attendanceMachineEquipmentManagement',
|
||||
// meta: {
|
||||
// title: 'message.router.attendanceMachineEquipmentManagement',
|
||||
// isLink: '',
|
||||
// isHide: false,
|
||||
// isKeepAlive: true,
|
||||
// isAffix: false,
|
||||
// isIframe: false,
|
||||
// roles: ['admin', 'common'],
|
||||
// icon: 'el-icon-alarm-clock',
|
||||
// },
|
||||
// },
|
||||
|
||||
{
|
||||
path: '/attendanceMachineEquipmentManagement',
|
||||
name: 'attendanceMachineEquipmentManagement',
|
||||
component: 'attendanceMachineEquipmentManagement',
|
||||
component: 'layout/routerView/parent',
|
||||
redirect: '/attendanceMachineEquipmentManagement/attendanceMachineEquipmentManagement',
|
||||
meta: {
|
||||
title: 'message.router.attendanceMachineEquipmentManagement',
|
||||
isLink: '',
|
||||
isHide: false,
|
||||
isKeepAlive: true,
|
||||
isAffix: false,
|
||||
isIframe: false,
|
||||
roles: ['admin', 'common'],
|
||||
icon: 'el-icon-brush',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/attendanceMachineEquipmentManagement/attendanceMachineEquipmentManagement',
|
||||
name: 'attendanceMachineEquipmentManagement/attendanceMachineEquipmentManagement',
|
||||
component: 'attendanceMachineEquipmentManagement/attendanceMachineEquipmentManagement',
|
||||
meta: {
|
||||
title: 'message.router.attendanceMachineEquipmentManagement',
|
||||
isLink: '',
|
||||
@@ -468,6 +500,24 @@ export default {
|
||||
icon: 'el-icon-alarm-clock',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/attendanceMachineEquipmentManagement/devicelog',
|
||||
name: 'attendanceMachineEquipmentManagement/devicelog',
|
||||
component: 'attendanceMachineEquipmentManagement/devicelog',
|
||||
meta: {
|
||||
title: 'message.router.devicelog',
|
||||
isLink: '',
|
||||
isHide: false,
|
||||
isKeepAlive: true,
|
||||
isAffix: false,
|
||||
isIframe: false,
|
||||
roles: ['admin', 'common'],
|
||||
icon: 'el-icon-notebook-2',
|
||||
},
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/growthAlbumSection',
|
||||
|
||||
@@ -68,3 +68,27 @@ export function rulesPhone(phoneVal) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
根据id递归查询对象
|
||||
@param { Array } arr(必填) 查询的数组
|
||||
@param { Number||String } value(必填) 查询的数组
|
||||
@param { Number||String } unique(选填) 默认值'id' 查询的字段名
|
||||
@param { Array } children(选填) 默认值'children' 查询递归数组
|
||||
@return { Object||null } 查询到的值
|
||||
*/
|
||||
export function recursion (arr, value, unique = 'id', children = 'children' ) {
|
||||
let obj = null
|
||||
arr.forEach(( item, index ) => {
|
||||
if(item[unique] == value){
|
||||
obj = item
|
||||
}else {
|
||||
if(item[children] && item[children].length != 0){
|
||||
if(recursion(item[children], value, unique, children)){
|
||||
obj = recursion(item[children], value, unique, children)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return obj
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export default {
|
||||
setScoreRules:'setScoreRules',
|
||||
facultyInformation:'facultyInformation',
|
||||
attendanceMachineEquipmentManagement:'attendanceMachineEquipmentManagement',
|
||||
devicelog:'devicelog',
|
||||
recipe: 'recipe',
|
||||
evaluate: 'evaluate',
|
||||
classList: 'classList',
|
||||
|
||||
@@ -54,6 +54,7 @@ export default {
|
||||
schoolAlbumManagement:'学校画册管理',
|
||||
facultyInformation:'教职工信息',
|
||||
attendanceMachineEquipmentManagement:'考勤机设备管理',
|
||||
devicelog: '设备日志',
|
||||
recipe: '每周食谱',
|
||||
evaluate: '幼儿评价表',
|
||||
classList: '班级管理',
|
||||
|
||||
@@ -54,6 +54,7 @@ export default {
|
||||
facultyInformation:'教職工信息',
|
||||
deviceManagement:'人脸设备管理',
|
||||
attendanceMachineEquipmentManagement:'考勤機設備管理',
|
||||
devicelog: '設備日誌',
|
||||
recipe: '每周食谱',
|
||||
evaluate: '幼儿评价表',
|
||||
classList: '班级管理',
|
||||
|
||||
@@ -4,6 +4,16 @@ export default [
|
||||
prop: "id",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "设备Id",
|
||||
prop: "deviceId",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "设备名称",
|
||||
prop: "deviceName",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "姓名",
|
||||
prop: "username",
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
<el-form-item label="日期范围选择">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="yyyy-MM-dd"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
@@ -117,14 +117,24 @@ export default {
|
||||
this.dateRange[0],
|
||||
this.dateRange[1]
|
||||
);
|
||||
if (result.code == 200) {
|
||||
// this.attendanceData = result.records;
|
||||
this.attendanceData = result.records.map(item =>{
|
||||
item.pictureUrl = 'data:image/' + item.imgType + ';base64,'+item.faceImg // 将base64图片添加前缀处理
|
||||
return item
|
||||
})
|
||||
this.loading = false;
|
||||
this.attendanceData = result.data.records;
|
||||
this.total = result.data.total;
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.$message.error("网络错误");
|
||||
}
|
||||
this.total = result.total;
|
||||
|
||||
|
||||
|
||||
// if (result.code == 200) {
|
||||
// this.loading = false;
|
||||
// this.attendanceData = result.data.records;
|
||||
// this.total = result.data.total;
|
||||
// } else {
|
||||
// this.loading = false;
|
||||
// this.$message.error("网络错误");
|
||||
// }
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
this.$message.error("网络错误");
|
||||
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request';
|
||||
|
||||
// 获取当前用户老师可查看的考勤表单
|
||||
export const rqObtainingSafetyAttendanceTeachers = (current,size,startTime,endTime) => request({
|
||||
url: `/attendance/equipment/entranceLog/all?current=${current}&size=${size}&startTime=${startTime}&endTime=${endTime}`,
|
||||
url: `/manager/entrance/list?current=${current}&size=${size}&startTime=${startTime}&endTime=${endTime}`,
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 获取设备日志数据列表
|
||||
export const rqGetDeviceList = (current,size) => request({
|
||||
url: `/device/face/sync/log?current=${current}&size=${size}`,
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
// 日志重试接口
|
||||
export const putRetry = (array) => request({
|
||||
url: `/manager/device/retry`,
|
||||
method: 'put',
|
||||
data: array
|
||||
})
|
||||
// 获取服务列表
|
||||
export const getDevice = () => request({
|
||||
url: `/manager/mqtt/list`,
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
// 添加
|
||||
export const postDevice = (data) => {
|
||||
return request({
|
||||
url: '/manager/device',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 修改
|
||||
export const putDevice = (data) => {
|
||||
return request({
|
||||
url: '/manager/device',
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 获取详情
|
||||
export const getDeviceById = (deviceId) => {
|
||||
return request({
|
||||
url: `/manager/device/${deviceId}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 删除
|
||||
export const deleteDevice = (deviceId) => request({
|
||||
url: `/manager/device/${deviceId}`,
|
||||
method: 'delete',
|
||||
})
|
||||
@@ -0,0 +1,47 @@
|
||||
export default [
|
||||
{
|
||||
label: "日志id",
|
||||
prop: "id",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "commandId",
|
||||
prop: "commandId",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "设备id",
|
||||
prop: "deviceId",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "用户id",
|
||||
prop: "userid",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
label: "发生时间",
|
||||
prop: "createTime",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "参数",
|
||||
prop: "arguments",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "消息",
|
||||
prop: "msg",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "success",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button @click="newlyClick" type="primary" size="mini" icon="el-icon-plus"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan"
|
||||
>重置</el-button
|
||||
>
|
||||
<el-button @click="afreshClick" type="warning" size="mini" icon="el-icon-refresh-left"
|
||||
>重试</el-button
|
||||
>
|
||||
<el-input
|
||||
v-if="false"
|
||||
v-model="searchData"
|
||||
size="mini"
|
||||
style="width: 20%"
|
||||
placeholder="请输入搜索的关键字"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CommonHead",
|
||||
data() {
|
||||
return {
|
||||
searchData: "",
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
newlyClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("newly-data");
|
||||
},
|
||||
resetClick() {
|
||||
this.$emit("reset-data");
|
||||
},
|
||||
afreshClick() {
|
||||
this.$emit("afresh-data", this.searchData);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<el-table
|
||||
ref="table"
|
||||
border
|
||||
:header-cell-style="{
|
||||
background: '#f5f7fa',
|
||||
}"
|
||||
:data="tableData"
|
||||
style="width: 100%; margin-top: 20px"
|
||||
height="650"
|
||||
size="mini"
|
||||
:row-key="getRowKeys"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="column.label !== 'id'"
|
||||
align="left"
|
||||
v-for="(column, index) in tableColumns"
|
||||
:key="index"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
width="auto"
|
||||
></el-table-column>
|
||||
<el-table-column align="left" prop="zip" label="操作" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@click="handleEdit(scope.row)"
|
||||
class="el-icon-edit"
|
||||
type="text"
|
||||
size="small"
|
||||
>编辑</el-button
|
||||
>
|
||||
|
||||
<el-popconfirm @confirm="handleDelete(scope.row)" :title="'确定要删除吗?'">
|
||||
<el-button
|
||||
slot="reference"
|
||||
style="margin-left: 10px; color: red"
|
||||
class="el-icon-delete"
|
||||
type="text"
|
||||
size="small"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-popconfirm>
|
||||
|
||||
<el-button
|
||||
v-if="scope.row.success == '失败'"
|
||||
@click="afreshClick(scope.row)"
|
||||
style="margin-left: 10px;"
|
||||
class="el-icon-refresh-left"
|
||||
type="text"
|
||||
size="small"
|
||||
>重试</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
columns: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
deleteFunc: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
editFunc: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
afreshFunc: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
name: "CommonTables",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
// 删除事件
|
||||
handleDelete(row) {
|
||||
this.deleteFunc(row);
|
||||
},
|
||||
// 编辑事件
|
||||
handleEdit(row) {
|
||||
console.log(row);
|
||||
this.editFunc(row);
|
||||
},
|
||||
afreshClick(row) {
|
||||
this.afreshFunc(row);
|
||||
},
|
||||
getRowKeys(row){
|
||||
return row.id
|
||||
},
|
||||
selectable(row, index) {
|
||||
if (row.success == 0 || row.status == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
tableColumns() {
|
||||
// 处理传进来的列配置,返回符合 Element UI 表格要求的配置
|
||||
return this.columns.map((column) => {
|
||||
return {
|
||||
label: column.label,
|
||||
prop: column.prop,
|
||||
};
|
||||
});
|
||||
},
|
||||
tableData() {
|
||||
// 处理传进来的数据,返回符合 Element UI 表格要求的数据
|
||||
return this.data.map((rowData) => {
|
||||
let row = {};
|
||||
for (let column of this.columns) {
|
||||
row[column.prop] = rowData[column.prop];
|
||||
}
|
||||
return row;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.s {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<div class="form-adapt-container">
|
||||
<el-card shadow="hover">
|
||||
<CommonHead
|
||||
@search-data="searchForm"
|
||||
@reset-data="reset"
|
||||
@newly-data="add"
|
||||
></CommonHead>
|
||||
<!-- newly-data删除所选事件 -->
|
||||
<!-- reset-data重置表单内容 -->
|
||||
<!-- search-data搜索事件,接收被搜索的内容 -->
|
||||
</el-card>
|
||||
|
||||
<CommonTables
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:delete-func="deleteData"
|
||||
:edit-func="editData"
|
||||
:afreshFunc ="afreshClick"
|
||||
:columns="columns"
|
||||
:data="equipmentList"
|
||||
></CommonTables>
|
||||
|
||||
<Pagination
|
||||
:total="total"
|
||||
:pageNum="query.pageNum"
|
||||
:pageSize="query.pageSize"
|
||||
@clickCurrent="onClickCurrent"
|
||||
@clickSize="onClickSize"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 对话框 -->
|
||||
<el-dialog
|
||||
:title="formTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%">
|
||||
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
<el-form-item size="mini" label="设备Id" prop="deviceId">
|
||||
<el-input
|
||||
v-model="form.deviceId"
|
||||
placeholder="请输入设备Id"
|
||||
:disabled="formTitle == '编辑设备'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item size="mini" label="设备名称" prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
placeholder="请输入设备名称"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务选择" prop="serviceId">
|
||||
<el-select v-model="form.serviceId" placeholder="请选择服务" >
|
||||
<el-option v-for="item in deviceArr" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item size="mini" label="设备标签" prop="label">
|
||||
<el-input
|
||||
v-model="form.label"
|
||||
placeholder="请输入设备标签"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item size="mini" label="欢迎词" prop="welcome">
|
||||
<el-input
|
||||
v-model="form.welcome"
|
||||
placeholder="请输入欢迎词"
|
||||
></el-input>
|
||||
<p style="font-size: 12px;">例如:欢迎${personName}进校,${personName}为用户姓名</p>
|
||||
</el-form-item>
|
||||
<el-form-item size="mini" label="排序" prop="sort">
|
||||
<el-input
|
||||
v-model="form.sort"
|
||||
placeholder="请输入排序数值越大越靠前"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false" size="mini">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmSettingRules" size="mini"
|
||||
>确 定</el-button
|
||||
>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import columns from "./columns";
|
||||
import { rqGetDeviceList, getDevice, postDevice, deleteDevice, putDevice, getDeviceById, putRetry } from "./api";
|
||||
import { formatDate } from "@/com/index";
|
||||
import CommonHead from "./components/CommonHead";
|
||||
import CommonTables from "./components/CommonTables.vue";
|
||||
|
||||
export default {
|
||||
name: "attendanceMachineEquipmentManagement",
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
total: 0,
|
||||
query: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
loading: false,
|
||||
equipmentList: [],
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
deviceId: "",
|
||||
name: "",
|
||||
serviceId: null,
|
||||
label: '',
|
||||
welcome: '',
|
||||
sort: 0
|
||||
},
|
||||
deviceArr: [], // 服务列表
|
||||
formTitle: '新增设备',
|
||||
// 对话框表单验证
|
||||
rules: {
|
||||
deviceId: [{ required: true, message: "请输入设备id", trigger: "change" }],
|
||||
name: [{ required: true, message: "请输入设备名称", trigger: "change" }],
|
||||
serviceId: [{ required: true, message: "请选择服务", trigger: "change" }],
|
||||
label: [{ required: true, message: "请输入标签", trigger: "change" }],
|
||||
welcome: [{ required: true, message: "请输入欢迎词", trigger: "change" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
CommonHead,
|
||||
CommonTables
|
||||
},
|
||||
created() {
|
||||
this.getAttendanceFormData();
|
||||
this.deviceList()
|
||||
},
|
||||
methods: {
|
||||
afreshClick(item) {
|
||||
console.log(item)
|
||||
putRetry([item.id]).then(res => {
|
||||
this.$message({
|
||||
message: "重试成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getAttendanceFormData();
|
||||
})
|
||||
},
|
||||
// 搜索按钮
|
||||
searchForm() {
|
||||
this.$message("正在搜索");
|
||||
},
|
||||
// 重置按钮
|
||||
reset() {
|
||||
this.bus.$emit("onCurrentContextmenuClick", {
|
||||
id: 0,
|
||||
path: this.$route.path,
|
||||
});
|
||||
},
|
||||
// 添加
|
||||
add() {
|
||||
console.log(888);
|
||||
// 清除数据
|
||||
this.form = {
|
||||
deviceId: "",
|
||||
name: "",
|
||||
serviceId: null,
|
||||
label: '',
|
||||
welcome: '',
|
||||
sort: 0
|
||||
}
|
||||
this.formTitle = "新增设备";
|
||||
|
||||
this.dialogVisible = true;
|
||||
if(this.$refs.ruleForm){
|
||||
this.$refs.ruleForm.resetFields()
|
||||
}
|
||||
|
||||
},
|
||||
// 删除
|
||||
async deleteData(row) {
|
||||
console.log(row.deviceId);
|
||||
let res = await deleteDevice(row.deviceId);
|
||||
this.$message({
|
||||
message: "删除成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getAttendanceFormData();
|
||||
|
||||
console.log(row);
|
||||
},
|
||||
// 编辑
|
||||
editData(item) {
|
||||
getDeviceById(item.deviceId).then(res =>{
|
||||
if(this.$refs.ruleForm){
|
||||
this.$refs.ruleForm.resetFields()
|
||||
}
|
||||
this.form = res
|
||||
delete this.form.updateTime
|
||||
delete this.form.createTime
|
||||
this.formTitle = "编辑设备";
|
||||
this.dialogVisible = true;
|
||||
})
|
||||
},
|
||||
// 点击切换页数
|
||||
onClickCurrent(val) {
|
||||
this.query.pageNum = val;
|
||||
this.getAttendanceFormData();
|
||||
},
|
||||
// 点击了每页页数
|
||||
onClickSize(val) {
|
||||
this.query.pageSize = val;
|
||||
this.getAttendanceFormData();
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm("确认关闭?")
|
||||
.then((_) => {
|
||||
done();
|
||||
})
|
||||
.catch((_) => {});
|
||||
},
|
||||
// 获取设备日志列表
|
||||
async getAttendanceFormData() {
|
||||
try {
|
||||
this.loading = true;
|
||||
let result = await rqGetDeviceList(this.query.pageNum, this.query.pageSize);
|
||||
console.log('result');
|
||||
console.log(result);
|
||||
this.loading = false;
|
||||
let arr = result.records;
|
||||
this.equipmentList = arr.map(item =>{
|
||||
if(item.arguments.length >100){
|
||||
item.arguments = item.arguments.substr(0,100)
|
||||
}
|
||||
let successEnum = {
|
||||
0: '等待设备响应',
|
||||
1: '成功',
|
||||
2: '失败'
|
||||
}
|
||||
item.success = successEnum[item.success]
|
||||
return item
|
||||
})
|
||||
this.total = result.total;
|
||||
console.log(this.$refs.tableRef)
|
||||
console.log(this.$refs.tableRef.$el)
|
||||
this.$nextTick(() => {
|
||||
this.equipmentList.forEach((v, i) => {
|
||||
if (v.success == 0 || v.success == 1) {
|
||||
this.$refs.table.toggleRowSelection(v, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
this.$message.error("网络错误");
|
||||
}
|
||||
},
|
||||
// 获取服务列表
|
||||
deviceList () {
|
||||
getDevice().then(res =>{
|
||||
this.deviceArr = res
|
||||
})
|
||||
},
|
||||
// 确认新增或者修改按钮
|
||||
confirmSettingRules() {
|
||||
this.$refs.ruleForm.validate(async (success) => {
|
||||
if (success) {
|
||||
if(this.formTitle == '新增设备'){
|
||||
let result = await postDevice(this.form);
|
||||
this.dialogVisible = false;
|
||||
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getAttendanceFormData();
|
||||
}else {
|
||||
putDevice(this.form).then(res =>{
|
||||
this.$message({ message: "修改成功", type: "success", });
|
||||
this.dialogVisible = false;
|
||||
this.getAttendanceFormData();
|
||||
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -64,6 +64,15 @@ export function postClass (data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 一键升学
|
||||
export function postPromotion (classId) {
|
||||
return request({
|
||||
url: `/manager/class/promotion/${classId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 校区学段年级班级修改
|
||||
export function putManager (data) {
|
||||
return request({
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<el-button @click="onClickUpdate" v-if="nodeData.className" size="mini" type="warning" class="el-icon-edit">修改名称</el-button>
|
||||
<el-button @click="onClickRemove" v-if="nodeData.className" size="mini" type="danger" class="el-icon-delete">删除</el-button>
|
||||
<el-button @click="onClickUpdateRule" v-if="nodeData.className && nodeData.superId === '0'" size="mini" type="primary" class="el-icon-setting">设置规则</el-button>
|
||||
<el-button @click="onClickUpgrades" v-if="nodeData && nodeData.classType == 'grade'" size="mini" type="success" class="el-icon-top">{{isMaxGade ? '一键结业' : '一键升学'}}</el-button>
|
||||
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -120,10 +121,11 @@
|
||||
placeholder="请选择开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="addNum == 1" label="班级">
|
||||
<el-input v-model="schoolForm.classLevel" placeholder="请输入班级" type="number">
|
||||
<template slot="append">班</template>
|
||||
</el-input>
|
||||
<el-form-item v-if="addNum == 1 && schoolForm.gradeId" label="班级">
|
||||
<el-select v-model="schoolForm.classLevel" placeholder="请选择班级">
|
||||
<el-option v-for="item in selectClassArr" :label="item" :value="item" :disabled="disabledClassArr.includes(item)"></el-option>
|
||||
</el-select>
|
||||
<span> 班</span>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
@@ -192,10 +194,10 @@
|
||||
|
||||
<script>
|
||||
import columns from "./columns";
|
||||
import { getClass, getClassStudent, postManager, putManager, deleteManager, getGuardian , getPeriod, getPeriodType, postPeriod, postGrade, postClass } from "./api";
|
||||
import { getClass, getClassStudent, postManager, putManager, deleteManager, getGuardian , getPeriod, getPeriodType, postPeriod, postGrade, postClass, postPromotion } from "./api";
|
||||
import { getRuleGroup } from "../../regulation/api";
|
||||
import { Loading } from 'element-ui';
|
||||
import { formatDate } from "@/com/index";
|
||||
import { formatDate, recursion } from "@/com/index";
|
||||
import CommonHead from './components/CommonHead.vue'
|
||||
import { cutUpload } from "@/com/cutUpload";
|
||||
// import workerUrl from '@/com/worker.js';
|
||||
@@ -205,6 +207,7 @@ const FlagEnum = {
|
||||
OUT: 1,// 出
|
||||
MORNING: 2, // 早上到校时间
|
||||
};
|
||||
|
||||
let loading
|
||||
export default {
|
||||
name: "deviceManagement",
|
||||
@@ -254,6 +257,9 @@ export default {
|
||||
ruleGroupArr: [], // 规则组数据
|
||||
periodArr: [], // 查询学段数据
|
||||
periodTypeArr: [], // 查询年级等级数据
|
||||
selectClassArr: [], // 可选择的班级列表
|
||||
disabledClassArr: [], // 不可选择的班级列表
|
||||
isMaxGade: false, // 是否是最大年级
|
||||
};
|
||||
},
|
||||
components: {
|
||||
@@ -263,7 +269,6 @@ export default {
|
||||
getPeriod().then(res => {
|
||||
this.periodArr = res
|
||||
})
|
||||
|
||||
this.ruleList()
|
||||
this.classList()
|
||||
const defaultCheckClass= localStorage.getItem('defaultCheckClass') // 设置之前选中了班级
|
||||
@@ -276,8 +281,39 @@ export default {
|
||||
mounted () {
|
||||
// console.log(workerUrl)
|
||||
// let worker = new Worker(workerUrl);
|
||||
for(let i = 1; i <= 50; i++){
|
||||
this.selectClassArr.push(i)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 一键升学
|
||||
onClickUpgrades() {
|
||||
let message = this.isMaxGade == true ? '是否确定结业,结业后将删除所有数据是否继续?' : '是否确定升学,是否继续?'
|
||||
this.$confirm( message, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
postPromotion(this.nodeData.classId).then(res =>{
|
||||
|
||||
this.classList().then(arr =>{
|
||||
if(this.isMaxGade){
|
||||
this.nodeData = {}
|
||||
}else {
|
||||
this.nodeData = recursion(arr, this.nodeData.classId, 'classId', 'childrenList')
|
||||
this.handleNodeClick(this.nodeData)
|
||||
}
|
||||
})
|
||||
this.isMaxGade ? this.$message.success('结业成功') : this.$message.success('升学成功')
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
// 查询年级等级
|
||||
periodTypeList(periodType){
|
||||
getPeriodType(periodType).then(res => {
|
||||
@@ -476,7 +512,7 @@ export default {
|
||||
return
|
||||
}
|
||||
if(!this.schoolForm.classLevel){
|
||||
this.$message.error('请输入班级')
|
||||
this.$message.error('请选择班级')
|
||||
return
|
||||
}
|
||||
let obj = { ...this.schoolForm }
|
||||
@@ -518,10 +554,37 @@ export default {
|
||||
},
|
||||
// 选择年级
|
||||
onChangeGrade(value) {
|
||||
this.classArr = this.gradeArr.find( item => item.classId == value).childrenList
|
||||
delete this.schoolForm.classLevel
|
||||
let gradeObj = this.gradeArr.find( item => item.classId == value)
|
||||
this.classArr = gradeObj.childrenList
|
||||
this.classArr.map(item =>{
|
||||
this.disabledClassArr.push(JSON.parse(item.feature).class_level) // 已经有的班级禁用
|
||||
})
|
||||
|
||||
},
|
||||
handleNodeClick(item) {
|
||||
this.nodeData = item
|
||||
|
||||
if(item.classType == 'grade'){ // 点击年级时候执行 判断是否是最后一级
|
||||
const featureObj = JSON.parse(item.feature)
|
||||
console.log(item)
|
||||
console.log(featureObj)
|
||||
let maxObject // 获取最大值
|
||||
getPeriodType(item.periodType.period_type).then(res => { // 判断升学是不是最后一级
|
||||
console.log(res)
|
||||
maxObject = res.reduce((accumulator, currentObj) => {
|
||||
return accumulator.value > currentObj.value ? accumulator : currentObj;
|
||||
}, res[0]);
|
||||
if(featureObj.grade_level == maxObject.level){ // 说明已经是最大的年级了
|
||||
this.isMaxGade = true
|
||||
}else{
|
||||
this.isMaxGade = false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// localStorage.setItem('defaultCheckClass', JSON.stringify(item) )
|
||||
if(item.childrenList.length === 0 && item.classId !== this.classData.classId) {
|
||||
this.studentList(item.classId)
|
||||
@@ -533,10 +596,28 @@ export default {
|
||||
},
|
||||
// 班级列表
|
||||
classList(){
|
||||
return new Promise((resolve, reject) => {
|
||||
getClass().then( res =>{
|
||||
this.nodeData.classId ? this.defaultCheckedKeys = [this.nodeData.classId] : ''
|
||||
this.organizeArr = res
|
||||
const arr = res.map(item =>{ // 将学段type传递个年级 用于一键升学是否是最高级查询
|
||||
if(item.childrenList.length){
|
||||
item.childrenList.map( it =>{
|
||||
let periodType =JSON.parse(it.feature)
|
||||
if(it.childrenList.length){
|
||||
it.childrenList.map(classObj =>{
|
||||
classObj.periodType = periodType
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return item
|
||||
})
|
||||
// console.log(arr)
|
||||
this.organizeArr = arr
|
||||
resolve(arr)
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
// 获取班级学生列表
|
||||
studentList(classId){
|
||||
|
||||
Reference in New Issue
Block a user