<template>
|
<view class="account-detail">
|
<PageHeader title="整改" @back="goBack" />
|
<up-form :model="form" label-width="110">
|
<up-form-item label="整改说明" required>
|
<up-textarea v-model="form.rectifyDesc" placeholder="请输入" auto-height />
|
</up-form-item>
|
</up-form>
|
|
<FooterButtons :loading="loading" confirmText="保存" @cancel="goBack" @confirm="handleSubmit" />
|
</view>
|
</template>
|
|
<script setup>
|
import { ref } from "vue";
|
import { onLoad } from "@dcloudio/uni-app";
|
import PageHeader from "@/components/PageHeader.vue";
|
import FooterButtons from "@/components/FooterButtons.vue";
|
import { updateInspectionHazard } from "@/api/safeProduction/lineInspection";
|
|
const loading = ref(false);
|
const hazardId = ref(null);
|
|
const form = ref({
|
rectifyDesc: "",
|
});
|
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
|
const handleSubmit = () => {
|
const rectifyDesc = String(form.value.rectifyDesc || "").trim();
|
if (!rectifyDesc) {
|
uni.showToast({ title: "请输入整改说明", icon: "none" });
|
return;
|
}
|
if (!hazardId.value) return;
|
|
loading.value = true;
|
updateInspectionHazard({ id: hazardId.value, status: "已整改", rectifyDesc })
|
.then(() => {
|
uni.showToast({ title: "整改成功", icon: "success" });
|
uni.$emit("lineInspection:hazardsRefresh");
|
goBack();
|
})
|
.catch(() => {
|
uni.showToast({ title: "整改失败", icon: "none" });
|
})
|
.finally(() => {
|
loading.value = false;
|
});
|
};
|
|
onLoad(options => {
|
if (options?.data) {
|
try {
|
const obj = JSON.parse(decodeURIComponent(options.data));
|
hazardId.value = obj?.row?.id;
|
} catch (e) {}
|
}
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/static/scss/form-common.scss";
|
</style>
|