qsh 3 months ago
parent f7980cf66a
commit 735d638b49
  1. 10
      src/api/system/dept/index.ts
  2. 7
      src/api/system/dict/dict.data.ts
  3. 25
      src/api/system/role/daliyReport.js
  4. 177
      src/views/Basic/Dept/DeptForm.vue
  5. 133
      src/views/Basic/Dept/DialogTarget.vue
  6. 17
      src/views/Basic/Dept/index.vue
  7. 95
      src/views/Basic/Role/Comp/ReportDaily.vue

@ -41,3 +41,13 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => { export const deleteDept = async (id: number) => {
return await request.delete({ url: '/admin-api/system/dept/delete?id=' + id }) return await request.delete({ url: '/admin-api/system/dept/delete?id=' + id })
} }
// 获取部门业务指标
export const getDeptTarget = async (deptId: number) => {
return await request.get({ url: '/admin-api/crm/dept-target/get', params: { deptId } })
}
// 更新部门业务指标
export const updateDeptTarget = async (data: any) => {
return await request.put({ url: '/admin-api/crm/dept-target/save', data, isSubmitForm: true })
}

@ -44,6 +44,11 @@ export const deleteDictData = (id: number) => {
} }
// 导出字典类型数据 // 导出字典类型数据
export const exportDictData = (params) => { export const exportDictData = (params: any) => {
return request.get({ url: '/admin-api/crm/dict-data/export', params }) return request.get({ url: '/admin-api/crm/dict-data/export', params })
} }
// 获取通用字典数据
export const getGeneralSysDictData = (dictType: string) => {
return request.get({ url: '/admin-api/system/dict-data/get-by-type', params: { dictType } })
}

@ -0,0 +1,25 @@
import request from '@/config/axios'
// 获取角色快报配置
export const getRoleDaliyReport = async (roleId) => {
return await request.get({
url: '/admin-api/system/role-message-setting/get',
params: { roleId }
})
}
// 保存角色每日快报配置
export const updateRoleDaliyReport = async (data) => {
return await request.post({
url: '/admin-api/system/role-message-setting/save',
data,
isSubmitForm: true
})
}
// 获取每日快报发送内容
export const getDaliyReportContent = async () => {
return await request.get({
url: '/admin-api/system/message-item/list-all-simple'
})
}

