FlowDesigner.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  1. <!-- OA 竖向流程树设计器(钉钉式,无 X6) -->
  2. <template>
  3. <div class="oa-flow-designer">
  4. <p class="oa-flow-designer__hint">
  5. 点击节点配置选人;「+」插入审批 / 抄送 / 条件分支。预置角色(总经理 / 董事长)置顶。
  6. </p>
  7. <div class="oa-flow-designer__canvas">
  8. <div class="oa-flow-designer__canvas-inner">
  9. <FlowBranch
  10. :node="root"
  11. :candidates="candidates"
  12. @edit="openEdit"
  13. @remove="onRemove"
  14. @add="onAdd"
  15. />
  16. </div>
  17. </div>
  18. <el-drawer
  19. v-model="drawerVisible"
  20. size="640px"
  21. append-to-body
  22. class="oa-flow-drawer"
  23. :show-close="false"
  24. :close-on-click-modal="false"
  25. >
  26. <template #header>
  27. <div class="oa-flow-drawer__hd">
  28. <div class="oa-flow-drawer__hd-top">
  29. <div class="oa-flow-drawer__icon" aria-hidden="true">
  30. <el-icon :size="22"><UserFilled /></el-icon>
  31. </div>
  32. <div class="oa-flow-drawer__titles">
  33. <h3 class="oa-flow-drawer__title">{{ drawerTitle }}</h3>
  34. <p class="oa-flow-drawer__sub">{{ drawerSubtitle }}</p>
  35. </div>
  36. <button
  37. type="button"
  38. class="oa-flow-drawer__close"
  39. aria-label="关闭"
  40. @click="drawerVisible = false"
  41. >
  42. <el-icon :size="16"><Close /></el-icon>
  43. </button>
  44. </div>
  45. <div class="oa-flow-drawer__actions">
  46. <el-button class="btn-ghost" @click="drawerVisible = false">
  47. <el-icon><Close /></el-icon>
  48. 取消
  49. </el-button>
  50. <el-button class="btn-main" type="primary" @click="applyEdit">
  51. <el-icon><Check /></el-icon>
  52. 确定
  53. </el-button>
  54. </div>
  55. </div>
  56. </template>
  57. <el-form v-if="editing" label-position="top" class="oa-flow-drawer__form">
  58. <el-form-item label="节点名称">
  59. <el-input v-model="editing.name" maxlength="50" />
  60. </el-form-item>
  61. <template v-if="editing.type === 'approval' || editing.type === 'cc'">
  62. <el-form-item label="选人方式">
  63. <div class="assignee-seg">
  64. <button
  65. v-for="opt in assigneeTypeOptions"
  66. :key="opt.value"
  67. type="button"
  68. class="assignee-seg__item"
  69. :class="{ 'is-on': cfg.assigneeType === opt.value }"
  70. @click="setAssigneeType(opt.value)"
  71. >
  72. {{ opt.label }}
  73. </button>
  74. </div>
  75. </el-form-item>
  76. <el-form-item v-if="cfg.assigneeType === 'users'">
  77. <template #label>
  78. 指定成员
  79. <span class="form-label-tip">可多选,已选将作为本节点{{ editing.type === 'cc' ? '抄送' : '审批' }}人</span>
  80. </template>
  81. <div v-loading="userLoading" class="member-picker">
  82. <el-select
  83. v-model="memberPickBuffer"
  84. filterable
  85. clearable
  86. :loading="userLoading"
  87. placeholder="搜索姓名 / 工号,点击添加"
  88. style="width: 100%"
  89. popper-class="oa-flow-member-select-popper"
  90. @change="onMemberPick"
  91. >
  92. <el-option
  93. v-for="u in userOptions"
  94. :key="u.id"
  95. :label="memberOptionLabel(u)"
  96. :value="u.id"
  97. :disabled="(cfg.userIds || []).includes(u.id)"
  98. >
  99. <div class="member-option">
  100. <span class="member-avatar" :style="{ background: avatarColor(u.id) }">
  101. {{ avatarInitial(u.nickName) }}
  102. </span>
  103. <span class="member-option__meta">
  104. <span class="member-option__name">{{ u.nickName || '未命名' }}</span>
  105. <span v-if="memberOptionSub(u)" class="member-option__sub">
  106. {{ memberOptionSub(u) }}
  107. </span>
  108. </span>
  109. <el-tag
  110. v-if="(cfg.userIds || []).includes(u.id)"
  111. size="small"
  112. type="info"
  113. effect="plain"
  114. class="member-option__tag"
  115. >
  116. 已选
  117. </el-tag>
  118. </div>
  119. </el-option>
  120. </el-select>
  121. <div
  122. class="member-chips"
  123. :class="{ 'is-empty': !(cfg.userIds && cfg.userIds.length) }"
  124. >
  125. <template v-if="cfg.userIds && cfg.userIds.length">
  126. <span v-for="id in cfg.userIds" :key="id" class="member-chip">
  127. <span class="member-avatar member-avatar--sm" :style="{ background: avatarColor(id) }">
  128. {{ avatarInitial(resolveUser(id)?.nickName) }}
  129. </span>
  130. <span class="member-chip__name" :title="chipTitle(id)">
  131. {{ resolveUser(id)?.nickName || id }}
  132. </span>
  133. <button
  134. type="button"
  135. class="member-chip__rm"
  136. :aria-label="`移除 ${resolveUser(id)?.nickName || id}`"
  137. @click="removeMember(id)"
  138. >
  139. ×
  140. </button>
  141. </span>
  142. </template>
  143. <template v-else>暂未选择成员,请从上方搜索添加</template>
  144. </div>
  145. <p class="member-picked-count">已选 {{ cfg.userIds?.length || 0 }} 人</p>
  146. </div>
  147. </el-form-item>
  148. <el-form-item v-if="cfg.assigneeType === 'oa_roles'" label="工作流角色">
  149. <el-select
  150. v-model="cfg.oaRoleIds"
  151. multiple
  152. filterable
  153. collapse-tags
  154. collapse-tags-tooltip
  155. placeholder="选择角色"
  156. style="width: 100%"
  157. :loading="roleLoading"
  158. >
  159. <el-option-group label="预置">
  160. <el-option
  161. v-for="r in presetRoles"
  162. :key="r.id"
  163. :label="`${r.roleName}(${r.roleCode})`"
  164. :value="r.id"
  165. />
  166. </el-option-group>
  167. <el-option-group label="自定义">
  168. <el-option
  169. v-for="r in customRoles"
  170. :key="r.id"
  171. :label="`${r.roleName}(${r.roleCode})`"
  172. :value="r.id"
  173. />
  174. </el-option-group>
  175. </el-select>
  176. </el-form-item>
  177. <el-form-item v-if="editing.type === 'approval'" label="多人审批方式">
  178. <div class="sign-mode">
  179. <label
  180. class="sign-mode__card"
  181. :class="{ 'is-on': cfg.signMode === 'or' }"
  182. >
  183. <el-radio v-model="cfg.signMode" value="or">
  184. <span class="sign-mode__text">
  185. <strong>或签</strong>
  186. <span>一人通过即可进入下一节点</span>
  187. </span>
  188. </el-radio>
  189. </label>
  190. <label
  191. class="sign-mode__card"
  192. :class="{ 'is-on': cfg.signMode === 'and' }"
  193. >
  194. <el-radio v-model="cfg.signMode" value="and">
  195. <span class="sign-mode__text">
  196. <strong>会签</strong>
  197. <span>所选成员全部通过后进入下一节点</span>
  198. </span>
  199. </el-radio>
  200. </label>
  201. </div>
  202. </el-form-item>
  203. </template>
  204. <template v-if="editing.type === 'condition'">
  205. <div
  206. v-for="(g, idx) in editing.conditionGroups || []"
  207. :key="idx"
  208. class="cond-group-editor"
  209. >
  210. <el-form-item :label="`分支 ${idx + 1} 名称`">
  211. <el-input v-model="g.name" />
  212. </el-form-item>
  213. <ConditionRuleEditor
  214. v-model="g.rules"
  215. :disabled="!!g.isDefault"
  216. :candidates="candidates"
  217. :legacy-when="g.when"
  218. />
  219. <el-form-item label="默认分支">
  220. <el-switch
  221. v-model="g.isDefault"
  222. @change="(v) => onDefaultChange(idx, !!v)"
  223. />
  224. </el-form-item>
  225. </div>
  226. <el-button class="btn-ghost" @click="addConditionGroup">
  227. <el-icon><Plus /></el-icon>
  228. 增加分支
  229. </el-button>
  230. </template>
  231. <template v-if="editing.type === 'start'">
  232. <p class="muted">发起范围在「基础设置」中配置;此处节点仅作流程起点。</p>
  233. </template>
  234. </el-form>
  235. </el-drawer>
  236. </div>
  237. </template>
  238. <script setup lang="ts">
  239. import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue'
  240. import { ElMessage, ElMessageBox } from 'element-plus'
  241. import { Plus, Close, Check, UserFilled } from '@element-plus/icons-vue'
  242. import { fetchUserList } from '@/api/admin'
  243. import { fetchOaRoleList } from '@/api/oaApproval'
  244. import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
  245. import type { ConditionCandidate } from '@/components/oa-approval/oa-condition-fields'
  246. import ConditionRuleEditor from './ConditionRuleEditor.vue'
  247. import FlowBranch from './FlowBranch.vue'
  248. import {
  249. createEndNode,
  250. createNode,
  251. ensureFlowRoot,
  252. findParent,
  253. type ApproverConfig,
  254. type AssigneeType,
  255. type ConditionRule,
  256. type FlowNode
  257. } from './types'
  258. defineOptions({ name: 'OaFlowDesigner' })
  259. type UserOption = { id: string; nickName: string; userNo: string }
  260. const AVATAR_COLORS = [
  261. '#059669',
  262. '#0ea5e9',
  263. '#8b5cf6',
  264. '#d97706',
  265. '#ef4444',
  266. '#14b8a6',
  267. '#6366f1',
  268. '#ec4899'
  269. ]
  270. const props = withDefaults(
  271. defineProps<{
  272. modelValue: FlowNode | Record<string, unknown> | null
  273. candidates?: ConditionCandidate[]
  274. }>(),
  275. { candidates: () => [] }
  276. )
  277. const candidates = computed(() => props.candidates || [])
  278. const emit = defineEmits<{
  279. 'update:modelValue': [value: FlowNode]
  280. }>()
  281. const root = ref<FlowNode>(ensureFlowRoot(props.modelValue))
  282. watch(
  283. () => props.modelValue,
  284. (v) => {
  285. root.value = ensureFlowRoot(v)
  286. }
  287. )
  288. function commit() {
  289. emit('update:modelValue', root.value)
  290. }
  291. const drawerVisible = ref(false)
  292. const editing = ref<FlowNode | null>(null)
  293. const cfg = reactive<ApproverConfig>({
  294. assigneeType: 'dept_leader',
  295. userIds: [],
  296. oaRoleIds: [],
  297. signMode: 'or'
  298. })
  299. const assigneeTypeOptions: Array<{ label: string; value: AssigneeType }> = [
  300. { label: '指定成员', value: 'users' },
  301. { label: '工作流角色', value: 'oa_roles' },
  302. { label: '部门负责人', value: 'dept_leader' },
  303. { label: '发起人主管', value: 'direct_supervisor' },
  304. { label: '发起人自选', value: 'initiator_select' }
  305. ]
  306. const drawerTitle = computed(() => {
  307. const t = editing.value?.type
  308. if (t === 'start') return '发起人'
  309. if (t === 'approval') return '审批人设置'
  310. if (t === 'cc') return '抄送人设置'
  311. if (t === 'condition') return '条件分支'
  312. return '节点设置'
  313. })
  314. const drawerSubtitle = computed(() => {
  315. const t = editing.value?.type
  316. if (t === 'approval') return '配置本节点审批人与多人会签规则'
  317. if (t === 'cc') return '配置本节点抄送人'
  318. if (t === 'condition') return '配置条件分支名称与可视化规则'
  319. if (t === 'start') return '流程起点节点'
  320. return '配置流程节点'
  321. })
  322. const roleLoading = ref(false)
  323. const userLoading = ref(false)
  324. const roleOptions = ref<any[]>([])
  325. const userOptions = ref<UserOption[]>([])
  326. const memberPickBuffer = ref('')
  327. const presetRoles = computed(() =>
  328. roleOptions.value.filter((r) => r.roleKind === 'preset' || ['GM', 'CHAIRMAN'].includes(r.roleCode))
  329. )
  330. const customRoles = computed(() =>
  331. roleOptions.value.filter((r) => r.roleKind !== 'preset' && !['GM', 'CHAIRMAN'].includes(r.roleCode))
  332. )
  333. function avatarColor(id: string) {
  334. let hash = 0
  335. for (let i = 0; i < id.length; i++) hash = (hash * 31 + id.charCodeAt(i)) >>> 0
  336. return AVATAR_COLORS[hash % AVATAR_COLORS.length]
  337. }
  338. function avatarInitial(name?: string) {
  339. const t = (name || '?').trim()
  340. return t ? t.slice(0, 1) : '?'
  341. }
  342. function resolveUser(id: string) {
  343. return userOptions.value.find((u) => u.id === id)
  344. }
  345. function chipTitle(id: string) {
  346. const u = resolveUser(id)
  347. return u ? memberOptionLabel(u) : id
  348. }
  349. function memberOptionLabel(u: UserOption) {
  350. const name = (u.nickName || '').trim() || '未命名'
  351. const no = (u.userNo || '').trim()
  352. if (no && no !== name) return `${name}(${no})`
  353. return name
  354. }
  355. /** 副文案:仅展示与姓名不同的账号,避免双行同名显得拥挤 */
  356. function memberOptionSub(u: UserOption) {
  357. const name = (u.nickName || '').trim()
  358. const no = (u.userNo || '').trim()
  359. if (!no || no === name) return ''
  360. return `账号 ${no}`
  361. }
  362. function onMemberPick(id: string) {
  363. if (!id) return
  364. if (!cfg.userIds) cfg.userIds = []
  365. if (!cfg.userIds.includes(id)) cfg.userIds.push(id)
  366. nextTick(() => {
  367. memberPickBuffer.value = ''
  368. })
  369. }
  370. function removeMember(id: string) {
  371. if (!cfg.userIds) return
  372. cfg.userIds = cfg.userIds.filter((x) => x !== id)
  373. }
  374. async function setAssigneeType(type: AssigneeType) {
  375. cfg.assigneeType = type
  376. await onAssigneeTypeChange()
  377. }
  378. async function loadRoles() {
  379. roleLoading.value = true
  380. try {
  381. const res = await fetchOaRoleList({ status: '1' })
  382. roleOptions.value = res?.list || []
  383. } finally {
  384. roleLoading.value = false
  385. }
  386. }
  387. async function loadUsers() {
  388. userLoading.value = true
  389. try {
  390. const pageSize = MAX_ADMIN_LIST_PAGE_SIZE
  391. const raw: any[] = []
  392. let page = 1
  393. for (;;) {
  394. const res = await fetchUserList({ page, pageSize, status: '1' })
  395. const list = res?.list || []
  396. raw.push(...list)
  397. if (list.length < pageSize) break
  398. if (typeof res?.total === 'number' && raw.length >= res.total) break
  399. page += 1
  400. }
  401. userOptions.value = raw.map((u) => ({
  402. id: u.id,
  403. nickName: u.nickName || '',
  404. userNo: u.userNo || ''
  405. }))
  406. } finally {
  407. userLoading.value = false
  408. }
  409. }
  410. function findNode(node: FlowNode, id: string): FlowNode | null {
  411. if (node.id === id) return node
  412. if (node.child) {
  413. const f = findNode(node.child, id)
  414. if (f) return f
  415. }
  416. for (const g of node.conditionGroups || []) {
  417. if (g.child) {
  418. const f = findNode(g.child, id)
  419. if (f) return f
  420. }
  421. }
  422. return null
  423. }
  424. function onAdd(payload: { parentId: string; type: 'approval' | 'cc' | 'condition' }) {
  425. const parent = findNode(root.value, payload.parentId)
  426. if (!parent) return
  427. const neu = createNode(payload.type)
  428. const old = parent.child || createEndNode()
  429. if (payload.type === 'condition') {
  430. const groups = neu.conditionGroups || []
  431. const def = groups.find((g) => g.isDefault) || groups[groups.length - 1]
  432. if (def) def.child = old
  433. parent.child = neu
  434. } else {
  435. neu.child = old.type === 'end' || old ? old : createEndNode()
  436. parent.child = neu
  437. }
  438. commit()
  439. }
  440. async function onRemove(nodeId: string) {
  441. const target = findNode(root.value, nodeId)
  442. if (!target || target.type === 'start' || target.type === 'end') {
  443. ElMessage.warning('该节点不可删除')
  444. return
  445. }
  446. await ElMessageBox.confirm(`确定删除节点「${target.name}」吗?`, '提示', { type: 'warning' })
  447. const parent = findParent(root.value, nodeId)
  448. if (!parent) return
  449. const splice = target.child || createEndNode()
  450. if (parent.type === 'condition') {
  451. for (const g of parent.conditionGroups || []) {
  452. if (g.child?.id === nodeId) {
  453. g.child = splice
  454. commit()
  455. return
  456. }
  457. }
  458. }
  459. if (parent.child?.id === nodeId) {
  460. parent.child = splice
  461. commit()
  462. return
  463. }
  464. ElMessage.warning('未能定位父节点,删除失败')
  465. }
  466. async function openEdit(node: FlowNode) {
  467. editing.value = JSON.parse(JSON.stringify(node)) as FlowNode
  468. if (editing.value.type === 'condition') {
  469. editing.value.conditionGroups = (editing.value.conditionGroups || []).map((g) => ({
  470. ...g,
  471. rules: Array.isArray(g.rules) ? g.rules : []
  472. }))
  473. }
  474. const ac = editing.value.approverConfig || { assigneeType: 'dept_leader' as const }
  475. cfg.assigneeType = ac.assigneeType || 'dept_leader'
  476. cfg.userIds = [...(ac.userIds || [])]
  477. cfg.oaRoleIds = [...(ac.oaRoleIds || [])]
  478. cfg.signMode = ac.signMode || 'or'
  479. memberPickBuffer.value = ''
  480. if (cfg.assigneeType === 'users') await loadUsers()
  481. if (cfg.assigneeType === 'oa_roles') await loadRoles()
  482. drawerVisible.value = true
  483. }
  484. async function onAssigneeTypeChange() {
  485. if (cfg.assigneeType === 'users' && !userOptions.value.length) await loadUsers()
  486. if (cfg.assigneeType === 'oa_roles' && !roleOptions.value.length) await loadRoles()
  487. }
  488. function onDefaultChange(idx: number, v: boolean) {
  489. if (!editing.value?.conditionGroups || !v) return
  490. editing.value.conditionGroups.forEach((g, i) => {
  491. g.isDefault = i === idx
  492. if (g.isDefault) {
  493. g.when = ''
  494. g.rules = []
  495. }
  496. })
  497. }
  498. function sanitizeConditionRules(rules?: ConditionRule[]): ConditionRule[] {
  499. return (rules || []).filter(
  500. (r) =>
  501. !!r &&
  502. String(r.field || '').trim() &&
  503. String(r.op || '').trim() &&
  504. r.value !== '' &&
  505. r.value != null
  506. )
  507. }
  508. function addConditionGroup() {
  509. if (!editing.value) return
  510. if (!editing.value.conditionGroups) editing.value.conditionGroups = []
  511. editing.value.conditionGroups.push({
  512. name: `条件${editing.value.conditionGroups.length}`,
  513. when: '',
  514. rules: [],
  515. isDefault: false,
  516. child: createEndNode()
  517. })
  518. }
  519. function applyEdit() {
  520. if (!editing.value) return
  521. const live = findNode(root.value, editing.value.id)
  522. if (!live) {
  523. drawerVisible.value = false
  524. return
  525. }
  526. live.name = editing.value.name
  527. if (live.type === 'approval' || live.type === 'cc') {
  528. live.approverConfig = {
  529. assigneeType: cfg.assigneeType,
  530. userIds: cfg.assigneeType === 'users' ? [...(cfg.userIds || [])] : undefined,
  531. oaRoleIds: cfg.assigneeType === 'oa_roles' ? [...(cfg.oaRoleIds || [])] : undefined,
  532. signMode: live.type === 'approval' ? cfg.signMode || 'or' : undefined
  533. }
  534. }
  535. if (live.type === 'condition' && editing.value.conditionGroups) {
  536. const oldGroups = live.conditionGroups || []
  537. live.conditionGroups = editing.value.conditionGroups.map((g, i) => {
  538. const isDefault = !!g.isDefault
  539. return {
  540. ...g,
  541. isDefault,
  542. when: '',
  543. rules: isDefault ? [] : sanitizeConditionRules(g.rules),
  544. child: oldGroups[i]?.child || g.child || createEndNode()
  545. }
  546. })
  547. }
  548. commit()
  549. drawerVisible.value = false
  550. }
  551. onMounted(() => {
  552. commit()
  553. })
  554. </script>
  555. <style scoped lang="scss">
  556. .oa-flow-designer {
  557. display: flex;
  558. flex-direction: column;
  559. width: 100%;
  560. height: calc(100vh - 200px);
  561. min-height: 480px;
  562. }
  563. .oa-flow-designer__hint {
  564. flex-shrink: 0;
  565. margin: 0 0 12px;
  566. color: var(--mint-text-muted, #94a3b8);
  567. font-size: 13px;
  568. }
  569. .oa-flow-designer__canvas {
  570. flex: 1 1 auto;
  571. width: 100%;
  572. min-width: 0;
  573. min-height: 0;
  574. overflow: auto;
  575. background: #f8fafc;
  576. border: 1px solid var(--mint-border, #e2e8f0);
  577. border-radius: 10px;
  578. }
  579. .oa-flow-designer__canvas-inner {
  580. display: flex;
  581. justify-content: center;
  582. box-sizing: border-box;
  583. width: max-content;
  584. min-width: 100%;
  585. padding: 24px 16px;
  586. }
  587. .oa-flow-drawer__form {
  588. :deep(.el-form-item) {
  589. margin-bottom: 18px;
  590. }
  591. :deep(.el-form-item__content) {
  592. width: 100%;
  593. }
  594. }
  595. .assignee-seg {
  596. display: grid;
  597. grid-template-columns: repeat(5, minmax(0, 1fr));
  598. gap: 10px;
  599. width: 100%;
  600. }
  601. .assignee-seg__item {
  602. box-sizing: border-box;
  603. width: 100%;
  604. min-width: 0;
  605. padding: 12px 6px;
  606. color: var(--mint-text-muted, #64748b);
  607. font: inherit;
  608. font-size: 12px;
  609. line-height: 1.35;
  610. text-align: center;
  611. white-space: nowrap;
  612. background: #fff;
  613. border: 1px solid var(--mint-border, #e2e8f0);
  614. border-radius: 8px;
  615. cursor: pointer;
  616. transition: 0.15s ease;
  617. &:hover {
  618. color: var(--mint-text, #0f172a);
  619. border-color: #a7f3d0;
  620. }
  621. &.is-on {
  622. color: var(--primary-dark, #059669);
  623. font-weight: 600;
  624. background: var(--primary-bg, #ecfdf5);
  625. border-color: var(--primary, #10b981);
  626. }
  627. }
  628. .member-picker {
  629. width: 100%;
  630. }
  631. .member-option {
  632. display: flex;
  633. gap: 12px;
  634. align-items: center;
  635. width: 100%;
  636. min-height: 40px;
  637. padding: 4px 0;
  638. }
  639. .member-option__meta {
  640. display: flex;
  641. flex: 1;
  642. flex-direction: column;
  643. gap: 2px;
  644. justify-content: center;
  645. min-width: 0;
  646. line-height: 1.35;
  647. }
  648. .member-option__name {
  649. overflow: hidden;
  650. font-size: 13px;
  651. font-weight: 600;
  652. white-space: nowrap;
  653. text-overflow: ellipsis;
  654. }
  655. .member-option__sub {
  656. overflow: hidden;
  657. color: var(--mint-text-muted, #64748b);
  658. font-size: 12px;
  659. white-space: nowrap;
  660. text-overflow: ellipsis;
  661. }
  662. .member-option__tag {
  663. flex-shrink: 0;
  664. margin-left: auto;
  665. }
  666. .member-avatar {
  667. display: inline-flex;
  668. flex-shrink: 0;
  669. align-items: center;
  670. justify-content: center;
  671. width: 36px;
  672. height: 36px;
  673. color: #fff;
  674. font-size: 13px;
  675. font-weight: 700;
  676. line-height: 1;
  677. text-align: center;
  678. border-radius: 50%;
  679. &--sm {
  680. width: 28px;
  681. height: 28px;
  682. font-size: 11px;
  683. }
  684. }
  685. .member-chips {
  686. display: flex;
  687. flex-wrap: wrap;
  688. gap: 8px;
  689. min-height: 44px;
  690. margin-top: 12px;
  691. padding: 12px;
  692. background: #f8fafc;
  693. border: 1px dashed #cbd5e1;
  694. border-radius: 8px;
  695. &.is-empty {
  696. align-items: center;
  697. justify-content: center;
  698. color: var(--mint-text-muted, #94a3b8);
  699. font-size: 13px;
  700. }
  701. }
  702. .member-chip {
  703. display: inline-flex;
  704. gap: 8px;
  705. align-items: center;
  706. max-width: 100%;
  707. padding: 4px 8px 4px 4px;
  708. background: #fff;
  709. border: 1px solid var(--mint-border, #e2e8f0);
  710. border-radius: 999px;
  711. }
  712. .member-chip__name {
  713. max-width: 120px;
  714. overflow: hidden;
  715. font-size: 13px;
  716. font-weight: 500;
  717. white-space: nowrap;
  718. text-overflow: ellipsis;
  719. }
  720. .member-chip__rm {
  721. display: grid;
  722. flex-shrink: 0;
  723. place-items: center;
  724. width: 20px;
  725. height: 20px;
  726. padding: 0;
  727. color: var(--mint-text-muted, #64748b);
  728. font-size: 14px;
  729. line-height: 1;
  730. background: #f1f5f9;
  731. border: 0;
  732. border-radius: 50%;
  733. cursor: pointer;
  734. &:hover {
  735. color: #dc2626;
  736. background: #fee2e2;
  737. }
  738. }
  739. .member-picked-count {
  740. margin: 8px 0 0;
  741. color: var(--mint-text-muted, #94a3b8);
  742. font-size: 12px;
  743. }
  744. .sign-mode {
  745. display: flex;
  746. flex-direction: column;
  747. gap: 8px;
  748. width: 100%;
  749. }
  750. .sign-mode__card {
  751. display: block;
  752. padding: 12px 14px;
  753. cursor: pointer;
  754. background: #fff;
  755. border: 1px solid var(--mint-border, #e2e8f0);
  756. border-radius: 8px;
  757. transition: 0.15s ease;
  758. &:hover {
  759. border-color: #a7f3d0;
  760. }
  761. &.is-on {
  762. background: var(--primary-bg, #ecfdf5);
  763. border-color: var(--primary, #10b981);
  764. }
  765. :deep(.el-radio) {
  766. width: 100%;
  767. height: auto;
  768. margin-right: 0;
  769. align-items: flex-start;
  770. white-space: normal;
  771. }
  772. :deep(.el-radio__label) {
  773. padding-left: 10px;
  774. }
  775. }
  776. .sign-mode__text {
  777. display: flex;
  778. flex-direction: column;
  779. gap: 2px;
  780. line-height: 1.4;
  781. strong {
  782. font-size: 13px;
  783. font-weight: 600;
  784. }
  785. span {
  786. color: var(--mint-text-muted, #64748b);
  787. font-size: 12px;
  788. font-weight: 400;
  789. }
  790. }
  791. .cond-group-editor {
  792. padding: 12px;
  793. margin-bottom: 12px;
  794. background: #f8fafc;
  795. border: 1px solid var(--mint-border, #e2e8f0);
  796. border-radius: 8px;
  797. }
  798. .muted {
  799. color: var(--mint-text-muted, #94a3b8);
  800. font-size: 13px;
  801. }
  802. </style>
  803. <!-- append-to-body 后需非 scoped,才能作用到抽屉 root -->
  804. <style lang="scss">
  805. .oa-flow-drawer {
  806. .el-drawer__header {
  807. margin-bottom: 0;
  808. padding: 0;
  809. }
  810. .el-drawer__body {
  811. padding: 20px 28px 28px;
  812. }
  813. .oa-flow-drawer__hd {
  814. padding: 18px 28px 14px;
  815. background: linear-gradient(180deg, #ecfdf5 0%, #fff 72%);
  816. border-bottom: 1px solid var(--mint-border, #e2e8f0);
  817. }
  818. .oa-flow-drawer__hd-top {
  819. display: flex;
  820. gap: 12px;
  821. align-items: flex-start;
  822. margin-bottom: 14px;
  823. }
  824. .oa-flow-drawer__icon {
  825. display: grid;
  826. flex-shrink: 0;
  827. place-items: center;
  828. width: 40px;
  829. height: 40px;
  830. color: #fff;
  831. background: var(--primary, #10b981);
  832. border-radius: 10px;
  833. box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
  834. }
  835. .oa-flow-drawer__titles {
  836. flex: 1;
  837. min-width: 0;
  838. }
  839. .oa-flow-drawer__title {
  840. margin: 0;
  841. font-size: 16px;
  842. font-weight: 700;
  843. line-height: 1.35;
  844. letter-spacing: 0.01em;
  845. }
  846. .oa-flow-drawer__sub {
  847. margin: 2px 0 0;
  848. color: var(--mint-text-muted, #64748b);
  849. font-size: 12px;
  850. line-height: 1.4;
  851. }
  852. .oa-flow-drawer__close {
  853. display: grid;
  854. flex-shrink: 0;
  855. place-items: center;
  856. width: 32px;
  857. height: 32px;
  858. padding: 0;
  859. color: var(--mint-text-muted, #64748b);
  860. background: transparent;
  861. border: 0;
  862. border-radius: 8px;
  863. cursor: pointer;
  864. &:hover {
  865. color: var(--mint-text, #0f172a);
  866. background: #f1f5f9;
  867. }
  868. }
  869. .oa-flow-drawer__actions {
  870. display: flex;
  871. gap: 8px;
  872. justify-content: flex-end;
  873. }
  874. }
  875. /* 下拉挂 body,须非 scoped */
  876. .oa-flow-member-select-popper {
  877. .el-select-dropdown__list {
  878. padding: 8px;
  879. }
  880. .el-select-dropdown__item {
  881. height: auto !important;
  882. min-height: 56px;
  883. margin-bottom: 8px;
  884. padding: 10px 12px !important;
  885. line-height: normal !important;
  886. border-radius: 8px;
  887. &:last-child {
  888. margin-bottom: 0;
  889. }
  890. &.is-disabled {
  891. opacity: 0.55;
  892. }
  893. &.hover,
  894. &:hover {
  895. background: var(--primary-bg, #ecfdf5);
  896. }
  897. }
  898. .member-option {
  899. display: flex;
  900. gap: 12px;
  901. align-items: center;
  902. width: 100%;
  903. min-height: 36px;
  904. }
  905. .member-option__meta {
  906. display: flex;
  907. flex: 1;
  908. flex-direction: column;
  909. gap: 2px;
  910. justify-content: center;
  911. min-width: 0;
  912. }
  913. .member-option__name {
  914. overflow: hidden;
  915. color: var(--mint-text, #0f172a);
  916. font-size: 13px;
  917. font-weight: 600;
  918. white-space: nowrap;
  919. text-overflow: ellipsis;
  920. }
  921. .member-option__sub {
  922. overflow: hidden;
  923. color: var(--mint-text-muted, #64748b);
  924. font-size: 12px;
  925. white-space: nowrap;
  926. text-overflow: ellipsis;
  927. }
  928. .member-option__tag {
  929. flex-shrink: 0;
  930. margin-left: auto;
  931. }
  932. .member-avatar {
  933. display: inline-flex;
  934. flex-shrink: 0;
  935. align-items: center;
  936. justify-content: center;
  937. width: 36px;
  938. height: 36px;
  939. color: #fff;
  940. font-size: 13px;
  941. font-weight: 700;
  942. line-height: 1;
  943. text-align: center;
  944. border-radius: 50%;
  945. }
  946. }
  947. </style>