You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.2 KiB

3 weeks ago
<template>
<el-dialog
:title="title"
v-model="visible"
width="25%"
class="x-dialog"
:destroy-on-close="true"
>
<el-form
class="dialog-data"
:model="form"
:rules="rules"
ref="formRef"
label-width="100px"
3 weeks ago
>
<el-form-item label="处理描述:" prop="clms">
<el-input
v-model="form.clms"
:rows="2"
type="textarea"
placeholder="请填写"
/>
</el-form-item>
<el-form-item label="处理后照片:" prop="clhtp">
<ImageUpload v-model="form.clhtp"></ImageUpload>
3 weeks ago
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="handlerClose()" icon="CloseBold">取消</el-button>
<el-button type="primary" icon="Select" @click="confirm()"
>确定</el-button
>
</div>
</template>
</el-dialog>
</template>
<script setup>
const { proxy } = getCurrentInstance();
3 weeks ago
import { feedBackyj } from "@/api/emergency";
3 weeks ago
const props = defineProps({
title: {
type: String,
default: "工单处理反馈",
3 weeks ago
},
3 weeks ago
id: {
type: Number,
},
modelValue: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:modelValue", "confirm"]);
3 weeks ago
const data = reactive({
form: {
id: null,
clhtp: undefined,
clms: undefined,
3 weeks ago
},
rules: {
clhtp: [{ required: true, message: "请上传处理后图片", trigger: "blur" }],
clms: [{ required: true, message: "请填写处理描述", trigger: "blur" }],
3 weeks ago
},
});
const { form, rules } = toRefs(data);
const visible = ref(props.modelValue);
const handlerClose = () => {
visible.value = false;
proxy.resetForm("formRef");
3 weeks ago
};
const confirm = () => {
proxy.$refs["formRef"].validate(async (valid) => {
if (valid) {
form.value.id = props.id;
await feedBackyj(form.value);
proxy.$modal.msgSuccess(`反馈成功`);
3 weeks ago
emit("confirm");
handlerClose();
}
});
};
// 监听外部 modelValue 变化
watch(
() => props.modelValue,
(val) => {
visible.value = val;
}
);
watch(visible, (val) => {
emit("update:modelValue", val);
});
</script>
<style scoped>
3 weeks ago
</style>