@@ -63,7 +63,7 @@ async def create_key_visit(
|
|||||||
planned_date=data.planned_date,
|
planned_date=data.planned_date,
|
||||||
planned_visitor=data.planned_visitor,
|
planned_visitor=data.planned_visitor,
|
||||||
visit_target=data.visit_target,
|
visit_target=data.visit_target,
|
||||||
manager_id=data.manager_id or uuid.UUID(current_user["user_id"]),
|
manager_id=uuid.UUID(current_user["user_id"]),
|
||||||
)
|
)
|
||||||
init_entry(k, current_user["name"])
|
init_entry(k, current_user["name"])
|
||||||
db.add(k)
|
db.add(k)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ async def create_mini_business(
|
|||||||
amount=data.amount,
|
amount=data.amount,
|
||||||
follow_up_detail=data.follow_up_detail,
|
follow_up_detail=data.follow_up_detail,
|
||||||
status=data.status,
|
status=data.status,
|
||||||
manager_id=data.manager_id or uuid.UUID(current_user["user_id"]),
|
manager_id=uuid.UUID(current_user["user_id"]),
|
||||||
expected_revenue_date=data.expected_revenue_date,
|
expected_revenue_date=data.expected_revenue_date,
|
||||||
)
|
)
|
||||||
init_entry(m, current_user["name"])
|
init_entry(m, current_user["name"])
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ async def create_work_plan(
|
|||||||
customer_id=data.customer_id,
|
customer_id=data.customer_id,
|
||||||
plan_content=data.plan_content,
|
plan_content=data.plan_content,
|
||||||
plan_date=parse_date(data.plan_date),
|
plan_date=parse_date(data.plan_date),
|
||||||
manager_id=data.manager_id or uuid.UUID(current_user["user_id"]),
|
manager_id=uuid.UUID(current_user["user_id"]),
|
||||||
status=data.status,
|
status=data.status,
|
||||||
)
|
)
|
||||||
init_entry(wp, current_user["name"])
|
init_entry(wp, current_user["name"])
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ class KeyVisitCreate(BaseModel):
|
|||||||
planned_date: str = ""
|
planned_date: str = ""
|
||||||
planned_visitor: str = ""
|
planned_visitor: str = ""
|
||||||
visit_target: str = ""
|
visit_target: str = ""
|
||||||
manager_id: Optional[uuid.UUID] = None
|
|
||||||
|
|
||||||
|
|
||||||
class KeyVisitUpdate(BaseModel):
|
class KeyVisitUpdate(BaseModel):
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class MiniBusinessCreate(BaseModel):
|
|||||||
follow_up_detail: str = ""
|
follow_up_detail: str = ""
|
||||||
status: str = "跟进中"
|
status: str = "跟进中"
|
||||||
expected_revenue_date: str = ""
|
expected_revenue_date: str = ""
|
||||||
manager_id: Optional[uuid.UUID] = None
|
|
||||||
|
|
||||||
|
|
||||||
class MiniBusinessUpdate(BaseModel):
|
class MiniBusinessUpdate(BaseModel):
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ class WorkPlanCreate(BaseModel):
|
|||||||
plan_content: str = ""
|
plan_content: str = ""
|
||||||
plan_date: str # "YYYY-MM-DD"
|
plan_date: str # "YYYY-MM-DD"
|
||||||
status: str = "计划中"
|
status: str = "计划中"
|
||||||
manager_id: Optional[uuid.UUID] = None # director can assign to a specific manager
|
|
||||||
|
|
||||||
|
|
||||||
class WorkPlanUpdate(BaseModel):
|
class WorkPlanUpdate(BaseModel):
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ const auth = useAuthStore()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const keyVisits = ref<any[]>([])
|
const keyVisits = ref<any[]>([])
|
||||||
const customers = ref<any[]>([])
|
const customers = ref<any[]>([])
|
||||||
const managers = ref<any[]>([])
|
|
||||||
const allUsers = ref<any[]>([])
|
const allUsers = ref<any[]>([])
|
||||||
const plannedVisitors = ref<string[]>([])
|
const plannedVisitors = ref<string[]>([])
|
||||||
|
|
||||||
@@ -37,16 +36,9 @@ const managerSummary = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([loadItems(), loadCustomers(), loadUsers(), loadManagers()])
|
await Promise.all([loadItems(), loadCustomers(), loadUsers()])
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadManagers() {
|
|
||||||
try {
|
|
||||||
const res = await api.get('/users/', { params: { role: 'manager' } })
|
|
||||||
managers.value = res.data || []
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadUsers() {
|
async function loadUsers() {
|
||||||
try {
|
try {
|
||||||
const res = await api.get('/users/')
|
const res = await api.get('/users/')
|
||||||
@@ -74,7 +66,7 @@ async function loadItems() {
|
|||||||
|
|
||||||
function openCreate() {
|
function openCreate() {
|
||||||
dialogMode.value = 'create'
|
dialogMode.value = 'create'
|
||||||
form.value = { customer_id: '', urgency_level: '一般', description: '', progress_status: '未开始', planned_date: '', planned_visitor: '', visit_target: '', manager_id: '' }
|
form.value = { customer_id: '', urgency_level: '一般', description: '', progress_status: '未开始', planned_date: '', planned_visitor: '', visit_target: '' }
|
||||||
plannedVisitors.value = []
|
plannedVisitors.value = []
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
@@ -199,11 +191,6 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 要客拜访'" width="520px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 要客拜访'" width="520px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item v-if="(auth.isDirector || auth.isLeader) && dialogMode==='create'" label="客户经理">
|
|
||||||
<el-select v-model="form.manager_id" placeholder="留空则为本人" clearable style="width:100%">
|
|
||||||
<el-option v-for="m in managers" :key="m.id" :label="m.name" :value="m.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ const auth = useAuthStore()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const miniBusiness = ref<any[]>([])
|
const miniBusiness = ref<any[]>([])
|
||||||
const customers = ref<any[]>([])
|
const customers = ref<any[]>([])
|
||||||
const managers = ref<any[]>([])
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogMode = ref<'create' | 'edit'>('create')
|
const dialogMode = ref<'create' | 'edit'>('create')
|
||||||
@@ -35,16 +34,9 @@ const managerSummary = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([loadItems(), loadCustomers(), loadManagers()])
|
await Promise.all([loadItems(), loadCustomers()])
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadManagers() {
|
|
||||||
try {
|
|
||||||
const res = await api.get('/users/', { params: { role: 'manager' } })
|
|
||||||
managers.value = res.data || []
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadCustomers(q?: string) {
|
async function loadCustomers(q?: string) {
|
||||||
try {
|
try {
|
||||||
const params: any = { page_size: 100 }
|
const params: any = { page_size: 100 }
|
||||||
@@ -65,7 +57,7 @@ async function loadItems() {
|
|||||||
|
|
||||||
function openCreate() {
|
function openCreate() {
|
||||||
dialogMode.value = 'create'
|
dialogMode.value = 'create'
|
||||||
form.value = { customer_id: '', product_type: '', amount: '', follow_up_detail: '', status: '跟进中', expected_revenue_date: '', manager_id: '' }
|
form.value = { customer_id: '', product_type: '', amount: '', follow_up_detail: '', status: '跟进中', expected_revenue_date: '' }
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,11 +171,6 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 小微商机'" width="500px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 小微商机'" width="500px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item v-if="(auth.isDirector || auth.isLeader) && dialogMode==='create'" label="客户经理">
|
|
||||||
<el-select v-model="form.manager_id" placeholder="留空则为本人" clearable style="width:100%">
|
|
||||||
<el-option v-for="m in managers" :key="m.id" :label="m.name" :value="m.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ const auth = useAuthStore()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const workPlans = ref<any[]>([])
|
const workPlans = ref<any[]>([])
|
||||||
const customers = ref<any[]>([])
|
const customers = ref<any[]>([])
|
||||||
const managers = ref<any[]>([])
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const dialogMode = ref<'create' | 'edit'>('create')
|
const dialogMode = ref<'create' | 'edit'>('create')
|
||||||
@@ -35,16 +34,9 @@ const managerSummary = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([loadPlans(), loadCustomers(), loadManagers()])
|
await Promise.all([loadPlans(), loadCustomers()])
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadManagers() {
|
|
||||||
try {
|
|
||||||
const res = await api.get('/users/', { params: { role: 'manager' } })
|
|
||||||
managers.value = res.data || []
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadCustomers(q?: string) {
|
async function loadCustomers(q?: string) {
|
||||||
try {
|
try {
|
||||||
const params: any = { page_size: 100 }
|
const params: any = { page_size: 100 }
|
||||||
@@ -65,7 +57,7 @@ async function loadPlans() {
|
|||||||
|
|
||||||
function openCreate() {
|
function openCreate() {
|
||||||
dialogMode.value = 'create'
|
dialogMode.value = 'create'
|
||||||
form.value = { customer_id: '', plan_content: '', plan_date: todayStr(), status: '计划中', manager_id: '' }
|
form.value = { customer_id: '', plan_content: '', plan_date: todayStr(), status: '计划中' }
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,11 +169,6 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 工作计划'" width="500px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 工作计划'" width="500px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item v-if="(auth.isDirector || auth.isLeader) && dialogMode==='create'" label="客户经理">
|
|
||||||
<el-select v-model="form.manager_id" placeholder="留空则为本人" clearable style="width:100%">
|
|
||||||
<el-option v-for="m in managers" :key="m.id" :label="m.name" :value="m.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="(q: string) => loadCustomers(q)" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
|
|||||||
Reference in New Issue
Block a user