CRM:线索创建时增加负责人选择框

pull/370/head
min 2024-01-21 18:58:48 +08:00
parent 3471b5c5b2
commit e0bc3ea6dc
1 changed files with 23 additions and 5 deletions

View File

@ -27,9 +27,15 @@
<el-form-item label="地址" prop="address">
<el-input v-model="formData.address" placeholder="请输入地址" />
</el-form-item>
<!-- TODO wanwan 负责人选择 -->
<el-form-item label="负责人" prop="ownerUserId">
<el-input v-model="formData.ownerUserId" placeholder="请输入负责人" />
<el-form-item v-if="formType === 'create'" label="负责人" prop="userIds" span="24">
<el-select v-model="formData.ownerUserId">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
@ -43,14 +49,17 @@
</template>
<script setup lang="ts">
import * as ClueApi from '@/api/crm/clue'
import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
import * as UserApi from "@/api/system/user";
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const userOptions = ref<UserApi.UserVO[]>([]) //
const formData = ref({
id: undefined,
name: undefined,
@ -63,7 +72,8 @@ const formData = ref({
remark: undefined
})
const formRules = reactive({
name: [{ required: true, message: '线索名称不能为空', trigger: 'blur' }]
name: [{ required: true, message: '线索名称不能为空', trigger: 'blur' }],
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
@ -82,6 +92,14 @@ const open = async (type: string, id?: number) => {
formLoading.value = false
}
}
//
userOptions.value = await UserApi.getSimpleUserList()
//
if (formType.value === 'create') {
const { wsCache } = useCache()
const user = wsCache.get(CACHE_KEY.USER).user
formData.value.ownerUserId = user.id
}
}
defineExpose({ open }) // open