|
@@ -1,6 +1,6 @@
|
|
|
<script lang="ts" setup>
|
|
|
/**
|
|
|
- * @Name: createDialog.vue
|
|
|
+ * @Name: CreateDialog.vue
|
|
|
* @Description: 商品监控-创建对话框
|
|
|
* @Author: xinyan
|
|
|
*/
|
|
@@ -9,12 +9,14 @@ import { ElMessage, FormInstance, FormRules } from 'element-plus';
|
|
|
import { DictionaryStore } from '/@/stores/dictionary';
|
|
|
import { useResponse } from '/@/utils/useResponse';
|
|
|
import * as api from '../api';
|
|
|
+import { Close, Finished } from '@element-plus/icons-vue';
|
|
|
|
|
|
const shopOptions = <Ref>inject('shopOptions');
|
|
|
const groupOptions = <Ref>inject('groupOptions');
|
|
|
const { data: staticData } = DictionaryStore();
|
|
|
|
|
|
const loading = ref(false);
|
|
|
+const createDialog = <Ref>useTemplateRef('createDialog');
|
|
|
const createOpen = defineModel({ default: false });
|
|
|
|
|
|
const emit = defineEmits(['refresh']);
|
|
@@ -48,7 +50,6 @@ const rules = reactive<FormRules<RuleForm>>({
|
|
|
country: [{ required: true, message: '请选择国家', trigger: 'change' }],
|
|
|
shop: [{ required: true, message: '请输入店铺', trigger: 'blur' }],
|
|
|
group: [{ required: true, message: '请输入分组', trigger: 'blur' }],
|
|
|
- status: [{ message: '请选择状态', trigger: 'blur' }],
|
|
|
// frequency: [ { message: '请选择更新频率', trigger: 'blur' } ]
|
|
|
});
|
|
|
|
|
@@ -82,6 +83,11 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+function cancelDialog() {
|
|
|
+ resetForm(ruleFormRef.value);
|
|
|
+ createDialog.value.visible = false;
|
|
|
+}
|
|
|
+
|
|
|
const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return;
|
|
|
formEl.resetFields();
|
|
@@ -89,7 +95,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <el-dialog v-model="createOpen" :close-on-click-modal="false" :close-on-press-escape="false" :title="`商品监控 - 创建 `" style="width: 40%">
|
|
|
+ <el-dialog ref="createDialog" v-model="createOpen" :close-on-click-modal="false" :close-on-press-escape="false" :title="`商品监控 - 创建 `" style="width: 40%">
|
|
|
<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-position="top" label-width="auto" class="mx-2.5 mt-5" status-icon>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
@@ -142,8 +148,8 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
- <el-button :icon="Finished" @click="resetForm(ruleFormRef);createOpen = false">取 消</el-button>
|
|
|
- <el-button :icon="Close" :loading="loading" type="primary" @click="submitForm(ruleFormRef)">确 定</el-button>
|
|
|
+ <el-button :icon="Close" @click="cancelDialog">取 消</el-button>
|
|
|
+ <el-button :icon="Finished" :loading="loading" type="primary" @click="submitForm(ruleFormRef)">确 定</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</template>
|