<template>
|
<div class="system-add-menu-container">
|
<el-dialog :title="title" v-model="isShowRecordDialog" append-to-body :close-on-click-modal="false" width="600px">
|
<div class="record-form">
|
<el-form :model="recordForm" ref="recordFormRef" size="default" label-width="100px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="检查内容" prop="checkContent">
|
<el-input class="input-length" :disabled="true" type="textarea" :rows="3" v-model.trim="recordForm.checkContent" placeholder="检查内容"> </el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
</el-dialog>
|
<el-dialog :title="title" v-model="isShowSubmitDialog" width="600px" :close-on-click-modal="false">
|
<el-form :model="submitForm" ref="rectifyFormRef" size="default" label-width="120px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="处理结果" prop="checkResult">
|
<el-select class="input-add" v-model="checkResults.checkResult" placeholder="请输入处理结果">
|
<el-option v-for="item in resultList" :label="item.name" :key="item.id" :value="item.id"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="isShowSubmitDialog = !isShowSubmitDialog" size="default">取 消</el-button>
|
<el-button type="primary" @click="submitRecord" v-throttle size="default">确 定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script lang="ts">
|
import { getUserByDepartment } from '/@/assets/methods';
|
|
interface stateType {
|
isShowRecordDialog: Boolean;
|
isShowSubmitDialog: Boolean;
|
recordForm: {
|
taskCode: string | null;
|
checkContent: string | null;
|
checkResult: string | null;
|
checkTaskId: number | null;
|
classify1: number | null;
|
classify2: number | null;
|
classify3: string | null;
|
controlMeasureCode: string | null;
|
controlMeasureId: number | null;
|
controlType: number | null;
|
measureDesc: string | null;
|
};
|
title: string;
|
submitForm: {
|
execUserId: number | null;
|
id: number | null;
|
checkResults: Array<checkResults>;
|
};
|
checkResults: {
|
id: number | null;
|
controlMeasureId: number | null;
|
checkResult: number | null;
|
};
|
resultList: Array<result>;
|
}
|
interface result {
|
id: number;
|
name: string;
|
}
|
interface checkResults {
|
id: number | null;
|
controlMeasureId: number | null;
|
checkResult: number | null;
|
}
|
import { reactive, toRefs, ref } from 'vue';
|
import { recordApi } from '/@/api/doublePreventSystem/record';
|
import { ElMessage } from 'element-plus';
|
export default {
|
name: 'recordDialog',
|
setup(props: any, context: any) {
|
const recordFormRef = ref();
|
const state = reactive<stateType>({
|
title: '查看',
|
isShowSubmitDialog: false,
|
isShowRecordDialog: false,
|
recordForm: {
|
taskCode: null,
|
checkContent: null,
|
checkResult: null,
|
checkTaskId: null,
|
classify1: null,
|
classify2: null,
|
classify3: null,
|
controlMeasureCode: null,
|
controlMeasureId: null,
|
controlType: null,
|
measureDesc: null
|
},
|
submitForm: {
|
id: null,
|
execUserId: null,
|
checkResults: []
|
},
|
checkResults: {
|
id: null,
|
controlMeasureId: null,
|
checkResult: null
|
},
|
resultList: [
|
{ id: 1, name: '正常' },
|
{ id: 2, name: '不正常' }
|
]
|
});
|
|
//打开模态框
|
const openRecordDialog = async (type: string, value: object) => {
|
if (type === '查看') {
|
state.title = '查看';
|
state.isShowRecordDialog = true;
|
let recordFormValue = JSON.parse(JSON.stringify(value));
|
state.recordForm.taskCode = recordFormValue.taskCode;
|
state.recordForm.checkContent = recordFormValue.checkContent;
|
} else {
|
state.title = '提交';
|
state.isShowSubmitDialog = true;
|
state.submitForm.id = JSON.parse(JSON.stringify(value)).checkTaskId;
|
state.checkResults.id = JSON.parse(JSON.stringify(value)).id;
|
state.checkResults.controlMeasureId = JSON.parse(JSON.stringify(value)).controlMeasureId;
|
}
|
};
|
|
//新增修改提交
|
const submitRecord = async () => {
|
if (state.checkResults.checkResult !== null) {
|
if (state.title === '提交') {
|
state.submitForm.checkResults.push(state.checkResults);
|
let res = await recordApi().submitRecord(state.submitForm);
|
if (res.data.code === '200') {
|
ElMessage({
|
type: 'success',
|
message: '排查记录新增成功',
|
duration: 2000
|
});
|
state.isShowRecordDialog = false;
|
context.emit('refreshRecord');
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
}
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: '请完善基本信息'
|
});
|
}
|
};
|
|
return {
|
...toRefs(state),
|
recordFormRef,
|
submitRecord,
|
openRecordDialog
|
};
|
}
|
};
|
</script>
|
|
<style scoped>
|
::v-deep.el-divider--horizontal {
|
margin-top: 0px !important;
|
}
|
|
::v-deep.el-dialog__body {
|
padding-top: 10px !important;
|
}
|
.filter-container {
|
padding: 10px 0px;
|
}
|
</style>
|