|
|
@@ -1,20 +1,56 @@
|
|
|
<!-- 驳回弹窗 -->
|
|
|
<template>
|
|
|
- <simple-form-modal
|
|
|
+ <ele-modal
|
|
|
+ form
|
|
|
+ :width="540"
|
|
|
+ v-model="visible"
|
|
|
title="驳回提示"
|
|
|
- :items="formItems"
|
|
|
- ref="editRef"
|
|
|
- :baseUrl="baseUrl"
|
|
|
- :formatData="formatData"
|
|
|
- @success="handleSuccess"
|
|
|
- ></simple-form-modal>
|
|
|
+ @open="handleOpen"
|
|
|
+ >
|
|
|
+ <SimpleForm
|
|
|
+ :items="formItems"
|
|
|
+ labelWidth="80"
|
|
|
+ ref="formRef"
|
|
|
+ :initKeys="form"
|
|
|
+ ></SimpleForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="handleCancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handleSumbit">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { reactive, ref, defineEmits, computed } from 'vue';
|
|
|
- import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';
|
|
|
+ import { ref, reactive, nextTick, computed } from 'vue';
|
|
|
+ import SimpleForm from '@/components/CommonPage/SimpleForm.vue';
|
|
|
+ import request from '@/utils/request';
|
|
|
|
|
|
- const emit = defineEmits(['refresh']);
|
|
|
+ /** 弹窗是否打开 */
|
|
|
+ const visible = defineModel({ type: Boolean });
|
|
|
+
|
|
|
+ /** 关闭弹窗 */
|
|
|
+ const handleCancel = () => {
|
|
|
+ visible.value = false;
|
|
|
+ nextTick(() => {
|
|
|
+ formRef.value?.resetForm();
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const form = ref({
|
|
|
+ id: '',
|
|
|
+ checkStatus: 3,
|
|
|
+ refusalReson: ''
|
|
|
+ });
|
|
|
+
|
|
|
+ /** 弹窗打开事件 */
|
|
|
+ const handleOpen = (id) => {
|
|
|
+ if (!id) return;
|
|
|
+ visible.value = true;
|
|
|
+ nextTick(() => {
|
|
|
+ form.value.id = id;
|
|
|
+ formRef.value?.setData(form.value);
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
const formItems = computed(() => {
|
|
|
return [
|
|
|
@@ -22,42 +58,35 @@
|
|
|
type: 'dictSelect',
|
|
|
label: '驳回原因',
|
|
|
prop: 'refusalReson',
|
|
|
- props: { code: 'audit_reject_reason', class: 'custom-select' }
|
|
|
+ required: true,
|
|
|
+ props: {
|
|
|
+ code: 'audit_reject_reason',
|
|
|
+ class: 'custom-select'
|
|
|
+ }
|
|
|
}
|
|
|
];
|
|
|
});
|
|
|
|
|
|
- //默认值
|
|
|
- const baseUrl = reactive({
|
|
|
- add: '/order/orderInfo/exceptcheck',
|
|
|
- update: '/order/orderInfo/exceptcheck'
|
|
|
- });
|
|
|
+ const formRef = ref();
|
|
|
|
|
|
- const formData = ref({
|
|
|
- id: '',
|
|
|
- checkStatus: 3
|
|
|
- });
|
|
|
-
|
|
|
- const formatData = (data) => {
|
|
|
- return {
|
|
|
- id: formData.value.id,
|
|
|
- checkStatus: formData.value.checkStatus,
|
|
|
- refusalReson: data.refusalReson,
|
|
|
- refusalResonCode: data.refusalReson
|
|
|
- };
|
|
|
- };
|
|
|
- //成功之后的回调
|
|
|
- const handleSuccess = (data) => {
|
|
|
- console.log(data, 'data---------');
|
|
|
- emit('refresh', data);
|
|
|
+ const emit = defineEmits(['refresh']);
|
|
|
+ const handleSumbit = () => {
|
|
|
+ formRef.value?.submitForm().then((data) => {
|
|
|
+ const formattedData = {
|
|
|
+ id: form.value.id,
|
|
|
+ checkStatus: form.value.checkStatus,
|
|
|
+ refusalReson: data.refusalReson,
|
|
|
+ refusalResonCode: data.refusalReson
|
|
|
+ };
|
|
|
+ request.post('/order/orderInfo/exceptcheck', formattedData).then(() => {
|
|
|
+ visible.value = false;
|
|
|
+ ElMessage.success('驳回成功');
|
|
|
+ emit('refresh', formattedData);
|
|
|
+ });
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
- const editRef = ref(null);
|
|
|
-
|
|
|
- function handleOpen(id) {
|
|
|
- formData.value.id = id;
|
|
|
- editRef.value?.handleOpen(formData.value);
|
|
|
- }
|
|
|
-
|
|
|
- defineExpose({ handleOpen });
|
|
|
+ defineExpose({
|
|
|
+ handleOpen
|
|
|
+ });
|
|
|
</script>
|