|
@@ -4,14 +4,15 @@
|
|
<div class="flex justify-between items-center border-b pb-3">
|
|
<div class="flex justify-between items-center border-b pb-3">
|
|
<h4 :id="titleId" :class="titleClass">{{ editForm ? '编辑任务' : '新增任务' }}</h4>
|
|
<h4 :id="titleId" :class="titleClass">{{ editForm ? '编辑任务' : '新增任务' }}</h4>
|
|
<div>
|
|
<div>
|
|
- <el-button v-if="!editForm" type="primary" :loading="props.saveLoading"
|
|
|
|
- @click="submitForm(formRef, false)">保存并新建</el-button>
|
|
|
|
- <el-button type="primary" :loading="props.saveLoading" @click="submitForm(formRef, true)">保存</el-button>
|
|
|
|
|
|
+ <el-button v-if="!editForm" type="primary" :loading="['2'].includes(props.saveLoading)"
|
|
|
|
+ @click="submitForm(formRef, true)">保存并新建</el-button>
|
|
|
|
+ <el-button type="primary" :loading="['2'].includes(props.saveLoading)"
|
|
|
|
+ @click="submitForm(formRef, false)">保存</el-button>
|
|
<el-button @click="closeVisible()">取消</el-button>
|
|
<el-button @click="closeVisible()">取消</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
- <div class="h-[55vh] overflow-y-auto">
|
|
|
|
|
|
+ <div class="h-[55vh] overflow-y-auto scroll-bar">
|
|
<el-form ref="formRef" :model="form" label-width="100px" :rules="rules" class="flex flex-wrap form">
|
|
<el-form ref="formRef" :model="form" label-width="100px" :rules="rules" class="flex flex-wrap form">
|
|
<el-form-item label="任务名称" prop="taskName" required>
|
|
<el-form-item label="任务名称" prop="taskName" required>
|
|
<el-input v-model="form.taskName" type="textarea" placeholder="请输入任务名称" clearable maxlength="100"
|
|
<el-input v-model="form.taskName" type="textarea" placeholder="请输入任务名称" clearable maxlength="100"
|
|
@@ -120,44 +121,46 @@ import { get } from '@/utils/request';
|
|
import { Delete, Plus } from "@element-plus/icons-vue"
|
|
import { Delete, Plus } from "@element-plus/icons-vue"
|
|
import { FormInstance } from 'element-plus';
|
|
import { FormInstance } from 'element-plus';
|
|
import { getFromValue } from '@/utils/tools';
|
|
import { getFromValue } from '@/utils/tools';
|
|
-const props = defineProps({
|
|
|
|
- visible: {
|
|
|
|
- type: Boolean,
|
|
|
|
- default: false
|
|
|
|
- },
|
|
|
|
- saveLoading: {
|
|
|
|
- type: Boolean,
|
|
|
|
- default: false
|
|
|
|
- },
|
|
|
|
- editForm: {
|
|
|
|
- type: Object,
|
|
|
|
|
|
+const props = defineProps<{
|
|
|
|
+ visible: boolean,
|
|
|
|
+ saveLoading: saveLoadingType,
|
|
|
|
+ editForm: Object
|
|
|
|
+}>()
|
|
|
|
+const emit = defineEmits(['closeModalVisible', 'submitForm'])
|
|
|
|
+watch(() => props.saveLoading, (val) => {
|
|
|
|
+ if (val == "3") {
|
|
|
|
+ formRef.value?.resetFields();
|
|
|
|
+ form.value = { ...defalutModalForm };
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-const emit = defineEmits(['closeModalVisible', 'submitForm'])
|
|
|
|
-watch(props, (val) => {
|
|
|
|
|
|
+watch(() => props.visible, (val) => {
|
|
formRef.value?.resetFields();
|
|
formRef.value?.resetFields();
|
|
- modalVisible.value = val.visible
|
|
|
|
- form.value = val.editForm ? { ...val.editForm } : { ...defalutModalForm };
|
|
|
|
- customeDate.value = (form.value.repeatDesignSameday || "").split(',').filter(Boolean);
|
|
|
|
- if (val.visible) {
|
|
|
|
|
|
+ modalVisible.value = val
|
|
|
|
+ if (val) {
|
|
get(CUSTOMER_FORM_URL).then(res => {
|
|
get(CUSTOMER_FORM_URL).then(res => {
|
|
if (Array.isArray(res.data) && res.data.length > 0) {
|
|
if (Array.isArray(res.data) && res.data.length > 0) {
|
|
generateFormData.value = JSON.parse(res.data[0].config)
|
|
generateFormData.value = JSON.parse(res.data[0].config)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- if (!val.editForm) {
|
|
|
|
- //TODO 如果是新增
|
|
|
|
- taskTypeValueData.value = [{ label: '客户1', value: '1' }, { label: '客户2', value: '2' }];
|
|
|
|
- contactValueData.value = [{ label: '联系人1', value: '1' }, { label: '联系人2', value: '2' }];
|
|
|
|
- executorValueData.value = [{ label: '执行人1', value: '1' }, { label: '执行人2', value: '2' }];
|
|
|
|
- } else {
|
|
|
|
- //TODO 如果是编辑
|
|
|
|
- changeTaskType(form.value.taskType)
|
|
|
|
- contactValueData.value = [{ label: '联系人1', value: '1' }, { label: '联系人2', value: '2' }];
|
|
|
|
- executorValueData.value = [{ label: '执行人1', value: '1' }, { label: '执行人2', value: '2' }];
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+watch(() => props.editForm, (val) => {
|
|
|
|
+ if (!val) {
|
|
|
|
+ //TODO 如果是新增
|
|
|
|
+ form.value = { ...defalutModalForm };
|
|
|
|
+ taskTypeValueData.value = [{ label: '客户1', value: '1' }, { label: '客户2', value: '2' }];
|
|
|
|
+ contactValueData.value = [{ label: '联系人1', value: '1' }, { label: '联系人2', value: '2' }];
|
|
|
|
+ executorValueData.value = [{ label: '执行人1', value: '1' }, { label: '执行人2', value: '2' }];
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //TODO 如果是编辑
|
|
|
|
+ form.value = { ...val };
|
|
|
|
+ customeDate.value = (form.value.repeatDesignSameday || "").split(',').filter(Boolean);
|
|
|
|
+ changeTaskType(form.value.taskType)
|
|
|
|
+ contactValueData.value = [{ label: '联系人1', value: '1' }, { label: '联系人2', value: '2' }];
|
|
|
|
+ executorValueData.value = [{ label: '执行人1', value: '1' }, { label: '执行人2', value: '2' }];
|
|
|
|
+
|
|
|
|
+})
|
|
const rules = ref({
|
|
const rules = ref({
|
|
taskName: [
|
|
taskName: [
|
|
{ required: true, message: '请输入任务名称', trigger: 'blur' }
|
|
{ required: true, message: '请输入任务名称', trigger: 'blur' }
|
|
@@ -172,7 +175,6 @@ const generateFormRef = ref<typeof GenerateForm>();
|
|
const generateFormData = ref<any>(defaultGenerateFormData);
|
|
const generateFormData = ref<any>(defaultGenerateFormData);
|
|
|
|
|
|
const modalVisible = ref(false);
|
|
const modalVisible = ref(false);
|
|
-const closeStatus = ref(false);
|
|
|
|
function closeVisible() {
|
|
function closeVisible() {
|
|
generateFormData.value = defaultGenerateFormData;
|
|
generateFormData.value = defaultGenerateFormData;
|
|
emit('closeModalVisible')
|
|
emit('closeModalVisible')
|
|
@@ -191,8 +193,7 @@ function submitForm(formEl: FormInstance | undefined, isClose: boolean) {
|
|
...res
|
|
...res
|
|
})
|
|
})
|
|
console.log("submitDAata", submitData);
|
|
console.log("submitDAata", submitData);
|
|
- emit('submitForm', submitData)
|
|
|
|
- closeStatus.value = isClose
|
|
|
|
|
|
+ emit('submitForm', submitData, isClose)
|
|
}).catch((err: any) => {
|
|
}).catch((err: any) => {
|
|
console.log(err);
|
|
console.log(err);
|
|
})
|
|
})
|