feat(安全巡检): 新增工单复查和整改功能
- 添加安全巡检工单复查和整改的API接口 - 在工单列表页添加复查和整改按钮 - 实现复查和整改的对话框表单及提交逻辑
This commit is contained in:
@ -61,3 +61,26 @@ export const delSafetyInspection = (id: string | number | Array<string | number>
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
/**
|
||||
*
|
||||
* 新增安全巡检工单复查
|
||||
* @param data
|
||||
*/
|
||||
export const addSafetyInspectionReview = (data: any) => {
|
||||
return request({
|
||||
url: '/safety/safetyInspection/review',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 新增安全巡检工单整改
|
||||
* @param data
|
||||
*/
|
||||
export const addSafetyInspectionRectification = (data: any) => {
|
||||
return request({
|
||||
url: '/safety/safetyInspection/rectification',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
@ -104,6 +104,14 @@
|
||||
v-hasPermi="['safety:safetyInspection:query']">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button link type="success" v-if="scope.row.status === '1'" icon="Pointer"
|
||||
@click="handleDialog(scope.row)" v-hasPermi="['safety:safetyInspection:rectification']">
|
||||
整改
|
||||
</el-button>
|
||||
<el-button link type="warning" icon="SuccessFilled" v-if="scope.row.status === '2'"
|
||||
@click="handleDialog(scope.row)" v-hasPermi="['safety:safetyInspection:review']">
|
||||
复查
|
||||
</el-button>
|
||||
<!-- <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:safetyInspection:edit']">修改 </el-button> -->
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['safety:safetyInspection:remove']">
|
||||
@ -195,6 +203,29 @@
|
||||
<el-dialog title="巡检工单详情" v-model="showDetailDialog" width="60vw">
|
||||
<safety-inspection-detail-dialog :safety-inspection-id="currentSafetyInspectionId" />
|
||||
</el-dialog>
|
||||
<el-dialog :title="handleType === 'rectification' ? '处理整改工单' : '处理复查工单'" v-model="handleDialogVisible"
|
||||
width="500px">
|
||||
<el-form ref="handleFormRef" :model="handleForm" :rules="rules" label-width="120px">
|
||||
<el-form-item label="整改措施" prop="measure" v-if="handleType === 'rectification'">
|
||||
<el-input v-model="handleForm.measure" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整改附件" prop="rectificationFile" v-if="handleType === 'rectification'">
|
||||
<image-upload v-model="handleForm.rectificationFile" />
|
||||
</el-form-item>
|
||||
<el-form-item label="复查情况" prop="review" v-if="handleType === 'review'">
|
||||
<el-input v-model="handleForm.review" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="复查类型" prop="reviewType" v-if="handleType === 'review'">
|
||||
<el-select v-model="handleForm.reviewType" placeholder="请选择复查类型">
|
||||
<el-option v-for="dict in review_type" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -204,7 +235,9 @@ import {
|
||||
delSafetyInspection,
|
||||
getSafetyInspection,
|
||||
listSafetyInspection,
|
||||
updateSafetyInspection
|
||||
updateSafetyInspection,
|
||||
addSafetyInspectionReview,
|
||||
addSafetyInspectionRectification,
|
||||
} from '@/api/safety/safetyInspection';
|
||||
import { SafetyInspectionForm, SafetyInspectionQuery, SafetyInspectionVO } from '@/api/safety/safetyInspection/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
@ -242,7 +275,14 @@ const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const handleForm = ref({
|
||||
id: undefined,
|
||||
measure: undefined,
|
||||
rectificationFile: undefined,
|
||||
review: undefined,
|
||||
reviewType: undefined,
|
||||
remark: undefined,
|
||||
})
|
||||
const initFormData: SafetyInspectionForm = {
|
||||
id: undefined,
|
||||
pid: undefined,
|
||||
@ -310,6 +350,10 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
const teamOpt = ref([]);
|
||||
const foremanOpt = ref([]);
|
||||
const teamList = ref<ProjectTeamForemanResp[]>();
|
||||
const handleType = ref("")
|
||||
|
||||
|
||||
|
||||
/** 查询安全巡检工单列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
@ -335,16 +379,48 @@ const changeForeman = (value: string | number) => {
|
||||
}));
|
||||
form.value.correctorId = '';
|
||||
};
|
||||
/** 处理安全巡查工单 */
|
||||
const handleSubmit = async () => {
|
||||
let flag = false;
|
||||
if (handleType.value == "rectification") {
|
||||
const { code } = await addSafetyInspectionRectification(handleForm.value)
|
||||
if (code == 200) flag = true
|
||||
} else {
|
||||
const { code } = await addSafetyInspectionReview(handleForm.value)
|
||||
if (code == 200) flag = true
|
||||
}
|
||||
if (flag) {
|
||||
ElMessage.success("处理成功")
|
||||
handleDialogVisible.value = false;
|
||||
getList()
|
||||
reset()
|
||||
} else {
|
||||
ElMessage.error("处理失败")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** 展开安全巡检工单详情对话框操作 */
|
||||
const currentSafetyInspectionId = ref<string | number>();
|
||||
const showDetailDialog = ref<boolean>(false);
|
||||
const handleDialogVisible = ref<boolean>(false);
|
||||
const handleShowDialog = (row?: SafetyInspectionVO) => {
|
||||
currentSafetyInspectionId.value = row.id;
|
||||
|
||||
showDetailDialog.value = true;
|
||||
};
|
||||
/**打开整改/复查对话框操作*/
|
||||
const handleDialog = (row?: SafetyInspectionVO) => {
|
||||
|
||||
if (row.status == '1') {
|
||||
handleType.value = "rectification"
|
||||
} else {
|
||||
handleType.value = "review"
|
||||
}
|
||||
handleForm.value.id = row.id;
|
||||
handleDialogVisible.value = true;
|
||||
};
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
|
||||
Reference in New Issue
Block a user