Compare commits
No commits in common. 'main' and 'dev-report' have entirely different histories.
main
...
dev-report
@ -0,0 +1,15 @@ |
||||
{ |
||||
"recommendations": [ |
||||
"voorjaar.windicss-intellisense", |
||||
"vscode-icons-team.vscode-icons", |
||||
"davidanson.vscode-markdownlint", |
||||
"stylelint.vscode-stylelint", |
||||
"dbaeumer.vscode-eslint", |
||||
"esbenp.prettier-vscode", |
||||
"vue.volar", |
||||
"lokalise.i18n-ally", |
||||
"mikestead.dotenv", |
||||
"eamodio.gitlens", |
||||
"antfu.iconify" |
||||
] |
||||
} |
@ -0,0 +1,16 @@ |
||||
{ |
||||
// Use IntelliSense to learn about possible attributes. |
||||
// Hover to view descriptions of existing attributes. |
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
||||
"version": "0.2.0", |
||||
"configurations": [ |
||||
{ |
||||
"type": "msedge", |
||||
"request": "launch", |
||||
"name": "Launch Edge against localhost", |
||||
"url": "http://localhost", |
||||
"webRoot": "${workspaceFolder}/src", |
||||
"sourceMaps": true |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,54 @@ |
||||
{ |
||||
"typescript.tsdk": "node_modules/typescript/lib", |
||||
"prettier.enable": true, |
||||
"editor.formatOnType": true, |
||||
"editor.formatOnSave": true, |
||||
"editor.formatOnPaste": true, |
||||
"editor.codeActionsOnSave": { |
||||
"source.fixAll.eslint": "explicit" |
||||
}, |
||||
"[vue]": { |
||||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
||||
}, |
||||
"[javascript]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"[typescript]": { |
||||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
||||
}, |
||||
"[json]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"[jsonc]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"[html]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"[css]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"[scss]": { |
||||
"editor.defaultFormatter": "esbenp.prettier-vscode" |
||||
}, |
||||
"i18n-ally.localesPaths": ["src/locales"], |
||||
"i18n-ally.keystyle": "nested", |
||||
"i18n-ally.sortKeys": true, |
||||
"i18n-ally.namespace": true, |
||||
"i18n-ally.enabledParsers": ["ts"], |
||||
"i18n-ally.sourceLanguage": "en", |
||||
"i18n-ally.displayLanguage": "zh-CN", |
||||
"i18n-ally.enabledFrameworks": ["vue", "react"], |
||||
"god.tsconfig": "./tsconfig.json", |
||||
"vue-i18n.i18nPaths": "src/locales", |
||||
"explorer.fileNesting.enabled": true, |
||||
"explorer.fileNesting.expand": false, |
||||
"explorer.fileNesting.patterns": { |
||||
"*.ts": "$(capture).test.ts, $(capture).test.tsx", |
||||
"*.tsx": "$(capture).test.ts, $(capture).test.tsx", |
||||
"*.env": "$(capture).env.*", |
||||
"CHANGELOG.md": "CHANGELOG*", |
||||
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc,vite.config.*,windi.*,tailwind.*,tsconfig.*,postcss*", |
||||
".eslintrc.js": ".eslintignore,.eslintrc-*,.prettierignore,.stylelintignore,.commitlintrc.js,.prettierrc.js,.stylelint*,stylelint*,prettier.*,.editorconfig" |
||||
} |
||||
} |
@ -1,8 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const getInfo = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/sale/report/detail', data }) |
||||
} |
||||
|
||||
export const getList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/sale/report', data }) |
||||
} |
@ -1,42 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createKpi = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/oa/examine-configuration/create', |
||||
data, |
||||
isSubmitForm: true |
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateKpi = (data) => { |
||||
return request.put({ url: '/admin-api/oa/examine-configuration/update', data }) |
||||
} |
||||
|
||||
// 修改状态
|
||||
export const updateKpiStatus = (data) => { |
||||
return request.put({ url: '/admin-api/oa/examine-configuration/status/update', data }) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getKpiPage = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-configuration/page', params }) |
||||
} |
||||
|
||||
// 详情
|
||||
export const getKpiDetail = (id) => { |
||||
return request.get({ url: '/admin-api/oa/examine-configuration/get', params: { id } }) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deleteKpi = (id) => { |
||||
return request.delete({ url: '/admin-api/oa/examine-configuration/delete', params: { id } }) |
||||
} |
||||
|
||||
//
|
||||
export const getKpiEmployees = () => { |
||||
return request.get({ |
||||
url: '/admin-api/oa/employee/examinedEmployees' |
||||
}) |
||||
} |
@ -1,41 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 打分数据
|
||||
export const getKpiEmployees = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-score/getExamineUserExamineScore', params }) |
||||
} |
||||
|
||||
// 保存考勤打分数据
|
||||
export const saveKpiScore = (data) => { |
||||
return request.put({ url: '/admin-api/oa/examine-score/update', data }) |
||||
} |
||||
|
||||
// 删除考核项
|
||||
export const deleteKpiItem = (params) => { |
||||
return request.delete({ url: '/admin-api/oa/examine-score/delete', params }) |
||||
} |
||||
|
||||
// 考评分页数据
|
||||
export const getScorePage = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-period/page', params }) |
||||
} |
||||
|
||||
// 封存
|
||||
export const saveScoreRecord = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-period/confirm', params }) |
||||
} |
||||
|
||||
// 查询周期是否已封存
|
||||
export const getKpiPeriodStatus = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-period/getExaminePeriodByPeriod', params }) |
||||
} |
||||
|
||||
// 查询考核记录
|
||||
export const getScoreRecord = (data) => { |
||||
return request.post({ url: '/admin-api/oa/examine-result/periodPage', data }) |
||||
} |
||||
|
||||
// 查详情
|
||||
export const getScoreDetail = (params) => { |
||||
return request.get({ url: '/admin-api/oa/examine-result/detail', params }) |
||||
} |
@ -1,38 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createComment = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/okr/comments/create', |
||||
data, |
||||
isSubmitForm: true |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getCommentPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/comments/page', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取评论类型
|
||||
export const getCommentTypeOptions = () => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/dict-data/get-by-type', |
||||
params: { dictType: 'comment_type' } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 点赞评论
|
||||
export const likeComment = (commentId) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/comments-likes/update', |
||||
data: { commentId } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
@ -1,45 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
export const createMeeting = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/okr/meeting/add', |
||||
data, |
||||
isSubmitForm: true |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateMeeting = (data) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/meeting/update', |
||||
data |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
// 查询详情
|
||||
export const getMeetingDetail = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/meeting/get', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 取消会议
|
||||
export const cancelMeeting = (data) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/meeting/cancel', |
||||
data |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 分页查询
|
||||
export const getMeetingPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/meeting/page', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
@ -1,154 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createOkrNode = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/okr/node/add', |
||||
data, |
||||
isSubmitForm: true |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateOkrNode = (data) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/node/update', |
||||
data |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 查询详情
|
||||
export const getOkrNodeDetail = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/get', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 我负责的 - 节点树
|
||||
export const getMyNodeTree = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/my/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 我负责的 - okr列表
|
||||
export const getMyOkrPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/my/object/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 全部目标 - 节点树
|
||||
export const getAllNodeTree = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/all/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 全部目标 - okr列表
|
||||
export const getAllOkrPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/all/object/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取节点操作历史
|
||||
export const getOkrNodeHistory = (nodeId) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/record/list', |
||||
params: { nodeId } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取系统默认的关键成果内容
|
||||
export const getDefaultOkrOptions = () => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/dict-data/get-by-type', |
||||
params: { dictType: 'key_result_source' } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 更新OKR进度
|
||||
export const updateOkrProgress = (data) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/node/progress/update', |
||||
data |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取目标关系树一级节点
|
||||
export const getOkrRelationTree = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/first-node', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取目标关系树下级节点数据
|
||||
export const getOkrRelationTreeChildren = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/node-tree', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取我的组员
|
||||
export const getMyMemberList = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/my-members', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取我的组员节点树
|
||||
export const getMySonNodeTree = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/member/node/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取我的组员OKR列表
|
||||
export const getMySonOkrPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/member/objective/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取渠道
|
||||
export const getChannelOptions = () => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/source' |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 获取统计表中的合计信息
|
||||
export const getOkrStatisticsTotal = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/node/data/count', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
@ -1,83 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createWait = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/okr/agent-work/create', |
||||
data, |
||||
isSubmitForm: true |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateWait = (data) => { |
||||
return request.put({ |
||||
url: '/admin-api/okr/agent-work/update', |
||||
data |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getWaitPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/agent-work/page', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 详情
|
||||
export const getWaitDetail = (id) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/agent-work/get', |
||||
params: { id } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deleteWait = (id) => { |
||||
return request.delete({ |
||||
url: '/admin-api/okr/agent-work/delete', |
||||
params: { id } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 催办
|
||||
export const urgeWait = (workId) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/agent-work/urge', |
||||
params: { workId } |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 跟进待办
|
||||
export const followWait = (data) => { |
||||
return request.post({ |
||||
url: '/admin-api/okr/agent-work-follow/create', |
||||
data, |
||||
isSubmitForm: true |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
// 查询跟进记录
|
||||
export const getFollowWaitPage = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/agent-work-follow/list', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
||||
|
||||
export const getWaitCount = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/okr/agent-work/getAgentWorkNum', |
||||
params |
||||
// headers: { 'instance-id': 1016 }
|
||||
}) |
||||
} |
@ -1,36 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createPlan = (data) => { |
||||
return request.post({ url: '/admin-api/oa/attendance-setting/create', data, isSubmitForm: true }) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updatePlan = (data) => { |
||||
return request.put({ url: '/admin-api/oa/attendance-setting/update', data }) |
||||
} |
||||
|
||||
// 修改状态
|
||||
export const updatePlanStatus = (data) => { |
||||
return request.put({ url: '/admin-api/oa/attendance-setting/status/update', data }) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getPlanPage = (params) => { |
||||
return request.get({ url: '/admin-api/oa/attendance-setting/page', params }) |
||||
} |
||||
|
||||
// 列表
|
||||
export const getPlanSimpleList = (params) => { |
||||
return request.get({ url: '/admin-api/oa/attendance-setting/simple-list', params }) |
||||
} |
||||
|
||||
// 详情
|
||||
export const getPlanDetail = (id) => { |
||||
return request.get({ url: '/admin-api/oa/attendance-setting/get', params: { id } }) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deletePlan = (id) => { |
||||
return request.delete({ url: '/admin-api/oa/attendance-setting/delete', params: { id } }) |
||||
} |
@ -1,41 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 创建
|
||||
export const createEmployee = (data) => { |
||||
return request.post({ url: '/admin-api/oa/employee/create', data, isSubmitForm: true }) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getEmployeeSimpleList = (params) => { |
||||
return request.get({ url: '/admin-api/oa/employee/list-all-simple', params }) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateEmployee = (data) => { |
||||
return request.put({ url: '/admin-api/oa/employee/update', data }) |
||||
} |
||||
|
||||
// 修改状态
|
||||
export const updateEmployeeStatus = (data) => { |
||||
return request.put({ url: '/admin-api/oa/employee/status/update', data }) |
||||
} |
||||
|
||||
// 分页
|
||||
export const getEmployeePage = (params) => { |
||||
return request.get({ url: '/admin-api/oa/employee/page', params }) |
||||
} |
||||
|
||||
// 详情
|
||||
export const getEmployeeDetail = (id) => { |
||||
return request.get({ url: '/admin-api/oa/employee/get', params: { id } }) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deleteEmployee = (id) => { |
||||
return request.delete({ url: '/admin-api/oa/employee/delete', params: { id } }) |
||||
} |
||||
|
||||
// 获取钉钉id
|
||||
export const getDingUserId = (params) => { |
||||
return request.get({ url: '/admin-api/oa/employee/getDingTalkUserIdByMobile', params }) |
||||
} |
@ -1,33 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
// 查询列表
|
||||
export const getSupplierPage = async (params) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/page', params }) |
||||
} |
||||
|
||||
export const getSupplierSimpleList = async (params) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/simple-list', params }) |
||||
} |
||||
|
||||
// 查询详情
|
||||
export const getSupplier = async (id) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/get?id=' + id }) |
||||
} |
||||
|
||||
// 新增
|
||||
export const createSupplier = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/crm/erp-supplier/create', |
||||
data: data, |
||||
isSubmitForm: true |
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateSupplier = async (params) => { |
||||
return await request.put({ url: '/admin-api/crm/erp-supplier/update', data: params }) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deleteSupplier = async (id) => { |
||||
return await request.delete({ url: '/admin-api/crm/erp-supplier/delete?id=' + id }) |
||||
} |
@ -1,23 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
// 更新
|
||||
export const updateWechatConfig = (data) => { |
||||
return request.post({ url: '/admin-api/system/wx-robot-message-setting/save', data }) |
||||
} |
||||
|
||||
// 更新发送时间
|
||||
export const updateWechatSendTime = (data) => { |
||||
return request.put({ url: '/admin-api/system/wx-robot-message-setting/update-send-time', data }) |
||||
} |
||||
// 更新微信群
|
||||
export const updateWechatGroup = (data) => { |
||||
return request.put({ url: '/admin-api/system/wx-robot-message-setting/update-wx-group', data }) |
||||
} |
||||
|
||||
// 获得列表
|
||||
export const getWechatConfigList = (params) => { |
||||
return request.get({ |
||||
url: '/admin-api/system/wx-robot-message-setting/list', |
||||
params |
||||
}) |
||||
} |
@ -1,48 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
export const getVipDiscountList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/member/discount/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const addVipDiscount = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/member/discount/add', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const updateVipDiscount = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/member/discount/update', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const deleteVipDiscount = async (id) => { |
||||
return await request.delete({ |
||||
url: '/admin-api/applet/xunjia/member/discount/delete?discountId=' + id |
||||
}) |
||||
} |
||||
|
||||
export const getVipDiscountOptions = async () => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/member/discount/simple-list' |
||||
}) |
||||
} |
||||
|
||||
export const getUserDiscountList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/user/discount/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const giveUserDiscount = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/user/discount/send', |
||||
data |
||||
}) |
||||
} |
@ -1,39 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
export const getResellList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/distribution/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const addResell = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/distribution/add', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const updateResell = async (data) => { |
||||
return await request.put({ |
||||
url: '/admin-api/applet/xunjia/distribution/update', |
||||
data |
||||
}) |
||||
} |
||||
export const deleteResell = async (id) => { |
||||
return await request.delete({ |
||||
url: '/admin-api/applet/xunjia/distribution/delete?distributionId=' + id |
||||
}) |
||||
} |
||||
export const getResellDetail = async (id) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/distribution/' + id |
||||
}) |
||||
} |
||||
|
||||
export const getResellSimpleList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/distribution/simple-list', |
||||
params: params |
||||
}) |
||||
} |
@ -1,56 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
export const getUserMemberList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/user/member/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const giveUserMember = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/user/member/add', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const getVipTypeList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/member/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const addVipType = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/member/add', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const updateVipType = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/member/update', |
||||
data |
||||
}) |
||||
} |
||||
|
||||
export const deleteVipType = async (id) => { |
||||
return await request.delete({ |
||||
url: '/admin-api/applet/xunjia/member/delete?memberId=' + id |
||||
}) |
||||
} |
||||
|
||||
export const getVipTypeOptions = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/member/simple-list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const getRechargeRecords = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/pay/list', |
||||
params: params |
||||
}) |
||||
} |
@ -1,67 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
|
||||
export const addJx = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/question/jx/add', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const getJxQuestionList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/question/jx/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const delJxData = async (id) => { |
||||
return await request.delete({ |
||||
url: `/admin-api/applet/xunjia/question/jx/delete?id=${id}` |
||||
}) |
||||
} |
||||
|
||||
export const addMj = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/secret/add', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const getMjList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/secret/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const delMj = async (secretId) => { |
||||
return await request.delete({ |
||||
url: `/admin-api/applet/xunjia/secret/delete?secretId=${secretId}` |
||||
}) |
||||
} |
||||
|
||||
export const clearMj = async (secretId) => { |
||||
return await request.delete({ |
||||
url: `/admin-api/applet/xunjia/secret/clear?secretId=${secretId}` |
||||
}) |
||||
} |
||||
|
||||
export const getMjQuestionList = async (params) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/secret/question/list', |
||||
params: params |
||||
}) |
||||
} |
||||
|
||||
export const addMjQuestion = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/secret/question/add', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const delMjQuestion = async (id) => { |
||||
return await request.delete({ |
||||
url: `/admin-api/applet/xunjia/secret/question/delete?id=${id}` |
||||
}) |
||||
} |
@ -1,48 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const searchQuestion = async (param) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/question/list', |
||||
params: param |
||||
}) |
||||
} |
||||
|
||||
export const updateQuestion = async (data) => { |
||||
return await request.put({ |
||||
url: '/admin-api/applet/xunjia/question/update', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const addQuestion = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/question/add', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const deleteQuestion = async (id) => { |
||||
return await request.delete({ |
||||
url: '/admin-api/applet/xunjia/question/delete?id=' + id |
||||
}) |
||||
} |
||||
|
||||
export const uploadFile = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/applet/xunjia/question/upload', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export const getQuestionSort = async (param) => { |
||||
return await request.get({ |
||||
url: '/admin-api/applet/xunjia/question/sort/list', |
||||
params: param |
||||
}) |
||||
} |
||||
|
||||
export const getMjList = async (params) => { |
||||
return await request.get({ |
||||
url: 'http://localhost/tiku-api/tiku/xunjia/secret/list', |
||||
params: params |
||||
}) |
||||
} |
Before Width: | Height: | Size: 309 KiB |
Before Width: | Height: | Size: 192 KiB |
@ -1,2 +1,2 @@ |
||||
@import './process-designer.scss'; |
||||
@import './process-panel.scss'; |
||||
@import './process-panel.scss'; |
||||
|
@ -1,87 +0,0 @@ |
||||
const staticRouter: AppCustomRouteRecordRaw[] = [ |
||||
{ |
||||
icon: 'ep:calendar', |
||||
path: '/Okr', |
||||
component: '', |
||||
name: 'OKR', |
||||
componentName: '', |
||||
redirect: '', |
||||
parentId: 0, |
||||
visible: true, |
||||
alwaysShow: true, |
||||
children: [ |
||||
{ |
||||
icon: 'ep:finished', |
||||
path: 'okr-management', |
||||
name: 'OKR管理', |
||||
componentName: 'OkrManagement', |
||||
component: 'OKR/Management/index', |
||||
visible: true, |
||||
alwaysShow: true, |
||||
meta: { |
||||
title: 'OKR管理' |
||||
}, |
||||
redirect: '' |
||||
}, |
||||
{ |
||||
icon: 'ep:alarm-clock', |
||||
path: 'okr-wait', |
||||
name: '待办事项', |
||||
componentName: 'OkrWait', |
||||
component: 'OKR/Wait/index', |
||||
meta: { |
||||
title: '待办事项' |
||||
}, |
||||
visible: true, |
||||
alwaysShow: true, |
||||
redirect: '' |
||||
}, |
||||
{ |
||||
icon: 'ep:data-line', |
||||
path: 'okr-analysis', |
||||
name: 'Okr统计', |
||||
componentName: 'OkrAnalysis', |
||||
component: 'OKR/Analysis/index', |
||||
meta: { |
||||
title: 'Okr统计' |
||||
}, |
||||
visible: true, |
||||
alwaysShow: true, |
||||
redirect: '' |
||||
}, |
||||
{ |
||||
icon: 'ep:data-board', |
||||
path: 'okr-meeting', |
||||
name: '会议管理', |
||||
componentName: 'OkrMeeting', |
||||
component: 'OKR/Meeting/index', |
||||
meta: { |
||||
title: '会议管理' |
||||
}, |
||||
visible: true, |
||||
alwaysShow: true, |
||||
redirect: '' |
||||
}, |
||||
{ |
||||
icon: 'ep:data-board', |
||||
path: 'okr-meeting-info/:id', |
||||
name: '会议详情', |
||||
componentName: 'MeetingInfo', |
||||
component: 'OKR/Meeting/MeetingInfo', |
||||
meta: { |
||||
title: '会议详情' |
||||
}, |
||||
visible: false, |
||||
alwaysShow: true, |
||||
redirect: '', |
||||
keepAlive: true |
||||
} |
||||
], |
||||
meta: { |
||||
title: 'OKR', |
||||
icon: 'ep:calendar' |
||||
} |
||||
} |
||||
] |
||||
|
||||
export default staticRouter |
@ -1,7 +0,0 @@ |
||||
<template> |
||||
<div> record </div> |
||||
</template> |
||||
|
||||
<script setup name="WXRecord"></script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,228 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-table v-loading="loading" :data="tableList" border stripe> |
||||
<el-table-column v-for="col in columns" :prop="col.prop" :key="col.prop" :label="col.label" /> |
||||
<el-table-column label="发送方式" min-width="150"> |
||||
<template #default="{ row }"> |
||||
<el-checkbox-group v-model="row.sendType" size="small" @change="rowChange(row)"> |
||||
<el-checkbox label="微信"> 微信 </el-checkbox> |
||||
<el-checkbox label="微信群"> 微信群 </el-checkbox> |
||||
</el-checkbox-group> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="群二维码" width="100"> |
||||
<template #default="{ row }"> |
||||
<el-upload |
||||
ref="rewardFile" |
||||
action="#" |
||||
:limit="1" |
||||
accept=".jpg,.jpeg,.png" |
||||
:disabled="loading" |
||||
:show-file-list="false" |
||||
:before-upload="fileBeforeUpload" |
||||
:http-request="(data) => rewardUpload(data, row.id)" |
||||
> |
||||
<el-button type="primary" size="small"> |
||||
<Icon icon="ep:upload" class="mr-5px" size="small" /> 点击上传 |
||||
</el-button> |
||||
</el-upload> |
||||
<!-- <UploadImg v-model="row.wxQrCode" /> --> |
||||
|
||||
<!-- <img :src="row.wxCode" width="80px" height="80px" alt="" /> --> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="微信群名称" prop="wxGroup" min-width="150" /> |
||||
<el-table-column label="操作" width="100"> |
||||
<template #default="{ row }"> |
||||
<!-- <div> |
||||
<el-button |
||||
v-if="row.sendType.includes('微信群')" |
||||
type="primary" |
||||
style="padding: 5px 0" |
||||
text |
||||
@click="row.edit = true" |
||||
> |
||||
修改群名称 |
||||
</el-button> |
||||
</div> --> |
||||
<div v-if="['每日', '每月'].includes(row.sendFrequency)"> |
||||
<el-button type="primary" style="padding: 5px 0" text @click="changeSendTime(row)"> |
||||
修改发送时间 |
||||
</el-button> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<Dialog |
||||
:title="`修改【${sendTimeInfo.messageName}】发送时间`" |
||||
v-model="showSendTime" |
||||
width="500px" |
||||
> |
||||
<el-text type="danger"> |
||||
<span v-if="sendTimeInfo.sendFrequency == '每日'"> |
||||
请按照时间格式输入,多个时间以“、”分割,如09:00、15:00、18:00 |
||||
</span> |
||||
<span v-else-if="sendTimeInfo.sendFrequency == '每月'"> |
||||
请按照"日期-时间"格式输入,多个日期以“、”分割,如26-18:00、28-14:00、30-15:00、30-18:00 |
||||
</span> |
||||
</el-text> |
||||
<el-input |
||||
type="textarea" |
||||
class="mt-20px mb-20px" |
||||
:autosize="{ minRows: 3 }" |
||||
v-model="sendTimeInfo.sendTime" |
||||
placeholder="请输入" |
||||
clearable |
||||
/> |
||||
<template #footer> |
||||
<el-button :disabled="formLoading" type="primary" @click="submitSendTime">确 定</el-button> |
||||
<el-button @click="showSendTime = false">取 消</el-button> |
||||
</template> |
||||
</Dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="WXSetting"> |
||||
import * as WechatApi from '@/api/system/wechat' |
||||
|
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
const columns = [ |
||||
{ |
||||
label: '消息名称', |
||||
prop: 'messageName' |
||||
}, |
||||
{ |
||||
label: '解释说明', |
||||
prop: 'description' |
||||
}, |
||||
{ |
||||
label: '发送频率', |
||||
prop: 'sendFrequency' |
||||
}, |
||||
{ |
||||
label: '发送时间', |
||||
prop: 'sendTime' |
||||
} |
||||
] |
||||
|
||||
onMounted(() => { |
||||
getTableList() |
||||
}) |
||||
|
||||
async function getTableList() { |
||||
try { |
||||
loading.value = true |
||||
const list = await WechatApi.getWechatConfigList() |
||||
tableList.value = list.map((it) => ({ ...it, sendType: it.sendType || [] })) |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
let timer = ref(null) |
||||
const lastId = ref('') |
||||
function rowChange(row) { |
||||
try { |
||||
lastId.value == row.id && clearTimeout(timer.value) |
||||
timer.value = setTimeout(async () => { |
||||
lastId.value = row.id |
||||
await WechatApi.updateWechatGroup({ |
||||
id: row.id, |
||||
sendType: row.sendType, |
||||
wxGroup: row.wxGroup |
||||
}) |
||||
// message.success('修改成功') |
||||
}, 1500) |
||||
} finally { |
||||
} |
||||
} |
||||
|
||||
const showSendTime = ref(false) |
||||
const sendTimeInfo = ref({}) |
||||
function changeSendTime(row) { |
||||
showSendTime.value = true |
||||
sendTimeInfo.value = { ...row } |
||||
} |
||||
|
||||
const formLoading = ref(false) |
||||
|
||||
async function submitSendTime() { |
||||
// 校验时间是否有效 |
||||
const arr = sendTimeInfo.value.sendTime ? sendTimeInfo.value.sendTime.split('、') : [] |
||||
|
||||
if (sendTimeInfo.value.sendFrequency == '每日') { |
||||
// 正则校验是否HH:MM |
||||
if (arr.some((it) => !/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(it))) { |
||||
message.error('请检查输入格式是否正确!!!') |
||||
return |
||||
} else { |
||||
try { |
||||
formLoading.value = true |
||||
await WechatApi.updateWechatSendTime({ |
||||
id: sendTimeInfo.value.id, |
||||
sendTime: arr.join('、') |
||||
}) |
||||
message.success('修改成功!') |
||||
getTableList() |
||||
showSendTime.value = false |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
} else if (sendTimeInfo.value.sendFrequency == '每月') { |
||||
// 正则校验是否【1-31】-HH:MM |
||||
const reg = /^([1-9]|[1-2]\d|3[01])-([01]?[0-9]|2[0-3]):[0-5][0-9]$/ |
||||
if (arr.length > 0 && arr.some((it) => !reg.test(it))) { |
||||
message.error('请检查输入格式是否正确!!!') |
||||
return |
||||
} else { |
||||
try { |
||||
formLoading.value = true |
||||
await WechatApi.updateWechatSendTime({ |
||||
id: sendTimeInfo.value.id, |
||||
sendTime: arr.join('、') |
||||
}) |
||||
message.success('修改成功!') |
||||
getTableList() |
||||
showSendTime.value = false |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
const fileBeforeUpload = (file) => { |
||||
let format = '.' + file.name.split('.')[1] |
||||
if (!['.jpg', '.png', 'jpeg'].includes(format)) { |
||||
message.error(`请上传指定格式".jpg,.jpeg,.png"文件`) |
||||
return false |
||||
} |
||||
let isRightSize = file.size / 1024 / 1024 < 20 |
||||
if (!isRightSize) { |
||||
message.error('文件大小超过 20MB') |
||||
} |
||||
return isRightSize |
||||
} |
||||
|
||||
const fd = ref(new FormData()) |
||||
|
||||
async function rewardUpload(data, id) { |
||||
fd.value.append('file', data.file) |
||||
fd.value.append('id', id) |
||||
// 上传接口,成功后得到微信群名 |
||||
try { |
||||
// 上传文件 |
||||
setTimeout(() => { |
||||
getTableList() |
||||
}, 2000) |
||||
} finally { |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -0,0 +1,62 @@ |
||||
// import { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||||
import { dateFormatter } from '@/utils/formatTime' |
||||
|
||||
const statusOptions = [ |
||||
{ label: '发送成功', value: 1 }, |
||||
{ label: '发送失败', value: 2 }, |
||||
{ label: '排队中', value: 3 }, |
||||
{ label: '微信端卡住', value: 4 } |
||||
] |
||||
|
||||
// CrudSchema:https://doc.iocoder.cn/vue3/crud-schema/
|
||||
const crudSchemas = reactive([ |
||||
{ |
||||
label: '发送对象', |
||||
field: 'sendUser', |
||||
isSearch: true, |
||||
isTable: true |
||||
}, |
||||
{ |
||||
label: '发送内容', |
||||
field: 'content', |
||||
isSearch: false, |
||||
isTable: true |
||||
}, |
||||
{ |
||||
label: '发送状态', |
||||
field: 'status', |
||||
isSearch: true, |
||||
isTable: true, |
||||
search: { |
||||
component: 'Select', |
||||
api: () => statusOptions, |
||||
componentProps: { |
||||
optionsAlias: { |
||||
labelField: 'label', |
||||
valueField: 'value' |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
label: '发送时间', |
||||
field: 'createTime', |
||||
isSearch: true, |
||||
isTable: true, |
||||
formatter: dateFormatter, |
||||
detail: { |
||||
dateFormat: 'YYYY-MM-DD' |
||||
}, |
||||
search: { |
||||
component: 'DatePicker', |
||||
componentProps: { |
||||
type: 'daterange', |
||||
format: 'YYYY-MM-DD', |
||||
valueFormat: 'YYYY-MM-DD', |
||||
startPlaceholder: '发送时间', |
||||
endPlaceholder: '发送时间' |
||||
} |
||||
} |
||||
} |
||||
]) |
||||
export const { allSchemas } = useCrudSchemas(crudSchemas) |
@ -1,19 +1,77 @@ |
||||
<template> |
||||
<el-tabs v-model="tabIndex" type="border-card"> |
||||
<!-- <el-tab-pane label="微信消息记录" :name="0"> |
||||
<Record /> |
||||
</el-tab-pane> --> |
||||
<el-tab-pane label="消息配置" :name="1"> |
||||
<Setting /> |
||||
<el-tab-pane label="微信消息记录" :name="0"> |
||||
<!-- 搜索工作栏 --> |
||||
<Search |
||||
:schema="allSchemas.searchSchema" |
||||
labelWidth="0" |
||||
@search="setSearchParams" |
||||
@reset="setSearchParams" |
||||
/> |
||||
<!-- 列表 --> |
||||
<SSTable |
||||
class="mt-20px" |
||||
v-model:tableObject="tableObject" |
||||
:tableColumns="allSchemas.tableColumns" |
||||
@get-list="getTableList" |
||||
> |
||||
<el-table-column |
||||
v-for="item in allSchemas.tableColumns" |
||||
:key="item.field" |
||||
:prop="item.field" |
||||
:label="item.label" |
||||
:fixed="item.fixed" |
||||
min-width="150px" |
||||
showOverflowTooltip |
||||
/> |
||||
<el-table-column label="操作" width="150px" fixed="right"> |
||||
<template #default="{ row }"> |
||||
<el-button type="primary" link @click="sendMsg(row)">再次发送</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</SSTable> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</template> |
||||
|
||||
<script setup name="WXBoot"> |
||||
// import Record from './Record.vue' |
||||
import Setting from './Setting.vue' |
||||
<script setup> |
||||
import { allSchemas } from './index.data.js' |
||||
|
||||
const tabIndex = ref(1) |
||||
const tabIndex = ref(0) |
||||
|
||||
const tableObject = ref({ |
||||
tableList: [], |
||||
loading: false, |
||||
total: 1, |
||||
pageSize: 20, |
||||
currentPage: 1 |
||||
}) |
||||
|
||||
function setSearchParams() { |
||||
tableObject.value.tableList = [ |
||||
{ |
||||
sendUser: '测试', |
||||
content: '您今日有10条待跟进的线索', |
||||
status: '发送成功', |
||||
createTime: '2024-04-25 12:00:00' |
||||
} |
||||
] |
||||
} |
||||
|
||||
function getTableList() { |
||||
tableObject.value.tableList = [ |
||||
{ |
||||
sendUser: '测试', |
||||
content: '您今日有10条待跟进的线索', |
||||
status: '发送成功', |
||||
createTime: '2024-04-25 12:00:00' |
||||
} |
||||
] |
||||
} |
||||
|
||||
function sendMsg() { |
||||
console.log('测试') |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
||||
|
@ -1,130 +0,0 @@ |
||||
<template> |
||||
<Dialog title="添加产品" v-model="show" width="800px"> |
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="成交产品" prop="productId"> |
||||
<el-select |
||||
v-model="form.productId" |
||||
placeholder="选择成交产品" |
||||
filterable |
||||
@change="form.specsId = undefined" |
||||
> |
||||
<el-option |
||||
v-for="item in prodOptions" |
||||
:key="item.productId" |
||||
:label="item.productName" |
||||
:value="item.productId" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="产品规格" prop="specsId"> |
||||
<el-select |
||||
v-model="form.specsId" |
||||
placeholder="选择规格" |
||||
filterable |
||||
:disabled="!form.productId" |
||||
> |
||||
<el-option |
||||
v-for="item in specsOptions(form.productId)" |
||||
:key="item.specsId" |
||||
:label="item.specsName" |
||||
:value="item.specsId" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="成交数量" prop="signNum"> |
||||
<el-input-number v-model="form.signNum" :min="1" :controls="false" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="生产状态" prop="isProduced"> |
||||
<el-radio-group v-model="form.isProduced"> |
||||
<el-radio :label="0">待生产</el-radio> |
||||
<el-radio :label="1">已生产</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="备注" prop="remark"> |
||||
<el-input |
||||
type="textarea" |
||||
:autoSize="{ minRows: 3 }" |
||||
v-model="form.remark" |
||||
placeholder="请输入备注" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<template #footer> |
||||
<span> |
||||
<el-button @click="show = false">取 消</el-button> |
||||
<el-button :disabled="formLoading" type="primary" @click="handleSave">保 存</el-button> |
||||
</span> |
||||
</template> |
||||
</Dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogProduct"> |
||||
import { addOrderProduct } from '@/api/clue/sign' |
||||
|
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const specsOptions = computed({ |
||||
get() { |
||||
return (prodId) => { |
||||
if (prodId) { |
||||
return prodOptions.value.find((it) => it.productId == prodId).productSpecList |
||||
} |
||||
return [] |
||||
} |
||||
} |
||||
}) |
||||
|
||||
const show = ref(false) |
||||
const form = ref({}) |
||||
const rules = { |
||||
productId: { required: true, message: '成交产品不可为空', trigger: 'change' }, |
||||
specsId: { required: true, message: '产品规格不可为空', trigger: 'change' }, |
||||
signNum: { required: true, message: '成交数量不可为空', trigger: 'blur' } |
||||
} |
||||
|
||||
const prodOptions = ref([]) |
||||
|
||||
function open(signId, arr) { |
||||
prodOptions.value = arr |
||||
form.value.signId = signId |
||||
form.value.isProduced = 0 |
||||
show.value = true |
||||
} |
||||
defineExpose({ open }) |
||||
|
||||
const emit = defineEmits(['success']) |
||||
const formRef = ref() |
||||
const formLoading = ref(false) |
||||
async function handleSave() { |
||||
// 校验表单 |
||||
if (!formRef.value) return |
||||
const valid = await formRef.value.validate() |
||||
if (!valid) return |
||||
|
||||
// 提交请求 |
||||
formLoading.value = true |
||||
try { |
||||
await addOrderProduct(form.value) |
||||
message.success('新增成功!') |
||||
show.value = false |
||||
// 发送操作成功的事件 |
||||
emit('success') |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,62 +0,0 @@ |
||||
<template> |
||||
<Echart :options="optionsData" :width="400" :height="200" /> |
||||
</template> |
||||
|
||||
<script setup name="BarSalerClueReport"> |
||||
import { set } from 'lodash-es' |
||||
|
||||
onMounted(() => { |
||||
nextTick(() => { |
||||
getReportData() |
||||
}) |
||||
}) |
||||
|
||||
const optionsData = ref({}) |
||||
|
||||
const getReportData = async () => { |
||||
// const data = await HomeApi.getClueSignSignRate() |
||||
set(optionsData, 'radiusAxis', { |
||||
type: 'category', |
||||
data: ['宝典', '一点通', '抖音', '小红书'], |
||||
z: 10 |
||||
}) |
||||
set(optionsData, 'series', [ |
||||
{ |
||||
type: 'bar', |
||||
data: [1, 2, 3, 4], |
||||
coordinateSystem: 'polar', |
||||
name: '高意向A', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
}, |
||||
{ |
||||
type: 'bar', |
||||
data: [2, 4, 6, 8], |
||||
coordinateSystem: 'polar', |
||||
name: '中意向B', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
}, |
||||
{ |
||||
type: 'bar', |
||||
data: [1, 2, 3, 4], |
||||
coordinateSystem: 'polar', |
||||
name: '低意向C', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
} |
||||
]) |
||||
} |
||||
|
||||
defineExpose({ |
||||
getReportData |
||||
}) |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,402 +0,0 @@ |
||||
<template> |
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px"> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.consultTime" |
||||
type="daterange" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
start-placeholder="选择日期" |
||||
end-placeholder="选择日期" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="props.sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
clearable |
||||
filterable |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
@change="sourceChange" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<el-select |
||||
v-model="searchForm.licenseTypeList" |
||||
placeholder="选择驾照类型" |
||||
clearable |
||||
multiple |
||||
> |
||||
<el-option |
||||
v-for="item in props.licenseTypeOptions" |
||||
:key="item.label" |
||||
:label="item.label" |
||||
:value="item.label" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-tabs v-model="showPane" class="pb-10px"> |
||||
<el-tab-pane label="详细数据" :name="1"> |
||||
<el-table v-loading="loading" :data="tableList" border stripe> |
||||
<el-table-column prop="sourceName" label="渠道名称" width="100" fixed="left" /> |
||||
<el-table-column prop="newClueNumber" label="新线索数" sortable min-width="100" /> |
||||
<el-table-column prop="signNumber" label="成交数" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="signRate" |
||||
label="成交率" |
||||
sortable |
||||
min-width="100" |
||||
:formatter="(row) => row.signRate + '%'" |
||||
/> |
||||
<el-table-column prop="averageSignPeriod" label="成交周期" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="grossProfitOfSingleSign" |
||||
label="毛利/单" |
||||
sortable |
||||
min-width="100" |
||||
/> |
||||
<el-table-column prop="payPriceOfSingleSign" label="支出/单" sortable min-width="100" /> |
||||
<el-table-column prop="costOfSingleClue" label="线索成本/条" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="netProfitOfSingleSign" |
||||
label="净利润/单" |
||||
sortable |
||||
min-width="100" |
||||
/> |
||||
<el-table-column label="总线索成本" prop="clueCostTotal" sortable min-width="100" /> |
||||
<el-table-column label="总支出" prop="payPriceTotal" sortable min-width="100" /> |
||||
<el-table-column label="总利润" prop="profitTotal" sortable min-width="100" /> |
||||
</el-table> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="图表展示" :name="2" lazy> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-checkbox-group v-model="showChannel" @change="setReportData"> |
||||
<el-checkbox v-for="(item, index) in channelArr" :key="index" :label="item" /> |
||||
</el-checkbox-group> |
||||
</el-col> |
||||
|
||||
<el-col :span="12" :offset="0"> |
||||
<el-skeleton :loading="loading" animated> |
||||
<Echart :options="echart1Option" width="100%" :height="400" /> |
||||
</el-skeleton> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0" v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<Echart :options="echart2Option" width="100%" :height="400" /> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0"> |
||||
<Echart :options="echart3Option" width="100%" :height="400" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</Dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogSalerReportDetail"> |
||||
import { set } from 'lodash-es' |
||||
import * as reportApi from '@/api/home/reportSaler' |
||||
import { getIntDictOptions } from '@/utils/dict' |
||||
import { removeNullField } from '@/utils' |
||||
import { useAppStore } from '@/store/modules/app' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
|
||||
const appStore = useAppStore() |
||||
|
||||
const props = defineProps({ |
||||
licenseTypeOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
}, |
||||
sourceOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
const showChannel = ref([]) |
||||
const intentionOptions = getIntDictOptions('intention_state') |
||||
|
||||
const channelArr = computed(() => { |
||||
if (searchForm.value.sourceId) { |
||||
let arr = |
||||
props.sourceOptions.find((it) => it.sourceId == searchForm.value.sourceId)?.children || [] |
||||
return arr.map((it) => it.sourceName) |
||||
} else { |
||||
return props.sourceOptions.map((it) => it.sourceName) |
||||
} |
||||
}) |
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
const dialogTitle = ref('') // 弹窗的标题 |
||||
const loading = ref(false) |
||||
const searchForm = ref({}) |
||||
|
||||
const showPane = ref(1) |
||||
|
||||
function handleReset() { |
||||
searchForm.value = { |
||||
nickname: undefined, |
||||
consultTime: [`${year}-${month}-01`, formatDate(new Date())], |
||||
licenseTypeList: [], |
||||
sourceId: undefined |
||||
} |
||||
} |
||||
|
||||
/** 打开弹窗 */ |
||||
const open = async (info, queryInfo) => { |
||||
showPane.value = 1 |
||||
dialogVisible.value = true |
||||
dialogTitle.value = info.nickname |
||||
searchForm.value = { ...queryInfo } |
||||
searchForm.value.userId = info.userId |
||||
|
||||
sourceChange() |
||||
} |
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
||||
const tableList = ref([]) |
||||
|
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const params = { ...searchForm.value } |
||||
const data = await reportApi.getInfo(removeNullField(params)) |
||||
tableList.value = data.sourceDetailVOList |
||||
setReportData(data) |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function sourceChange() { |
||||
handleSearch() |
||||
showChannel.value = channelArr.value |
||||
} |
||||
|
||||
const echart1Option = ref({ |
||||
title: { |
||||
text: '线索分布图' |
||||
}, |
||||
radiusAxis: {}, |
||||
angleAxis: {}, |
||||
tooltip: { |
||||
show: true, |
||||
formatter: '{b0}-{a}: {c}' |
||||
}, |
||||
polar: {}, |
||||
legend: { |
||||
show: true, |
||||
type: 'scroll', |
||||
left: 100 |
||||
} |
||||
}) |
||||
|
||||
const echart2Option = ref({ |
||||
title: { |
||||
text: '成交分布图' |
||||
}, |
||||
radiusAxis: {}, |
||||
angleAxis: {}, |
||||
tooltip: { |
||||
show: true, |
||||
formatter: '{b0}-{a}: {c}' |
||||
}, |
||||
polar: {}, |
||||
legend: { |
||||
show: true, |
||||
type: 'scroll', |
||||
left: 100 |
||||
} |
||||
}) |
||||
|
||||
const echart3Option = ref({ |
||||
title: { |
||||
text: '销售雷达图' |
||||
}, |
||||
radar: { |
||||
indicator: [ |
||||
{ name: '成交周期' }, |
||||
{ name: '毛利/单' }, |
||||
{ name: '支出/单' }, |
||||
{ name: '线索成本/条' }, |
||||
{ name: '净利润/单' }, |
||||
{ name: '成交率' } |
||||
// { name: '线索总成本' }, |
||||
// { name: '总支出' }, |
||||
// { name: '总利润' } |
||||
] |
||||
}, |
||||
legend: { |
||||
show: true, |
||||
right: '10px', |
||||
orient: 'vertical' |
||||
} |
||||
}) |
||||
|
||||
const setReportData = async (data) => { |
||||
// const data = await HomeApi.getClueSignSignRate() |
||||
|
||||
const channelClueArr = showChannel.value.sort((pre, cur) => { |
||||
const preArr = tableList.value.find((it) => it.sourceName == pre).clueIntentionNumVOList || [] |
||||
const curArr = tableList.value.find((it) => it.sourceName == cur).clueIntentionNumVOList || [] |
||||
const preCount = preArr.reduce((preVal, curVal) => preVal + curVal.intentionNum, 0) |
||||
const curCount = curArr.reduce((preVal, curVal) => preVal + curVal.intentionNum, 0) |
||||
return preCount - curCount |
||||
}) |
||||
|
||||
const arr1 = intentionOptions.map((intention) => { |
||||
const list = [] |
||||
channelClueArr.map((item) => { |
||||
const row = tableList.value.find((it) => item == it.sourceName) |
||||
if (row) { |
||||
list.push( |
||||
row.clueIntentionNumVOList.find((it) => it.intentionState == intention.value).intentionNum |
||||
) |
||||
} |
||||
}) |
||||
return { |
||||
type: 'bar', |
||||
data: list, |
||||
coordinateSystem: 'polar', |
||||
name: intention.label, |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
}, |
||||
label: { |
||||
show: true, |
||||
position: 'middle' |
||||
} |
||||
} |
||||
}) |
||||
|
||||
const channelSignArr = showChannel.value.sort((pre, cur) => { |
||||
const preArr = tableList.value.find((it) => it.sourceName == pre).signLicenseTypeNumVOList || [] |
||||
const curArr = tableList.value.find((it) => it.sourceName == cur).signLicenseTypeNumVOList || [] |
||||
const preCount = preArr.reduce((preVal, curVal) => preVal + curVal.licenseTypeNum, 0) |
||||
const curCount = curArr.reduce((preVal, curVal) => preVal + curVal.licenseTypeNum, 0) |
||||
return preCount - curCount |
||||
}) |
||||
const arr2 = props.licenseTypeOptions.map((cartype) => { |
||||
const list = [] |
||||
channelClueArr.map((item) => { |
||||
const row = tableList.value.find((it) => item == it.sourceName) |
||||
if (row) { |
||||
list.push( |
||||
row.signLicenseTypeNumVOList.find((it) => it.licenseType == cartype.label).licenseTypeNum |
||||
) |
||||
} |
||||
}) |
||||
return { |
||||
type: 'bar', |
||||
data: list, |
||||
coordinateSystem: 'polar', |
||||
name: cartype.label, |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
}, |
||||
label: { |
||||
show: true, |
||||
position: 'middle' |
||||
} |
||||
} |
||||
}) |
||||
|
||||
set(echart1Option.value, 'radiusAxis', { |
||||
type: 'category', |
||||
data: channelClueArr, |
||||
axisLabel: { |
||||
margin: 5, |
||||
fontSize: 10, |
||||
interval: 0 |
||||
} |
||||
}) |
||||
|
||||
set(echart1Option.value, 'series', arr1) |
||||
|
||||
set(echart2Option.value, 'radiusAxis', { |
||||
type: 'category', |
||||
data: channelSignArr, |
||||
axisLabel: { |
||||
margin: 5, |
||||
fontSize: 10, |
||||
interval: 0 |
||||
} |
||||
}) |
||||
set(echart2Option.value, 'series', arr2) |
||||
const { personDetail, averageDetail } = data |
||||
set(echart3Option.value, 'series', [ |
||||
{ |
||||
type: 'radar', |
||||
data: [ |
||||
{ |
||||
value: [ |
||||
averageDetail.averageSignPeriod, |
||||
averageDetail.grossProfitOfSingleSign, |
||||
averageDetail.payPriceOfSingleSign, |
||||
averageDetail.costOfSingleClue, |
||||
averageDetail.netProfitOfSingleSign, |
||||
averageDetail.signRate |
||||
// averageDetail.clueCostTotal, |
||||
// averageDetail.payPriceTotal, |
||||
// averageDetail.profitTotal |
||||
], |
||||
name: '平均水平', |
||||
lineStyle: { |
||||
type: 'dashed' |
||||
}, |
||||
areaStyle: { |
||||
color: 'rgba(0, 191, 255, 0.6)' |
||||
}, |
||||
label: { |
||||
show: true |
||||
} |
||||
}, |
||||
{ |
||||
value: [ |
||||
personDetail.averageSignPeriod, |
||||
personDetail.grossProfitOfSingleSign, |
||||
personDetail.payPriceOfSingleSign, |
||||
personDetail.costOfSingleClue, |
||||
personDetail.netProfitOfSingleSign, |
||||
personDetail.signRate |
||||
// personDetail.clueCostTotal, |
||||
// personDetail.payPriceTotal, |
||||
// personDetail.profitTotal |
||||
], |
||||
name: dialogTitle.value, |
||||
areaStyle: { |
||||
color: 'rgba(255, 145, 124, 0.4)' |
||||
}, |
||||
label: { |
||||
show: true |
||||
} |
||||
} |
||||
] |
||||
} |
||||
]) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,248 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.consultTime" |
||||
type="daterange" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
start-placeholder="选择日期" |
||||
end-placeholder="选择日期" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-input v-model="searchForm.nickname" placeholder="销售姓名" clearable /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
clearable |
||||
filterable |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<el-select |
||||
v-model="searchForm.licenseTypeList" |
||||
placeholder="选择驾照类型" |
||||
clearable |
||||
multiple |
||||
> |
||||
<el-option |
||||
v-for="item in licenseTypeOptions" |
||||
:key="item.label" |
||||
:label="item.label" |
||||
:value="item.label" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="tableList" |
||||
border |
||||
stripe |
||||
show-summary |
||||
:summary-method="getSummaries" |
||||
> |
||||
<el-table-column type="index" width="60" fixed="left" align="center" /> |
||||
<el-table-column prop="nickname" label="姓名" width="80" fixed="left"> |
||||
<template #default="{ row }"> |
||||
<el-button type="primary" style="padding: 0" text @click="handleDetail(row)">{{ |
||||
row.nickname |
||||
}}</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="newClueNumber" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="咨询日期在所选周期内的线索总数" /> |
||||
<span>新线索数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="成交数" prop="signNumber" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="成交日期在所选周期内的成交数" /> |
||||
<span>成交数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
label="成交率" |
||||
prop="signRate" |
||||
sortable |
||||
min-width="100" |
||||
:formatter="(row) => row.signRate + '%'" |
||||
/> |
||||
<el-table-column label="跟进数/日" prop="dayFollowNumber" sortable min-width="100" /> |
||||
<el-table-column label="成交数/日" prop="daySignNumber" sortable min-width="100" /> |
||||
<el-table-column label="平均成交周期" prop="averageSignPeriod" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="平均每条成交的线索,从咨询开始到成交所需要的天数" /> |
||||
<span>平均成交周期</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="grossProfitOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip |
||||
message="平均每笔成交订单的公司利润【按照登记,不按审核到账】=总公司利润/总成交数" |
||||
/> |
||||
<span>毛利/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="payPriceOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip |
||||
message="平均每笔成交订单的额外支出(返费等)【按照登记,不按审核到账】=总支出/总成交数" |
||||
/> |
||||
<span>支出/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="costOfSingleClue" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="平均每条线索的成本=总线索成本/新线索条数" /> |
||||
<span>线索成本/条</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="netProfitOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="=(总公司利润-总支出-总线索成本)/总成交数" /> |
||||
<span>净利润/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="总线索成本" prop="clueCostTotal" sortable min-width="100" /> |
||||
<el-table-column label="总支出" prop="payPriceTotal" sortable min-width="100" /> |
||||
<el-table-column label="总利润" prop="profitTotal" sortable min-width="100" /> |
||||
<el-table-column prop="efficiency" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="=总利润/(总成本+总支出)" /> |
||||
<span>能效</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="撞单数" prop="repeatClueNum" sortable min-width="100" /> |
||||
<el-table-column label="撞单成交数" prop="repeatClueSignNum" sortable min-width="100" /> |
||||
</el-table> |
||||
|
||||
<DialogSalerReportDetail |
||||
:licenseTypeOptions="licenseTypeOptions" |
||||
:source-options="sourceOptions" |
||||
ref="SalerDetailDialog" |
||||
/> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="SalesReport"> |
||||
import DialogSalerReportDetail from './Comp/DialogSalerReportDetail.vue' |
||||
|
||||
import * as reportApi from '@/api/home/reportSaler' |
||||
import { getSimpleSourceList as getResourceOptions } from '@/api/clue/source' |
||||
|
||||
import { removeNullField } from '@/utils' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import { handleTree } from '@/utils/tree' |
||||
import { getIntDictOptions } from '@/utils/dict' |
||||
import { useAppStore } from '@/store/modules/app' |
||||
|
||||
const appStore = useAppStore() |
||||
onMounted(() => { |
||||
getOptions() |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
const sourceOptions = ref([]) |
||||
const licenseTypeOptions = ref([]) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
const year = new Date().getFullYear() |
||||
const month = new Date().getMonth() + 1 + '' |
||||
searchForm.value = { |
||||
nickname: undefined, |
||||
consultTime: [`${year}-${month.padStart(2, '0')}-01`, formatDate(new Date())], |
||||
licenseTypeList: [], |
||||
sourceId: undefined |
||||
} |
||||
} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
const avgData = ref({}) |
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const data = await reportApi.getList(removeNullField(searchForm.value)) |
||||
tableList.value = data.personDataVOList |
||||
avgData.value = data.averageDataVO |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
const sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '统计' |
||||
return |
||||
} |
||||
|
||||
const doubleSumsColumns = [ |
||||
'newClueNumber', |
||||
'signNumber', |
||||
'clueCostTotal', |
||||
'payPriceTotal', |
||||
'profitTotal' |
||||
] |
||||
if (column.property in avgData.value) { |
||||
sums[index] = `均值: ${avgData.value[column.property]}` |
||||
} else if (doubleSumsColumns.includes(column.property)) { |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
let sum = values.reduce((prev, curr) => prev + curr, 0) |
||||
let avg = sum / values.length |
||||
if (['newClueNumber', 'signNumber'].includes(column.property)) { |
||||
avg = Math.floor(avg) |
||||
} else { |
||||
sum = sum.toFixed(2) |
||||
avg = avg.toFixed(2) |
||||
} |
||||
sums[index] = h('div', {}, [h('div', {}, `合计:${sum}`), h('div', {}, `均值:${avg}`)]) |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
|
||||
const SalerDetailDialog = ref() |
||||
function handleDetail(info) { |
||||
SalerDetailDialog.value.open(info, searchForm.value) |
||||
} |
||||
|
||||
function getOptions() { |
||||
getResourceOptions().then((data) => { |
||||
sourceOptions.value = handleTree(data, 'sourceId') |
||||
}) |
||||
licenseTypeOptions.value = getIntDictOptions('license_type') |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,225 +0,0 @@ |
||||
<template> |
||||
<Dialog :title="title" v-model="show" width="800px"> |
||||
<el-form v-loading="formLoading" :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="考核指标" prop="examineTarget"> |
||||
<el-input v-model="form.examineTarget" placeholder="请输入" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="生效日期" prop="effectiveDate"> |
||||
<el-date-picker |
||||
v-model="form.effectiveDate" |
||||
:disabled="form.id" |
||||
type="date" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
placeholder="选择日期时间" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="模式" prop="type"> |
||||
<el-radio-group v-model="form.type"> |
||||
<el-radio |
||||
v-for="(item, index) in prop.kpiModeOoptions" |
||||
:key="index" |
||||
:label="item.value" |
||||
> |
||||
{{ item.label }} |
||||
</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="weight"> |
||||
<el-input-number v-model="form.weight" :min="0" :step="1" :controls="false" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="评分上限" prop="examineScore"> |
||||
<el-input-number v-model="form.examineScore" :min="0" :step="1" :controls="false" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="考核内容" prop="examineContent"> |
||||
<Editor |
||||
v-model:modelValue="form.examineContent" |
||||
height="150px" |
||||
:toolbarConfig="{ |
||||
toolbarKeys: [] |
||||
}" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="考核规则" prop="examineRule"> |
||||
<Editor |
||||
v-model:modelValue="form.examineRule" |
||||
height="150px" |
||||
:toolbarConfig="{ toolbarKeys: [] }" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="考核员工" prop="examinedUserIdList"> |
||||
<div> |
||||
<el-checkbox |
||||
v-model="checkAll" |
||||
:indeterminate="isIndeterminate" |
||||
@change="handleCheckAllChange" |
||||
> |
||||
全选 |
||||
</el-checkbox> |
||||
<el-checkbox-group v-model="form.examinedUserIdList" @change="handleCheckedChange"> |
||||
<el-checkbox |
||||
v-for="item in employeeOptions" |
||||
:key="item.id" |
||||
:disabled="item.status == 1" |
||||
:label="item.id" |
||||
:value="item.id" |
||||
> |
||||
{{ item.name }} |
||||
</el-checkbox> |
||||
</el-checkbox-group> |
||||
</div> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<template #footer> |
||||
<span> |
||||
<el-button @click="show = false">取 消</el-button> |
||||
<el-button type="primary" :disabled="formLoading" @click="handleSave">保 存</el-button> |
||||
</span> |
||||
</template> |
||||
</Dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogAppraise"> |
||||
import * as KpiApi from '@/api/kpi/index.js' |
||||
|
||||
const prop = defineProps({ |
||||
kpiModeOoptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}) |
||||
|
||||
const { t } = useI18n() // 国际化 |
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const show = ref(false) |
||||
const title = ref('') |
||||
const formType = ref('create') |
||||
|
||||
const form = ref({}) |
||||
const formLoading = ref(false) |
||||
const rules = ref({ |
||||
examineTarget: { required: true, message: '标题不可为空', trigger: 'blur' }, |
||||
effectiveDate: { required: true, message: '生效日期不可为空', trigger: 'blur,change' }, |
||||
examineContent: { required: true, message: '标题不可为空', trigger: 'blur' }, |
||||
examineRule: { required: true, message: '标题不可为空', trigger: 'blur' } |
||||
}) |
||||
|
||||
async function open(type, val) { |
||||
show.value = true |
||||
title.value = type == 'update' ? '修改考核项' : '新增考核项' |
||||
formType.value = type |
||||
resetForm() |
||||
if (val) { |
||||
formLoading.value = true |
||||
try { |
||||
form.value = await KpiApi.getKpiDetail(val) |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
getOptions() |
||||
} |
||||
|
||||
function getOptions() { |
||||
KpiApi.getKpiEmployees().then((data) => { |
||||
employeeOptions.value = data |
||||
if (formType.value == 'update') { |
||||
handleCheckedChange(form.value.examinedUserIdList) |
||||
} else { |
||||
handleCheckAllChange(true) |
||||
checkAll.value = true |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function resetForm() { |
||||
form.value = { |
||||
examineTarget: '', |
||||
type: '3', |
||||
weight: 0, |
||||
examineContent: ``, |
||||
examineRule: ``, |
||||
examineScore: 5, |
||||
examinedUserIdList: [] |
||||
} |
||||
} |
||||
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
||||
const formRef = ref() |
||||
|
||||
/** 提交表单 */ |
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
async function handleSave() { |
||||
// 校验表单 |
||||
if (!formRef.value) return |
||||
const valid = await formRef.value.validate() |
||||
if (!valid) return |
||||
// 提交请求 |
||||
formLoading.value = true |
||||
try { |
||||
if (formType.value === 'create') { |
||||
await KpiApi.createKpi(form.value) |
||||
message.success(t('common.createSuccess')) |
||||
} else { |
||||
await KpiApi.updateKpi(form.value) |
||||
message.success(t('common.updateSuccess')) |
||||
} |
||||
show.value = false |
||||
// 发送操作成功的事件 |
||||
emit('success') |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
|
||||
const checkAll = ref(false) |
||||
const isIndeterminate = ref(false) |
||||
const employeeOptions = ref([]) |
||||
|
||||
function handleCheckAllChange(val) { |
||||
form.value.examinedUserIdList = val ? employeeOptions.value.map((it) => it.id) : [] |
||||
isIndeterminate.value = false |
||||
} |
||||
|
||||
function handleCheckedChange(value) { |
||||
const checkedCount = value.length |
||||
checkAll.value = checkedCount === employeeOptions.value.length |
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < employeeOptions.value.length |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,156 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="searchForm" ref="queryFormRef" inline label-width="0"> |
||||
<el-form-item> |
||||
<el-input v-model="searchForm.examineTarget" placeholder="请输入考核指标" clearable /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleQuery" v-hasPermi="['kpi:appraise:search']"> 搜索</el-button> |
||||
<el-button @click="resetQuery" v-hasPermi="['kpi:appraise:reset']"> 重置</el-button> |
||||
<el-button |
||||
type="primary" |
||||
plain |
||||
@click="openForm('create')" |
||||
v-hasPermi="['kpi:appraise:add']" |
||||
> |
||||
新增 |
||||
</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list" border> |
||||
<el-table-column prop="examineTarget" label="考核指标" width="180" /> |
||||
<el-table-column prop="typeName" label="分值模式" width="90" :formatter="getKpiModeLabel" /> |
||||
<el-table-column prop="weight" label="权重%" width="90" /> |
||||
<el-table-column label="考核内容"> |
||||
<template #default="{ row }"> |
||||
<div v-dompurify-html="row.examineContent"></div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="考核规则" prop="examineRule"> |
||||
<template #default="{ row }"> |
||||
<div v-dompurify-html="row.examineRule"></div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="评分上限" prop="examineScore" width="90" /> |
||||
<el-table-column label="考核人数" width="90"> |
||||
<template #default="{ row }"> |
||||
{{ row.examinedUserIdList?.length || 0 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="生效日期" prop="effectiveDate" width="120" /> |
||||
<el-table-column label="操作" class-name="fixed-width" width="120"> |
||||
<template #default="{ row }"> |
||||
<el-button |
||||
link |
||||
type="primary" |
||||
@click="openForm('update', row.id)" |
||||
v-hasPermi="['kpi:appraise:update']" |
||||
> |
||||
修改 |
||||
</el-button> |
||||
<el-button |
||||
link |
||||
type="danger" |
||||
@click="handleDelete(row.id)" |
||||
v-hasPermi="['kpi:appraise:remove']" |
||||
> |
||||
删除 |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<Pagination |
||||
v-model:limit="searchForm.pageSize" |
||||
v-model:page="searchForm.pageNo" |
||||
:total="total" |
||||
@pagination="getList" |
||||
/> |
||||
|
||||
<DialogAppraise ref="formRef" :kpiModeOoptions="kpiModeOoptions" @success="handleQuery" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="KpiContent"> |
||||
import { removeNullField } from '@/utils' |
||||
import DialogAppraise from './Components/DialogAppraise.vue' |
||||
import * as KpiApi from '@/api/kpi/index.js' |
||||
import { getGeneralSysDictData } from '@/api/system/dict/dict.data' |
||||
|
||||
const { t } = useI18n() // 国际化 |
||||
const message = useMessage() // 消息弹窗 |
||||
const loading = ref(false) // 列表的加载中 |
||||
const list = ref([]) // 列表的数据 |
||||
const searchForm = ref({ |
||||
examineTarget: undefined, |
||||
pageNo: 1, |
||||
pageSize: 20 |
||||
}) |
||||
const total = ref(0) |
||||
|
||||
/** 初始化 **/ |
||||
onMounted(() => { |
||||
getOptions() |
||||
handleQuery() |
||||
}) |
||||
|
||||
const kpiModeOoptions = ref([]) |
||||
function getOptions() { |
||||
getGeneralSysDictData('examine_type').then((data) => { |
||||
kpiModeOoptions.value = data |
||||
}) |
||||
} |
||||
|
||||
function getKpiModeLabel(row) { |
||||
return kpiModeOoptions.value.find((it) => it.value == row.type)?.label |
||||
} |
||||
|
||||
const getList = async () => { |
||||
loading.value = true |
||||
try { |
||||
const data = await KpiApi.getKpiPage(removeNullField(searchForm.value)) |
||||
list.value = data.list |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
/** 搜索按钮操作 */ |
||||
const handleQuery = () => { |
||||
searchForm.value.pageNo = 1 |
||||
getList() |
||||
} |
||||
|
||||
/** 重置按钮操作 */ |
||||
const resetQuery = () => { |
||||
searchForm.value = { |
||||
examineTarget: undefined, |
||||
pageNo: 1, |
||||
pageSize: 20 |
||||
} |
||||
handleQuery() |
||||
} |
||||
|
||||
/** 添加/修改操作 */ |
||||
const formRef = ref() |
||||
const openForm = (type, id) => { |
||||
formRef.value.open(type, id) |
||||
} |
||||
|
||||
/** 删除按钮操作 */ |
||||
const handleDelete = async (id) => { |
||||
try { |
||||
// 删除的二次确认 |
||||
await message.delConfirm() |
||||
// 发起删除 |
||||
await KpiApi.deleteKpi(id) |
||||
message.success(t('common.delSuccess')) |
||||
// 刷新列表 |
||||
await getList() |
||||
} catch {} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,214 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="searchForm" inline label-width="0"> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.period" |
||||
type="month" |
||||
format="YYYY-MM" |
||||
value-format="YYYY-MM" |
||||
:clearable="false" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="getList" v-hasPermi="['kpi:score:search']"> 搜索</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<el-tabs v-model="employeeId" @tab-click="getList"> |
||||
<el-tab-pane |
||||
v-for="item in employeeOptions" |
||||
:key="item.examinedUser" |
||||
:name="item.examinedUser" |
||||
> |
||||
<template #label> |
||||
<span>{{ item.examinedUserName }}</span> |
||||
<el-badge :is-dot="item.notExaminedCount > 0" type="danger" /> |
||||
</template> |
||||
<div class="mb-10px"> |
||||
<el-tag v-if="periodSaved == 1" type="danger"> |
||||
当前周期已封存,不可修改当月绩效考核 |
||||
</el-tag> |
||||
<el-tag v-else type="warning"> |
||||
当前周期未封存,可选择修改当月绩效考核,两秒内不操作将自动保存考核结果 |
||||
</el-tag> |
||||
</div> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="list" |
||||
border |
||||
show-summary |
||||
:summary-method="getSummaries" |
||||
> |
||||
<el-table-column prop="examineTarget" label="考核指标" width="180" /> |
||||
<el-table-column prop="typeName" label="分值模式" width="90" /> |
||||
<el-table-column prop="weight" label="权重%" width="90" /> |
||||
<el-table-column label="考核内容"> |
||||
<template #default="{ row }"> |
||||
<div v-dompurify-html="row.examineContent"></div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="考核规则" prop="examineRule"> |
||||
<template #default="{ row }"> |
||||
<div v-dompurify-html="row.examineRule"></div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="评分上限" prop="examineScore" width="90" /> |
||||
<el-table-column label="考核评分" width="120"> |
||||
<template #default="{ row }"> |
||||
<div v-if="periodSaved == 1">{{ row.score }}</div> |
||||
<el-input-number |
||||
v-else |
||||
v-model="row.score" |
||||
:min="0" |
||||
:max="row.examineScore" |
||||
:step="1" |
||||
:controls="false" |
||||
size="small" |
||||
style="width: 100%" |
||||
@input="handleSave(row)" |
||||
/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="评分备注" width="200"> |
||||
<template #default="{ row }"> |
||||
<div v-if="periodSaved == 1">{{ row.remark }}</div> |
||||
<el-input |
||||
v-else |
||||
v-model="row.remark" |
||||
type="textarea" |
||||
:rows="3" |
||||
size="small" |
||||
style="width: 100%" |
||||
@input="handleSave(row)" |
||||
/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="加权得分" prop="weightSocre" width="90" /> |
||||
<el-table-column label="操作" fixed="right" width="100"> |
||||
<template #default="{ row }"> |
||||
<el-button style="padding: 0" type="danger" text @click="handleDelete(row)"> |
||||
删除 |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="KpiScore"> |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import * as KpiApi from '@/api/kpi/score.js' |
||||
|
||||
const { t } = useI18n() // 国际化 |
||||
const message = useMessage() // 消息弹窗 |
||||
const loading = ref(false) // 列表的加载中 |
||||
const list = ref([]) // 列表的数据 |
||||
const searchForm = ref({ |
||||
period: undefined |
||||
}) |
||||
|
||||
const periodSaved = ref(0) |
||||
|
||||
const employeeOptions = ref([]) |
||||
const employeeId = ref('') |
||||
|
||||
onMounted(() => { |
||||
// 默认取上个月 |
||||
const today = new Date() |
||||
searchForm.value.period = formatDate( |
||||
new Date(today.getFullYear(), today.getMonth() - 1), |
||||
'YYYY-MM' |
||||
) |
||||
|
||||
KpiApi.getKpiPeriodStatus({ period: searchForm.value.period }).then((data) => { |
||||
periodSaved.value = data.status |
||||
}) |
||||
|
||||
getList() |
||||
}) |
||||
|
||||
async function getList() { |
||||
try { |
||||
// 获取当前要考核的人员 |
||||
const arr = await KpiApi.getKpiEmployees(searchForm.value) |
||||
employeeOptions.value = arr || [] |
||||
if (employeeOptions.value.length > 0) { |
||||
if (!employeeId.value) { |
||||
employeeId.value = employeeOptions.value[0].examinedUser |
||||
} |
||||
} else { |
||||
message.error('当月无待考核员工!!!') |
||||
return |
||||
} |
||||
list.value = |
||||
employeeOptions.value.find((it) => it.examinedUser == employeeId.value) |
||||
?.examineScoreRespVOList || [] |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
let timer = ref(null) |
||||
const lastId = ref('') |
||||
function handleSave(row) { |
||||
try { |
||||
lastId.value == row.id && clearTimeout(timer.value) |
||||
timer.value = setTimeout(async () => { |
||||
lastId.value = row.id |
||||
// message.success('正在保存数据,请稍后') |
||||
await KpiApi.saveKpiScore({ |
||||
id: row.id, |
||||
score: row.score, |
||||
remark: row.remark |
||||
}) |
||||
message.success('修改成功!') |
||||
getList() |
||||
}, 2000) |
||||
} catch (err) { |
||||
console.log(err) |
||||
} |
||||
} |
||||
|
||||
async function handleDelete(row) { |
||||
try { |
||||
// 删除的二次确认 |
||||
await message.delConfirm( |
||||
`删除后,该员工于${searchForm.value.period}将不再考核此项,是否确认删除?` |
||||
) |
||||
// 发起删除 |
||||
await KpiApi.deleteKpiItem({ id: row.id }) |
||||
message.success(t('common.delSuccess')) |
||||
// 刷新列表 |
||||
await getList() |
||||
} catch {} |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
let sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '考核总分' |
||||
return |
||||
} |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
if (!values.every((value) => Number.isNaN(value))) { |
||||
if (column.property == 'weightSocre') { |
||||
const employee = employeeOptions.value.find((it) => it.examinedUser == employeeId.value) |
||||
sums[index] = employee.scoreTotal + '分' |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,600 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-row class="mb-10px flex justify-between items-start"> |
||||
<el-tree-select |
||||
v-model="searchForm.nodeId" |
||||
:data="peroidList" |
||||
:props="defaultProps" |
||||
:render-after-expand="false" |
||||
:default-expand-all="false" |
||||
check-strictly |
||||
style="width: 300px" |
||||
@change="nodeChange" |
||||
/> |
||||
<div class="flex justify-end flex-1"> |
||||
<el-button type="info" @click="handleExport">导出</el-button> |
||||
<el-popover |
||||
ref="countRef" |
||||
placement="left" |
||||
:title="`${currentNode?.nodeName} 数据汇总`" |
||||
trigger="click" |
||||
width="500px" |
||||
v-model:visible="showCountPop" |
||||
> |
||||
<template #reference><el-button>数据汇总</el-button></template> |
||||
<el-table :data="countInfo" stripe> |
||||
<el-table-column prop="keyResultShowName" label="项目名称" /> |
||||
<el-table-column prop="currentValue" label="当前值" width="90" /> |
||||
<el-table-column prop="targetValue" label="预期值" width="90" /> |
||||
<el-table-column label="完成度" width="150"> |
||||
<template #default="{ row }"> |
||||
<el-progress |
||||
:percentage="parseInt((row.currentValue / row.targetValue) * 100) || 0" |
||||
:color="customColors" |
||||
/> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-popover> |
||||
<el-button type="primary" @click="openDrawer(1, currentNode.nodeId, currentNode.nodeName)"> |
||||
节点笔谈 |
||||
</el-button> |
||||
</div> |
||||
</el-row> |
||||
|
||||
<el-table |
||||
id="okrAnalysisTable" |
||||
:data="originList" |
||||
border |
||||
:show-summary="!!tableKeywords" |
||||
:span-method="objectSpanMethod" |
||||
@cell-click="handleClickCell" |
||||
> |
||||
<el-table-column prop="objectInfo.objectiveName" label="目标"> |
||||
<template #default="{ row }"> |
||||
{{ row.objectInfo.objectiveName }} |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column prop="objectiveId" label="占比" width="100px"> |
||||
<template #default> 0 </template> |
||||
</el-table-column> --> |
||||
<el-table-column prop="keyResultShowName"> |
||||
<template #header> |
||||
<div class="flex items-center justify-center"> |
||||
<div class="flex-1 mr-10px"> |
||||
<el-input |
||||
v-if="showTableSearch" |
||||
v-model="tableKeywords" |
||||
placeholder="请输入关键字" |
||||
size="small" |
||||
style="width: 100%" |
||||
clearable |
||||
@change="handleTableFilter" |
||||
/> |
||||
<div v-else>关键成果</div> |
||||
</div> |
||||
<el-button type="primary" size="small" @click="handleFilterTableClick"> |
||||
{{ showTableSearch ? '取消' : '筛选' }} |
||||
</el-button> |
||||
</div> |
||||
</template> |
||||
<template #default="{ row }"> |
||||
{{ row.sourceName ? `【${row.sourceName}】` : '' }} {{ row.keyResultShowName }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="targetValue" label="目标值" width="100px" /> |
||||
<el-table-column prop="currentValue" label="当前进度" width="100px" /> |
||||
<el-table-column label="开始日期" width="120px"> |
||||
<template #default> |
||||
{{ currentNode.startTime }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="status" label="完成状态" width="100px"> |
||||
<template #default="{ row }"> |
||||
<el-tag v-if="row.currentValue >= row.targetValue" type="success">完成</el-tag> |
||||
<el-tag v-else type="danger">未完成</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="muis" label="差值" width="100px"> |
||||
<template #default="{ row }"> |
||||
<span |
||||
:style="{ |
||||
color: row.targetValue >= row.currentValue ? 'red' : '#333', |
||||
'font-weight': row.targetValue >= row.currentValue ? 'bold' : '500' |
||||
}" |
||||
> |
||||
{{ parseInt(row.targetValue - row.currentValue) }} |
||||
</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="complete" label="完成度" width="200px"> |
||||
<template #default="{ row }"> |
||||
<el-progress :percentage="parseInt(row.progress)" :color="customColors" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="endTime" label="结束日期" width="120px"> |
||||
<template #default> |
||||
{{ currentNode.endTime }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="objectInfo.progress" label="目标完成度" width="100px" align="center"> |
||||
<template #default="{ row }"> |
||||
{{ parseInt(row.objectInfo.progress) }}% |
||||
<!-- <el-progress :percentage="parseInt(row.objectInfo.progress)" :color="customColors" /> --> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<el-drawer |
||||
v-if="showDrawer" |
||||
v-model="showDrawer" |
||||
:title="drawerTitle" |
||||
size="60vw" |
||||
direction="rtl" |
||||
append-to-body |
||||
destroy-on-close |
||||
> |
||||
<el-tabs v-model="currentType" @tab-click="searchCommentList()"> |
||||
<el-tab-pane |
||||
v-for="item in commentTypeOptions" |
||||
:key="item.id" |
||||
:label="item.label" |
||||
:name="item.id" |
||||
> |
||||
<div v-if="item.id == currentType"> |
||||
<div v-if="addNewComment"> |
||||
<div class="flex justify-between items-center"> |
||||
<div> |
||||
<el-button size="small" @click="addNewComment = false"> 取消 </el-button> |
||||
<el-button type="primary" size="small" @click="handleSaveComment"> |
||||
发布 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="mt-10px" v-if="addNewComment"> |
||||
<Editor |
||||
v-model:modelValue="form.commentValue" |
||||
height="300px" |
||||
:toolbarConfig="toolbarConfig" |
||||
/> |
||||
</div> |
||||
</div> |
||||
<el-button v-else type="primary" size="small" @click="handleInsertComment"> |
||||
新增 |
||||
</el-button> |
||||
<div |
||||
v-for="(it, index) in commentList" |
||||
:key="it.commentId" |
||||
class="border-b-1" |
||||
style="padding: 10px 5px" |
||||
> |
||||
<div |
||||
class="flex items-center justify-between overflow-hidden text-16px" |
||||
style="line-height: 30px" |
||||
> |
||||
<div class="flex items-center"> |
||||
<el-avatar |
||||
shape="circle" |
||||
style=" |
||||
background-color: var(--el-color-primary-light-3); |
||||
width: 30px; |
||||
height: 30px; |
||||
" |
||||
fit="fill" |
||||
> |
||||
<span class="text-12px">{{ it.creatorName.slice(-2) }}</span> |
||||
</el-avatar> |
||||
<div class="ml-10px text-16px">{{ it.creatorName }}</div> |
||||
</div> |
||||
</div> |
||||
<div class="ml-10px" v-dompurify-html="it.content"></div> |
||||
<div |
||||
class="ml-10px mt-10px flex items-center justify-between text-12px" |
||||
style="line-height: 20px; color: #aaa" |
||||
> |
||||
<div class="flex items-center"> |
||||
<div class="flex items-center mr-50px"> |
||||
<el-button link @click="good(it)"> |
||||
<Icon |
||||
icon="fa:thumbs-o-up" |
||||
:size="16" |
||||
:color="it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'" |
||||
/> |
||||
</el-button> |
||||
<span |
||||
class="ml-5px" |
||||
:style="{ |
||||
color: it.currentUserIsLike ? 'var(--el-color-primary)' : '#333' |
||||
}" |
||||
>{{ it.likeCount }}</span |
||||
> |
||||
</div> |
||||
<div class="flex items-center mr-50px"> |
||||
<el-button link @click="showChildComment(index)"> |
||||
<Icon icon="ep:chat-dot-square" :size="16" color="#333" /> |
||||
</el-button> |
||||
<span class="ml-5px" style="color: #333">{{ it.commentCount }}</span> |
||||
</div> |
||||
</div> |
||||
<div class="ml-10px text-13px text-gray-400"> |
||||
{{ formatDate(it.createTime, 'YYYY-MM-DD HH:mm') }} |
||||
</div> |
||||
</div> |
||||
<!-- 评论 --> |
||||
<div |
||||
v-if="showCommentIndex == index" |
||||
class="bg-gray-100 pl-10px pr-10px pt-5px pb-5px" |
||||
style="margin: 10px 10px 0 10px; border-radius: 4px" |
||||
label="笔谈" |
||||
> |
||||
<div |
||||
v-for="subComment in it.children.sort((a, b) => a.createTime - b.createTime)" |
||||
:key="subComment.commentId" |
||||
class="text-14px" |
||||
style="line-height: 24px" |
||||
> |
||||
<span class="font-bold">{{ subComment.creatorName }}:</span> |
||||
<span> |
||||
{{ subComment.content }} |
||||
</span> |
||||
</div> |
||||
<div class="mt-10px relative"> |
||||
<!-- <el-input |
||||
v-model="form.commentValue" |
||||
placeholder="请输入评论" |
||||
type="textarea" |
||||
:autosize="{ minRows: 4 }" |
||||
clearable |
||||
size="small" |
||||
style="width: 100%" |
||||
/> --> |
||||
<el-mention |
||||
v-model="form.commentValue" |
||||
type="textarea" |
||||
:autosize="{ minRows: 4 }" |
||||
:options="employeeOptions" |
||||
style="width: 100%" |
||||
size="small" |
||||
whole |
||||
placeholder="请输入内容" |
||||
@select="handleMention" |
||||
> |
||||
<template #label="scope"> |
||||
<div class="flex items-center justify-between h-full"> |
||||
<span class="text-14px text-dark-700">{{ scope.item.name }}</span> |
||||
<span class="text-12px text-gray-400">{{ scope.item.dept }}</span> |
||||
</div> |
||||
</template> |
||||
</el-mention> |
||||
<el-button |
||||
type="primary" |
||||
size="small" |
||||
style="position: absolute; right: 2px; bottom: 2px" |
||||
@click="handleSendCommnet(index)" |
||||
> |
||||
发布 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</el-drawer> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="Analysis"> |
||||
import { listToTree, findNode } from '@/utils/tree' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import { getAllNodeTree, getAllOkrPage, getOkrStatisticsTotal } from '@/api/okr/okr' |
||||
import { getEmployeeSimpleList } from '@/api/pers/employee' |
||||
import { cloneDeep } from 'lodash-es' |
||||
import { |
||||
getCommentTypeOptions, |
||||
createComment, |
||||
getCommentPage, |
||||
likeComment |
||||
} from '@/api/okr/comment' |
||||
import { exportTableWithVue } from '@/utils' |
||||
|
||||
const message = useMessage() |
||||
const defaultProps = { |
||||
value: 'nodeId', |
||||
label: 'nodeName', |
||||
children: 'children' |
||||
} |
||||
const searchForm = ref({ |
||||
nodeId: undefined |
||||
}) |
||||
|
||||
const currentNode = ref(undefined) |
||||
const showDrawer = ref(false) |
||||
const drawerTitle = ref('详情') |
||||
|
||||
const customColors = [ |
||||
{ color: 'rgb(196, 86.4, 86.4)', percentage: 20 }, |
||||
{ color: 'rgb(196, 86.4, 86.4)', percentage: 40 }, |
||||
{ color: 'rgb(237.5, 189.9, 118.5)', percentage: 60 }, |
||||
{ color: 'rgb(159.5, 206.5, 255)', percentage: 80 }, |
||||
{ color: 'rgb(179, 224.5, 156.5)', percentage: 100 } |
||||
] |
||||
|
||||
const peroidList = ref([]) |
||||
|
||||
const showTableSearch = ref(false) |
||||
const tableKeywords = ref('') |
||||
|
||||
handleSearchPeroid() |
||||
getOptions() |
||||
|
||||
// 当前是否是叶子节点 |
||||
// 如果不是叶子节点,则表格数据不可修改 |
||||
const isCurrentLeafNode = ref(false) |
||||
|
||||
function handleSearchPeroid() { |
||||
getAllNodeTree().then((resp) => { |
||||
if (resp.nodeId) { |
||||
peroidList.value = listToTree(resp?.tree || [], { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
nodeChange(resp.nodeId) |
||||
currentNode.value = (resp.tree || []).find((item) => item.nodeId === resp.nodeId) |
||||
} else { |
||||
message.warning('请先创建节点数据') |
||||
} |
||||
}) |
||||
} |
||||
const showCountPop = ref(false) |
||||
function nodeChange(nodeId) { |
||||
if (nodeId) { |
||||
searchForm.value.nodeId = nodeId |
||||
getOkrList() |
||||
getCountInfo() |
||||
currentNode.value = findNode(peroidList.value, (node) => { |
||||
return node.nodeId == nodeId |
||||
}) |
||||
searchForm.value.creatorId = currentNode.value.creatorId |
||||
if (!currentNode.value.children || currentNode.value.children.length == 0) { |
||||
isCurrentLeafNode.value = true |
||||
} else { |
||||
isCurrentLeafNode.value = false |
||||
} |
||||
} |
||||
} |
||||
|
||||
const originList = ref([]) |
||||
const defaultTableList = ref([]) |
||||
const spanObj = ref([]) |
||||
function getOkrList() { |
||||
getAllOkrPage(searchForm.value).then((resp) => { |
||||
originList.value = [] |
||||
spanObj.value = [] |
||||
if (resp && resp.length) { |
||||
resp.map((o) => { |
||||
if (o.keyResults && o.keyResults.length) { |
||||
const arr = o.keyResults.map((k, index) => { |
||||
spanObj.value.push(index == 0 ? o.keyResults.length : 0) |
||||
const obj = cloneDeep(o) |
||||
delete obj.keyResults |
||||
return { |
||||
...k, |
||||
objectInfo: obj |
||||
} |
||||
}) |
||||
originList.value = [...originList.value, ...arr] |
||||
} |
||||
}) |
||||
defaultTableList.value = [...originList.value] |
||||
} |
||||
}) |
||||
} |
||||
|
||||
const countInfo = ref([]) |
||||
function getCountInfo() { |
||||
getOkrStatisticsTotal({ nodeId: searchForm.value.nodeId }).then(async (resp) => { |
||||
countInfo.value = resp || [] |
||||
// await nextTick(() =) |
||||
showCountPop.value = true |
||||
}) |
||||
} |
||||
|
||||
function objectSpanMethod({ column, rowIndex }) { |
||||
if (['目标', '目标完成度'].includes(column.label)) { |
||||
let _row = spanObj.value[rowIndex] |
||||
let _col = _row > 0 ? 1 : 0 |
||||
return { |
||||
rowspan: _row, |
||||
colspan: _col |
||||
} |
||||
} |
||||
} |
||||
|
||||
function handleClickCell(row, column) { |
||||
if (column.property === 'keyResultShowName') { |
||||
openDrawer(2, row.keyResultId, `${row.sourceName} ${row.keyResultShowName}`) |
||||
} else if (column.property === 'objectInfo.objectiveName') { |
||||
openDrawer(3, row.objectInfo.objectiveId, row.objectInfo.objectiveName) |
||||
} |
||||
} |
||||
|
||||
const commentTypeOptions = ref([]) |
||||
const currentType = ref(1) // 默认评论类型为1 |
||||
function getOptions() { |
||||
getCommentTypeOptions().then((resp) => { |
||||
commentTypeOptions.value = (resp || []).sort((pre, cur) => pre.sort - cur.sort) |
||||
currentType.value = resp[0].id |
||||
}) |
||||
getEmployeeSimpleList({ status: 0 }).then((resp) => { |
||||
employeeOptions.value = resp.map((item) => ({ |
||||
...item, |
||||
label: item.name, |
||||
value: item.name |
||||
})) |
||||
}) |
||||
} |
||||
|
||||
const commentList = ref([]) |
||||
const commentInfo = ref({ |
||||
businessType: undefined, |
||||
businessId: undefined, |
||||
commentType: undefined, |
||||
pageSize: -1 |
||||
}) |
||||
function openDrawer(type, id, name) { |
||||
showDrawer.value = true |
||||
drawerTitle.value = `【${name}】笔谈` |
||||
commentInfo.value = { |
||||
businessType: type, |
||||
businessId: id, |
||||
commentType: currentType.value, |
||||
pageSize: -1 |
||||
} |
||||
searchCommentList() |
||||
} |
||||
|
||||
function searchCommentList() { |
||||
commentInfo.value.commentType = currentType.value |
||||
getCommentPage(commentInfo.value).then((resp) => { |
||||
// commentList.value = resp.list |
||||
commentList.value = listToTree(resp.list, { |
||||
id: 'commentId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
const showCommentIndex = ref(-1) |
||||
function showChildComment(index) { |
||||
showCommentIndex.value = showCommentIndex.value == index ? -1 : index |
||||
} |
||||
|
||||
function good(item) { |
||||
likeComment(item.commentId).then(() => { |
||||
message.success('点赞成功') |
||||
searchCommentList() |
||||
}) |
||||
} |
||||
|
||||
const form = ref({ |
||||
commentValue: '', |
||||
mentionedUserIdList: [] |
||||
}) |
||||
const employeeOptions = ref([]) |
||||
|
||||
function handleMention(item) { |
||||
form.value.mentionedUserIdList.push(item.id) |
||||
} |
||||
|
||||
function handleSendCommnet(idx) { |
||||
try { |
||||
// 过滤掉删除的用户,方式为遍历mentionedUserIdList,查找评论中是否有对应的用户名 |
||||
const userList = [...form.value.mentionedUserIdList] |
||||
const arr = [] |
||||
userList.map((item) => { |
||||
if (form.value.commentValue.indexOf(`@${item.name}`) != -1) { |
||||
arr.push(item.id) |
||||
// 然后移除对应的用户名,防止有多个 |
||||
form.value.commentValue = form.value.commentValue.replace(`@${item.name}`, '') |
||||
} |
||||
}) |
||||
const data = { |
||||
businessType: commentInfo.value.businessType, |
||||
businessId: commentInfo.value.businessId, |
||||
commentType: currentType.value, |
||||
content: form.value.commentValue, |
||||
mentionedUserIdList: arr, |
||||
parentId: commentList.value[idx].commentId |
||||
} |
||||
createComment(data) |
||||
.then(() => { |
||||
message.success('创建成功') |
||||
searchCommentList() |
||||
}) |
||||
.finally(() => { |
||||
form.value.commentValue = '' |
||||
}) |
||||
} catch (error) { |
||||
console.log(error) |
||||
message.error('创建失败') |
||||
} |
||||
} |
||||
|
||||
const addNewComment = ref(false) |
||||
function handleInsertComment() { |
||||
addNewComment.value = true |
||||
form.value.commentValue = commentTypeOptions.value.find( |
||||
(item) => item.id == currentType.value |
||||
).remark |
||||
} |
||||
|
||||
const toolbarConfig = { |
||||
toolbarKeys: [ |
||||
'bold', // 加粗 |
||||
'underline', // 下划线 |
||||
'italic', // 斜体 |
||||
'color', // 文字颜色 |
||||
'bgColor', // 背景色 |
||||
'fontSize', // 字号 |
||||
'bulletedList', // 无序列表 |
||||
'numberedList', // 有序列表 |
||||
'insertTable', // 插入表格 |
||||
'insertLink', // 插入链接 |
||||
'undo' // 撤销 |
||||
] |
||||
} |
||||
|
||||
function handleSaveComment() { |
||||
addNewComment.value = false |
||||
try { |
||||
const data = { |
||||
businessType: commentInfo.value.businessType, |
||||
businessId: commentInfo.value.businessId, |
||||
commentType: currentType.value, |
||||
content: form.value.commentValue, |
||||
mentionedUserIdList: form.value.mentionedUserIdList |
||||
} |
||||
createComment(data) |
||||
.then(() => { |
||||
message.success('创建成功') |
||||
searchCommentList() |
||||
}) |
||||
.finally(() => { |
||||
form.value.commentValue = '' |
||||
}) |
||||
} catch (error) { |
||||
message.error('创建失败') |
||||
} |
||||
} |
||||
|
||||
function handleExport() { |
||||
exportTableWithVue('#okrAnalysisTable', `OKR分析报表-${currentNode.value.nodeName}`) |
||||
} |
||||
|
||||
function handleTableFilter() { |
||||
console.log('tableKeywords', tableKeywords.value) |
||||
|
||||
if (tableKeywords.value) { |
||||
originList.value = defaultTableList.value.filter( |
||||
(item) => |
||||
item.keyResultShowName.includes(tableKeywords.value) || |
||||
item.sourceName.includes(tableKeywords.value) |
||||
) |
||||
} else { |
||||
originList.value = [...defaultTableList.value] |
||||
} |
||||
} |
||||
|
||||
function handleFilterTableClick() { |
||||
showTableSearch.value = !showTableSearch.value |
||||
if (!showTableSearch.value) { |
||||
tableKeywords.value = '' |
||||
originList.value = [...defaultTableList.value] |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,150 +0,0 @@ |
||||
<template> |
||||
<div class="flex flex-col w-full h-full p-4 bg-white rounded-lg shadow-md overflow-hidden"> |
||||
<div class="flex items-center justify-between"> |
||||
<el-row> |
||||
<el-tree-select |
||||
v-model="searchForm.nodeId" |
||||
:data="peroidList" |
||||
:props="defaultProps" |
||||
:render-after-expand="false" |
||||
:default-expand-all="false" |
||||
check-strictly |
||||
style="width: 400px" |
||||
@change="nodeChange" |
||||
/> |
||||
<el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button> |
||||
</el-row> |
||||
<el-row> |
||||
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button> |
||||
<el-button |
||||
type="warning" |
||||
v-if="currentUserId == searchForm.creatorId" |
||||
@click="handleEditOkr(searchForm.nodeId)" |
||||
> |
||||
修改当前节点 |
||||
</el-button> |
||||
<el-button |
||||
type="success" |
||||
v-if="searchForm.executor?.includes(currentUserId)" |
||||
@click="handleUpdateProcess" |
||||
>更新进度</el-button |
||||
> |
||||
</el-row> |
||||
</div> |
||||
<OkrTable ref="okrTableRef" :canEdit="isCurrentLeafNode" /> |
||||
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> |
||||
<DialogOkrInfo ref="dialogOkrInfo" @success="handleSearchPeroid" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="AllTarget"> |
||||
import OkrTable from './OkrTable.vue' |
||||
import DialogOkrInfo from './DialogOkrInfo.vue' |
||||
import DialogOkr from './DialogOkr.vue' |
||||
|
||||
import { getAllNodeTree, getAllOkrPage } from '@/api/okr/okr' |
||||
import { listToTree, findNode } from '@/utils/tree' |
||||
import { useUserStore } from '@/store/modules/user' |
||||
|
||||
const message = useMessage() |
||||
const userStore = useUserStore() |
||||
const currentUserId = userStore.getUser.id |
||||
|
||||
const defaultProps = { |
||||
value: 'nodeId', |
||||
label: 'nodeName', |
||||
children: 'children' |
||||
} |
||||
|
||||
const okrTableRef = ref(null) |
||||
const searchForm = ref({ |
||||
nodeId: undefined |
||||
}) |
||||
|
||||
const peroidList = ref([]) |
||||
|
||||
handleSearchPeroid() |
||||
|
||||
// 当前是否是叶子节点 |
||||
// 如果不是叶子节点,则表格数据不可修改 |
||||
const isCurrentLeafNode = ref(false) |
||||
|
||||
function handleSearchPeroid() { |
||||
getAllNodeTree().then((resp) => { |
||||
if (resp.nodeId) { |
||||
peroidList.value = listToTree(resp?.tree || [], { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
nodeChange(resp.nodeId) |
||||
} else { |
||||
message.warning('请先创建节点数据') |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function nodeChange(nodeId) { |
||||
if (nodeId) { |
||||
searchForm.value.nodeId = nodeId |
||||
getOkrList() |
||||
const currentNode = findNode(peroidList.value, (node) => { |
||||
return node.nodeId == nodeId |
||||
}) |
||||
searchForm.value.creatorId = currentNode.creatorId |
||||
if (!currentNode.children || currentNode.children.length == 0) { |
||||
isCurrentLeafNode.value = true |
||||
} else { |
||||
isCurrentLeafNode.value = false |
||||
} |
||||
} |
||||
} |
||||
|
||||
function getOkrList() { |
||||
getAllOkrPage(searchForm.value).then((resp) => { |
||||
const list = resp |
||||
if (list && list.length > 0) { |
||||
nextTick(() => { |
||||
okrTableRef.value.prepareData(list) |
||||
}) |
||||
} else { |
||||
// 如果没有数据,清空表格 |
||||
okrTableRef.value.prepareData([]) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
const dialogOkrInfo = ref(null) |
||||
function handleAddNode() { |
||||
dialogOkrInfo.value.open('create', null) |
||||
} |
||||
|
||||
function handleEditOkr(nodeId = undefined) { |
||||
dialogOkr.value.close() |
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2) |
||||
} |
||||
|
||||
function handleUpdateProcess() { |
||||
okrTableRef.value.updateProcess(searchForm.value.nodeId).then(() => { |
||||
message.success('更新成功') |
||||
getOkrList() |
||||
}) |
||||
} |
||||
|
||||
const dialogOkr = ref(null) |
||||
function handleShowOkr(id) { |
||||
dialogOkr.value.open({ |
||||
nodeId: id, |
||||
canEdit: isCurrentLeafNode.value, |
||||
queryType: 2 |
||||
}) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
:deep(.el-overlay-dialog) { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
</style> |
@ -1,682 +0,0 @@ |
||||
<template> |
||||
<el-dialog |
||||
v-if="show" |
||||
v-model="show" |
||||
width="94vw" |
||||
class="dialog-okr" |
||||
:show-close="false" |
||||
:close-on-click-modal="false" |
||||
> |
||||
<template #header> |
||||
<div class="dialog-okr-header"> |
||||
<div class="flex-1 flex items-center" style="line-height: 50px"> |
||||
<div class="dialog-okr-title"> |
||||
<Icon icon="ep:circle-check-filled" color="#30d1fc" :size="14" /> |
||||
<span>目标</span> |
||||
</div> |
||||
<el-divider direction="vertical" /> |
||||
<span class="text-14px ml-0.25">ork落地</span> |
||||
<div class="ml-20px text-14px"> |
||||
<span>【节点】</span> |
||||
<span |
||||
v-for="(item, index) in nodeInfo.parentNodes" |
||||
:key="item.nodeId" |
||||
@click="handleChildItem(item)" |
||||
> |
||||
<span |
||||
class="cursor-pointer" |
||||
:style="{ |
||||
color: index < nodeInfo.parentNodes.length - 1 ? '#409eff' : '#333', |
||||
borderBottom: |
||||
index < nodeInfo.parentNodes.length - 1 ? '1px solid #409eff' : 'none' |
||||
}" |
||||
> |
||||
{{ item.nodeName }} |
||||
</span> |
||||
<span v-if="index != nodeInfo.parentNodes.length - 1"> -> </span> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
<div class="flex items-center"> |
||||
<el-button |
||||
v-if="nodeInfo.creatorId == currentUserId" |
||||
link |
||||
@click="emit('edit', nodeInfo.nodeId)" |
||||
> |
||||
<el-tooltip content="编辑" placement="top" effect="dark"> |
||||
<Icon icon="ep:edit" :size="16" /> |
||||
</el-tooltip> |
||||
</el-button> |
||||
|
||||
<el-button link @click="show = false"> |
||||
<el-tooltip content="关闭" placement="top" effect="dark"> |
||||
<Icon icon="ep:close" :size="16" /> |
||||
</el-tooltip> |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<template #default> |
||||
<div class="dialog-okr-body"> |
||||
<div class="dialog-okr-content pr-10px"> |
||||
<div class="dialog-okr-content-detail"> |
||||
<div class="detail-basic-title"> |
||||
<div class="basic-title-item"> |
||||
<div class="basic-title-label">创建人</div> |
||||
<div class="basic-title-value">{{ nodeInfo.creator }}</div> |
||||
</div> |
||||
<div class="basic-title-item"> |
||||
<div class="basic-title-label">执行人</div> |
||||
<div class="basic-title-value">{{ nodeInfo.executorName || '无' }}</div> |
||||
</div> |
||||
<div class="basic-title-item"> |
||||
<div class="basic-title-label">目标数</div> |
||||
<div class="basic-title-value">{{ okrList.length }}</div> |
||||
</div> |
||||
<div class="basic-title-item" style="min-width: 200px"> |
||||
<div class="basic-title-label">总体进度</div> |
||||
<el-progress :percentage="parseInt(nodeInfo.progress) || 0" :stroke-width="8" /> |
||||
</div> |
||||
</div> |
||||
<div class="flex detail-basic-info"> |
||||
<span>开始日期:{{ nodeInfo.startTime }}</span> |
||||
<span>截止日期:{{ nodeInfo.endTime }}</span> |
||||
<span>最新更新时间:{{ nodeInfo.updateTime }}</span> |
||||
</div> |
||||
</div> |
||||
<div class="flex" style="position: relative; flex: 1; height: 100px"> |
||||
<el-tabs v-model="workIndex" style="flex: 1"> |
||||
<el-tab-pane label="目标/关键成果" name="okr"> |
||||
<div class="content-wrap"> |
||||
<OkrTable ref="okrTableRef" :canEdit="canEdit" /> |
||||
</div> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
<el-button v-if="canEdit" class="sav-btn" type="primary" @click="handleSaveProcess"> |
||||
保存并更新 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="dialog-okr-side pl-10px"> |
||||
<el-tabs v-model="sideIndex" style="flex: 1; height: 100%"> |
||||
<el-tab-pane label="子节点" name="subNode" key=" "> |
||||
<div class="overflow-y-auto" style="height: calc(100% - 50px)"> |
||||
<div |
||||
v-for="item in childNodeList" |
||||
:key="item.nodeId" |
||||
class="border-b-1 child-item" |
||||
style="padding: 10px 5px; cursor: pointer" |
||||
@click="handleChildItem(item)" |
||||
> |
||||
<div |
||||
class="flex justify-between items-center overflow-hidden text-16px" |
||||
style="line-height: 30px" |
||||
> |
||||
<div class="child-label">【节点】{{ item.nodeName }}</div> |
||||
<el-progress |
||||
type="line" |
||||
:percentage="parseInt(item.progress) || 0" |
||||
:stroke-width="6" |
||||
style="width: 120px" |
||||
/> |
||||
</div> |
||||
<div class="ml-10px flex items-center text-13px" style="line-height: 30px"> |
||||
<span>目标数:</span> |
||||
<span style="color: #aaa">{{ item.objectiveNum }}</span> |
||||
<el-divider direction="vertical" style="margin: 0 20px" /> |
||||
<div |
||||
class="flex-1 overflow-hidden h-30px" |
||||
style="text-overflow: ellipsis; white-space: nowrap" |
||||
> |
||||
<span>执行人:</span> |
||||
<span style="color: #aaa">{{ item.executorName || '无' }}</span> |
||||
</div> |
||||
</div> |
||||
<div |
||||
class="ml-10px flex items-center text-12px" |
||||
style="line-height: 20px; color: #aaa" |
||||
> |
||||
<span>开始日期:{{ item.startTime }}</span> |
||||
<el-divider direction="vertical" style="margin: 0 20px" /> |
||||
<span>截止日期:{{ item.endTime }}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="笔谈" name="conclusion" key="conclusion"> |
||||
<div class="relative overflow-y-auto" style="height: calc(100% - 50px)"> |
||||
<div v-if="addNewComment"> |
||||
<div class="flex justify-between items-center"> |
||||
<el-select |
||||
v-model="form.commentType" |
||||
filterable |
||||
size="small" |
||||
style="width: 120px" |
||||
@change="getCommentTemplate" |
||||
> |
||||
<el-option |
||||
v-for="it in commentTypeOptions" |
||||
:label="it.label" |
||||
:value="it.id" |
||||
:key="it.id" |
||||
/> |
||||
</el-select> |
||||
|
||||
<div> |
||||
<el-button size="small" @click="addNewComment = false"> 取消 </el-button> |
||||
<el-button type="primary" size="small" @click="handleSaveComment"> |
||||
发布 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
<div class="mt-10px" v-if="addNewComment"> |
||||
<Editor |
||||
v-model:modelValue="form.commentValue" |
||||
height="300px" |
||||
:toolbarConfig="toolbarConfig" |
||||
/> |
||||
</div> |
||||
</div> |
||||
<el-button v-else type="primary" size="small" @click="handleInsertComment"> |
||||
新增笔谈 |
||||
</el-button> |
||||
<div |
||||
v-for="(it, index) in commentList" |
||||
:key="it.commentId" |
||||
class="border-b-1" |
||||
style="padding: 10px 5px" |
||||
> |
||||
<div |
||||
class="flex items-center justify-between overflow-hidden text-16px" |
||||
style="line-height: 30px" |
||||
> |
||||
<div class="flex items-center"> |
||||
<el-avatar |
||||
shape="circle" |
||||
style=" |
||||
background-color: var(--el-color-primary-light-3); |
||||
width: 30px; |
||||
height: 30px; |
||||
" |
||||
fit="fill" |
||||
> |
||||
<span class="text-12px">{{ it.creatorName.slice(-2) }}</span> |
||||
</el-avatar> |
||||
<div class="ml-10px text-16px">{{ it.creatorName }}</div> |
||||
</div> |
||||
</div> |
||||
<div class="ml-10px" v-dompurify-html="it.content"></div> |
||||
<div |
||||
class="ml-10px mt-10px flex items-center justify-between text-12px" |
||||
style="line-height: 20px; color: #aaa" |
||||
> |
||||
<div class="flex items-center"> |
||||
<div class="flex items-center mr-50px"> |
||||
<el-button link @click="good(it)"> |
||||
<Icon |
||||
icon="fa:thumbs-o-up" |
||||
:size="16" |
||||
:color="it.currentUserIsLike ? 'var(--el-color-primary)' : '#333'" |
||||
/> |
||||
</el-button> |
||||
<span |
||||
class="ml-5px" |
||||
:style="{ |
||||
color: it.currentUserIsLike ? 'var(--el-color-primary)' : '#333' |
||||
}" |
||||
>{{ it.likeCount }}</span |
||||
> |
||||
</div> |
||||
<div class="flex items-center mr-50px"> |
||||
<el-button link @click="showComment(index)"> |
||||
<Icon icon="ep:chat-dot-square" :size="16" color="#333" /> |
||||
</el-button> |
||||
<span class="ml-5px" style="color: #333">{{ it.commentCount }}</span> |
||||
</div> |
||||
</div> |
||||
<div class="ml-10px text-13px text-gray-400"> |
||||
{{ formatDate(it.createTime, 'YYYY-MM-DD HH:mm') }} |
||||
</div> |
||||
</div> |
||||
<!-- 评论 --> |
||||
<div |
||||
v-if="showCommentIndex == index" |
||||
class="bg-gray-100 pl-10px pr-10px pt-5px pb-5px" |
||||
style="margin: 10px 10px 0 10px; border-radius: 4px" |
||||
label="笔谈" |
||||
> |
||||
<div |
||||
v-for="subComment in it.children.sort((a, b) => a.createTime - b.createTime)" |
||||
:key="subComment.commentId" |
||||
class="text-14px" |
||||
style="line-height: 24px" |
||||
> |
||||
<span class="font-bold">{{ subComment.creatorName }}:</span> |
||||
<span> |
||||
{{ subComment.content }} |
||||
</span> |
||||
</div> |
||||
<div class="mt-10px relative"> |
||||
<!-- <el-input |
||||
v-model="form.commentValue" |
||||
placeholder="请输入评论" |
||||
type="textarea" |
||||
:autosize="{ minRows: 4 }" |
||||
clearable |
||||
size="small" |
||||
style="width: 100%" |
||||
/> --> |
||||
<el-mention |
||||
v-model="form.commentValue" |
||||
type="textarea" |
||||
:autosize="{ minRows: 4 }" |
||||
:options="employeeOptions" |
||||
style="width: 100%" |
||||
size="small" |
||||
whole |
||||
placeholder="请输入内容" |
||||
@select="handleMention" |
||||
> |
||||
<template #label="{ item }"> |
||||
<div class="flex items-center justify-between h-full"> |
||||
<span class="text-14px text-dark-700">{{ item.name }}</span> |
||||
<span class="text-12px text-gray-400">{{ item.dept }}</span> |
||||
</div> |
||||
</template> |
||||
</el-mention> |
||||
<el-button |
||||
type="primary" |
||||
size="small" |
||||
style="position: absolute; right: 2px; bottom: 2px" |
||||
@click="handleSendCommnet(index)" |
||||
> |
||||
发布 |
||||
</el-button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="进度历史" name="history" key="history"> |
||||
<div class="overflow-y-auto pl-15px" style="height: calc(100% - 50px)"> |
||||
<el-timeline class="ml-10px"> |
||||
<el-timeline-item |
||||
v-for="item in nodeRecords" |
||||
:key="item.recordId" |
||||
placement="bottom" |
||||
:timestamp="formatDate(item.createTime, 'YYYY-MM-DD HH:mm:ss')" |
||||
color="#30d1fc" |
||||
> |
||||
<div>{{ item.creator }}</div> |
||||
<div class="mt-10px text-14px" style="line-height: 24px; color: #666"> |
||||
{{ item.content }} |
||||
</div> |
||||
</el-timeline-item> |
||||
</el-timeline> |
||||
</div> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogOkr"> |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import OkrTable from './OkrTable.vue' |
||||
|
||||
import { getOkrNodeDetail, getOkrNodeHistory } from '@/api/okr/okr' |
||||
import { |
||||
getCommentTypeOptions, |
||||
createComment, |
||||
getCommentPage, |
||||
likeComment |
||||
} from '@/api/okr/comment' |
||||
import { listToTree } from '@/utils/tree' |
||||
import { getEmployeeSimpleList } from '@/api/pers/employee' |
||||
import { useUserStore } from '@/store/modules/user' |
||||
|
||||
const message = useMessage() |
||||
const userStore = useUserStore() |
||||
const currentUserId = userStore.getUser.id |
||||
const emit = defineEmits(['edit', 'close']) |
||||
|
||||
const show = ref(false) |
||||
|
||||
watch( |
||||
() => show.value, |
||||
(newValue, oldValue) => { |
||||
if (oldValue && !newValue) { |
||||
emit('close', nodeInfo.value) |
||||
} |
||||
} |
||||
) |
||||
|
||||
const canEdit = ref(false) |
||||
|
||||
const toolbarConfig = { |
||||
toolbarKeys: [ |
||||
'bold', // 加粗 |
||||
'underline', // 下划线 |
||||
'italic', // 斜体 |
||||
'color', // 文字颜色 |
||||
'bgColor', // 背景色 |
||||
'fontSize', // 字号 |
||||
'bulletedList', // 无序列表 |
||||
'numberedList', // 有序列表 |
||||
'insertTable', // 插入表格 |
||||
'insertLink', // 插入链接 |
||||
'undo' // 撤销 |
||||
] |
||||
} |
||||
|
||||
const workIndex = ref('okr') |
||||
const okrList = ref([]) |
||||
const childNodeList = ref([]) |
||||
const sideIndex = ref('subNode') |
||||
|
||||
const okrTableRef = ref(null) |
||||
const nodeInfo = ref({}) |
||||
|
||||
const nodeRecords = ref([]) |
||||
const commentTypeOptions = ref([]) |
||||
|
||||
const queryType = ref(1) |
||||
function open(curNode) { |
||||
canEdit.value = curNode.canEdit |
||||
nodeInfo.value.nodeId = curNode.nodeId |
||||
queryType.value = curNode.queryType |
||||
// 获取数据详情 |
||||
searchInfo(curNode) |
||||
show.value = true |
||||
} |
||||
|
||||
const employeeOptions = ref([]) |
||||
|
||||
function searchInfo(curNode) { |
||||
try { |
||||
getOkrNodeDetail({ nodeId: curNode.nodeId, queryType: queryType.value }).then((resp) => { |
||||
nodeInfo.value = { |
||||
...resp, |
||||
executor: resp.executor || [] |
||||
} |
||||
canEdit.value = canEdit.value && nodeInfo.value.executor.includes(currentUserId + '') |
||||
if (resp.objectives) { |
||||
okrList.value = resp.objectives.map((item) => ({ |
||||
...item, |
||||
keyResults: item.keyResults || [] |
||||
})) |
||||
} else { |
||||
okrList.value = [] |
||||
} |
||||
childNodeList.value = [...resp.children] |
||||
nextTick(() => { |
||||
okrTableRef.value.prepareData(okrList.value) |
||||
}) |
||||
}) |
||||
getOkrNodeHistory(curNode.nodeId).then((resp) => { |
||||
nodeRecords.value = resp |
||||
}) |
||||
getEmployeeSimpleList({ status: 0 }).then((resp) => { |
||||
employeeOptions.value = resp.map((item) => ({ |
||||
...item, |
||||
label: item.name, |
||||
value: item.name |
||||
})) |
||||
}) |
||||
getCommentTypeOptions().then((resp) => { |
||||
commentTypeOptions.value = resp |
||||
}) |
||||
searchCommentList() |
||||
} finally { |
||||
} |
||||
} |
||||
|
||||
function close() { |
||||
show.value = false |
||||
} |
||||
|
||||
defineExpose({ open, close }) |
||||
|
||||
function handleMention(item) { |
||||
form.value.mentionedUserIdList.push(item.id) |
||||
} |
||||
|
||||
function handleSaveProcess() { |
||||
okrTableRef.value.updateProcess(nodeInfo.value.nodeId).then(() => { |
||||
message.success('更新成功') |
||||
searchInfo({ nodeId: nodeInfo.value.nodeId }) |
||||
}) |
||||
} |
||||
|
||||
function handleChildItem(item) { |
||||
const arr = item.executor || [] |
||||
const isExecutor = arr.includes(currentUserId) |
||||
canEdit.value = isExecutor && (!item.children || item.children.length == 0) |
||||
searchInfo(item) |
||||
} |
||||
|
||||
const addNewComment = ref(false) |
||||
const form = ref({ |
||||
commentValue: '', |
||||
commentType: undefined, |
||||
mentionedUserIdList: [] |
||||
}) |
||||
function handleInsertComment() { |
||||
addNewComment.value = true |
||||
const defaultComment = commentTypeOptions.value[0] |
||||
if (defaultComment) { |
||||
form.value = { |
||||
commentType: defaultComment.id, |
||||
mentionedUserIdList: [] |
||||
} |
||||
} |
||||
getCommentTemplate() |
||||
} |
||||
|
||||
function getCommentTemplate() { |
||||
if (form.value.commentType) { |
||||
form.value.commentValue = commentTypeOptions.value.find( |
||||
(item) => item.id == form.value.commentType |
||||
).remark |
||||
} else { |
||||
form.value.commentValue = `<h2 style=\"text-align: start;\">一、工作概况</h2><p> </p><h2 style=\"text-align: start;\">二、数据统计</h2><ol><li>呼出电话数:</li><li>有效沟通数:</li><li>销售成果</li></ol><h2 style=\"text-align: start;\">三、问题与改进方案</h2><p><br></p>` |
||||
} |
||||
} |
||||
|
||||
function handleSaveComment() { |
||||
addNewComment.value = false |
||||
try { |
||||
const data = { |
||||
businessType: 1, |
||||
businessId: nodeInfo.value.nodeId, |
||||
commentType: form.value.commentType, |
||||
content: form.value.commentValue, |
||||
mentionedUserIdList: form.value.mentionedUserIdList |
||||
} |
||||
createComment(data) |
||||
.then(() => { |
||||
message.success('创建成功') |
||||
searchCommentList() |
||||
}) |
||||
.finally(() => { |
||||
form.value.commentValue = '' |
||||
}) |
||||
} catch (error) { |
||||
message.error('创建失败') |
||||
} |
||||
} |
||||
const commentList = ref([]) |
||||
|
||||
function searchCommentList() { |
||||
getCommentPage({ |
||||
businessType: 1, |
||||
businessId: nodeInfo.value.nodeId, |
||||
pageNum: 1, |
||||
pageSize: -1 |
||||
}).then((resp) => { |
||||
commentList.value = listToTree(resp.list, { |
||||
id: 'commentId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
function good(item) { |
||||
likeComment(item.commentId).then(() => { |
||||
message.success('点赞成功') |
||||
searchCommentList() |
||||
}) |
||||
} |
||||
|
||||
const showCommentIndex = ref(-1) |
||||
function showComment(index) { |
||||
showCommentIndex.value = showCommentIndex.value == index ? -1 : index |
||||
} |
||||
|
||||
function handleSendCommnet(idx) { |
||||
try { |
||||
// 过滤掉删除的用户,方式为遍历mentionedUserIdList,查找评论中是否有对应的用户名 |
||||
const userList = [...form.value.mentionedUserIdList] |
||||
const arr = [] |
||||
userList.map((item) => { |
||||
if (form.value.commentValue.indexOf(`@${item.name}`) != -1) { |
||||
arr.push(item.id) |
||||
// 然后移除对应的用户名,防止有多个 |
||||
form.value.commentValue = form.value.commentValue.replace(`@${item.name}`, '') |
||||
} |
||||
}) |
||||
const data = { |
||||
businessType: 1, |
||||
businessId: nodeInfo.value.nodeId, |
||||
contentType: 1, |
||||
commentType: form.value.commentType, |
||||
content: form.value.commentValue, |
||||
mentionedUserIdList: arr, |
||||
parentId: commentList.value[idx].commentId |
||||
} |
||||
createComment(data) |
||||
.then(() => { |
||||
message.success('创建成功') |
||||
searchCommentList() |
||||
}) |
||||
.finally(() => { |
||||
form.value.commentValue = '' |
||||
}) |
||||
} catch (error) { |
||||
message.error('创建失败') |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.dialog-okr { |
||||
.dialog-okr-header { |
||||
display: flex; |
||||
height: 51px; |
||||
min-height: 51px; |
||||
vertical-align: middle; |
||||
justify-content: space-between; |
||||
-webkit-box-align: center; |
||||
-ms-flex-align: center; |
||||
align-items: center; |
||||
padding: 0 1.25rem; |
||||
.dialog-okr-title { |
||||
display: flex; |
||||
margin-right: 5px; |
||||
align-items: center; |
||||
background: rgba(48, 209, 252, 0.1); |
||||
border-radius: 3px; |
||||
padding: 0 10px; |
||||
line-height: 24px; |
||||
span { |
||||
color: #2a344b; |
||||
font-size: 12px; |
||||
margin-left: 6px; |
||||
} |
||||
} |
||||
} |
||||
.dialog-okr-body { |
||||
display: flex; |
||||
background: #f0f3fa; |
||||
overflow: hidden; |
||||
min-width: 1064px; |
||||
height: calc(94vh - 85px); |
||||
.dialog-okr-content { |
||||
display: flex; |
||||
flex-direction: column; |
||||
height: 100%; |
||||
width: 70%; |
||||
flex: auto; |
||||
min-width: 700px; |
||||
background: #fff; |
||||
margin: 0 1px 0 0; |
||||
justify-content: space-between; |
||||
overflow-y: hidden !important; |
||||
.dialog-okr-content-detail { |
||||
position: relative; |
||||
margin-bottom: 30px; |
||||
overflow-y: auto; |
||||
display: -webkit-box; |
||||
display: -ms-flexbox; |
||||
display: flex; |
||||
-webkit-box-orient: vertical; |
||||
-webkit-box-direction: normal; |
||||
-ms-flex-direction: column; |
||||
flex-direction: column; |
||||
.detail-basic-title { |
||||
display: flex; |
||||
font-size: 14px; |
||||
margin-bottom: 16px; |
||||
.basic-title-item { |
||||
margin-right: 50px; |
||||
.basic-title-label { |
||||
color: #aaa; |
||||
margin-bottom: 6px; |
||||
} |
||||
.basic-title-value { |
||||
color: #2a344b; |
||||
font-size: 14px; |
||||
} |
||||
} |
||||
} |
||||
.detail-basic-info { |
||||
font-size: 14px; |
||||
color: #aaa; |
||||
span { |
||||
margin-right: 40px; |
||||
} |
||||
} |
||||
} |
||||
.content-wrap { |
||||
display: flex; |
||||
flex-direction: column; |
||||
height: calc(100% - 15px); |
||||
} |
||||
} |
||||
.dialog-okr-side { |
||||
padding-left: 10px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
width: 30%; |
||||
overflow: hidden; |
||||
min-width: 364px; |
||||
max-width: 500px; |
||||
background: #fff; |
||||
margin: 0; |
||||
.child-item:hover { |
||||
background: #f0f3fa; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.sav-btn { |
||||
position: absolute; |
||||
right: 10px; |
||||
top: 0; |
||||
width: auto; |
||||
} |
||||
</style> |
@ -1,647 +0,0 @@ |
||||
<template> |
||||
<el-dialog |
||||
v-model="show" |
||||
width="88vw" |
||||
class="dialog-okr" |
||||
:show-close="false" |
||||
:close-on-click-modal="false" |
||||
> |
||||
<template #header> |
||||
<div class="dialog-okr-header"> |
||||
<div class="flex-1 flex items-center" style="line-height: 50px"> {{ title }} </div> |
||||
<div class="flex items-center"> |
||||
<el-button type="primary" link :disabled="formLoading" @click="handleSave"> |
||||
保存 |
||||
</el-button> |
||||
<el-button link @click="show = false"> 关闭 </el-button> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<template #default> |
||||
<div class="dialog-okr-body" v-loading="formLoading"> |
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="0"> |
||||
<el-row :gutter="10"> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="parentId"> |
||||
<el-tree-select |
||||
v-model="form.parentId" |
||||
:data="parentNodeList" |
||||
check-strictly |
||||
:props="{ value: 'nodeId', label: 'nodeName', children: 'children' }" |
||||
:render-after-expand="false" |
||||
placeholder="父节点" |
||||
clearable |
||||
:disabled="!!form.nodeId" |
||||
@change="handleChangeParent" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="nodeName"> |
||||
<el-input v-model="form.nodeName" placeholder="请输入节点名称" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="startTime"> |
||||
<el-date-picker |
||||
v-model="form.startTime" |
||||
type="date" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
placeholder="开始日期" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="endTime"> |
||||
<el-date-picker |
||||
v-model="form.endTime" |
||||
type="date" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
placeholder="截止日期" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="executor"> |
||||
<el-select |
||||
v-model="form.executor" |
||||
placeholder="选择执行人,可多选" |
||||
multiple |
||||
collapse-tags |
||||
collapse-tags-tooltip |
||||
clearable |
||||
filterable |
||||
> |
||||
<el-option |
||||
v-for="item in userOptions" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id + ''" |
||||
:disabled="item.status == 1" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="4" :offset="0"> |
||||
<el-form-item prop="dataScope"> |
||||
<el-select v-model="form.dataScope" placeholder="选择权限" clearable filterable> |
||||
<el-option label="公开" :value="1" /> |
||||
<el-option label="仅上级可见" :value="2" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<div class="relative"> |
||||
<el-button |
||||
v-if="okrKey == 'okr'" |
||||
style="position: absolute; right: 10px; top: 10px; z-index: 9" |
||||
type="primary" |
||||
size="small" |
||||
@click="addObjective" |
||||
> |
||||
添加目标 |
||||
</el-button> |
||||
<el-button |
||||
v-else-if="okrKey == 'childNode'" |
||||
style="position: absolute; right: 10px; top: 10px; z-index: 9" |
||||
type="primary" |
||||
size="small" |
||||
@click="addChildNode" |
||||
> |
||||
添加子节点 |
||||
</el-button> |
||||
<el-tabs v-model="okrKey"> |
||||
<el-tab-pane label="目标/关键成果" name="okr"> |
||||
<div> |
||||
<div |
||||
class="flex items-center w-full" |
||||
v-for="(item, i) in objectList" |
||||
:key="item.objectiveId" |
||||
style="padding-bottom: 5px" |
||||
> |
||||
<div class="flex-1 w-100px"> |
||||
<div class="flex items-center"> |
||||
<el-tooltip content="点击可折叠/展开目标" placement="top" effect="dark"> |
||||
<el-tag |
||||
type="success" |
||||
class="mr-10px" |
||||
@click="item.hideChild = !item.hideChild" |
||||
> |
||||
O{{ i + 1 }} |
||||
</el-tag> |
||||
</el-tooltip> |
||||
|
||||
<el-input |
||||
v-model="item.objectiveName" |
||||
placeholder="目标名称" |
||||
class="flex-1 w-150px" |
||||
:disabled="!!item.objectiveId" |
||||
/> |
||||
<el-select |
||||
v-model="item.executor" |
||||
placeholder="选择执行人,可多选" |
||||
multiple |
||||
clearable |
||||
collapse-tags |
||||
filterable |
||||
style="width: 240px; margin-left: 10px" |
||||
> |
||||
<el-option |
||||
v-for="it in userOptions" |
||||
:key="it.id" |
||||
:label="it.name" |
||||
:value="it.id + ''" |
||||
:disabled="it.status == 1" |
||||
/> |
||||
</el-select> |
||||
<el-select |
||||
v-model="item.dataScope" |
||||
placeholder="选择权限" |
||||
clearable |
||||
filterable |
||||
style="width: 120px; margin-left: 10px" |
||||
> |
||||
<el-option label="公开" :value="1" /> |
||||
<el-option label="仅上级可见" :value="2" /> |
||||
</el-select> |
||||
<div class="ml-10px"> |
||||
<el-button type="primary" text @click="AddKR(i)">新增关键成果</el-button> |
||||
<el-button type="danger" text @click="removeObj(i)">删除目标</el-button> |
||||
</div> |
||||
</div> |
||||
<div v-if="!item.hideChild" style="background: #f0f3fa; padding-bottom: 10px"> |
||||
<div |
||||
class="ml-50px" |
||||
v-for="(kr, index) in item.keyResults" |
||||
:key="kr.keyResultId" |
||||
> |
||||
<div class="flex flex-1 items-center pb-5px pt-5px"> |
||||
<el-tag class="mr-10px">KR{{ index + 1 }}</el-tag> |
||||
<el-select |
||||
v-model="kr.keyResultName" |
||||
placeholder="选择或输入关键成果" |
||||
filterable |
||||
:props="{ value: 'keyResultId', label: 'keyResultName' }" |
||||
allow-create |
||||
:reserve-keyword="false" |
||||
class="flex-1 w-150px" |
||||
@change="krChange(i, index)" |
||||
> |
||||
<el-option |
||||
v-for="it in krOptions" |
||||
:key="it.value" |
||||
:label="it.label" |
||||
:value="it.value" |
||||
/> |
||||
</el-select> |
||||
<el-button type="danger" text @click="removeKR(i, index)"> |
||||
删除关键成果 |
||||
</el-button> |
||||
</div> |
||||
<div class="mt-5px flex items-center"> |
||||
<el-tree-select |
||||
v-model="kr.source" |
||||
:data="sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
clearable |
||||
filterable |
||||
style="width: 200px" |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
/> |
||||
<!-- <el-radio-group v-model="kr.resultType" class="ml-10px"> |
||||
<el-radio-button :value="1">目标值</el-radio-button> |
||||
<el-radio-button :value="2">是/否</el-radio-button> |
||||
</el-radio-group> --> |
||||
|
||||
<el-input |
||||
v-if="kr.resultType == 1" |
||||
v-model="kr.targetValue" |
||||
type="number" |
||||
placeholder="目标值" |
||||
class="ml-10px" |
||||
style="width: 120px" |
||||
/> |
||||
|
||||
<el-select |
||||
v-model="kr.executor" |
||||
placeholder="选择执行人,可多选" |
||||
multiple |
||||
clearable |
||||
filterable |
||||
collapse-tags |
||||
collapse-tags-tooltip |
||||
style="width: 240px; margin-left: 10px" |
||||
> |
||||
<el-option |
||||
v-for="it in userOptions" |
||||
:key="it.id" |
||||
:label="it.name" |
||||
:value="it.id + ''" |
||||
:disabled="it.status == 1" |
||||
/> |
||||
</el-select> |
||||
<el-select |
||||
v-model="kr.dataScope" |
||||
placeholder="选择权限" |
||||
clearable |
||||
filterable |
||||
style="width: 120px; margin-left: 10px" |
||||
> |
||||
<el-option label="公开" :value="1" /> |
||||
<el-option label="仅上级可见" :value="2" /> |
||||
</el-select> |
||||
<el-radio-group v-model="kr.isCount" class="ml-10px"> |
||||
<el-radio :label="true" :value="true">参与统计</el-radio> |
||||
<el-radio :label="false" :value="false">不参与统计</el-radio> |
||||
</el-radio-group> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<!-- <div class="w-100px"></div> --> |
||||
</div> |
||||
</div> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="子节点" name="childNode"> |
||||
<el-table :data="childNodeList"> |
||||
<el-table-column label="名称"> |
||||
<template #default="{ row }"> |
||||
<el-input v-model="row.nodeName" placeholder="子节点名称" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="开始日期" width="160px"> |
||||
<template #default="{ row }"> |
||||
<el-date-picker |
||||
v-model="row.startTime" |
||||
type="date" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
placeholder="选择日期时间" |
||||
style="width: 130px" |
||||
/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="截止日期" width="160px"> |
||||
<template #default="{ row }"> |
||||
<el-date-picker |
||||
v-model="row.endTime" |
||||
type="date" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
placeholder="选择日期时间" |
||||
style="width: 130px" |
||||
/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="权限" width="160px"> |
||||
<template #default="{ row }"> |
||||
<el-select v-model="row.dataScope" placeholder="请选择" style="width: 130px"> |
||||
<el-option label="公开" :value="1" /> |
||||
<el-option label="仅上级可见" :value="2" /> |
||||
</el-select> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="执行人" width="300px"> |
||||
<template #default="{ row }"> |
||||
<el-select |
||||
v-model="row.executor" |
||||
placeholder="选择执行人,可多选" |
||||
multiple |
||||
clearable |
||||
filterable |
||||
style="width: 100%" |
||||
> |
||||
<el-option |
||||
v-for="item in userOptions" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id + ''" |
||||
:disabled="item.status == 1" |
||||
/> |
||||
</el-select> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column fixed="right" label="删除" :width="100"> |
||||
<template #default="{ $index }"> |
||||
<el-button type="danger" text @click="removeChildNode($index)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogOkrInfo"> |
||||
import { |
||||
getAllNodeTree, |
||||
getOkrNodeDetail, |
||||
createOkrNode, |
||||
updateOkrNode, |
||||
getAllOkrPage, |
||||
getDefaultOkrOptions, |
||||
getChannelOptions |
||||
} from '@/api/okr/okr' |
||||
import { listToTree } from '@/utils/tree' |
||||
import { getEmployeeSimpleList } from '@/api/pers/employee' |
||||
|
||||
const { t } = useI18n() // 国际化 |
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const show = ref(false) |
||||
|
||||
watch( |
||||
() => show.value, |
||||
(newValue, oldValue) => { |
||||
if (oldValue && !newValue) { |
||||
emit('close') |
||||
} |
||||
} |
||||
) |
||||
|
||||
const title = ref('') |
||||
const formType = ref('create') |
||||
|
||||
const form = ref({}) |
||||
const formLoading = ref(false) |
||||
const rules = ref({ |
||||
nodeName: { required: true, message: '节点名称不可为空', trigger: 'blur' }, |
||||
startTime: { required: true, message: '开始日期不可为空', trigger: 'change' }, |
||||
endTime: { required: true, message: '截止日期不可为空', trigger: 'change' } |
||||
}) |
||||
|
||||
const okrKey = ref('okr') |
||||
|
||||
const parentNodeList = ref([]) |
||||
|
||||
const childNodeList = ref([]) |
||||
|
||||
const userOptions = ref([]) |
||||
const krOptions = ref([]) |
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
const sourceOptions = ref([]) |
||||
const objectList = ref([]) |
||||
function open(type, val, queryType) { |
||||
show.value = true |
||||
title.value = type == 'update' ? '修改Okr' : '新增Okr' |
||||
formType.value = type |
||||
resetForm() |
||||
getEmployeeSimpleList().then((data) => { |
||||
userOptions.value = data |
||||
}) |
||||
getAllNodeTree().then((resp) => { |
||||
parentNodeList.value = listToTree(resp.tree, { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
}) |
||||
getDefaultOkrOptions().then((resp) => { |
||||
krOptions.value = resp |
||||
}) |
||||
getChannelOptions().then((resp) => { |
||||
sourceOptions.value = listToTree(resp, { |
||||
id: 'sourceId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
}) |
||||
if (val) { |
||||
formLoading.value = true |
||||
try { |
||||
getOkrNodeDetail({ |
||||
nodeId: val, |
||||
queryType |
||||
}).then((resp) => { |
||||
form.value = resp |
||||
if (resp.objectives) { |
||||
objectList.value = resp.objectives.map((item) => ({ |
||||
...item, |
||||
keyResults: item.keyResults || [] |
||||
})) |
||||
} else { |
||||
objectList.value = [] |
||||
} |
||||
childNodeList.value = [...resp.children] |
||||
}) |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
} |
||||
function resetForm() { |
||||
form.value = { |
||||
parentId: undefined, |
||||
nodeName: undefined, |
||||
startTime: undefined, |
||||
endTime: undefined, |
||||
executor: [], |
||||
dataScope: 2 |
||||
} |
||||
} |
||||
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
||||
const formRef = ref() |
||||
/** 提交表单 */ |
||||
const emit = defineEmits(['success', 'close']) // 定义 success 事件,用于操作成功后的回调 |
||||
|
||||
function addObjective() { |
||||
objectList.value.push({ |
||||
objectiveName: '', |
||||
executor: form.value.executor || [], |
||||
keyResults: [], |
||||
dataScope: form.value.dataScope || 2 |
||||
}) |
||||
} |
||||
|
||||
function AddKR(idx) { |
||||
if (!objectList.value[idx].keyResults) { |
||||
objectList.value[idx].keyResults = [] |
||||
} |
||||
const obj = objectList.value[idx] |
||||
objectList.value[idx].keyResults.push({ |
||||
keyResultName: undefined, |
||||
resultType: 1, |
||||
source: undefined, |
||||
targetValue: undefined, |
||||
process: undefined, |
||||
currentValue: undefined, |
||||
executor: obj.executor, |
||||
dataScope: obj.dataScope, |
||||
isCount: false |
||||
}) |
||||
} |
||||
|
||||
function removeObj(idx) { |
||||
objectList.value.splice(idx, 1) |
||||
} |
||||
|
||||
function removeKR(oIdx, krIdx) { |
||||
objectList.value[oIdx].keyResults.splice(krIdx, 1) |
||||
} |
||||
|
||||
function addChildNode() { |
||||
childNodeList.value.push({ dataScope: 2 }) |
||||
} |
||||
|
||||
function removeChildNode(idx) { |
||||
childNodeList.value.splice(idx, 1) |
||||
} |
||||
|
||||
// 读取父节点的OKR,并展示出来 |
||||
function handleChangeParent() { |
||||
// 通过父节点Id,查询父节点的okr,需要继承 |
||||
if (form.value.parentId) { |
||||
getAllOkrPage({ nodeId: form.value.parentId }).then((resp) => { |
||||
objectList.value = resp |
||||
}) |
||||
} |
||||
} |
||||
|
||||
function getLastDayOfMonth(year, month) { |
||||
// 创建一个日期对象,将月份设置为指定月份的下一个月,日期设置为 0 |
||||
const date = new Date(year, month + 1, 0) |
||||
// 返回该日期对象的日期部分,即指定年月的最后一天 |
||||
return date.getDate() |
||||
} |
||||
|
||||
function krChange(idx, krIdx) { |
||||
const kr = objectList.value[idx].keyResults[krIdx] |
||||
if (kr.keyResultName) { |
||||
const obj = krOptions.value.find((item) => item.value == kr.keyResultName) |
||||
if (obj) { |
||||
kr.isSys = true |
||||
} else { |
||||
kr.isSys = false |
||||
} |
||||
} |
||||
} |
||||
|
||||
async function handleSave() { |
||||
// 校验表单 |
||||
if (!formRef.value) return |
||||
const valid = await formRef.value.validate() |
||||
if (!valid) return |
||||
|
||||
form.value.executor = form.value.executor || [] |
||||
if (form.value.executor.length > 1) { |
||||
message |
||||
.confirm('是否按照当前节点所选的多个执行人自动新增对应的员工节点?', { |
||||
type: 'warning', |
||||
showCancelButton: true, |
||||
cancelButtonText: '不新增员工节点', |
||||
confirmButtonText: '新增员工节点' |
||||
}) |
||||
.then(() => { |
||||
saveOkrData(true) |
||||
}) |
||||
.catch(() => { |
||||
saveOkrData(false) |
||||
}) |
||||
} else { |
||||
saveOkrData(false) |
||||
} |
||||
} |
||||
|
||||
async function saveOkrData(isAutoAddChild = false) { |
||||
// 提交请求 |
||||
formLoading.value = true |
||||
try { |
||||
form.value.isAutoAddChild = isAutoAddChild |
||||
form.value.objectives = objectList.value |
||||
form.value.children = childNodeList.value |
||||
if (formType.value === 'create') { |
||||
// 创建的是一级节点,且子节点为空时,自动新增12个月子节点,并且每月添加4周的周子节点 |
||||
if (!form.value.parentId) { |
||||
if (form.value.children.length == 0) { |
||||
const defaultTime = new Date(form.value.startTime) |
||||
for (let month = 0; month < 12; month++) { |
||||
form.value.children.push({ |
||||
nodeName: `${month + 1}月`, |
||||
startTime: `${defaultTime.getFullYear()}-${String(month + 1).padStart(2, '0')}-01`, |
||||
endTime: `${defaultTime.getFullYear()}-${String(month + 1).padStart( |
||||
2, |
||||
'0' |
||||
)}-${getLastDayOfMonth(defaultTime.getFullYear(), month)}`, |
||||
dataScope: form.value.dataScope, |
||||
executor: form.value.executor |
||||
// children: [ |
||||
// { |
||||
// nodeName: `${month + 1}月第1周`, |
||||
// dataScope: form.value.dataScope, |
||||
// executor: form.value.executor, |
||||
// children: [] |
||||
// }, |
||||
// { |
||||
// nodeName: `${month + 1}月第2周`, |
||||
// dataScope: form.value.dataScope, |
||||
// executor: form.value.executor, |
||||
// children: [] |
||||
// }, |
||||
// { |
||||
// nodeName: `${month + 1}月第3周`, |
||||
// dataScope: form.value.dataScope, |
||||
// executor: form.value.executor, |
||||
// children: [] |
||||
// }, |
||||
// { |
||||
// nodeName: `${month + 1}月第4周`, |
||||
// dataScope: form.value.dataScope, |
||||
// executor: form.value.executor, |
||||
// children: [] |
||||
// } |
||||
// ] |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
await createOkrNode(form.value) |
||||
message.success(t('common.createSuccess')) |
||||
} else { |
||||
await updateOkrNode(form.value) |
||||
message.success(t('common.updateSuccess')) |
||||
} |
||||
show.value = false |
||||
// 发送操作成功的事件 |
||||
emit('success') |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.dialog-okr { |
||||
.dialog-okr-header { |
||||
display: flex; |
||||
height: 51px; |
||||
min-height: 51px; |
||||
vertical-align: middle; |
||||
justify-content: space-between; |
||||
-webkit-box-align: center; |
||||
-ms-flex-align: center; |
||||
align-items: center; |
||||
padding: 0 1.25rem; |
||||
} |
||||
.dialog-okr-body { |
||||
overflow-x: hidden; |
||||
overflow-y: auto; |
||||
min-width: 1064px; |
||||
height: calc(94vh - 85px); |
||||
} |
||||
} |
||||
</style> |
@ -1,113 +0,0 @@ |
||||
<template> |
||||
<div class="h-full flex flex-col"> |
||||
<div class="flex items-center justify-between"> |
||||
<el-row> |
||||
<el-tree-select |
||||
v-model="searchForm.nodeId" |
||||
:data="peroidList" |
||||
:props="defaultProps" |
||||
:render-after-expand="false" |
||||
:default-expand-all="false" |
||||
style="width: 400px" |
||||
@change="getOkrList" |
||||
/> |
||||
</el-row> |
||||
<el-row> |
||||
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button> |
||||
<el-button type="success" @click="handleUpdateProcess">更新进度</el-button> |
||||
</el-row> |
||||
</div> |
||||
|
||||
<OkrTable ref="okrTableRef" canEdit /> |
||||
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> |
||||
<DialogOkrInfo ref="dialogOkrInfo" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="MyDuty"> |
||||
import OkrTable from './OkrTable.vue' |
||||
import DialogOkrInfo from './DialogOkrInfo.vue' |
||||
import DialogOkr from './DialogOkr.vue' |
||||
import { listToTree } from '@/utils/tree' |
||||
|
||||
import { getMyNodeTree, getMyOkrPage } from '@/api/okr/okr' |
||||
|
||||
const message = useMessage() |
||||
|
||||
const defaultProps = { |
||||
value: 'nodeId', |
||||
label: 'nodeName', |
||||
children: 'children' |
||||
} |
||||
|
||||
const okrTableRef = ref(null) |
||||
const searchForm = ref({ |
||||
nodeId: undefined |
||||
}) |
||||
|
||||
const peroidList = ref([]) |
||||
|
||||
// onMounted(() => { |
||||
handleSearchPeroid() |
||||
// }) |
||||
|
||||
function handleSearchPeroid() { |
||||
getMyNodeTree().then((resp) => { |
||||
peroidList.value = listToTree(resp?.tree || [], { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
searchForm.value.nodeId = resp.nodeId |
||||
getOkrList() |
||||
}) |
||||
} |
||||
|
||||
function getOkrList() { |
||||
getMyOkrPage(searchForm.value).then((resp) => { |
||||
const list = resp |
||||
if (list && list.length > 0) { |
||||
nextTick(() => { |
||||
okrTableRef.value.prepareData(list) |
||||
}) |
||||
} else { |
||||
// 如果没有数据,清空表格 |
||||
okrTableRef.value.prepareData([]) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
const dialogOkrInfo = ref(null) |
||||
// function handleAddNode() { |
||||
// dialogOkrInfo.value.open('create', null) |
||||
// } |
||||
|
||||
function handleEditOkr(nodeId = undefined) { |
||||
dialogOkr.value.close() |
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 1) |
||||
} |
||||
|
||||
function handleUpdateProcess() { |
||||
okrTableRef.value.updateProcess(searchForm.value.nodeId).then(() => { |
||||
message.success('更新成功') |
||||
getOkrList() |
||||
}) |
||||
} |
||||
|
||||
const dialogOkr = ref(null) |
||||
function handleShowOkr(id) { |
||||
dialogOkr.value.open({ |
||||
nodeId: id, |
||||
canEdit: true, |
||||
queryType: 1 |
||||
}) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
:deep(.el-overlay-dialog) { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
</style> |
@ -1,125 +0,0 @@ |
||||
<template> |
||||
<div class="h-full flex flex-col"> |
||||
<div class="flex items-center justify-between"> |
||||
<el-row> |
||||
<el-tree-select |
||||
v-model="searchForm.nodeId" |
||||
:data="peroidList" |
||||
:props="defaultProps" |
||||
:render-after-expand="false" |
||||
:default-expand-all="false" |
||||
style="width: 400px" |
||||
@change="nodeChange" |
||||
/> |
||||
</el-row> |
||||
<el-row> |
||||
<el-button type="info" @click="handleShowOkr(searchForm.nodeId)"> 节点详情 </el-button> |
||||
<el-button |
||||
type="warning" |
||||
v-if="currentUserId == searchForm.creatorId" |
||||
@click="handleEditOkr(searchForm.nodeId)" |
||||
> |
||||
修改当前节点 |
||||
</el-button> |
||||
</el-row> |
||||
</div> |
||||
|
||||
<OkrTable ref="okrTableRef" canEdit /> |
||||
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> |
||||
<DialogOkrInfo ref="dialogOkrInfo" @success="handleSearchPeroid" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="MySon"> |
||||
import OkrTable from './OkrTable.vue' |
||||
import DialogOkr from './DialogOkr.vue' |
||||
import DialogOkrInfo from './DialogOkrInfo.vue' |
||||
import { listToTree, findNode } from '@/utils/tree' |
||||
import { useUserStore } from '@/store/modules/user' |
||||
|
||||
import { getMySonNodeTree, getMySonOkrPage } from '@/api/okr/okr' |
||||
|
||||
const props = defineProps({ |
||||
userId: { |
||||
type: Number, |
||||
default: undefined |
||||
} |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
value: 'nodeId', |
||||
label: 'nodeName', |
||||
children: 'children' |
||||
} |
||||
|
||||
const userStore = useUserStore() |
||||
const currentUserId = userStore.getUser.id |
||||
|
||||
const okrTableRef = ref(null) |
||||
const searchForm = ref({ |
||||
nodeId: undefined |
||||
}) |
||||
|
||||
const peroidList = ref([]) |
||||
|
||||
handleSearchPeroid() |
||||
|
||||
function handleSearchPeroid() { |
||||
getMySonNodeTree({ userId: props.userId }).then((resp) => { |
||||
peroidList.value = listToTree(resp?.tree || [], { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
nodeChange(resp.nodeId) |
||||
}) |
||||
} |
||||
|
||||
function getOkrList() { |
||||
getMySonOkrPage({ |
||||
...searchForm.value, |
||||
userId: props.userId |
||||
}).then((resp) => { |
||||
if (resp && resp.length > 0) { |
||||
nextTick(() => { |
||||
okrTableRef.value.prepareData(resp) |
||||
}) |
||||
} else { |
||||
// 如果没有数据,清空表格 |
||||
okrTableRef.value.prepareData([]) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function nodeChange(nodeId) { |
||||
searchForm.value.nodeId = nodeId |
||||
getOkrList() |
||||
const currentNode = findNode(peroidList.value, (node) => { |
||||
return node.nodeId == nodeId |
||||
}) |
||||
searchForm.value.creatorId = currentNode.creatorId |
||||
} |
||||
|
||||
const dialogOkr = ref(null) |
||||
function handleShowOkr(id) { |
||||
dialogOkr.value.open({ |
||||
nodeId: id, |
||||
canEdit: true, |
||||
queryType: 2 |
||||
}) |
||||
} |
||||
|
||||
const dialogOkrInfo = ref(null) |
||||
function handleEditOkr(nodeId = undefined) { |
||||
dialogOkr.value.close() |
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
:deep(.el-overlay-dialog) { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
</style> |
@ -1,270 +0,0 @@ |
||||
<template> |
||||
<div style="height: 100vh"> |
||||
<div class="flex items-center"> |
||||
<el-popover placement="bottom" width="500px" trigger="click" @show="handleSearchPeroid"> |
||||
<template #reference> |
||||
<div class="flex items-center border-1px w-300px h-32px p-10px peroid-select"> |
||||
<Icon icon="ep:calendar" style="color: #aaa" /> |
||||
<span class="text-14px ml-10px" style="color: #aaa"> |
||||
{{ searchForm.nodeName ? searchForm.nodeName : '选择周期' }} |
||||
</span> |
||||
</div> |
||||
</template> |
||||
<div> |
||||
<div class="mt-10px" style="height: 400px"> |
||||
<el-table :data="peroidList" @row-click="handleSelectPeroid"> |
||||
<el-table-column label="节点名称"> |
||||
<template #default="{ row }"> |
||||
<el-radio v-model="searchForm.nodeId" :label="row.nodeId">{{ |
||||
row.nodeName |
||||
}}</el-radio> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="开始日期" prop="startTime" width="120" /> |
||||
<el-table-column label="截止日期" prop="endTime" width="120" /> |
||||
</el-table> |
||||
</div> |
||||
</div> |
||||
</el-popover> |
||||
<el-button class="ml-10px" type="primary" @click="handleAddNode">新建节点</el-button> |
||||
</div> |
||||
|
||||
<vue3-tree-org |
||||
ref="treeOrgRef" |
||||
:data="dataList" |
||||
center |
||||
collapsable |
||||
:default-expand-keys="lastExpendKeys" |
||||
:props="treeProps" |
||||
@on-node-click="handleClickNode" |
||||
> |
||||
<template #default="{ node }"> |
||||
<div style="cursor: pointer"> |
||||
<div class="tree-org-node__text node-label"> |
||||
<el-popover placement="right" title="目标" width="270px" trigger="hover"> |
||||
<template #reference> |
||||
<div> |
||||
<div style="max-height: 40px; overflow: hidden">{{ node.label }}</div> |
||||
<div class="tip"> 目标数: {{ getNodePropData(node.id, 'objectiveNum') }}</div> |
||||
<!-- 执行人 --> |
||||
<div class="tip"> |
||||
执行人: {{ getNodePropData(node.id, 'executorName') || '无' }} |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<template #default> |
||||
<div style="font-size: 0.875rem; line-height: 1.5"> |
||||
<div v-for="i in getNodePropData(node.id, 'objectives')" :key="i.id" class="mt-5"> |
||||
<span style="color: #aaa">{{ parseInt(i.progress) }}%</span> |
||||
<span style="margin-left: 0.5rem"> |
||||
{{ i.objectiveName }} |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</el-popover> |
||||
</div> |
||||
<div class="p-5px"> |
||||
<el-progress |
||||
type="line" |
||||
:percentage="parseInt(getNodePropData(node.id, 'progress')) || 0" |
||||
text-inside |
||||
:stroke-width="12" |
||||
/> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
</vue3-tree-org> |
||||
<DialogOkr ref="dialogOkr" @edit="handleEditOkr" /> |
||||
<DialogOkrInfo ref="dialogOkrInfo" @close="openOkr" @success="resetTreeData" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="ObjectList"> |
||||
import { Vue3TreeOrg } from 'vue3-tree-org' |
||||
import 'vue3-tree-org/lib/vue3-tree-org.css' |
||||
import DialogOkr from './DialogOkr.vue' |
||||
import DialogOkrInfo from './DialogOkrInfo.vue' |
||||
|
||||
import { getOkrRelationTree, getOkrRelationTreeChildren } from '@/api/okr/okr' |
||||
import { listToTree } from '@/utils/tree' |
||||
|
||||
const dataList = ref({}) |
||||
const helpDataList = ref([]) |
||||
const lastExpendKeys = ref([]) |
||||
const treeProps = { |
||||
children: 'children', |
||||
label: 'nodeName', |
||||
id: 'nodeId', |
||||
pid: 'parentId' |
||||
} |
||||
|
||||
const searchForm = ref({ |
||||
nodeName: '', |
||||
nodeId: null |
||||
}) |
||||
|
||||
const peroidList = ref([]) |
||||
|
||||
handleSearchPeroid() |
||||
|
||||
function handleSearchPeroid() { |
||||
lastExpendKeys.value = [] |
||||
getOkrRelationTree().then((resp) => { |
||||
peroidList.value = resp |
||||
if (resp && resp.length && !searchForm.value.nodeId) { |
||||
searchForm.value.nodeId = resp[0].nodeId |
||||
searchForm.value.nodeName = resp[0].nodeName |
||||
getOkrList() |
||||
} |
||||
}) |
||||
} |
||||
|
||||
const treeOrgRef = ref(null) |
||||
function resetTreeData() { |
||||
if (treeOrgRef.value) { |
||||
lastExpendKeys.value = treeOrgRef.value.getExpandKeys() |
||||
} |
||||
|
||||
// 重新获取tree数据 |
||||
getOkrRelationTree().then((resp) => { |
||||
peroidList.value = resp |
||||
if (resp && resp.length) { |
||||
if (!searchForm.value.nodeId) { |
||||
searchForm.value.nodeId = resp[0].nodeId |
||||
searchForm.value.nodeName = resp[0].nodeName |
||||
} |
||||
getOkrRelationTreeChildren({ |
||||
nodeId: searchForm.value.nodeId |
||||
}).then((resp) => { |
||||
const tree = listToTree(resp, { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
// // 设置展开的keys |
||||
// if (treeOrgRef.value) { |
||||
// treeOrgRef.value.setExpandKeys(lastExpendKeys.value) |
||||
// } |
||||
helpDataList.value = resp |
||||
if (tree && tree.length) { |
||||
dataList.value = tree[0] |
||||
} else { |
||||
dataList.value = {} |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function getOkrList() { |
||||
getOkrRelationTreeChildren({ |
||||
nodeId: searchForm.value.nodeId |
||||
}).then((resp) => { |
||||
const tree = listToTree(resp, { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
helpDataList.value = resp |
||||
if (tree && tree.length) { |
||||
dataList.value = tree[0] |
||||
} else { |
||||
dataList.value = {} |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function handleSelectPeroid(row) { |
||||
searchForm.value.nodeName = row.nodeName |
||||
searchForm.value.nodeId = row.nodeId |
||||
getOkrList() |
||||
} |
||||
|
||||
function getNodePropData(nodeId, prop) { |
||||
const nodeData = helpDataList.value.find((it) => it.nodeId == nodeId) |
||||
if (nodeData) { |
||||
return nodeData[prop] |
||||
} else { |
||||
return '' |
||||
} |
||||
} |
||||
|
||||
function toggleExpand(data, val) { |
||||
if (Array.isArray(data)) { |
||||
data.forEach((item) => { |
||||
item.expand = val |
||||
if (item.children) { |
||||
toggleExpand(item.children, val) |
||||
} |
||||
}) |
||||
} else { |
||||
data.expand = val |
||||
if (data.children) { |
||||
toggleExpand(data.children, val) |
||||
} |
||||
} |
||||
} |
||||
|
||||
toggleExpand(dataList.value, true) |
||||
|
||||
const dialogOkr = ref(null) |
||||
const clickNode = ref(null) |
||||
function handleClickNode(node, data) { |
||||
clickNode.value = data |
||||
openOkr() |
||||
} |
||||
|
||||
function openOkr() { |
||||
clickNode.value && |
||||
dialogOkr.value.open({ |
||||
nodeId: clickNode.value.nodeId, |
||||
queryType: 2, |
||||
canEdit: !clickNode.value.children || clickNode.value.children.length == 0 |
||||
}) |
||||
} |
||||
|
||||
const dialogOkrInfo = ref(null) |
||||
function handleAddNode() { |
||||
clickNode.value = null |
||||
dialogOkrInfo.value.open('create', null) |
||||
} |
||||
|
||||
function handleEditOkr(nodeId = undefined) { |
||||
dialogOkr.value.close() |
||||
dialogOkrInfo.value.open('update', nodeId || searchForm.value.nodeId, 2) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.peroid-select { |
||||
border-radius: 4px; |
||||
cursor: pointer; |
||||
&:hover { |
||||
border-color: var(--el-color-primary-light-5); |
||||
} |
||||
} |
||||
|
||||
.tree-org-node__text { |
||||
min-width: 200px; |
||||
min-height: 80px; |
||||
text-align: left; |
||||
font-size: 14px; |
||||
border-bottom: 1px solid #ccc; |
||||
padding: 5px; |
||||
} |
||||
.tip { |
||||
position: relative; |
||||
color: #aaa; |
||||
font-size: 0.875rem; |
||||
} |
||||
:deep(.el-progress-bar__innerText) { |
||||
display: block; |
||||
font-size: 0.75rem !important; |
||||
} |
||||
:deep(.el-overlay-dialog) { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
</style> |
@ -1,194 +0,0 @@ |
||||
<template> |
||||
<div class="flex-1 h-200px overflow-hidden"> |
||||
<el-table |
||||
ref="tableRef" |
||||
:data="okrList" |
||||
default-expand-all |
||||
row-key="id" |
||||
size="large" |
||||
height="100%" |
||||
@row-click="handleRowClick" |
||||
@expand-change="handleExpand" |
||||
> |
||||
<el-table-column label="目标/关键成果"> |
||||
<template #default="{ row, $index }"> |
||||
<span |
||||
v-if="!expandedRows[row.id]" |
||||
class="line1" |
||||
:style="{ |
||||
top: row.type == '目标' ? '30px' : 0, |
||||
height: getHeight(row, $index) |
||||
}" |
||||
></span> |
||||
<span v-if="row.type == '目标'"> |
||||
<el-tag type="success" size="small">目标</el-tag> |
||||
{{ row.name }} |
||||
</span> |
||||
<template v-else> |
||||
<span class="line2"></span> |
||||
<span> |
||||
<el-tag type="primary" size="small">关键成果</el-tag> |
||||
<span class="font-bold text-black" v-if="row.sourceName"> |
||||
【{{ row.sourceName }}】 |
||||
</span> |
||||
<span>{{ row.name }}</span> |
||||
<span v-if="row.resultType == 1">达 {{ row.targetValue }}</span> |
||||
</span> |
||||
<div class="flex items-center mt-10px ml-50px"> |
||||
<span>当前进度:</span> |
||||
<span v-if="row.isSys || !props.canEdit">{{ row.currentValue }}</span> |
||||
<el-input |
||||
v-else-if="row.resultType == 1" |
||||
v-model="row.currentValue" |
||||
clearable |
||||
size="small" |
||||
style="width: 200px" |
||||
/> |
||||
<el-radio-group |
||||
v-else-if="row.resultType == 2" |
||||
v-model="row.currentValue" |
||||
size="small" |
||||
> |
||||
<el-radio :value="1">是</el-radio> |
||||
<el-radio :value="0">否</el-radio> |
||||
</el-radio-group> |
||||
</div> |
||||
</template> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="progress" label="进度" width="200px"> |
||||
<template #default="{ row }"> |
||||
<el-progress :percentage="parseInt(row.progress) || 0" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="executorName" label="执行人" width="200px" /> |
||||
</el-table> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="OkrTable"> |
||||
import { updateOkrProgress } from '@/api/okr/okr' |
||||
|
||||
const emit = defineEmits(['rowClick']) |
||||
|
||||
const props = defineProps({ |
||||
canEdit: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}) |
||||
|
||||
const okrList = ref([]) |
||||
const helpList = ref([]) |
||||
|
||||
function prepareData(list) { |
||||
if (!list || !Array.isArray(list) || list.length === 0) { |
||||
okrList.value = [] |
||||
return |
||||
} |
||||
helpList.value = [] |
||||
expandedRows.value = {} |
||||
okrList.value = list.map((item) => { |
||||
let obj = { |
||||
id: item.objectiveId, |
||||
name: item.objectiveName, |
||||
progress: item.progress, |
||||
executorName: item.executorName, |
||||
type: '目标' |
||||
} |
||||
helpList.value.push(obj) |
||||
if (item.keyResults) { |
||||
obj.children = item.keyResults.map((child) => { |
||||
let kr = { |
||||
id: child.keyResultId, |
||||
keyResultId: child.keyResultId, |
||||
objectiveId: child.objectiveId, |
||||
nodeId: child.nodeId, |
||||
isSys: child.isSys, |
||||
processId: child.id, |
||||
name: child.keyResultShowName, |
||||
progress: child.progress, |
||||
executorName: child.executorName, |
||||
type: '关键成果', |
||||
resultType: child.resultType, |
||||
targetValue: child.targetValue, |
||||
currentValue: Number(child.currentValue), |
||||
sourceName: child.sourceName |
||||
} |
||||
helpList.value.push(kr) |
||||
return kr |
||||
}) |
||||
} |
||||
return obj |
||||
}) |
||||
} |
||||
|
||||
defineExpose({ |
||||
prepareData, |
||||
updateProcess |
||||
}) |
||||
function getHeight(row, index) { |
||||
if (helpList.value.length - 1 == index || helpList.value[index + 1].type == '目标') { |
||||
return '22px' |
||||
} else { |
||||
return '100%' |
||||
} |
||||
} |
||||
|
||||
const expandedRows = ref({}) |
||||
function handleExpand(row, expanded) { |
||||
expandedRows.value[row.id] = !expanded |
||||
} |
||||
|
||||
function updateProcess(nodeId) { |
||||
return new Promise((resolve, reject) => { |
||||
try { |
||||
let arr = [] |
||||
okrList.value.map((item) => { |
||||
arr = [...arr, ...(item.children || []).map((it) => ({ ...it, id: it.processId }))] |
||||
}) |
||||
updateOkrProgress({ |
||||
nodeId, |
||||
keyResultProgressList: arr |
||||
}).then((resp) => { |
||||
resolve(resp) |
||||
}) |
||||
} catch (error) { |
||||
reject(error) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
function handleRowClick(row) { |
||||
emit('rowClick', row) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.line1 { |
||||
position: absolute; |
||||
width: 1px; |
||||
left: 21px; |
||||
border-left: 1px dashed #ccc; |
||||
} |
||||
.line2 { |
||||
position: absolute; |
||||
width: 26px; |
||||
height: 1px; |
||||
left: 21px; |
||||
top: 22px; |
||||
border-bottom: 1px dashed #ccc; |
||||
&::after { |
||||
position: absolute; |
||||
left: 25px; |
||||
top: -3px; |
||||
display: block; |
||||
width: 6px; |
||||
height: 6px; |
||||
border-radius: 6px; |
||||
margin: 0 auto; |
||||
border: 1px solid #ddd; |
||||
content: ''; |
||||
} |
||||
} |
||||
</style> |
@ -1,77 +0,0 @@ |
||||
<template> |
||||
<div :style="{ height: `${height}px` }"> |
||||
<el-tabs tab-position="left" v-model="tabIndex" style="height: 100%"> |
||||
<el-tab-pane disabled name="-1"> |
||||
<template #label> |
||||
<div class="w-full"> |
||||
<div style="text-align: left; transform: translateX(-10px)">目标</div> |
||||
</div> |
||||
</template> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="我负责的" name="0"> |
||||
<MyDuty v-if="tabIndex == 0" /> |
||||
</el-tab-pane> |
||||
<!-- <el-tab-pane label="待办事项" name="1"> |
||||
<WaitTarget v-if="tabIndex == 1" /> |
||||
</el-tab-pane> --> |
||||
<el-tab-pane label="全部目标" name="2"> |
||||
<AllTarget v-if="tabIndex == 2" /> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="目标关系树" name="3"> |
||||
<ObjectList v-if="tabIndex == 3" /> |
||||
</el-tab-pane> |
||||
<el-tab-pane disabled v-if="employeeList.length > 0"> |
||||
<template #label> |
||||
<div class="w-full"> |
||||
<el-divider |
||||
direction="horizontal" |
||||
style="width: calc(100% + 10px) !important; transform: translateX(-10px)" |
||||
/> |
||||
<div style="text-align: left; transform: translateX(-10px)">成员</div> |
||||
</div> |
||||
</template> |
||||
</el-tab-pane> |
||||
<el-tab-pane |
||||
v-for="item in employeeList" |
||||
:key="item.userId" |
||||
:label="item.userName" |
||||
:name="item.userId" |
||||
> |
||||
<MySon v-if="tabIndex == item.userId" :userId="item.userId" /> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="OkrManagement"> |
||||
import AllTarget from './Components/AllTarget.vue' |
||||
import MyDuty from './Components/MyDuty.vue' |
||||
import MySon from './Components/MySon.vue' |
||||
import ObjectList from './Components/ObjectList.vue' |
||||
// import WaitTarget from './Components/WaitTarget.vue' |
||||
|
||||
import { getMyMemberList } from '@/api/okr/okr' |
||||
|
||||
const tabIndex = ref('0') |
||||
const height = ref(innerHeight - 115) |
||||
|
||||
const employeeList = ref([]) |
||||
onMounted(() => { |
||||
getMyMemberList().then((res) => { |
||||
employeeList.value = res |
||||
}) |
||||
}) |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
:deep(.el-tabs__content) { |
||||
height: 100%; |
||||
} |
||||
:deep(.el-tab-pane) { |
||||
height: 100%; |
||||
} |
||||
:deep(.el-popover__title) { |
||||
font-size: 0.875rem; |
||||
color: #aaa !important; |
||||
} |
||||
</style> |
@ -1,305 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<!-- <el-affix postion="top" :offset="95" target="#app" v-if="!isDetail"> --> |
||||
<div class="flex justify-between mb-4 bg-white" v-if="!isDetail"> |
||||
<b class="text-20px">{{ form.meetingId ? '修改会议' : '新增会议' }}</b> |
||||
<el-button type="success" @click="submit()">保存</el-button> |
||||
</div> |
||||
<!-- </el-affix> --> |
||||
<el-form |
||||
:model="form" |
||||
ref="formRef" |
||||
:rules="rules" |
||||
label-width="120px" |
||||
v-loading="loading" |
||||
:disabled="!!isDetail" |
||||
> |
||||
<el-row :gutter="20"> |
||||
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24"> |
||||
<el-form-item label="会议主题" prop="meetingSubject"> |
||||
<el-input v-model="form.meetingSubject" placeholder="请输入会议主题" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24"> |
||||
<el-form-item label="okr节点" prop="nodeId"> |
||||
<el-tree-select |
||||
v-model="form.nodeId" |
||||
:data="peroidList" |
||||
:props="defaultProps" |
||||
:render-after-expand="false" |
||||
:default-expand-all="false" |
||||
check-strictly |
||||
clearable |
||||
placeholder="选择OKR节点" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24"> |
||||
<el-form-item label="会议时间" prop="startTime"> |
||||
<el-date-picker |
||||
v-model="form.startTime" |
||||
type="datetime" |
||||
format="YYYY-MM-DD HH:mm" |
||||
value-format="YYYY-MM-DD HH:mm" |
||||
placeholder="请选择会议开始时间" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24"> |
||||
<el-form-item label="预计结束时间" prop="expectEndTime"> |
||||
<el-date-picker |
||||
v-model="form.expectEndTime" |
||||
type="datetime" |
||||
format="YYYY-MM-DD HH:mm" |
||||
value-format="YYYY-MM-DD HH:mm" |
||||
placeholder="请选择预计结束时间" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24"> |
||||
<el-form-item label="会议地点" prop="meetingRoom"> |
||||
<el-input v-model="form.meetingRoom" placeholder="请输入会议地点" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="6" :lg="6" :md="12" :sm="12" :xs="24"> |
||||
<el-form-item label="会议状态" prop="status"> |
||||
<el-select v-model="form.status" placeholder="请选择会议状态" style="width: 100%"> |
||||
<el-option label="未开始" value="1" /> |
||||
<el-option label="已结束" value="2" /> |
||||
<el-option label="已取消" value="3" disabled /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="预约参会人员" prop="expectUsers"> |
||||
<el-select |
||||
v-model="form.expectUsers" |
||||
placeholder="选择参会人员" |
||||
clearable |
||||
filterable |
||||
style="width: 100%" |
||||
multiple |
||||
@change="handleUserChange" |
||||
> |
||||
<el-option |
||||
v-for="item in userOptions" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id" |
||||
:disabled="item.status == 1" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0" v-if="form.meetingId"> |
||||
<el-form-item label="实际参会人员" prop="actualUsers"> |
||||
<el-checkbox-group v-model="form.actualUsers"> |
||||
<el-checkbox |
||||
v-for="item in expectUserOptions" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id" |
||||
> |
||||
{{ item.name }} |
||||
</el-checkbox> |
||||
</el-checkbox-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0" v-if="!isAllActived"> |
||||
<el-form-item label="缺席原因" prop="absentReason"> |
||||
<el-input v-model="form.absentReason" placeholder="请输入缺席原因" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row :gutter="20"> |
||||
<el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24"> |
||||
<el-form-item label="会议内容" prop="meetingContent"> |
||||
<div v-if="!!isDetail" v-dompurify-html="form.meetingContent" class="w-full"></div> |
||||
<Editor v-else v-model="form.meetingContent" height="500px" style="width: 100%" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" v-if="!!form.meetingId"> |
||||
<el-form-item label="会议纪要" prop="meetingSummary" label-width="80px"> |
||||
<!-- <div v-if="!!isDetail" v-dompurify-html="form.meetingSummary" class="w-full"></div> |
||||
<Editor v-else v-model="form.meetingSummary" height="500px" /> --> |
||||
<div v-if="!!isDetail" class="w-full">{{ form.meetingSummary }}</div> |
||||
<el-input |
||||
v-else |
||||
v-model="form.meetingSummary" |
||||
type="textarea" |
||||
placeholder="请输入会议纪要" |
||||
:maxlength="-1" |
||||
:show-word-limit="false" |
||||
:autosize="{ minRows: 20 }" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="MeetingInfo"> |
||||
import { listToTree } from '@/utils/tree' |
||||
import { getAllNodeTree } from '@/api/okr/okr' |
||||
import * as MeetingApi from '@/api/okr/meeting' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import { getEmployeeSimpleList } from '@/api/pers/employee' |
||||
import { useTagsViewStore } from '@/store/modules/tagsView' |
||||
|
||||
const route = useRoute() |
||||
const message = useMessage() |
||||
const tagsViewStore = useTagsViewStore() |
||||
|
||||
const defaultProps = { |
||||
value: 'nodeId', |
||||
label: 'nodeName', |
||||
children: 'children' |
||||
} |
||||
|
||||
const isDetail = route.query.isDetail |
||||
|
||||
onMounted(async () => { |
||||
await getOptions() |
||||
if (route.params.id && route.params.id != 0) { |
||||
// 这里可以调用API获取会议详情数据 |
||||
getMeetingInfo(route.params.id) |
||||
} else { |
||||
console.error('会议不存在') |
||||
} |
||||
}) |
||||
|
||||
const peroidList = ref([]) |
||||
function getOptions() { |
||||
return Promise.all([getAllNodeTree(), getEmployeeSimpleList()]) |
||||
.then(([okrResp, employeeResp]) => { |
||||
peroidList.value = listToTree(okrResp?.tree || [], { |
||||
id: 'nodeId', |
||||
pid: 'parentId', |
||||
children: 'children' |
||||
}) |
||||
userOptions.value = employeeResp.map((it) => ({ ...it, id: it.id + '' })) |
||||
// handleUserChange() |
||||
}) |
||||
.catch((error) => { |
||||
console.error('获取数据失败:', error) |
||||
}) |
||||
// // 获取OKR节点数据 |
||||
// getAllNodeTree().then((resp) => { |
||||
// peroidList.value = listToTree(resp?.tree || [], { |
||||
// id: 'nodeId', |
||||
// pid: 'parentId', |
||||
// children: 'children' |
||||
// }) |
||||
// }) |
||||
// // 获取人员数据 |
||||
// getEmployeeSimpleList().then((data) => { |
||||
// userOptions.value = data.map((it) => ({ ...it, id: it.id + '' })) |
||||
// }) |
||||
} |
||||
|
||||
const form = ref({ |
||||
meetingId: undefined, |
||||
meetingSubject: '', |
||||
startTime: '', |
||||
meetingRoom: '', |
||||
expectEndTime: '', |
||||
expectUsers: [], |
||||
actualUsers: [], |
||||
okrNodeName: '', |
||||
status: '1', |
||||
meetingContent: '', |
||||
meetingSummary: '', |
||||
absentReason: '' |
||||
}) |
||||
const rules = { |
||||
meetingSubject: [{ required: true, message: '请输入会议主题', trigger: 'blur' }], |
||||
startTime: [{ required: true, message: '请选择会议开始时间', trigger: 'change' }], |
||||
expectEndTime: [{ required: true, message: '请选择预计结束时间', trigger: 'change' }], |
||||
meetingRoom: [{ required: true, message: '请输入会议地点', trigger: 'blur' }], |
||||
expectUsers: [{ required: true, message: '请选择参会人员', trigger: 'change' }] |
||||
} |
||||
|
||||
const formRef = ref(null) |
||||
const userOptions = ref([]) |
||||
const expectUserOptions = ref([]) |
||||
|
||||
const isAllActived = computed(() => { |
||||
// 判断实际参会人员是否包含所有预约参会人员 |
||||
return form.value.expectUsers.every((item) => form.value.actualUsers.includes(item)) |
||||
}) |
||||
|
||||
const loading = ref(false) |
||||
// 获取详情 |
||||
const getMeetingInfo = async (meetingId) => { |
||||
try { |
||||
loading.value = true |
||||
// 调用API获取会议详情 |
||||
const resp = await MeetingApi.getMeetingDetail({ meetingId }) |
||||
loading.value = false |
||||
if (resp) { |
||||
form.value = { |
||||
...form.value, |
||||
...resp, |
||||
startTime: formatDate(resp.startTime, 'YYYY-MM-DD HH:mm'), |
||||
expectEndTime: formatDate(resp.expectEndTime, 'YYYY-MM-DD HH:mm'), |
||||
expectUsers: resp.expectUsers || [], |
||||
actualUsers: resp.actualUsers || [] |
||||
} |
||||
handleUserChange() |
||||
} |
||||
} catch (error) { |
||||
loading.value = false |
||||
console.error('获取会议详情失败:', error) |
||||
} |
||||
} |
||||
|
||||
function handleUserChange() { |
||||
// 当预约参会人员变化时,更新实际参会人员选项 |
||||
expectUserOptions.value = userOptions.value.filter((user) => |
||||
form.value.expectUsers.some((it) => it == user.id) |
||||
) |
||||
if (!isDetail) { |
||||
form.value.actualUsers = [...form.value.expectUsers] |
||||
} |
||||
} |
||||
|
||||
const router = useRouter() |
||||
async function submit() { |
||||
// 校验表单 |
||||
if (!formRef.value) return |
||||
const valid = await formRef.value.validate() |
||||
if (!valid) return |
||||
|
||||
try { |
||||
// 提交表单数据 |
||||
if (form.value.meetingId) { |
||||
if (form.value.status == 2 && !form.value.meetingSummary) { |
||||
message.error('会议结束时,会议纪要不能为空') |
||||
return |
||||
} |
||||
// 更新会议 |
||||
await MeetingApi.updateMeeting(form.value) |
||||
message.success('会议更新成功') |
||||
} else { |
||||
if (form.value.status == 1 && !form.value.meetingContent) { |
||||
message.error('预约会议时,会议内容不能为空') |
||||
return |
||||
} |
||||
form.value.actualUsers = [] |
||||
// 新增会议 |
||||
await MeetingApi.createMeeting(form.value) |
||||
message.success('会议创建成功') |
||||
} |
||||
tagsViewStore.delView(route) |
||||
const visitedViews = tagsViewStore.getVisitedViews |
||||
const latestView = visitedViews.slice(-1)[0] |
||||
router.push(latestView) |
||||
} catch (error) { |
||||
console.error('保存会议数据失败:', error) |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue