映射保存功能

20240528Test
liujun 2024-04-13 16:12:37 +08:00
parent 83714b2115
commit 3d03d27b90
2 changed files with 125 additions and 49 deletions

View File

@ -202,12 +202,34 @@ export default {
}, },
methods: { methods: {
async init(e) { async init(e) {
if (e) {
this.heirloom = e
}
this.visible = true this.visible = true
await this.getDepartmentTree() await this.getDepartmentTree()
this.getDict() await this.getDict()
await this.getPeopleList({ id: e.departmentId })
if (e) {
await this.initInfo(e)
}
},
initInfo(e) {
return new Promise(resolve => {
this.heirloom = e
this.material.type = e.type
this.material.typeName = e.typeName
this.material.typeInfo = JSON.stringify({ name: e.typeName, value: e.type })
this.material.userId = e.userId
this.material.userName = e.userName
this.material.departmentId = e.departmentId
this.material.departmentName = e.departmentName
this.material.userPhone = e.userPhone
this.material.userCardId = e.userCardId
this.material.deviceId = e.deviceId
this.material.deviceName = e.deviceName
this.material.id = e.id
this.material.idRemark = e.idRemark
this.material.userInfo = e.userName
this.material.dwUserMapId = e.dwUserMapId
this.material.remark = e.remark
})
}, },
getMenu() { getMenu() {
return new Promise(resolve => { return new Promise(resolve => {
@ -224,6 +246,7 @@ export default {
}) })
}, },
sendMessage(e) { sendMessage(e) {
console.log(this.material)
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (!valid) { if (!valid) {
this.$message.error('请填写完整信息') this.$message.error('请填写完整信息')
@ -241,14 +264,16 @@ export default {
this.form.required.userPhone = this.material.userPhone this.form.required.userPhone = this.material.userPhone
this.form.idRemark = this.material.idRemark this.form.idRemark = this.material.idRemark
this.form.remark = this.material.remark this.form.remark = this.material.remark
this.form.dwUserMapId = this.material.dwUserMapId
requestFN( requestFN(
'/dingWei/saveOrUpdateMap', { data: JSON.stringify(this.form) } '/dingWei/saveOrUpdateMap', { data: JSON.stringify(this.form) }
).then((data) => { ).then((data) => {
if (data.code === 0) { if (data.code === 200) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleClose() this.handleClose()
this.$emit('refresh') this.$emit('flush')
this.visible = false
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
@ -259,17 +284,21 @@ export default {
}) })
}, },
getPeopleList(e) { getPeopleList(e) {
this.material.departmentName = e.name return new Promise(resolve => {
requestFN( this.material.departmentName = e.name
'/user/listAll', requestFN(
{ '/user/listAll',
DEPARTMENT_ID: e.id {
} DEPARTMENT_ID: e.id
).then((data) => { }
this.dic.userList = data.userList ).then((data) => {
this.material.userInfo = '' this.dic.userList = data.userList
}).catch((e) => { this.material.userInfo = ''
console.log(e) resolve(true)
}).catch((e) => {
console.log(e)
resolve(true)
})
}) })
}, },
chooseUser(e) { chooseUser(e) {
@ -278,32 +307,46 @@ export default {
this.material.userName = entity.NAME this.material.userName = entity.NAME
}, },
handleClose() { handleClose() {
this.form = { this.beforeClose()
STATUS: '',
APPOINT_DEPARTMENT_ID: null,
APPOINT_DEPARTMENT_NAME: '',
APPOINT_USER_ID: '',
APPOINT_USER_NAME: '',
OPINION: '',
user: '',
list: [],
tm: new Date().getTime()
}
this.visible = false
}, },
beforeClose() { beforeClose() {
this.visible = false this.visible = false
this.form = { this.form = {
STATUS: '', required: {
APPOINT_DEPARTMENT_ID: null, type: '',
APPOINT_DEPARTMENT_NAME: '', typeName: '',
APPOINT_USER_ID: '', departmentId: '',
APPOINT_USER_NAME: '', departmentName: '',
OPINION: '', userId: '',
user: '', userName: '',
list: [], deviceId: '',
tm: new Date().getTime() deviceName: '',
id: '',
userCardId: '',
userPhone: ''
},
remark: '',
idRemark: ''
} }
this.material = {
typeInfo: '',
type: '',
typeName: '',
deptInfo: '',
departmentId: null,
departmentName: '',
userInfo: '',
userId: '',
userName: '',
deviceId: '',
deviceName: '',
id: '',
idRemark: '',
remark: '',
userCardId: '',
userPhone: ''
}
this.$emit('flush')
}, },
saveInfo(e) { saveInfo(e) {
const info = JSON.parse(e) const info = JSON.parse(e)
@ -311,12 +354,16 @@ export default {
this.material.typeName = info.name this.material.typeName = info.name
}, },
getDict() { getDict() {
requestFN('dingWei/getDictionary').then((data) => { return new Promise(resolve => {
this.dic.alarmStatus = JSON.parse(data.AlarmStatus) requestFN('dingWei/getDictionary').then((data) => {
this.dic.logType = JSON.parse(data.LogType) this.dic.alarmStatus = JSON.parse(data.AlarmStatus)
this.dic.mapType = JSON.parse(data.MapType) this.dic.logType = JSON.parse(data.LogType)
}).catch((e) => { this.dic.mapType = JSON.parse(data.MapType)
this.listLoading = false resolve(true)
}).catch((e) => {
this.listLoading = false
resolve(true)
})
}) })
}, },
getDepartmentTree() { getDepartmentTree() {

View File

@ -47,8 +47,8 @@
<el-table-column prop="createdTime" label="创建时间" align="center"/> <el-table-column prop="createdTime" label="创建时间" align="center"/>
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleDelete(row)"></el-button> <el-button type="danger" icon="el-icon-edit" size="mini" @click="handleDelete(row)"></el-button>
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleDelete(row)"></el-button> <el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -89,8 +89,7 @@ export default {
} }
}, },
created() { created() {
this.getDict() this.getList()
// this.getList()
this.hasButton() this.hasButton()
}, },
methods: { methods: {
@ -118,7 +117,7 @@ export default {
).then((data) => { ).then((data) => {
this.listLoading = false this.listLoading = false
this.varList = data.list this.varList = data.list
this.total = data.page.total this.listQuery.total = Number(data.page.total)
}).catch((e) => { }).catch((e) => {
this.listLoading = false this.listLoading = false
}) })
@ -155,7 +154,37 @@ export default {
}).catch((e) => { }).catch((e) => {
this.listLoading = false this.listLoading = false
}) })
},
handleDelete(row) {
this.$confirm('是否删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/dingWei/deleteMap', { id: row.dwUserMapId }
).then((data) => {
this.listLoading = false
this.$message({
type: 'success',
message: '删除成功!'
})
this.getList()
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleEdit(row) {
this.$refs.info.init(row)
} }
} }
} }
</script> </script>