@ -1,122 +1,69 @@
<template> <template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px"> <Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-tabs v-model="tabIndex"> <el-form
<el-tab-pane label="基础信息" :name="1"> ref="formRef"
<el-form v-loading="formLoading"
ref="formRef" :model="formData"
v-loading="formLoading" :rules="formRules"
:model="formData" label-width="80px"
:rules="formRules" >
label-width="80px" <el-row :gutter="20">
> <el-col :span="12" :offset="0">
<el-row :gutter="20"> <el-form-item label="上级部门" prop="parentId">
<el-col :span="12" :offset="0"> <el-tree-select
<el-form-item label="上级部门" prop="parentId"> v-model="formData.parentId"
<el-tree-select :data="deptTree"
v-model="formData.parentId" :props="defaultProps"
:data="deptTree" check-strictly
:props="defaultProps" default-expand-all
check-strictly placeholder="请选择上级部门"
default-expand-all value-key="deptId"
placeholder="请选择上级部门"
value-key="deptId"
/>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="部门名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="负责人" prop="leaderUserId">
<el-select v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="备注" prop="remark">
<Editor v-model:modelValue="formData.remark" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="业务指标" :name="2">
<el-form :model="formData" label-width="auto">
<el-form-item label="每日跟进指标数">
<el-input-number
v-model="formData.followDaliyNum"
:controls="false"
style="width: 150px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="跟进指标生效日期"> </el-col>
<el-date-picker <el-col :span="12" :offset="0">
v-model="formData.effectDate" <el-form-item label="部门名称" prop="name">
type="date" <el-input v-model="formData.name" placeholder="请输入部门名称" />
placeholder="选择日期时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 150px"
/>
</el-form-item> </el-form-item>
</el-form> </el-col>
<el-divider direction="horizontal" content-position="left">成交额指标</el-divider> </el-row>
<el-button class="mb-10px" type="primary" @click="taskList.push({})">添加年份</el-button> <el-row :gutter="20">
<el-table :data="taskList" border> <el-col :span="12" :offset="0">
<el-table-column label="年份" width="120"> <el-form-item label="负责人" prop="leaderUserId">
<template #default="{ row }"> <el-select v-model="formData.leaderUserId" clearable placeholder="请输入负责人">
<el-date-picker <el-option
v-model="row.year" v-for="item in userList"
type="year" :key="item.id"
placeholder="选择年份" :label="item.nickname"
size="small" :value="item.id"
format="YYYY"
value-format="YYYY"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column v-for="col in 12" :key="col" :label="`${col}月`" width="100px">
<template #default="{ row }">
<el-input-number
v-model="row[`month${col}`]"
size="small"
:controls="false"
style="width: 100%"
/> />
</template> </el-select>
</el-table-column> </el-form-item>
</el-table> </el-col>
</el-tab-pane> <el-col :span="12" :offset="0">
</el-tabs> <el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
<el-radio :label="0"> 启用 </el-radio>
<el-radio :label="1"> 禁用 </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="备注" prop="remark">
<Editor v-model:modelValue="formData.remark" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer> <template #footer>
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
@ -135,8 +82,6 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const tabIndex = ref(1)
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formData = ref({ const formData = ref({
@ -232,6 +177,4 @@ const getTree = async () => {
dept.children = handleTree(data) dept.children = handleTree(data)
deptTree.value.push(dept) deptTree.value.push(dept)
} }
const taskList = ref([])
</script> </script>

@ -0,0 +1,133 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-form ref="formRef" :model="formData" label-width="130px">
<el-form-item label="每日跟进指标数">
<el-input-number v-model="formData.targetNum" :controls="false" style="width: 150px" />
</el-form-item>
<el-form-item label="跟进指标生效日期">
<el-date-picker
v-model="formData.startDate"
type="date"
placeholder="选择日期时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 150px"
/>
</el-form-item>
</el-form>
<el-divider direction="horizontal" content-position="left">成交额指标</el-divider>
<el-button class="mb-10px" type="primary" @click="handleAddPrice"> 添加年份 </el-button>
<el-table :data="formData.deptSignPriceTargetVOList" border>
<el-table-column label="年份" width="120">
<template #default="{ row }">
<el-date-picker
v-model="row.year"
type="year"
placeholder="选择年份"
size="small"
format="YYYY"
value-format="YYYY"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column v-for="col in 12" :key="col" :label="`${col}月`" width="100px">
<template #default="{ row }">
<el-input-number
v-model="row.monthTargetVOList[col - 1].targetPrice"
size="small"
:controls="false"
style="width: 100%"
/>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup name="DialogTarget">
import * as DeptApi from '@/api/system/dept'
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formData = ref({
remark: undefined
})
/** 打开弹窗 */
const open = async (deptId) => {
dialogVisible.value = true
dialogTitle.value = '业绩指标'
resetForm()
//
if (deptId) {
formLoading.value = true
try {
formData.value = await DeptApi.getDeptTarget(deptId)
formData.value.deptId = deptId
if (formData.value?.deptSignPriceTargetVOList) {
formData.value.deptSignPriceTargetVOList.forEach((it) => {
it.year = it.year + ''
})
}
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const formRef = ref() // Ref
const submitForm = async () => {
//
formLoading.value = true
try {
await DeptApi.updateDeptTarget(formData.value)
message.success('修改成功')
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
targetNum: undefined,
startDate: undefined,
deptSignPriceTargetVOList: []
}
formRef.value?.resetFields()
}
function handleAddPrice() {
const obj = {
year: undefined,
monthTargetVOList: []
}
for (let i = 1; i <= 12; i++) {
obj.monthTargetVOList.push({
month: i,
targetPrice: undefined
})
}
if (!formData.value.deptSignPriceTargetVOList) {
formData.value.deptSignPriceTargetVOList = []
}
formData.value.deptSignPriceTargetVOList.push(obj)
}
</script>
<style lang="scss" scoped></style>

@ -25,7 +25,7 @@
<el-table-column prop="sort" label="排序" width="200" /> <el-table-column prop="sort" label="排序" width="200" />
<el-table-column prop="status" label="状态" width="100" /> <el-table-column prop="status" label="状态" width="100" />
<el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" /> <el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" />
<el-table-column label="操作" class-name="fixed-width" width="160"> <el-table-column label="操作" class-name="fixed-width" width="240">
<template #default="scope"> <template #default="scope">
<el-button <el-button
link link
@ -35,6 +35,14 @@
> >
修改 修改
</el-button> </el-button>
<el-button
link
type="primary"
@click="openTarget(scope.row.id)"
v-hasPermi="['basic:dept:update']"
>
业绩指标
</el-button>
<el-button <el-button
link link
type="danger" type="danger"
@ -49,11 +57,13 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<DeptForm ref="formRef" @success="getList" /> <DeptForm ref="formRef" @success="getList" />
<DialogTarget ref="targetDialogRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="SystemDept"> <script setup lang="ts" name="SystemDept">
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
import DeptForm from './DeptForm.vue' import DeptForm from './DeptForm.vue'
import DialogTarget from './DialogTarget.vue'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -93,6 +103,11 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
const targetDialogRef = ref()
const openTarget = (id: number) => {
targetDialogRef.value.open(id)
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
try { try {

@ -2,35 +2,36 @@
<div class="pl-20px pr-20px"> <div class="pl-20px pr-20px">
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading"> <el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading">
<el-form-item label="开启通知"> <el-form-item label="开启通知">
<el-radio-group v-model="form.kaiqitongzhi"> <el-radio-group v-model="form.status">
<el-radio :label="1"> 开启 </el-radio> <el-radio :label="1"> 开启 </el-radio>
<el-radio :label="0"> 关闭 </el-radio> <el-radio :label="0"> 关闭 </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="发送途径"> <el-form-item label="发送途径">
<el-checkbox-group v-model="form.fasongtujing"> <el-checkbox-group v-model="form.sendType">
<el-checkbox :label="1">系统通知</el-checkbox> <el-checkbox v-for="(item, index) in sendTypeOptions" :key="index" :label="item.value">
<el-checkbox :label="2">微信公众号</el-checkbox> {{ item.label }}
</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="发送时间"> <el-form-item label="发送时间">
<el-time-picker <el-time-picker
v-model="form.sendTime" v-model="form.sendTime"
placeholder="任意时间点" placeholder="任意时间点"
format="HH:mm:ss" format="HH:mm"
value-format="HH:mm:ss" value-format="HH:mm"
/> />
</el-form-item> </el-form-item>
<el-form-item label="发送内容"> <el-form-item label="发送内容">
<el-tree <el-tree
ref="treeRef" ref="treeRef"
:data="contentOptions" :data="contentOptions"
:props="defaultProps"
empty-text="加载中,请稍候" empty-text="加载中,请稍候"
node-key="value" node-key="id"
show-checkbox show-checkbox
default-expand-all default-expand-all
:default-checked-keys="form.sendContent"
style="width: 100%" style="width: 100%"
/> />
</el-form-item> </el-form-item>
@ -42,7 +43,9 @@
</template> </template>
<script setup name="ReportDaily"> <script setup name="ReportDaily">
import { handleTree } from '@/utils/tree' import * as DaliyReportApi from '@/api/system/role/daliyReport'
import { defaultProps, handleTree } from '@/utils/tree'
import { getGeneralSysDictData } from '@/api/system/dict/dict.data'
const message = useMessage() // const message = useMessage() //
const props = defineProps({ const props = defineProps({
@ -53,9 +56,16 @@ const props = defineProps({
const formLoading = ref(false) const formLoading = ref(false)
const form = ref({ const form = ref({
checkedMenuIds: [] sendItem: []
}) })
watch(
() => props.roleId,
() => {
getReportInfo()
}
)
onMounted(() => { onMounted(() => {
init() init()
}) })
@ -71,43 +81,39 @@ async function init() {
getReportInfo() getReportInfo()
} }
const sendTypeOptions = ref([])
const treeRef = ref() const treeRef = ref()
function getOptions() { function getOptions() {
const arr = [ getGeneralSysDictData('message_send_type').then((data) => {
{ sendTypeOptions.value = data
value: 1, })
label: '销售快报', DaliyReportApi.getDaliyReportContent().then((data) => {
children: [ contentOptions.value = handleTree(data)
{ value: 11, label: '今日跟进线索数', pId: 1 }, })
{ value: 12, label: '今日待跟进数', pId: 1 },
{ value: 13, label: '今日接受线索数', pId: 1 }
]
},
{
value: 2,
label: '管理快报',
children: [
{ value: 21, label: '当日业绩(成交数,成交额)', pId: 2 },
{ value: 22, label: '当月业绩(成交数,成交额)', pId: 2 },
{ value: 23, label: '本月业绩完成情况(数值,比例)', pId: 2 }
]
}
]
contentOptions.value = arr
handleTree(arr)
} }
async function getReportInfo() { async function getReportInfo() {
try { try {
formLoading.value = true formLoading.value = true
form.value = { const data = await DaliyReportApi.getRoleDaliyReport(props.roleId)
kaiqitongzhi: 1, form.value = { ...data }
fasongtujing: [1, 2],
sendTime: '21:00:00', if (!form.value.sendType) {
sendContent: [21, 22, 23] form.value.sendType = []
}
if (!form.value.sendTime) {
form.value.sendTime = '22:00'
} }
if (!form.value.sendItem) {
form.value.sendItem = []
}
treeRef.value.setCheckedKeys([], false)
//
form.value.sendItem.forEach((menuId) => {
treeRef.value.setChecked(menuId, true, false)
})
formLoading.value = false formLoading.value = false
} catch (error) { } catch (error) {
console.log(error) console.log(error)
@ -121,16 +127,19 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
const data = { const data = {
id: form.value.id,
roleId: props.roleId, roleId: props.roleId,
menuIds: [ sendType: form.value.sendType,
sendTime: form.value.sendTime,
status: form.value.status,
sendItem: [
...treeRef.value.getCheckedKeys(false), // ...treeRef.value.getCheckedKeys(false), //
...treeRef.value.getHalfCheckedKeys() // ...treeRef.value.getHalfCheckedKeys() //
] ]
} }
// await PermissionApi.assignRoleMenu(data) await DaliyReportApi.updateRoleDaliyReport(data)
console.log(data)
message.success('保存成功') message.success('保存成功')
getReportInfo()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }

Loading…
Cancel
Save