35 changed files with 1683 additions and 897 deletions
@ -0,0 +1,149 @@ |
|||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="showDialog" |
||||
|
:title="formData.id ? t('updateCourse') : t('addCourse')" |
||||
|
width="50%" |
||||
|
class="diy-dialog-wrap" |
||||
|
:destroy-on-close="true" |
||||
|
> |
||||
|
<el-form |
||||
|
:model="formData" |
||||
|
label-width="120px" |
||||
|
ref="formRef" |
||||
|
:rules="formRules" |
||||
|
class="page-form" |
||||
|
v-loading="loading" |
||||
|
> |
||||
|
|
||||
|
<el-form-item label="合同" prop="contract_id"> |
||||
|
<el-select |
||||
|
class="input-width" |
||||
|
v-model="formData.contract_id" |
||||
|
placeholder="请选择合同" |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="(item, index) in contractList" |
||||
|
:key="index" |
||||
|
:label="item.contract_name" |
||||
|
:value="item.id" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<template #footer> |
||||
|
<span class="dialog-footer"> |
||||
|
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
:loading="loading" |
||||
|
@click="confirm(formRef)" |
||||
|
>{{ t('confirm') }}</el-button |
||||
|
> |
||||
|
</span> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { ref, reactive, computed, watch } from 'vue' |
||||
|
import { useDictionary } from '@/app/api/dict' |
||||
|
import { t } from '@/lang' |
||||
|
import type { FormInstance } from 'element-plus' |
||||
|
import { addCourse, editCourse, getCourseInfo,contractAll } from '@/app/api/course' |
||||
|
|
||||
|
let showDialog = ref(false) |
||||
|
const loading = ref(false) |
||||
|
|
||||
|
|
||||
|
const contractList : any = ref(null) |
||||
|
// 获取全部标签 |
||||
|
const getContractAll = async () => { |
||||
|
contractList.value = await (await contractAll()).data |
||||
|
} |
||||
|
getContractAll() |
||||
|
|
||||
|
/** |
||||
|
* 表单数据 |
||||
|
*/ |
||||
|
const initialFormData = { |
||||
|
id: '', |
||||
|
course_name: '', |
||||
|
course_type: '', |
||||
|
duration: '', |
||||
|
session_count: '', |
||||
|
single_session_count: '', |
||||
|
price: '', |
||||
|
internal_reminder: '', |
||||
|
customer_reminder: '', |
||||
|
remarks: '', |
||||
|
contract_id: '', |
||||
|
} |
||||
|
const formData: Record<string, any> = reactive({ ...initialFormData }) |
||||
|
|
||||
|
const formRef = ref<FormInstance>() |
||||
|
|
||||
|
// 表单验证规则 |
||||
|
const formRules = computed(() => { |
||||
|
return { |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
const emit = defineEmits(['complete']) |
||||
|
|
||||
|
/** |
||||
|
* 确认 |
||||
|
* @param formEl |
||||
|
*/ |
||||
|
const confirm = async (formEl: FormInstance | undefined) => { |
||||
|
if (loading.value || !formEl) return |
||||
|
let save = formData.id ? editCourse : addCourse |
||||
|
|
||||
|
await formEl.validate(async (valid) => { |
||||
|
if (valid) { |
||||
|
loading.value = true |
||||
|
|
||||
|
let data = formData |
||||
|
|
||||
|
save(data) |
||||
|
.then((res) => { |
||||
|
loading.value = false |
||||
|
showDialog.value = false |
||||
|
emit('complete') |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
loading.value = false |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 获取字典数据 |
||||
|
|
||||
|
const setFormData = async (row: any = null) => { |
||||
|
Object.assign(formData, initialFormData) |
||||
|
loading.value = true |
||||
|
if (row) { |
||||
|
const data = await (await getCourseInfo(row.id)).data |
||||
|
if (data) |
||||
|
Object.keys(formData).forEach((key: string) => { |
||||
|
if (data[key] != undefined) formData[key] = data[key] |
||||
|
}) |
||||
|
} |
||||
|
loading.value = false |
||||
|
} |
||||
|
|
||||
|
|
||||
|
defineExpose({ |
||||
|
showDialog, |
||||
|
setFormData, |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped></style> |
||||
|
<style lang="scss"> |
||||
|
.diy-dialog-wrap .el-form-item__label { |
||||
|
height: auto !important; |
||||
|
} |
||||
|
</style> |
||||
File diff suppressed because it is too large
@ -0,0 +1,228 @@ |
|||||
|
<template> |
||||
|
<div class="main-container"> |
||||
|
<el-card class="box-card !border-none" shadow="never" v-loading="loading"> |
||||
|
<div class="flex justify-between items-center"> |
||||
|
<span class="text-lg">{{ pageName }}</span> |
||||
|
<el-button type="primary" @click="addStage"> 新增阶段 </el-button> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
|
||||
|
<el-card class="box-card !border-none" shadow="never"> |
||||
|
<div |
||||
|
class="flex items-center justify-between p-[10px] table-item-border bg" |
||||
|
> |
||||
|
<span class="text-base w-[230px]">阶段名称</span> |
||||
|
<span class="text-base w-[110px] text-center">底薪</span> |
||||
|
</div> |
||||
|
|
||||
|
<el-collapse v-model="activeNames" accordion> |
||||
|
<el-collapse-item |
||||
|
v-for="(stage, index) in stages" |
||||
|
:key="stage.id" |
||||
|
:name="stage.id" |
||||
|
> |
||||
|
<template #title> |
||||
|
<div class="collapse-title"> |
||||
|
<span class="title-name">{{ stage.name }}</span> |
||||
|
<span class="arrow">{{ stage.price }} 元</span> |
||||
|
<!-- <span class="arrow">></span> --> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<el-form label-width="100px" style="margin-bottom: 10px"> |
||||
|
<el-form-item label="阶段名称"> |
||||
|
<el-input v-model="stage.name" placeholder="请输入阶段名称" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-form label-width="100px" style="margin-bottom: 10px"> |
||||
|
<el-form-item label="阶段底薪"> |
||||
|
<el-input v-model="stage.price" placeholder="请输入阶段底薪" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-button type="success" size="small" @click="addRule(stage)" |
||||
|
>新增规则</el-button |
||||
|
> |
||||
|
|
||||
|
<el-table :data="stage.rules" border style="margin-top: 10px"> |
||||
|
<el-table-column prop="renewal_standard_min" label="续费上限"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input |
||||
|
v-model="row.renewal_standard_min" |
||||
|
placeholder="请输入续费上限" |
||||
|
/> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="renewal_standard_max" label="续费下限"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input |
||||
|
v-model="row.renewal_standard_max" |
||||
|
placeholder="请输入续费下限" |
||||
|
/> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="renewal_commission" label="续费提成"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input v-model="row.renewal_commission" placeholder="%" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="new_count_min" label="新单成交数上限"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input v-model="row.new_count_min" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="new_count_max" label="新单成交数下限"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input v-model="row.new_count_max" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="new_move_5" label="新招(5+1)x3"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input v-model="row.new_move_5" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="new_move_7" label="新招(7+1)x3"> |
||||
|
<template #default="{ row }"> |
||||
|
<el-input v-model="row.new_move_7" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" width="100"> |
||||
|
<template #default="{ $index }"> |
||||
|
<el-button |
||||
|
type="danger" |
||||
|
size="small" |
||||
|
@click="removeRule(stage, $index)" |
||||
|
>删除</el-button |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<el-button |
||||
|
type="danger" |
||||
|
size="small" |
||||
|
style="margin-top: 10px" |
||||
|
@click="removeStage(index)" |
||||
|
>删除该阶段</el-button |
||||
|
> |
||||
|
</el-collapse-item> |
||||
|
</el-collapse> |
||||
|
|
||||
|
<div style="text-align: right; margin-top: 20px"> |
||||
|
<el-button type="primary" @click="onSave">提交保存</el-button> |
||||
|
</div> |
||||
|
</el-card> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { jlyjConfig, getJlyjConfig } from '@/app/api/sys' |
||||
|
import { reactive, ref } from 'vue' |
||||
|
import { ElMessage } from 'element-plus' |
||||
|
import { useRoute } from 'vue-router' |
||||
|
const route = useRoute() |
||||
|
const pageName = route.meta.title |
||||
|
|
||||
|
const loading = ref(true) |
||||
|
const stages = ref([]) |
||||
|
const activeNames = ref(null) |
||||
|
|
||||
|
function addStage() { |
||||
|
const newStage = { |
||||
|
name: '默认阶段', |
||||
|
price: 0, |
||||
|
rules: [ |
||||
|
{ |
||||
|
renewal_standard_min: '', |
||||
|
renewal_standard_max: '', |
||||
|
renewal_commission: '', |
||||
|
new_count_min: '', |
||||
|
new_count_max: '', |
||||
|
new_move_5: '', |
||||
|
new_move_7: '', |
||||
|
}, |
||||
|
], |
||||
|
} |
||||
|
stages.value.push(newStage) |
||||
|
activeNames.value = newStage.name |
||||
|
} |
||||
|
|
||||
|
function removeStage(index) { |
||||
|
stages.value.splice(index, 1) |
||||
|
} |
||||
|
|
||||
|
function addRule(stage) { |
||||
|
stage.rules.push({ |
||||
|
renewal_standard_min: '', |
||||
|
renewal_standard_max: '', |
||||
|
renewal_commission: '', |
||||
|
new_count_min: '', |
||||
|
new_count_max: '', |
||||
|
new_move_5: '', |
||||
|
new_move_7: '', |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
function removeRule(stage, ruleIndex) { |
||||
|
if (stage.rules.length === 1) { |
||||
|
ElMessage.warning('至少保留一条规则') |
||||
|
return |
||||
|
} |
||||
|
stage.rules.splice(ruleIndex, 1) |
||||
|
} |
||||
|
|
||||
|
const setFormData = async () => { |
||||
|
const data = await (await getJlyjConfig()).data |
||||
|
stages.value = data |
||||
|
loading.value = false |
||||
|
} |
||||
|
|
||||
|
setFormData() |
||||
|
|
||||
|
const onSave = async () => { |
||||
|
jlyjConfig(stages.value) |
||||
|
.then(() => { |
||||
|
loading.value = true |
||||
|
setFormData() |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
loading.value = false |
||||
|
}) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.collapse-title { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
width: 100%; |
||||
|
font-size: 14px; |
||||
|
font-weight: 500; |
||||
|
padding-right: 10px; |
||||
|
color: #333; |
||||
|
padding: 10px; |
||||
|
} |
||||
|
|
||||
|
.title-name { |
||||
|
width: 230px; |
||||
|
} |
||||
|
|
||||
|
.title-salary { |
||||
|
width: 110px; |
||||
|
text-align: center; |
||||
|
color: #7438d5; |
||||
|
} |
||||
|
|
||||
|
.arrow { |
||||
|
margin-left: auto; |
||||
|
color: #999; |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,188 @@ |
|||||
|
<template> |
||||
|
<div class="main-container"> |
||||
|
<!-- 实时概况 --> |
||||
|
<el-card shadow="never" class="!border-none"> |
||||
|
|
||||
|
<template #header> |
||||
|
<span class="text-lg font-extrabold mr-[10px]">统计概括</span> |
||||
|
<span class="text-sm text-[#a19f98]">查看校区、员工、资源和学员的实时数据</span> |
||||
|
</template> |
||||
|
|
||||
|
<el-row :gutter="20"> |
||||
|
<el-col :span="6"> |
||||
|
<div class="text-sm text-[#a19f98] leading-8 "> |
||||
|
<el-statistic :value="info.campus_count"> |
||||
|
<template #title> |
||||
|
<div style="display: inline-flex; align-items: center"> |
||||
|
<span class="mr-[5px]">校区数量</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-statistic> |
||||
|
<div class="text-sm text-[#a19f98] leading-8"> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
|
||||
|
<el-col :span="6"> |
||||
|
<div class="text-sm text-[#a19f98] leading-8 "> |
||||
|
<el-statistic :value="info.personnel_count"> |
||||
|
<template #title> |
||||
|
<div style="display: inline-flex; align-items: center"> |
||||
|
<span class="mr-[5px]">员工数量</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-statistic> |
||||
|
|
||||
|
<div class="text-sm text-[#a19f98] leading-8"> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
|
||||
|
<el-col :span="6"> |
||||
|
<div class="text-sm text-[#a19f98] leading-8 "> |
||||
|
<el-statistic :value="info.customerResources_count"> |
||||
|
<template #title> |
||||
|
<div style="display: inline-flex; align-items: center"> |
||||
|
<span class="mr-[5px]">资源数量</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-statistic> |
||||
|
|
||||
|
<div class="text-sm text-[#a19f98] leading-8"> |
||||
|
<span>昨日新增</span> |
||||
|
<span>{{info.customerResources_day_count}}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
|
||||
|
<el-col :span="6"> |
||||
|
<div class="text-sm text-[#a19f98] leading-8 "> |
||||
|
<el-statistic :value="info.student_count"> |
||||
|
<template #title> |
||||
|
<div style="display: inline-flex; align-items: center"> |
||||
|
<span class="mr-[5px]">学员数量</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-statistic> |
||||
|
<div class="text-sm text-[#a19f98] leading-8"> |
||||
|
<span>昨日新增</span> |
||||
|
<span>{{info.student_day_count}}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
|
||||
|
|
||||
|
</el-row> |
||||
|
|
||||
|
|
||||
|
</el-card> |
||||
|
<!-- 实时概况 end --> |
||||
|
|
||||
|
|
||||
|
<el-row :gutter="15" class="mt-[15px]"> |
||||
|
<el-col :span="24"> |
||||
|
<el-card shadow="never" class="!border-none"> |
||||
|
<template #header> |
||||
|
<span class="text-lg font-extrabold">资源增长趋势</span> |
||||
|
</template> |
||||
|
<div > |
||||
|
<el-button :type="activeRange === 'week' ? 'primary' : 'default'" size="small" |
||||
|
@click="changeRange('week')">周</el-button> |
||||
|
<el-button :type="activeRange === 'month' ? 'primary' : 'default'" size="small" |
||||
|
@click="changeRange('month')">月</el-button> |
||||
|
<el-button :type="activeRange === 'year' ? 'primary' : 'default'" size="small" |
||||
|
@click="changeRange('year')">年</el-button> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div ref="visitStat" :style="{ width: '100%', height: '300px' }"> |
||||
|
|
||||
|
</div> |
||||
|
</el-card> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { ref, reactive } from 'vue' |
||||
|
import { getHome } from '@/app/api/sys' |
||||
|
import * as echarts from 'echarts' |
||||
|
const visitStat = ref<any>(null) |
||||
|
const activeRange = ref<'week' | 'month' | 'year'>('week') |
||||
|
|
||||
|
const info = reactive({ |
||||
|
campus_count: 0, |
||||
|
personnel_count: 0, |
||||
|
customerResources_count: 0, |
||||
|
customerResources_day_count: 0, |
||||
|
student_count: 0, |
||||
|
student_day_count: 0, |
||||
|
customer: [] |
||||
|
}) |
||||
|
|
||||
|
const changeRange = (range) => { |
||||
|
activeRange.value = range |
||||
|
Init(range) // 加载新数据 |
||||
|
} |
||||
|
|
||||
|
const Init = (range) => { |
||||
|
|
||||
|
getHome({'date':range}) |
||||
|
.then((res) => { |
||||
|
info.campus_count = res.data.campus_count |
||||
|
info.personnel_count = res.data.personnel_count |
||||
|
info.customerResources_count = res.data.customerResources_count |
||||
|
info.customerResources_day_count = res.data.customerResources_day_count |
||||
|
info.student_count = res.data.student_count |
||||
|
info.student_day_count = res.data.student_day_count |
||||
|
info.customer = res.data.customer |
||||
|
drawChart(''); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
Init(); |
||||
|
|
||||
|
|
||||
|
const drawChart = (item : any) => { |
||||
|
let value = info.customer.value |
||||
|
if (item) value = item |
||||
|
if (!visitStat.value) return |
||||
|
|
||||
|
|
||||
|
const visitStatChart = echarts.init(visitStat.value) |
||||
|
const visitStatOption = ref({ |
||||
|
// title: { |
||||
|
// text: '订单量趋势' |
||||
|
// }, |
||||
|
legend: {}, |
||||
|
xAxis: { |
||||
|
data: [] |
||||
|
}, |
||||
|
yAxis: {}, |
||||
|
tooltip: { |
||||
|
trigger: 'axis' |
||||
|
}, |
||||
|
series: [ |
||||
|
{ |
||||
|
type: 'line', |
||||
|
data: [] |
||||
|
} |
||||
|
] |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
visitStatOption.value.xAxis.data = info.customer.time |
||||
|
visitStatOption.value.series[0].data = value |
||||
|
|
||||
|
visitStatChart.setOption(visitStatOption.value) |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped></style> |
||||
Loading…
Reference in new issue