<template>
|
<div class="system-add-gas-container">
|
<el-dialog
|
:title="state.title"
|
v-model="state.isShowUserDialog"
|
width="550px"
|
>
|
<el-form :model="state.infoForm" size="default" ref="gasRef" :rules="state.setFormRules" label-width="150px">
|
<el-form-item label="处理人:" prop="name">
|
<el-select
|
v-model="state.infoForm.name"
|
filterable
|
class="w100"
|
style="max-width: 180px"
|
size="default"
|
:disabled="state.disabled"
|
>
|
<el-option v-for="item in state.peopleList" :key="item.id" :label="item.realName" :value="item.id"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="处理方式:" prop="points">
|
<el-input type="textarea" v-model.trim="state.infoForm.method" :disabled="state.disabled" ></el-input>
|
</el-form-item>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="handleClose" size="default" v-if="!state.disabled">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" size="default">确 定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import {reactive, ref} from "vue";
|
import {InfoState} from "/@/types/warning";
|
import {userApi} from "/@/api/systemManage/user";
|
import {ElMessage} from "element-plus";
|
import {warningInfoApi} from "/@/api/warningManage/warningInfo";
|
|
const gasRef = ref();
|
const emit = defineEmits(["getInfoData"]);
|
const state = reactive<InfoState>({
|
title: '',
|
isShowUserDialog: false,
|
disabled: false,
|
infoForm: {
|
id: '',
|
name: '',
|
method: ''
|
},
|
setFormRules:{
|
name: [{ required: true, message: '请选择预警人员', trigger: 'blur' }],
|
},
|
peopleList: []
|
});
|
const openDialog = (type: string, value: any) => {
|
getUserList();
|
state.isShowUserDialog = true;
|
if (type === '查看') {
|
state.disabled = true;
|
let data = JSON.parse(JSON.stringify(value));
|
state.infoForm.id = data.id;
|
state.infoForm.name = data.handlerId;
|
state.infoForm.method = data.handlerDesc;
|
} else if (type === '处理'){
|
state.disabled = false;
|
state.infoForm = JSON.parse(JSON.stringify(value));
|
}
|
state.title = type;
|
};
|
|
const getUserList = async () => {
|
const param = {
|
pageIndex: 1,
|
pageSize: 9999,
|
searchParams: {
|
roleId: null,
|
name: "",
|
realName: "",
|
userIndentityId: null
|
}
|
}
|
let res = await userApi().getUserList(param);
|
if(res.data.code == 100) {
|
state.peopleList = res.data.data;
|
}else {
|
ElMessage({
|
type: 'error',
|
message: res.data.msg
|
});
|
}
|
}
|
|
const onSubmit = async () => {
|
if(state.title == '处理') {
|
const param = {
|
id: state.infoForm.id,
|
userId: state.infoForm.name,
|
handlerDesc: state.infoForm.method
|
}
|
let res = await warningInfoApi().handleWarnLog(param);
|
if(res.data.code == 100) {
|
ElMessage({
|
type: 'success',
|
message: '处理成功'
|
});
|
}else {
|
ElMessage({
|
type: 'error',
|
message: res.data.msg
|
});
|
}
|
gasRef.value.clearValidate();
|
}
|
state.isShowUserDialog = false;
|
emit('getInfoData');
|
};
|
|
const handleClose = () => {
|
gasRef.value.clearValidate();
|
state.isShowUserDialog = false;
|
emit('getInfoData');
|
}
|
defineExpose({
|
openDialog
|
});
|
</script>
|
<style scoped lang="scss">
|
.valueTable{
|
line-height: 18px;
|
&>div{
|
line-height: 1;
|
margin-bottom: 6px;
|
display: flex;
|
align-items: center;
|
|
div{
|
color: #999;
|
}
|
|
span{
|
font-weight: bolder;
|
}
|
|
&:last-of-type{
|
margin-bottom: 0;
|
margin-top: 10px;
|
}
|
}
|
}
|
.el-select-dropdown__item {
|
height: 50px;
|
line-height: 50px;
|
margin-top: 6px;
|
}
|
</style>
|