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

(cherry picked from commit e0bc3ea6dc)
This commit is contained in:
min 2024-01-21 18:58:48 +08:00 committed by shizhong
parent d7209882b8
commit 90743cdb85

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