qa-prevention-xgf-app/hiddenManageSubPackages/pages/hidden_confirm/confirm.vue

215 lines
5.3 KiB
Vue
Raw Permalink Normal View History

2024-08-08 11:08:55 +08:00
<template>
<view class="container">
<view class="card">
<!-- 隐患详情查看 -->
<app-hidden-view
:hidden-id="hiddenId"
@throw-basic-info="form = { ...form, ...$event.pd }"
/>
<!-- 隐患确认 -->
<view class="card">
<u-form
ref="formRef"
label-position="left"
:model="form"
:rules="rules"
label-width="auto"
>
<u-divider text-position="left" text="隐患确认"></u-divider>
<app-hidden-level
:id="form.HIDDENLEVEL"
:name="form.HIDDENLEVELNAME"
:is-show-more="false"
:is-show-major="false"
prop="HIDDENLEVELNAME"
label="隐患级别"
/>
<block v-if="form.RECTIFICATIONTYPE === '1'">
<up-form-item label="是否整改完成" prop="isTrue" required>
<up-radio-group v-model="form.isTrue" direction="horizontal">
<up-radio name="1" label="是" />
<up-radio name="2" label="否" />
</up-radio-group>
</up-form-item>
<up-line />
</block>
<block
v-if="
(form.RECTIFICATIONTYPE === '2' &&
form.HIDDENLEVEL !== 'hiddenLevel1001') ||
form.isTrue === '2'
"
>
<app-department
:id="form.RECTIFICATIONDEPT"
:name="form.RECTIFICATIONDEPTNAME"
:form="form"
clear-key="RECTIFICATIONORNAME,RECTIFICATIONOR"
prop="RECTIFICATIONDEPTNAME"
label="整改负责人部门"
/>
<app-personnel
:id="form.RECTIFICATIONOR"
:name="form.RECTIFICATIONORNAME"
:department-id="form.RECTIFICATIONDEPT"
prop="RECTIFICATIONORNAME"
label="整改负责人"
/>
<app-time
:model-value="form.RECTIFICATIONDEADLINE"
label="整改期限"
prop="RECTIFICATIONDEADLINE"
mode="date"
@fn-confirm-emit="fnConfirmEmit"
/>
</block>
<view class="mt-10 flex-between">
<view
v-if="form.SOURCE !== '4' && form.SOURCE !== '5'"
style="flex: 1; margin-right: 2%"
>
<u-button
type="error"
shape="circle"
text="打回"
@click="
route({
url: '/application/pages/hidden_confirm/reject',
params: {
HIDDEN_ID: hiddenId,
},
})
"
/>
</view>
<view style="flex: 1">
<u-button
type="primary"
shape="circle"
text="保存"
:throttle-time="1000"
@click="fnSubmit"
/>
</view>
</view>
</u-form>
</view>
</view>
</view>
</template>
<script>
import AppHiddenView from "@/components/hiddenView/index.vue";
import AppHiddenLevel from "@/components/hidden_level/hidden_level.vue";
import AppDepartment from "@/components/department/index.vue";
import AppPersonnel from "@/components/personnel/index.vue";
import AppTime from "@/components/time/index.vue";
import dayjs from "dayjs";
import useFormValidate from "@/utils/useFormValidate";
import { setHiddenConfirmSubmit } from "@/hiddenManageSubPackages/api";
export default {
components: {
AppHiddenView,
AppHiddenLevel,
AppDepartment,
AppPersonnel,
AppTime,
},
data() {
return {
store: this.$store,
hiddenId: "",
form: {
isTrue: "1",
HIDDENLEVEL: "",
HIDDENLEVELNAME: "",
RECTIFICATIONDEPT: "",
RECTIFICATIONDEPTNAME: "",
RECTIFICATIONOR: "",
RECTIFICATIONORNAME: "",
RECTIFICATIONDEADLINE: "",
},
// 表单校验规则
rules: {
HIDDENLEVELNAME: {
type: "string",
required: true,
message: "请选择隐患级别",
trigger: ["blur", "change"],
},
isTrue: {
type: "string",
required: true,
message: "请选择是否整改完成",
trigger: ["blur", "change"],
},
RECTIFICATIONDEPTNAME: {
type: "string",
required: true,
message: "请选择整改负责人部门",
trigger: ["blur", "change"],
},
RECTIFICATIONORNAME: {
type: "string",
required: true,
message: "请选择整改负责人",
trigger: ["blur", "change"],
},
RECTIFICATIONDEADLINE: {
type: "string",
required: true,
message: "请选择整改期限",
trigger: ["blur", "change"],
},
},
};
},
onLoad(query) {
this.hiddenId = query.HIDDEN_ID;
},
mounted() {},
methods: {
async fnSubmit() {
await useFormValidate(this.$refs.formRef);
await setHiddenConfirmSubmit({
USERNAME: this.store.state.userInfo.NAME,
HIDDEN_ID: this.hiddenId,
HIDDENLEVEL: this.form.value.HIDDENLEVEL,
RECTIFICATIONDEPT: this.form.value.RECTIFICATIONDEPT,
RECTIFICATIONDEADLINE: this.form.value.RECTIFICATIONDEADLINE,
RECTIFICATIONOR: this.form.value.RECTIFICATIONOR,
isTrue: this.form.value.isTrue,
});
uni.showToast({
icon: "none",
title: "提交成功",
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
},
fnConfirmEmit({ mode, value }) {
if (mode === "datetime") {
this.form = {
...this.form,
RECTIFICATIONDEADLINE: dayjs(value).format("YYYY-MM-DD HH:mm"),
};
} else if (mode === "date") {
this.form = {
...this.form,
RECTIFICATIONDEADLINE: dayjs(value).format("YYYY-MM-DD"),
};
} else if (mode === "year-month") {
this.form = {
...this.form,
RECTIFICATIONDEADLINE: dayjs(value).format("YYYY-MM"),
};
}
},
},
};
</script>
<style scoped lang="scss"></style>