上传
This commit is contained in:
@@ -200,6 +200,20 @@ const formSchema = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const rules = computed(() => {
|
||||
let ruleObj = {}
|
||||
props.schema.map((it) => {
|
||||
if (it.isRequired) {
|
||||
Reflect.set(ruleObj, it.field, {
|
||||
required: true,
|
||||
message: `${it.label}不可为空`,
|
||||
trigger: 'blur, change'
|
||||
})
|
||||
}
|
||||
})
|
||||
return ruleObj
|
||||
})
|
||||
|
||||
const dateAfterToday = (t) => {
|
||||
return t.getTime() > Date.now()
|
||||
}
|
||||
@@ -210,14 +224,6 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
const rules = {
|
||||
name: { required: true, message: '线索名称不可为空', trigger: 'blur' },
|
||||
phone: { required: true, message: '联系方式不可为空', trigger: 'blur' },
|
||||
source: { required: true, message: '线索来源不可为空', trigger: 'change' },
|
||||
intentionState: { required: true, message: '意向状态不可为空', trigger: 'change' },
|
||||
consultTime: { required: true, message: '咨询日期不可为空', trigger: 'change' }
|
||||
}
|
||||
|
||||
const tabName = ref('info')
|
||||
|
||||
const followList = ref([])
|
||||
|
||||
@@ -329,6 +329,7 @@ import { getPlaceList } from '@/api/school/place'
|
||||
import { getClassTypeList } from '@/api/school/class'
|
||||
import { getSimpleProductList } from '@/api/mall/product'
|
||||
import { getConfigByConfigKey } from '@/api/system/set'
|
||||
import { getSimpleFieldList } from '@/api/clue/orderField'
|
||||
|
||||
// import { getSimpleWarehouseList } from '@/api/mall/warehouse'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
@@ -338,11 +339,6 @@ import { useAppStore } from '@/store/modules/app'
|
||||
|
||||
const show = ref(false)
|
||||
const form = ref({})
|
||||
const rules = ref({
|
||||
dealDate: { required: true, message: '成交日期不可为空', trigger: 'change' },
|
||||
payAmount: { required: true, message: '支付金额不可为空', trigger: 'change,blur' },
|
||||
signPrice: { required: true, message: '支付金额不可为空', trigger: 'change,blur' }
|
||||
})
|
||||
|
||||
const schoolRules = {
|
||||
signSchool: { required: true, message: '成交驾校不可为空', trigger: 'change' },
|
||||
@@ -402,11 +398,29 @@ const showSchema = computed(() => {
|
||||
return [...list, ...arr]
|
||||
})
|
||||
|
||||
// const rules = computed(() => {
|
||||
// let ruleObj = {}
|
||||
// props.schema.map((it) => {
|
||||
// if (it.isRequired) {
|
||||
// Reflect.set(ruleObj, it.field, {
|
||||
// required: true,
|
||||
// message: `${it.label}不可为空`,
|
||||
// trigger: 'blur, change'
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// if (appStore.getAppInfo?.instanceType == 1) {
|
||||
// ruleObj = { ...ruleObj, ...schoolRules }
|
||||
// }
|
||||
// return ruleObj
|
||||
// })
|
||||
|
||||
const extraPayOptions = getDictOptions('other_pay_type')
|
||||
|
||||
async function open(id) {
|
||||
try {
|
||||
resetForm(id)
|
||||
getDiyFields()
|
||||
const data = await ClueApi.getClue(id)
|
||||
info.value = { ...data, ...data.diyParams }
|
||||
show.value = true
|
||||
@@ -416,6 +430,26 @@ async function open(id) {
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
const rules = ref([])
|
||||
function getDiyFields() {
|
||||
getSimpleFieldList().then((data) => {
|
||||
let ruleObj = {}
|
||||
data.map((it) => {
|
||||
if (it.isRequired) {
|
||||
Reflect.set(ruleObj, it.field, {
|
||||
required: true,
|
||||
message: `${it.label}不可为空`,
|
||||
trigger: 'blur, change'
|
||||
})
|
||||
}
|
||||
})
|
||||
if (appStore.getAppInfo?.instanceType == 1) {
|
||||
ruleObj = { ...ruleObj, ...schoolRules }
|
||||
}
|
||||
rules.value = ruleObj
|
||||
})
|
||||
}
|
||||
|
||||
async function resetForm(id) {
|
||||
const data = await getConfigByConfigKey({ configKey: 'companyCollectionConfig' })
|
||||
form.value = {
|
||||
@@ -553,9 +587,6 @@ function handleRemove(type, index) {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (appStore.getAppInfo?.instanceType == 1) {
|
||||
rules.value = { ...rules.value, ...schoolRules }
|
||||
}
|
||||
getOptions()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user