Compare commits

..

3 Commits

  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. 57
      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
  8. 10
      src/views/Clue/Order/Comp/DialogOrder.vue

@ -41,3 +41,13 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => {
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 })
}
// 获取通用字典数据
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,7 +1,5 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-tabs v-model="tabIndex">
<el-tab-pane label="基础信息" :name="1">
<el-form
ref="formRef"
v-loading="formLoading"
@ -66,57 +64,6 @@
</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 label="跟进指标生效日期">
<el-date-picker
v-model="formData.effectDate"
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="taskList.push({})">添加年份</el-button>
<el-table :data="taskList" 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[`month${col}`]"
size="small"
:controls="false"
style="width: 100%"
/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
@ -135,8 +82,6 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const tabIndex = ref(1)
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
@ -232,6 +177,4 @@ const getTree = async () => {
dept.children = handleTree(data)
deptTree.value.push(dept)
}
const taskList = ref([])
</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="status" label="状态" width="100" />
<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">
<el-button
link
@ -35,6 +35,14 @@
>
修改
</el-button>
<el-button
link
type="primary"
@click="openTarget(scope.row.id)"
v-hasPermi="['basic:dept:update']"
>
业绩指标
</el-button>
<el-button
link
type="danger"
@ -49,11 +57,13 @@
<!-- 表单弹窗添加/修改 -->
<DeptForm ref="formRef" @success="getList" />
<DialogTarget ref="targetDialogRef" @success="getList" />
</template>
<script setup lang="ts" name="SystemDept">
import { handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import DeptForm from './DeptForm.vue'
import DialogTarget from './DialogTarget.vue'
import { dateFormatter } from '@/utils/formatTime'
const message = useMessage() //
const { t } = useI18n() //
@ -93,6 +103,11 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
const targetDialogRef = ref()
const openTarget = (id: number) => {
targetDialogRef.value.open(id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {

@ -2,35 +2,36 @@
<div class="pl-20px pr-20px">
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" v-loading="formLoading">
<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="0"> 关闭 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发送途径">
<el-checkbox-group v-model="form.fasongtujing">
<el-checkbox :label="1">系统通知</el-checkbox>
<el-checkbox :label="2">微信公众号</el-checkbox>
<el-checkbox-group v-model="form.sendType">
<el-checkbox v-for="(item, index) in sendTypeOptions" :key="index" :label="item.value">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="发送时间">
<el-time-picker
v-model="form.sendTime"
placeholder="任意时间点"
format="HH:mm:ss"
value-format="HH:mm:ss"
format="HH:mm"
value-format="HH:mm"
/>
</el-form-item>
<el-form-item label="发送内容">
<el-tree
ref="treeRef"
:data="contentOptions"
:props="defaultProps"
empty-text="加载中,请稍候"
node-key="value"
node-key="id"
show-checkbox
default-expand-all
:default-checked-keys="form.sendContent"
style="width: 100%"
/>
</el-form-item>
@ -42,7 +43,9 @@
</template>
<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 props = defineProps({
@ -53,9 +56,16 @@ const props = defineProps({
const formLoading = ref(false)
const form = ref({
checkedMenuIds: []
sendItem: []
})
watch(
() => props.roleId,
() => {
getReportInfo()
}
)
onMounted(() => {
init()
})
@ -71,43 +81,39 @@ async function init() {
getReportInfo()
}
const sendTypeOptions = ref([])
const treeRef = ref()
function getOptions() {
const arr = [
{
value: 1,
label: '销售快报',
children: [
{ 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)
getGeneralSysDictData('message_send_type').then((data) => {
sendTypeOptions.value = data
})
DaliyReportApi.getDaliyReportContent().then((data) => {
contentOptions.value = handleTree(data)
})
}
async function getReportInfo() {
try {
formLoading.value = true
form.value = {
kaiqitongzhi: 1,
fasongtujing: [1, 2],
sendTime: '21:00:00',
sendContent: [21, 22, 23]
const data = await DaliyReportApi.getRoleDaliyReport(props.roleId)
form.value = { ...data }
if (!form.value.sendType) {
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
} catch (error) {
console.log(error)
@ -121,16 +127,19 @@ const submitForm = async () => {
formLoading.value = true
try {
const data = {
id: form.value.id,
roleId: props.roleId,
menuIds: [
sendType: form.value.sendType,
sendTime: form.value.sendTime,
status: form.value.status,
sendItem: [
...treeRef.value.getCheckedKeys(false), //
...treeRef.value.getHalfCheckedKeys() //
]
}
// await PermissionApi.assignRoleMenu(data)
console.log(data)
await DaliyReportApi.updateRoleDaliyReport(data)
message.success('保存成功')
getReportInfo()
} finally {
formLoading.value = false
}

@ -191,11 +191,17 @@ function getFields() {
})
getOrderFieldList().then((data) => {
const arr = useCrudSchemas(data).allSchemas.detailSchema
arr.forEach((it) => {
const list = useCrudSchemas(data).allSchemas.detailSchema
const arr = []
list.forEach((it) => {
if (it.label.includes('日期')) {
it.dateFormat = 'YYYY-MM-DD'
}
if (it.field == 'receivedMoney') {
checkPermi(['clue:order:return-list']) && arr.push(it)
} else {
arr.push(it)
}
})
if (arr.length % 2 != 0) {
arr.push({})

Loading…
Cancel
Save