zhouwenxuan
2023-08-31 21d10974b1f1e19162b690c313c6f4014f182963
src/views/warningManage/warningInfo/component/infoDialog.vue
@@ -15,7 +15,7 @@
                        size="default"
                        :disabled="state.disabled"
                    >
                        <el-option v-for="item in state.peopleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                        <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">
@@ -35,6 +35,9 @@
<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"]);
@@ -43,42 +46,74 @@
    isShowUserDialog: false,
    disabled: false,
    infoForm: {
        id: '',
        name: '',
        method: ''
    },
    setFormRules:{
        name: [{ required: true, message: '请选择预警人员', trigger: 'blur' }],
    },
    peopleList: [
        // {
        //     id: '1',
        //     name: '张三',
        // },
        // {
        //     id: '2',
        //     name: '李四',
        // }
    ]
    peopleList: []
});
const openDialog = (type: string, value: any) => {
    getUserList();
    state.isShowUserDialog = true;
    if (type === '查看') {
        state.disabled = true;
        state.infoForm = JSON.parse(JSON.stringify(value));
        state.infoForm.name = state.infoForm.managePeople;
        console.log("info",state.infoForm)
        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 = {
            name: '',
            method: ''
        }
        state.infoForm = JSON.parse(JSON.stringify(value));
    }
    state.title = type;
};
const onSubmit = () => {
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');
};