增加考勤机管理接口调试
This commit is contained in:
parent
8e141943e1
commit
0f4440dfeb
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||||
// 获取工程和考勤机树形数据
|
// 获取工程和考勤机树形数据
|
||||||
export function getProjectAndMacTreeAPI() {
|
export function getProjectAndMacTreeAPI() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/tree',
|
url: '/bmw/kqManager/getProKqjTree',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -11,7 +11,7 @@ export function getProjectAndMacTreeAPI() {
|
||||||
// 根据考勤机编号获取人员列表
|
// 根据考勤机编号获取人员列表
|
||||||
export function getPersonListByMacNoAPI(params) {
|
export function getPersonListByMacNoAPI(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/personList',
|
url: '/bmw/kqManager/getWorkerByDeviceId',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
|
|
@ -20,17 +20,18 @@ export function getPersonListByMacNoAPI(params) {
|
||||||
// 获取所有人员列表
|
// 获取所有人员列表
|
||||||
export function getAllPersonListAPI(params) {
|
export function getAllPersonListAPI(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/allPersonList',
|
url: '/bmw/kqManager/getProDeviceWorker',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除人员
|
// 删除人员
|
||||||
export function deletePersonAPI(id) {
|
export function deletePersonAPI(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/deletePerson/' + id,
|
url: '/bmw/kqManager/delWorkerByDevice/',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +47,7 @@ export function batchDeletePersonAPI(ids) {
|
||||||
// 下发
|
// 下发
|
||||||
export function sendDownAPI(data) {
|
export function sendDownAPI(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/sendDown',
|
url: '/bmw/kqManager/pushWorkerByDevice',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
|
@ -64,17 +65,17 @@ export function configAPI(data) {
|
||||||
// 刷新
|
// 刷新
|
||||||
export function refreshAPI(macNo) {
|
export function refreshAPI(macNo) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/refresh',
|
url: '/bmw/kqManager/refreshDevice',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { macNo },
|
data: { deviceCode: macNo },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重启
|
// 重启
|
||||||
export function restartAPI(macNo) {
|
export function restartAPI(macNo) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/attMacManage/restart',
|
url: '/bmw/kqManager/restartDevice',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: { macNo },
|
data: { deviceCode: macNo },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export default {
|
||||||
treeData: [],
|
treeData: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label',
|
label: 'name',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -58,6 +58,7 @@ export default {
|
||||||
async getTreeData() {
|
async getTreeData() {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectAndMacTreeAPI()
|
const res = await getProjectAndMacTreeAPI()
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.treeData = res.data || []
|
this.treeData = res.data || []
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +104,7 @@ export default {
|
||||||
// 树节点过滤
|
// 树节点过滤
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.label.indexOf(value) !== -1
|
return data.name.indexOf(value) !== -1
|
||||||
},
|
},
|
||||||
// 树节点点击事件
|
// 树节点点击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
|
|
|
||||||
|
|
@ -1,75 +1,190 @@
|
||||||
<template>
|
<template>
|
||||||
<el-card class="table-card" shadow="hover">
|
<div>
|
||||||
<div class="table-container">
|
<el-card class="table-card" shadow="hover">
|
||||||
<TableModel
|
<div class="table-container">
|
||||||
:formLabel="formLabel"
|
<TableModel
|
||||||
:columnsList="columnsList"
|
:formLabel="formLabel"
|
||||||
:request-api="requestApi"
|
:columnsList="columnsList"
|
||||||
:showOperation="true"
|
:request-api="requestApi"
|
||||||
:isSelectShow="true"
|
:showOperation="true"
|
||||||
:sendParams="sendParams"
|
:isSelectShow="true"
|
||||||
ref="tableRef"
|
:sendParams="sendParams"
|
||||||
>
|
ref="tableRef"
|
||||||
<template slot="btn">
|
>
|
||||||
<el-button
|
<template slot="btn">
|
||||||
size="mini"
|
<el-button
|
||||||
type="danger"
|
size="mini"
|
||||||
icon="el-icon-delete"
|
type="danger"
|
||||||
:disabled="selectedData.length === 0"
|
icon="el-icon-delete"
|
||||||
@click="handleBatchDelete"
|
:disabled="selectedData.length === 0"
|
||||||
>
|
@click="handleBatchDelete"
|
||||||
批量删除
|
>
|
||||||
|
批量删除
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="handleSendDown"
|
||||||
|
>
|
||||||
|
下发
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-setting"
|
||||||
|
@click="handleConfig"
|
||||||
|
>
|
||||||
|
配置
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
@click="handleRefresh"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-switch-button"
|
||||||
|
@click="handleRestart"
|
||||||
|
>
|
||||||
|
重启
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<template slot="handle" slot-scope="{ data }">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(data)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</TableModel>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 下发弹框 -->
|
||||||
|
<DialogModel
|
||||||
|
:dialogConfig="sendDownDialogConfig"
|
||||||
|
@closeDialogOuter="handleCloseSendDownDialog"
|
||||||
|
>
|
||||||
|
<template slot="outerContent">
|
||||||
|
<el-form
|
||||||
|
ref="sendDownFormRef"
|
||||||
|
:model="sendDownFormData"
|
||||||
|
:rules="sendDownFormRules"
|
||||||
|
label-width="120px"
|
||||||
|
>
|
||||||
|
<el-form-item label="选择人员:" prop="personIds">
|
||||||
|
<el-select
|
||||||
|
v-model="sendDownFormData.personIds"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
placeholder="请选择人员"
|
||||||
|
style="width: 100%"
|
||||||
|
:loading="personListLoading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in personList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="`${item.name}(${item.idNumber})`"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下发内容:" prop="content">
|
||||||
|
<el-input
|
||||||
|
v-model="sendDownFormData.content"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||||
|
placeholder="请输入下发内容"
|
||||||
|
clearable
|
||||||
|
maxlength="500"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row class="dialog-footer-btn">
|
||||||
|
<el-button size="medium" @click="handleCloseSendDownDialog">
|
||||||
|
取消
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-download"
|
@click="handleSendDownSubmit"
|
||||||
@click="handleSendDown"
|
|
||||||
>
|
>
|
||||||
下发
|
确定
|
||||||
|
</el-button>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
</DialogModel>
|
||||||
|
|
||||||
|
<!-- 配置弹框 -->
|
||||||
|
<DialogModel
|
||||||
|
:dialogConfig="configDialogConfig"
|
||||||
|
@closeDialogOuter="handleCloseConfigDialog"
|
||||||
|
>
|
||||||
|
<template slot="outerContent">
|
||||||
|
<el-form
|
||||||
|
ref="configFormRef"
|
||||||
|
:model="configFormData"
|
||||||
|
:rules="configFormRules"
|
||||||
|
label-width="120px"
|
||||||
|
>
|
||||||
|
<el-form-item label="选择人员:" prop="personIds">
|
||||||
|
<el-select
|
||||||
|
v-model="configFormData.personIds"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
placeholder="请选择人员"
|
||||||
|
style="width: 100%"
|
||||||
|
:loading="personListLoading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in personList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="`${item.name}(${item.idNumber})`"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="配置项:" prop="configItem">
|
||||||
|
<el-input
|
||||||
|
v-model="configFormData.configItem"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||||
|
placeholder="请输入配置项"
|
||||||
|
clearable
|
||||||
|
maxlength="500"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row class="dialog-footer-btn">
|
||||||
|
<el-button size="medium" @click="handleCloseConfigDialog">
|
||||||
|
取消
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-setting"
|
@click="handleConfigSubmit"
|
||||||
@click="handleConfig"
|
|
||||||
>
|
>
|
||||||
配置
|
确定
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
</el-row>
|
||||||
size="mini"
|
</template>
|
||||||
type="success"
|
</DialogModel>
|
||||||
icon="el-icon-refresh"
|
</div>
|
||||||
@click="handleRefresh"
|
|
||||||
>
|
|
||||||
刷新
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="warning"
|
|
||||||
icon="el-icon-switch-button"
|
|
||||||
@click="handleRestart"
|
|
||||||
>
|
|
||||||
重启
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<template slot="handle" slot-scope="{ data }">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="danger"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(data)"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</TableModel>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TableModel from '@/components/TableModel'
|
import TableModel from '@/components/TableModel'
|
||||||
|
import DialogModel from '@/components/DialogModel'
|
||||||
import {
|
import {
|
||||||
getPersonListByMacNoAPI,
|
getPersonListByMacNoAPI,
|
||||||
getAllPersonListAPI,
|
getAllPersonListAPI,
|
||||||
|
|
@ -77,18 +192,25 @@ import {
|
||||||
batchDeletePersonAPI,
|
batchDeletePersonAPI,
|
||||||
refreshAPI,
|
refreshAPI,
|
||||||
restartAPI,
|
restartAPI,
|
||||||
|
sendDownAPI,
|
||||||
|
configAPI,
|
||||||
} from '@/api/system/attMacManage.js'
|
} from '@/api/system/attMacManage.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RightTable',
|
name: 'RightTable',
|
||||||
components: {
|
components: {
|
||||||
TableModel,
|
TableModel,
|
||||||
|
DialogModel,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
macNo: {
|
macNo: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
proId: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -135,17 +257,80 @@ export default {
|
||||||
t_width: '180',
|
t_width: '180',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// 下发弹框配置
|
||||||
|
sendDownDialogConfig: {
|
||||||
|
outerVisible: false,
|
||||||
|
outerTitle: '下发',
|
||||||
|
outerWidth: '50%',
|
||||||
|
maxHeight: '80vh',
|
||||||
|
},
|
||||||
|
// 配置弹框配置
|
||||||
|
configDialogConfig: {
|
||||||
|
outerVisible: false,
|
||||||
|
outerTitle: '配置',
|
||||||
|
outerWidth: '50%',
|
||||||
|
maxHeight: '80vh',
|
||||||
|
},
|
||||||
|
// 下发表单数据
|
||||||
|
sendDownFormData: {
|
||||||
|
personIds: [],
|
||||||
|
content: '',
|
||||||
|
},
|
||||||
|
// 配置表单数据
|
||||||
|
configFormData: {
|
||||||
|
personIds: [],
|
||||||
|
configItem: '',
|
||||||
|
},
|
||||||
|
// 下发表单校验规则
|
||||||
|
sendDownFormRules: {
|
||||||
|
personIds: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择人员',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入下发内容',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// 配置表单校验规则
|
||||||
|
configFormRules: {
|
||||||
|
personIds: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择人员',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
configItem: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入配置项',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// 人员列表
|
||||||
|
personList: [],
|
||||||
|
personListLoading: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 根据是否有考勤机编号决定使用哪个API
|
// 根据是否有考勤机编号决定使用哪个API
|
||||||
requestApi() {
|
requestApi() {
|
||||||
return this.macNo ? getPersonListByMacNoAPI : getAllPersonListAPI
|
return this.macNo
|
||||||
|
? getPersonListByMacNoAPI
|
||||||
|
: getPersonListByMacNoAPI
|
||||||
},
|
},
|
||||||
// 传递给表格的查询参数
|
// 传递给表格的查询参数
|
||||||
sendParams() {
|
sendParams() {
|
||||||
return {
|
return {
|
||||||
macNo: this.macNo || '',
|
deviceCode: this.macNo || '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取选中的数据
|
// 获取选中的数据
|
||||||
|
|
@ -218,11 +403,113 @@ export default {
|
||||||
},
|
},
|
||||||
// 下发
|
// 下发
|
||||||
handleSendDown() {
|
handleSendDown() {
|
||||||
this.$parent.openSendDownDialog()
|
if (!this.macNo) {
|
||||||
|
this.$modal.msgWarning('请先选择考勤机')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.sendDownDialogConfig.outerVisible = true
|
||||||
|
this.resetSendDownForm()
|
||||||
|
this.getPersonList()
|
||||||
},
|
},
|
||||||
// 配置
|
// 配置
|
||||||
handleConfig() {
|
handleConfig() {
|
||||||
this.$parent.openConfigDialog()
|
if (!this.macNo) {
|
||||||
|
this.$modal.msgWarning('请先选择考勤机')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.configDialogConfig.outerVisible = true
|
||||||
|
this.resetConfigForm()
|
||||||
|
this.getPersonList()
|
||||||
|
},
|
||||||
|
// 获取人员列表
|
||||||
|
async getPersonList() {
|
||||||
|
this.personListLoading = true
|
||||||
|
try {
|
||||||
|
const res = await getAllPersonListAPI({
|
||||||
|
proId: this.proId,
|
||||||
|
})
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.personList = res.rows || res.data || []
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取人员列表失败:', error)
|
||||||
|
} finally {
|
||||||
|
this.personListLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 关闭下发弹框
|
||||||
|
handleCloseSendDownDialog() {
|
||||||
|
this.sendDownDialogConfig.outerVisible = false
|
||||||
|
this.resetSendDownForm()
|
||||||
|
},
|
||||||
|
// 重置下发表单
|
||||||
|
resetSendDownForm() {
|
||||||
|
this.sendDownFormData = {
|
||||||
|
personIds: [],
|
||||||
|
content: '',
|
||||||
|
}
|
||||||
|
if (this.$refs.sendDownFormRef) {
|
||||||
|
this.$refs.sendDownFormRef.resetFields()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 提交下发表单
|
||||||
|
handleSendDownSubmit() {
|
||||||
|
this.$refs.sendDownFormRef.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const params = {
|
||||||
|
macNo: this.macNo,
|
||||||
|
personIds: this.sendDownFormData.personIds,
|
||||||
|
content: this.sendDownFormData.content,
|
||||||
|
}
|
||||||
|
sendDownAPI(params)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$modal.msgSuccess('下发成功')
|
||||||
|
this.handleCloseSendDownDialog()
|
||||||
|
this.getTableList()
|
||||||
|
this.$emit('refresh-tree')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 关闭配置弹框
|
||||||
|
handleCloseConfigDialog() {
|
||||||
|
this.configDialogConfig.outerVisible = false
|
||||||
|
this.resetConfigForm()
|
||||||
|
},
|
||||||
|
// 重置配置表单
|
||||||
|
resetConfigForm() {
|
||||||
|
this.configFormData = {
|
||||||
|
personIds: [],
|
||||||
|
configItem: '',
|
||||||
|
}
|
||||||
|
if (this.$refs.configFormRef) {
|
||||||
|
this.$refs.configFormRef.resetFields()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 提交配置表单
|
||||||
|
handleConfigSubmit() {
|
||||||
|
this.$refs.configFormRef.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const params = {
|
||||||
|
macNo: this.macNo,
|
||||||
|
personIds: this.configFormData.personIds,
|
||||||
|
configItem: this.configFormData.configItem,
|
||||||
|
}
|
||||||
|
configAPI(params)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$modal.msgSuccess('配置成功')
|
||||||
|
this.handleCloseConfigDialog()
|
||||||
|
this.getTableList()
|
||||||
|
this.$emit('refresh-tree')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 刷新
|
// 刷新
|
||||||
handleRefresh() {
|
handleRefresh() {
|
||||||
|
|
@ -288,4 +575,9 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog-footer-btn {
|
||||||
|
text-align: right;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -10,161 +10,44 @@
|
||||||
<rightTable
|
<rightTable
|
||||||
ref="rightTableRef"
|
ref="rightTableRef"
|
||||||
:mac-no="selectedMacNo"
|
:mac-no="selectedMacNo"
|
||||||
|
:pro-id="selectedProId"
|
||||||
@refresh-tree="handleRefreshTree"
|
@refresh-tree="handleRefreshTree"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 下发弹框 -->
|
|
||||||
<DialogModel
|
|
||||||
:dialogConfig="sendDownDialogConfig"
|
|
||||||
@closeDialogOuter="handleCloseSendDownDialog"
|
|
||||||
>
|
|
||||||
<template slot="outerContent">
|
|
||||||
<el-form
|
|
||||||
ref="sendDownFormRef"
|
|
||||||
:model="sendDownFormData"
|
|
||||||
:rules="sendDownFormRules"
|
|
||||||
label-width="120px"
|
|
||||||
>
|
|
||||||
<el-form-item label="下发内容:" prop="content">
|
|
||||||
<el-input
|
|
||||||
v-model="sendDownFormData.content"
|
|
||||||
type="textarea"
|
|
||||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
|
||||||
placeholder="请输入下发内容"
|
|
||||||
clearable
|
|
||||||
maxlength="500"
|
|
||||||
show-word-limit
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-row class="dialog-footer-btn">
|
|
||||||
<el-button size="medium" @click="handleCloseSendDownDialog">
|
|
||||||
取消
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="medium"
|
|
||||||
type="primary"
|
|
||||||
@click="handleSendDownSubmit"
|
|
||||||
>
|
|
||||||
确定
|
|
||||||
</el-button>
|
|
||||||
</el-row>
|
|
||||||
</template>
|
|
||||||
</DialogModel>
|
|
||||||
|
|
||||||
<!-- 配置弹框 -->
|
|
||||||
<DialogModel
|
|
||||||
:dialogConfig="configDialogConfig"
|
|
||||||
@closeDialogOuter="handleCloseConfigDialog"
|
|
||||||
>
|
|
||||||
<template slot="outerContent">
|
|
||||||
<el-form
|
|
||||||
ref="configFormRef"
|
|
||||||
:model="configFormData"
|
|
||||||
:rules="configFormRules"
|
|
||||||
label-width="120px"
|
|
||||||
>
|
|
||||||
<el-form-item label="配置项:" prop="configItem">
|
|
||||||
<el-input
|
|
||||||
v-model="configFormData.configItem"
|
|
||||||
type="textarea"
|
|
||||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
|
||||||
placeholder="请输入配置项"
|
|
||||||
clearable
|
|
||||||
maxlength="500"
|
|
||||||
show-word-limit
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-row class="dialog-footer-btn">
|
|
||||||
<el-button size="medium" @click="handleCloseConfigDialog">
|
|
||||||
取消
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="medium"
|
|
||||||
type="primary"
|
|
||||||
@click="handleConfigSubmit"
|
|
||||||
>
|
|
||||||
确定
|
|
||||||
</el-button>
|
|
||||||
</el-row>
|
|
||||||
</template>
|
|
||||||
</DialogModel>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import leftTree from './components/leftTree.vue'
|
import leftTree from './components/leftTree.vue'
|
||||||
import rightTable from './components/rightTable.vue'
|
import rightTable from './components/rightTable.vue'
|
||||||
import DialogModel from '@/components/DialogModel'
|
|
||||||
import { sendDownAPI, configAPI } from '@/api/system/attMacManage.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AttMacManage',
|
name: 'AttMacManage',
|
||||||
components: {
|
components: {
|
||||||
leftTree,
|
leftTree,
|
||||||
rightTable,
|
rightTable,
|
||||||
DialogModel,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedMacNo: '', // 选中的考勤机编号
|
selectedMacNo: '', // 选中的考勤机编号
|
||||||
// 下发弹框配置
|
selectedProId: '', // 选中的工程id
|
||||||
sendDownDialogConfig: {
|
|
||||||
outerVisible: false,
|
|
||||||
outerTitle: '下发',
|
|
||||||
outerWidth: '50%',
|
|
||||||
maxHeight: '80vh',
|
|
||||||
},
|
|
||||||
// 配置弹框配置
|
|
||||||
configDialogConfig: {
|
|
||||||
outerVisible: false,
|
|
||||||
outerTitle: '配置',
|
|
||||||
outerWidth: '50%',
|
|
||||||
maxHeight: '80vh',
|
|
||||||
},
|
|
||||||
// 下发表单数据
|
|
||||||
sendDownFormData: {
|
|
||||||
content: '',
|
|
||||||
},
|
|
||||||
// 配置表单数据
|
|
||||||
configFormData: {
|
|
||||||
configItem: '',
|
|
||||||
},
|
|
||||||
// 下发表单校验规则
|
|
||||||
sendDownFormRules: {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入下发内容',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
// 配置表单校验规则
|
|
||||||
configFormRules: {
|
|
||||||
configItem: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入配置项',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 树节点点击事件
|
// 树节点点击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
if (data.level === 2) {
|
console.log('data选择的节点', data)
|
||||||
// 二级节点(考勤机)
|
|
||||||
this.selectedMacNo = data.macNo || data.id
|
this.selectedMacNo = data.id
|
||||||
} else {
|
this.selectedProId = data.proId
|
||||||
// 一级节点(工程)或根节点,显示所有人员
|
// if (data.level === 2) {
|
||||||
this.selectedMacNo = ''
|
// // 二级节点(考勤机)
|
||||||
}
|
// this.selectedMacNo = data.id
|
||||||
|
// } else {
|
||||||
|
// // 一级节点(工程)或根节点,显示所有人员
|
||||||
|
// this.selectedMacNo = ''
|
||||||
|
// }
|
||||||
// 刷新右侧表格
|
// 刷新右侧表格
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.rightTableRef) {
|
if (this.$refs.rightTableRef) {
|
||||||
|
|
@ -178,89 +61,8 @@ export default {
|
||||||
this.$refs.leftTreeRef.getTreeData()
|
this.$refs.leftTreeRef.getTreeData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 打开下发弹框
|
|
||||||
openSendDownDialog() {
|
|
||||||
this.sendDownDialogConfig.outerVisible = true
|
|
||||||
this.resetSendDownForm()
|
|
||||||
},
|
|
||||||
// 关闭下发弹框
|
|
||||||
handleCloseSendDownDialog() {
|
|
||||||
this.sendDownDialogConfig.outerVisible = false
|
|
||||||
this.resetSendDownForm()
|
|
||||||
},
|
|
||||||
// 重置下发表单
|
|
||||||
resetSendDownForm() {
|
|
||||||
this.sendDownFormData = {
|
|
||||||
content: '',
|
|
||||||
}
|
|
||||||
if (this.$refs.sendDownFormRef) {
|
|
||||||
this.$refs.sendDownFormRef.resetFields()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提交下发表单
|
|
||||||
handleSendDownSubmit() {
|
|
||||||
this.$refs.sendDownFormRef.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
const params = {
|
|
||||||
macNo: this.selectedMacNo,
|
|
||||||
content: this.sendDownFormData.content,
|
|
||||||
}
|
|
||||||
sendDownAPI(params)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$modal.msgSuccess('下发成功')
|
|
||||||
this.handleCloseSendDownDialog()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 打开配置弹框
|
|
||||||
openConfigDialog() {
|
|
||||||
this.configDialogConfig.outerVisible = true
|
|
||||||
this.resetConfigForm()
|
|
||||||
},
|
|
||||||
// 关闭配置弹框
|
|
||||||
handleCloseConfigDialog() {
|
|
||||||
this.configDialogConfig.outerVisible = false
|
|
||||||
this.resetConfigForm()
|
|
||||||
},
|
|
||||||
// 重置配置表单
|
|
||||||
resetConfigForm() {
|
|
||||||
this.configFormData = {
|
|
||||||
configItem: '',
|
|
||||||
}
|
|
||||||
if (this.$refs.configFormRef) {
|
|
||||||
this.$refs.configFormRef.resetFields()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提交配置表单
|
|
||||||
handleConfigSubmit() {
|
|
||||||
this.$refs.configFormRef.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
const params = {
|
|
||||||
macNo: this.selectedMacNo,
|
|
||||||
configItem: this.configFormData.configItem,
|
|
||||||
}
|
|
||||||
configAPI(params)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$modal.msgSuccess('配置成功')
|
|
||||||
this.handleCloseConfigDialog()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss"></style>
|
||||||
.dialog-footer-btn {
|
|
||||||
text-align: right;
|
|
||||||
padding-top: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue