This commit is contained in:
zlwu committed 2026-05-20 18:06:21 +08:00
1 parent 276299ff27
commit c6c3a37fa7
241 files changed
+17841 -15059

No files matched your search

@@ -77,7 +77,7 @@
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="openItemDialog(row)"><el-icon><Setting /></el-icon>险种价格配置</el-button>
@@ -208,7 +208,7 @@
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" align="center" header-align="center" show-overflow-tooltip />
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEditItem(row)"><el-icon><Edit /></el-icon>编辑</el-button>
<el-button class="btn-op-item" @click="handleDeleteItem(row)"><el-icon><Delete /></el-icon>删除</el-button>
@@ -26,7 +26,12 @@
/>
</el-form-item>
<el-form-item label="待办状态">
<el-select v-model="searchForm.todoStatus" placeholder="全部" clearable style="width: 100%">
<el-select
v-model="searchForm.todoStatus"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="全部" value="" />
<el-option label="未办保险" value="0" />
<el-option label="已办保险" value="1" />
@@ -58,6 +63,15 @@
>
<el-icon><EditPen /></el-icon>批量办理保险
</el-button>
<el-button
class="btn-ghost"
:loading="exportInsuranceLoading"
:disabled="selectedRows.length === 0"
@click="handleExportInsuranceSheet"
>
<el-icon><Download /></el-icon>
生成投保单
</el-button>
</div>
</div>
@@ -82,27 +96,81 @@
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column prop="protocolNo" label="采集协议号" min-width="160" align="center" header-align="center" />
<el-table-column prop="motherName" label="母亲姓名" min-width="100" align="center" header-align="center" />
<el-table-column prop="newbornDeliveryTime" label="新生儿分娩时间" min-width="160" align="center" header-align="center" />
<el-table-column prop="fullmoonDate" label="满月日期" min-width="120" align="center" header-align="center" />
<el-table-column prop="todoStatus" label="待办状态" min-width="100" align="center" header-align="center">
<el-table-column
prop="protocolNo"
label="采集协议号"
min-width="160"
align="center"
header-align="center"
/>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="newbornDeliveryTime"
label="新生儿分娩时间"
min-width="160"
align="center"
header-align="center"
/>
<el-table-column
prop="fullmoonDate"
label="满月日期"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="todoStatus"
label="待办状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.todoStatus == 1 ? 'success' : 'warning'" size="small">
{{ row.todoStatus == 1 ? '已办保险' : '未办保险' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="insuranceSubscribed" label="是否已订购保险" min-width="130" align="center" header-align="center">
<el-table-column
prop="insuranceSubscribed"
label="是否已订购保险"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.insuranceSubscribed == 1 ? 'success' : 'info'" size="small">
{{ row.insuranceSubscribed == 1 ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="insuranceCompanyName" label="保险公司" min-width="140" align="center" header-align="center" />
<el-table-column prop="insuranceType" label="保险险种" min-width="120" align="center" header-align="center" />
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column
prop="insuranceCompanyName"
label="保险公司"
min-width="140"
align="center"
header-align="center"
/>
<el-table-column
prop="insuranceType"
label="保险险种"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
label="操作"
width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -148,8 +216,12 @@
@closed="handleInsuranceDialogClosed"
>
<div v-if="isBatchMode" class="batch-insurance-tip">
将为已选 <strong>{{ batchEditingRows.length }}</strong> 条记录统一填写保险信息(适用于团体险等场景)。
<div v-if="batchProtocolSummary" class="batch-protocol-nos">{{ batchProtocolSummary }}</div>
将为已选
<strong>{{ batchEditingRows.length }}</strong>
条记录统一填写保险信息(适用于团体险等场景)。
<div v-if="batchProtocolSummary" class="batch-protocol-nos">{{
batchProtocolSummary
}}</div>
</div>
<el-form
ref="formRef"
@@ -323,7 +395,12 @@
</div>
</el-form-item>
<el-form-item label="办理备注" class="form-col-span-2">
<el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入办理备注" />
<el-input
v-model="formData.remark"
type="textarea"
:rows="3"
placeholder="请输入办理备注"
/>
</el-form-item>
</div>
</el-form>
@@ -353,6 +430,8 @@
</template>
<script setup lang="ts">
import ExcelJS from 'exceljs'
import FileSaver from 'file-saver'
import { ref, reactive, computed, nextTick, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import {
@@ -370,7 +449,10 @@
Delete
} from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import type { CollectionProtocolRow } from '@/api/collection-protocol'
import {
fetchCollectionProtocolDetail,
type CollectionProtocolRow
} from '@/api/collection-protocol'
import { fetchUploadAttachment } from '@/api/business'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
@@ -391,6 +473,7 @@
const selectedRows = ref<any[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const exportInsuranceLoading = ref(false)
function handleSelectionChange(rows: any[]) {
selectedRows.value = rows
@@ -536,6 +619,152 @@
loadData()
}
function formatYmdFromAny(val: unknown) {
const text = String(val ?? '').trim()
if (!text) return ''
const digits = text.replace(/\D/g, '')
if (digits.length >= 8) return digits.slice(0, 8)
return ''
}
function normalizeNewbornSex(val: unknown) {
const text = String(val ?? '').trim()
if (!text) return ''
if (text === '男' || text === 'M' || text === 'm' || text === '1') return '男'
if (text === '女' || text === 'F' || text === 'f' || text === '2') return '女'
return text
}
async function handleExportInsuranceSheet() {
if (!selectedRows.value.length) {
ElMessage.warning('请先选择待办记录')
return
}
exportInsuranceLoading.value = true
try {
const workbook = new ExcelJS.Workbook()
const worksheet = workbook.addWorksheet('新契约+批改')
const rows: Array<Array<string | number>> = [
[
'投保单位:安徽中科兴皖医学研究有限公司',
'',
'',
'',
'',
'',
'保单号:',
'',
'',
'',
'',
'',
'',
'',
'',
''
],
['表格中打*号是必填项', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''],
[
'序号',
'类型',
'姓名*',
'证件类型*',
'证件号码*',
'出生日期',
'性别',
'计划名称*',
'生效日期*',
'职业(职业代码)*',
'职业类别',
'特别约定*',
'手机号码',
'监护人姓名',
'监护人证件类型',
'监护人证件号码'
]
]
let index = 1
for (const row of selectedRows.value) {
const protocolId = String(row?.protocolId || row?.id || '').trim()
if (!protocolId) continue
const detail = await fetchCollectionProtocolDetail(protocolId)
const partyCustomer = (detail?.partyCustomer || {}) as Record<string, unknown>
const newbornName = String(partyCustomer.newbornName || '').trim()
if (!newbornName) continue
const newbornIdCard = String(partyCustomer.newbornIdCard || '').trim()
const newbornBirth = formatYmdFromAny(partyCustomer.newbornDeliveryTime)
const newbornSex = normalizeNewbornSex(partyCustomer.newbornSex)
const motherPhone = String(partyCustomer.motherPhone || '').trim()
const motherName = String(partyCustomer.motherName || '').trim()
const motherIdCard = String(partyCustomer.motherIdCard || '').trim()
rows.push([
index,
'新契约',
newbornName,
'身份证',
newbornIdCard,
newbornBirth,
newbornSex,
'',
'',
'1201002',
'1类',
'新保',
motherPhone,
motherName,
'身份证',
motherIdCard
])
index += 1
}
if (index === 1) {
ElMessage.warning('未找到可导出的新生儿数据')
return
}
rows.forEach((r) => worksheet.addRow(r))
worksheet.mergeCells('A1:E1')
worksheet.columns = [30, 10, 12, 12, 22, 12, 8, 14, 12, 16, 10, 10, 14, 12, 14, 22].map(
(wch) => ({ width: wch })
)
const borderStyle: Partial<ExcelJS.Borders> = {
top: { style: 'thin' },
bottom: { style: 'thin' },
left: { style: 'thin' },
right: { style: 'thin' }
}
for (let rowNum = 3; rowNum <= rows.length; rowNum += 1) {
for (let colNum = 1; colNum <= 16; colNum += 1) {
worksheet.getCell(rowNum, colNum).border = borderStyle
}
}
for (let colNum = 1; colNum <= 16; colNum += 1) {
worksheet.getCell(3, colNum).fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FFFFFF00' }
}
}
const fileName = `${new Date().toISOString().slice(0, 10).replace(/-/g, '')}投保单.xlsx`
const excelBuffer = await workbook.xlsx.writeBuffer()
const blob = new Blob([excelBuffer], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
FileSaver.saveAs(blob, fileName)
ElMessage.success(`已生成投保单,共 ${index - 1} 条`)
} catch (error) {
console.error(error)
ElMessage.error('生成投保单失败,请重试')
} finally {
exportInsuranceLoading.value = false
}
}
// ---------------------------------------------------------------------------
// 办理保险弹窗
// ---------------------------------------------------------------------------
@@ -663,8 +892,7 @@
formData.insuranceCompanyName = row.insuranceCompanyName || ''
formData.insuranceType = row.insuranceType || ''
formData.insurancePolicyNo = row.insurancePolicyNo || ''
formData.policyEffectiveDate =
row.insuranceEffectiveDate || row.policyEffectiveDate || ''
formData.policyEffectiveDate = row.insuranceEffectiveDate || row.policyEffectiveDate || ''
formData.policyExpiryDate = row.insuranceExpiryDate || row.policyExpiryDate || ''
formData.insuranceSubscribed = Number(row.insuranceSubscribed ?? 0)
formData.insuranceFee = row.insuranceFee ?? 0
@@ -127,7 +127,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="160" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="160" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
@@ -125,7 +125,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleStockIn(row)"><el-icon><Upload /></el-icon>入库</el-button>
<el-button class="btn-op-item" @click="handleStockOut(row)"><el-icon><Download /></el-icon>出库</el-button>
@@ -119,7 +119,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="140" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="140" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button
v-if="activeTab === 'pending'"
@@ -132,7 +132,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="140" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="140" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button
v-if="activeTab === 'pending'"
@@ -76,7 +76,7 @@
</template>
</el-table-column>
<el-table-column prop="makeDate" label="制作日期" width="120" align="center" header-align="center" />
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleUpload(row)">
<el-icon><Upload /></el-icon>上传储存证
@@ -72,7 +72,7 @@
<el-table-column prop="roomName" label="名称" min-width="160" align="center" header-align="center" />
<el-table-column label="等级" width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="gradeTagType(row.roomGrade)" effect="plain">
<el-tag class="clean-room-grade-tag" :class="gradeTagClass(row.roomGrade)" effect="light">
{{ gradeLabel(row.roomGrade) }}
</el-tag>
</template>
@@ -85,7 +85,7 @@
</template>
</el-table-column>
<el-table-column prop="areaSqm" label="面积(m²)" width="120" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -153,7 +153,7 @@
<el-option label="异常" value="yc" />
</el-select>
</el-form-item>
<el-form-item label="面积" prop="areaSqm">
<el-form-item label="面积(m²)" prop="areaSqm">
<el-input
type="number"
step="any"
@@ -231,7 +231,8 @@
<el-table-column prop="bodyTemp" label="体温(℃)" width="90" align="center" header-align="center">
<template #default="{ row }">{{ row.bodyTemp != null ? row.bodyTemp + '℃' : '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column prop="remark" label="备注" min-width="160" align="center" header-align="center" show-overflow-tooltip />
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleViewLog(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -374,7 +375,7 @@
import { Plus, Close, Check, View, Edit, Delete, User, OfficeBuilding, RefreshLeft, Search } from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
import { cleanRoomGradeLabel, cleanRoomGradeTagType } from '@/utils/status-tag-registry'
import { cleanRoomGradeLabel } from '@/utils/status-tag-registry'
import {
fetchCleanRoomList,
fetchCreateCleanRoom,
@@ -420,8 +421,11 @@
}
// ── 等级映射(使用 registry 函数) ──────────────────
const gradeTagType = cleanRoomGradeTagType
const gradeLabel = cleanRoomGradeLabel
const gradeTagClass = (grade?: string) => {
const code = (grade || '').toUpperCase()
return code ? `clean-room-grade-tag--${code}` : ''
}
// ── 选择 ──────────────────────────────────────────
const handleSelectionChange = (rows: any[]) => {
@@ -805,6 +809,35 @@
</script>
<style scoped lang="scss">
.clean-room-grade-tag {
border-width: 1px;
border-style: solid;
}
.clean-room-grade-tag--A {
color: #065f46;
background-color: #d1fae5;
border-color: #10b981;
}
.clean-room-grade-tag--B {
color: #047857;
background-color: #ecfdf5;
border-color: #6ee7b7;
}
.clean-room-grade-tag--C {
color: #059669;
background-color: #f0fdf4;
border-color: #a7f3d0;
}
.clean-room-grade-tag--D {
color: #10b981;
background-color: #f6fef9;
border-color: #d1fae5;
}
.clean-room-dialog-form {
:deep(.el-form-item) {
margin-bottom: 0;
@@ -74,7 +74,7 @@
<el-table-column prop="visitDate" label="到访日期" min-width="180" align="center" header-align="center" />
<el-table-column prop="visitorCount" label="人数" min-width="80" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -9,10 +9,10 @@
<section class="panel">
<div class="flex gap-4">
<!-- 左侧:库位树 -->
<!-- 左侧:库位 -->
<div class="w-[280px] shrink-0 border-r border-[var(--mint-border)] pr-4">
<div class="panel-top storage-aside__head">
<h2>库位树</h2>
<h2>库位</h2>
<el-button type="primary" size="small" @click="handleAddRoot">
<el-icon><Plus /></el-icon>
新增
@@ -92,7 +92,11 @@
</div>
<div class="storage-toolbar">
<el-button type="primary" @click="batchDialogVisible = true">
<el-button
type="primary"
:disabled="slotList.length > 0"
@click="batchDialogVisible = true"
>
批量生成格子
</el-button>
<el-button
@@ -123,14 +127,14 @@
<span class="add-icon">+</span>
</div>
<div
v-for="cell in row.cells"
v-for="(cell, cellIndex) in row.cells"
:key="cell.id"
class="shelf-cell"
:class="{ occupied: cell.slotStatus === '占用' }"
@click="handleEditSlot(cell)"
>
<button class="cell-delete-btn" @click.stop="handleDeleteSlot(cell)" title="删除">×</button>
<span class="cell-code">{{ cell.slotCode }}</span>
<span class="cell-code">{{ cellIndex + 1 }}</span>
</div>
</div>
</div>
@@ -193,6 +197,9 @@
<el-form-item label="是否存储格">
<el-switch v-model="nodeFormData.isLeaf" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="nodeFormData.orderNum" :min="0" :step="1" controls-position="right" style="width: 100%" />
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="nodeFormData.remark" placeholder="可选" />
</el-form-item>
@@ -332,7 +339,7 @@
>
<el-form :model="addRowForm" label-position="top" class="storage-dialog-form">
<el-form-item label="列数">
<el-input type="number" step="any" v-model="addRowForm.cols" :min="1" :max="20" style="width: 100%" />
<el-input type="number" step="any" v-model="addRowForm.cols" :min="1" style="width: 100%" />
</el-form-item>
<div class="storage-batch-preview">
将在当前行下方新增 <strong>{{ addRowForm.cols }}</strong> 个格子
@@ -368,6 +375,8 @@
fetchDeleteStorageFacility,
fetchStorageSlotList,
fetchBatchCreateSlots,
fetchClearStorageSlots,
fetchInsertStorageSlotRow,
fetchCreateStorageSlot,
fetchUpdateStorageSlot,
fetchDeleteStorageSlot
@@ -385,6 +394,12 @@
const treeRef = ref()
const treeKeyword = ref('')
const getNodeOrderNum = (item: any): number => {
const raw = item?.orderNum ?? item?.order_num ?? item?.sortOrder ?? item?.sort_order ?? 0
const parsed = Number(raw)
return Number.isFinite(parsed) ? parsed : 0
}
const buildTree = (list: any[]) => {
const map = new Map<string, any>()
const roots: any[] = []
@@ -399,6 +414,18 @@
roots.push(node)
}
})
const sortNodes = (nodes: any[]) => {
nodes.sort((a, b) => {
const orderDiff = getNodeOrderNum(a) - getNodeOrderNum(b)
if (orderDiff !== 0) return orderDiff
return String(a.nodeName || '').localeCompare(String(b.nodeName || ''), 'zh-Hans-CN')
})
nodes.forEach((node) => {
if (node.children?.length) sortNodes(node.children)
})
}
sortNodes(roots)
return roots
}
@@ -573,6 +600,7 @@
nodeName: '',
nodeType: 'facility',
isLeaf: 0 as 0 | 1,
orderNum: 0,
remark: ''
})
@@ -589,6 +617,7 @@
nodeName: '',
nodeType: 'facility',
isLeaf: 0,
orderNum: 0,
remark: ''
})
nodeDialogVisible.value = true
@@ -604,6 +633,7 @@
nodeName: '',
nodeType: 'layer',
isLeaf: 0,
orderNum: 0,
remark: ''
})
nodeDialogVisible.value = true
@@ -615,10 +645,11 @@
nodeDialogTitle.value = '编辑节点'
Object.assign(nodeFormData, {
id: data.id,
parentId: data.parentId || '',
parentId: data.parentId && data.parentId !== '0' ? data.parentId : '',
nodeName: data.nodeName || '',
nodeType: data.nodeType || 'facility',
isLeaf: data.isLeaf ?? 0,
orderNum: getNodeOrderNum(data),
remark: data.remark || ''
})
nodeDialogVisible.value = true
@@ -634,6 +665,7 @@
nodeName: nodeFormData.nodeName.trim(),
nodeType: nodeFormData.nodeType,
isLeaf: nodeFormData.isLeaf,
orderNum: Number(nodeFormData.orderNum) || 0,
remark: nodeFormData.remark?.trim() || undefined
}
if (isNodeEdit.value && nodeFormData.id) {
@@ -658,6 +690,7 @@
nodeName: '',
nodeType: 'facility',
isLeaf: 0,
orderNum: 0,
remark: ''
})
nodeFormRef.value?.clearValidate?.()
@@ -796,11 +829,10 @@
{ type: 'warning' }
)
clearSlotsLoading.value = true
for (const slot of slotList.value) {
await fetchDeleteStorageSlot(slot.id)
}
ElMessage.success('已清空所有格子')
slotList.value = []
const res: any = await fetchClearStorageSlots({ facilityNodeId: selectedNode.value.id })
const clearedCount = Number(res?.clearedCount ?? 0)
ElMessage.success(clearedCount > 0 ? `已清空 ${clearedCount} 个格子` : '已清空所有格子')
await loadSlots(selectedNode.value.id)
} catch (error: any) {
if (error !== 'cancel') console.error('清空失败:', error)
} finally {
@@ -863,35 +895,25 @@
if (rowIndex < 0 || rowIndex >= shelfRows.value.length) return
const currentRow = shelfRows.value[rowIndex]
const insertRowNum = currentRow.rowNum + 1
const prefix = currentRow.prefix
const numCols = addRowForm.cols
const numCols = Number(addRowForm.cols)
if (!Number.isFinite(numCols)) {
ElMessage.warning('列数必须是数字')
return
}
const normalizedCols = Math.floor(numCols)
if (normalizedCols < 1) {
ElMessage.warning('列数必须大于 0')
return
}
addSlotLoading.value = true
try {
// 1. 将当前行之后的所有行号 +1(从大到小排,避免行号冲突)
const rowsToShift = shelfRows.value
.filter((r) => r.rowNum > currentRow.rowNum)
.sort((a, b) => b.rowNum - a.rowNum)
for (const row of rowsToShift) {
for (const cell of row.cells) {
const parsed = parseSlotCode(cell.slotCode || '')
if (parsed) {
const newCode = `${parsed.prefix}${parsed.row + 1}-${parsed.col}`
await fetchUpdateStorageSlot(cell.id, { slotCode: newCode })
}
}
}
// 2. 在插入位置创建新行的格子
for (let c = 1; c <= numCols; c++) {
await fetchCreateStorageSlot({
facilityNodeId: selectedNode.value.id,
slotCode: `${prefix}${insertRowNum}-${c}`,
slotStatus: '空'
})
}
await fetchInsertStorageSlotRow({
facilityNodeId: selectedNode.value.id,
afterRowNum: currentRow.rowNum,
cols: normalizedCols,
codePrefix: currentRow.prefix || ''
})
ElMessage.success('新增行成功')
addRowDialogVisible.value = false
@@ -1174,7 +1196,7 @@
.shelf-label {
width: 28px;
flex-shrink: 0;
background: #059669;
background: #ea580c;
color: #fff;
display: flex;
align-items: center;
@@ -1193,7 +1215,7 @@
.shelf-cell {
width: 40px;
height: 40px;
border: 1px solid #d1fae5;
border: 1px solid #fed7aa;
display: flex;
flex-direction: column;
align-items: center;
@@ -1205,16 +1227,16 @@
flex-shrink: 0;
&:hover {
background: #ecfdf5;
background: #fff7ed;
}
/* 占用状态 — 深绿背景 */
/* 占用状态 — 深橙背景 */
&.occupied {
background: #059669;
border-color: #047857;
background: #ea580c;
border-color: #c2410c;
&:hover {
background: #047857;
background: #c2410c;
}
.cell-code {
@@ -1224,22 +1246,22 @@
/* 新增格子按钮 */
&--add {
border: 1px dashed #a7f3d0;
border: 1px dashed #fdba74;
background: transparent;
&:hover {
background: #ecfdf5;
border-color: #10b981;
background: #fff7ed;
border-color: #f97316;
}
.add-icon {
font-size: 20px;
color: #6ee7b7;
color: #fb923c;
line-height: 1;
}
&:hover .add-icon {
color: #10b981;
color: #f97316;
}
}
}
@@ -79,7 +79,7 @@
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="150" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -72,7 +72,7 @@
<el-table-column prop="specName" label="规格名称" min-width="150" align="center" header-align="center" />
<el-table-column prop="remark" label="备注" min-width="150" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -72,7 +72,7 @@
<el-table-column prop="productTypeName" label="类型名称" min-width="150" align="center" header-align="center" />
<el-table-column prop="remark" label="备注" min-width="150" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -116,7 +116,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
@@ -44,7 +44,7 @@
align="center"
show-overflow-tooltip
/>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEdit(row)"
><el-icon><Edit /></el-icon>编辑</el-button
@@ -130,7 +130,7 @@
<el-input v-model="row.remark" placeholder="可选" clearable />
</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ $index }">
<el-button class="btn-op-item" @click="detailItems.splice($index, 1)">
<el-icon><Delete /></el-icon>删除
@@ -77,7 +77,7 @@
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="openItemDialog(row)"><el-icon><Setting /></el-icon>项目价格配置</el-button>
@@ -209,7 +209,7 @@
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" align="center" header-align="center" show-overflow-tooltip />
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEditItem(row)"><el-icon><Edit /></el-icon>编辑</el-button>
<el-button class="btn-op-item" @click="handleDeleteItem(row)"><el-icon><Delete /></el-icon>删除</el-button>
@@ -97,7 +97,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -190,7 +190,7 @@
/>
</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ $index }">
<el-button class="btn-op-item" type="danger" link size="small" @click="detailItems.splice($index, 1)">
<el-icon><Delete /></el-icon>删除
@@ -126,7 +126,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
@@ -79,7 +79,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -71,7 +71,7 @@
<el-table-column prop="typeCode" label="类型编码" min-width="150" align="center" header-align="center" />
<el-table-column prop="typeName" label="类型名称" min-width="150" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -71,7 +71,7 @@
<el-table-column prop="categoryCode" label="分类编码" min-width="150" align="center" header-align="center" />
<el-table-column prop="categoryName" label="分类名称" min-width="150" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -110,7 +110,7 @@
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="120" align="center" header-align="center" show-overflow-tooltip />
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" header-align="center" />
<el-table-column label="操作" width="340" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="340" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleOpenConfig(row)">
<el-icon><Rank /></el-icon>路线图配置
@@ -124,7 +124,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEdit(row)">编辑</el-button>
<el-button class="btn-op-item" @click="handleDelete(row)">删除</el-button>
@@ -67,7 +67,7 @@
<el-table-column prop="completedTime" label="完成时间" min-width="170" align="center">
<template #default="{ row }">{{ row.completedTime || '—' }}</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEnterExecution(row)"><el-icon><VideoPlay /></el-icon>进入执行</el-button>
<el-button class="btn-op-item" @click="handleViewDetail(row)"><el-icon><View /></el-icon>查看详情</el-button>
@@ -55,7 +55,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
<el-table-column label="操作" width="280" fixed="right" align="center">
<el-table-column label="操作" min-width="280" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看详情</el-button>
<el-button
@@ -79,7 +79,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
+1 -1
View File
@@ -77,7 +77,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
@@ -61,7 +61,7 @@
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="320" fixed="right" align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="handleEdit(row)"><el-icon><Edit /></el-icon>编辑</el-button>
@@ -110,7 +110,7 @@
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" align="center" header-align="center" show-overflow-tooltip />
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" header-align="center" />
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
@@ -118,7 +118,7 @@
<el-table-column prop="remark" label="备注" min-width="140" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center">
<template #default="{ row }">
<template v-if="row.taskType === 'sysz' && row.taskStatus === 'dzx'">
<el-button class="btn-op-item primary" @click="handleStart(row)"><el-icon><VideoPlay /></el-icon>开始</el-button>
@@ -70,7 +70,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
<el-table-column label="操作" width="280" fixed="right" align="center">
<el-table-column label="操作" min-width="280" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button
@@ -85,7 +85,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" header-align="center" />
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEdit(row)">编辑</el-button>
<el-button class="btn-op-item" @click="handleDelete(row)">删除</el-button>
@@ -76,7 +76,7 @@
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="openItemDialog(row)"><el-icon><Setting /></el-icon>检测项目配置</el-button>
@@ -209,7 +209,7 @@
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEditItem(row)"><el-icon><Edit /></el-icon>编辑</el-button>
<el-button class="btn-op-item" @click="handleDeleteItem(row)"><el-icon><Delete /></el-icon>删除</el-button>
@@ -145,7 +145,7 @@
</template>
</el-table-column>
<el-table-column prop="createAt" label="创建时间" width="180" align="center" header-align="center" />
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="handleAddChild(row)" v-if="!row.parentId">
+1 -1
View File
@@ -71,7 +71,7 @@
<el-table-column prop="expressCode" label="快递编码" min-width="120" align="center" header-align="center" />
<el-table-column prop="expressName" label="快递名称" min-width="140" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
+2 -2
View File
@@ -214,7 +214,7 @@
<el-form-item v-if="formData.menuType === 'C'" label="组件路径">
<el-input v-model="formData.component" placeholder="请输入组件路径" />
</el-form-item>
<el-form-item v-if="formData.menuType === 'F'" label="权限标识">
<el-form-item v-if="formData.menuType !== 'M'" label="权限标识">
<el-input v-model="formData.perms" placeholder="如 system:menu:list" />
</el-form-item>
<el-form-item label="显示状态">
@@ -482,7 +482,7 @@
menuType: formData.menuType,
path: formData.path?.trim() || undefined,
component: formData.menuType === 'C' ? formData.component?.trim() || undefined : undefined,
perms: formData.menuType === 'F' ? formData.perms?.trim() || undefined : undefined,
perms: formData.menuType !== 'M' ? formData.perms?.trim() || undefined : undefined,
isFrame: formData.isFrame,
visible: formData.visible,
status: formData.status,
+1 -1
View File
@@ -78,7 +78,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="480" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="480" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="handlePostBindUsers(row)">
+1 -1
View File
@@ -139,7 +139,7 @@
</template>
</el-table-column>
<el-table-column prop="createAt" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleView(row)">查看</el-button>
<el-button class="btn-op-item" @click="handleEdit(row)">编辑</el-button>
+219 -17
View File
@@ -291,7 +291,7 @@
v-model="dataScopeUserKeyword"
class="data-scope-user-filter"
clearable
placeholder="按姓名、账号过滤"
placeholder="按姓名、工号、联系方式过滤"
/>
<div class="data-scope-user-list-wrap">
<el-checkbox-group
@@ -358,9 +358,48 @@
v-model:visible="viewVisible"
:title="viewRow?.roleName || '角色详情'"
:icon="Stamp"
:meta="`数据权限:${dataScopeLabel(viewRow?.dataScope || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
width="860px"
:meta="`数据权限:${dataScopeLabel(viewDataScopeCode || viewRow?.dataScope || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
/>
>
<template #menuTree>
<div v-loading="viewDetailLoading" class="role-view-tree-block">
<div v-if="viewMenuTreeData.length" class="role-view-tree-scroll">
<el-tree
:key="'menu-' + viewTreeRenderKey"
ref="viewMenuTreeRef"
class="role-view-readonly-tree"
show-checkbox
:data="viewMenuTreeData"
node-key="id"
:props="{ label: 'menuName', children: 'children' }"
:default-checked-keys="viewMenuCheckedKeys"
default-expand-all
/>
</div>
<el-empty v-else-if="!viewDetailLoading" description="暂无菜单数据" :image-size="40" />
</div>
</template>
<template #customDeptTree>
<div v-loading="viewDetailLoading" class="role-view-tree-block">
<div v-if="viewDeptTreeData.length" class="role-view-tree-scroll">
<el-tree
:key="'dept-' + viewTreeRenderKey"
ref="viewDeptTreeRef"
class="role-view-readonly-tree"
show-checkbox
check-strictly
:data="viewDeptTreeData"
node-key="id"
:props="{ label: 'deptName', children: 'children' }"
:default-checked-keys="viewDeptCheckedKeys"
default-expand-all
/>
</div>
<el-empty v-else-if="!viewDetailLoading" description="暂无部门数据" :image-size="40" />
</div>
</template>
</SystemViewDialog>
</section>
</div>
</template>
@@ -369,7 +408,9 @@
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Close, Check, DataAnalysis, View, Stamp, RefreshLeft, Search } from '@element-plus/icons-vue'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import SystemViewDialog, {
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { buildPathLabelMapFromTreeRoots } from '@/utils/tree-path'
@@ -433,7 +474,15 @@
const deptTreeRef = ref()
const deptTreeData = ref<Api.Dept.DeptItem[]>([])
const allUsers = ref<
Array<{ id: string; nickName: string; userNo: string; deptId: string; deptName?: string }>
Array<{
id: string
nickName: string
userNo: string
deptId: string
deptName?: string
phoneNo: string
status: string
}>
>([])
const scopeDeptCheckedKeys = ref<string[]>([])
const scopeUserCheckedKeys = ref<string[]>([])
@@ -499,7 +548,8 @@
if (!kw) return true
const name = (u.nickName || '').toLowerCase()
const no = (u.userNo || '').toLowerCase()
return name.includes(kw) || no.includes(kw)
const phone = (u.phoneNo || '').toLowerCase()
return name.includes(kw) || no.includes(kw) || phone.includes(kw)
})
})
@@ -547,10 +597,21 @@
dataScopeSelectedDeptRows.value.length > 0 || dataScopeSelectedUserSummaries.value.length > 0
)
function userOptionLabel(u: { id: string; nickName: string; userNo: string; deptName?: string }) {
const base = u.nickName || u.userNo || u.id
if (u.deptName) return `${base}(${u.deptName})`
return base
function userStatusText(status: string | undefined) {
return status === '1' ? '正常' : '停用'
}
function userOptionLabel(u: {
id: string
nickName: string
userNo: string
phoneNo?: string
status?: string
}) {
const name = u.nickName || u.userNo || u.id
const no = u.userNo || '—'
const phone = u.phoneNo || '—'
return `${name}(${no}、${phone}、${userStatusText(u.status)})`
}
function handleDataScopeDeptNodeClick(data: Api.Dept.DeptItem) {
@@ -634,7 +695,7 @@
if (isEdit.value && editingId.value) {
await fetchUpdateRole(editingId.value, payload)
} else {
await fetchCreateRole(payload)
await fetchCreateRole({ ...payload, dataScope: '4' })
}
dialogVisible.value = false
await loadData()
@@ -706,7 +767,15 @@
* 分页拉取租户用户列表供「数据权限」多选;单页 pageSize 超过 100 时接口会 422。
*/
async function fetchAllUsersForDataScope(): Promise<
Array<{ id: string; nickName: string; userNo: string; deptId: string; deptName?: string }>
Array<{
id: string
nickName: string
userNo: string
deptId: string
deptName?: string
phoneNo: string
status: string
}>
> {
const pageSize = MAX_ADMIN_LIST_PAGE_SIZE
const raw: any[] = []
@@ -724,7 +793,9 @@
deptId: u.deptId || '',
nickName: u.nickName || u.realName || '',
userNo: u.userNo || '',
deptName: u.deptName
deptName: u.deptName,
phoneNo: u.phoneNo || '',
status: u.status || '0'
}))
}
@@ -794,27 +865,127 @@
// ---- 查看弹窗 ----
const viewVisible = ref(false)
const viewRow = ref<Api.Role.RoleItem | null>(null)
const viewDetailLoading = ref(false)
const viewDataScopeCode = ref('')
const viewMenuTreeData = ref<Api.Menu.MenuItem[]>([])
const viewMenuCheckedKeys = ref<string[]>([])
const viewDeptTreeData = ref<Api.Dept.DeptItem[]>([])
const viewDeptCheckedKeys = ref<string[]>([])
const viewCustomUserLabels = ref<string[]>([])
const viewMenuTreeRef = ref()
const viewDeptTreeRef = ref()
const viewTreeRenderKey = ref(0)
const viewSections = computed(() => {
const viewSections = computed((): ViewSection[] => {
const row = viewRow.value
if (!row) return []
return [
const loadingText = '加载中…'
const scopeCode = viewDataScopeCode.value || row.dataScope
const dataFields: ViewSection['fields'] = [
{
label: '权限范围',
value: viewDetailLoading.value ? loadingText : dataScopeLabel(scopeCode),
tagType: viewDetailLoading.value ? undefined : dataScopeTagType(scopeCode)
}
]
if (scopeCode === '5') {
dataFields.push({
label: '自定义用户',
span: true,
...(viewDetailLoading.value
? { value: loadingText }
: viewCustomUserLabels.value.length
? { items: viewCustomUserLabels.value }
: { value: '—' })
})
}
const sections: ViewSection[] = [
{
title: '基本信息',
fields: [
{ label: '角色名称', value: row.roleName },
{ label: '数据权限', value: dataScopeLabel(row.dataScope) },
{ label: '状态', value: row.status === '1' ? '正常' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{
label: '状态',
value: row.status === '1' ? '正常' : '停用',
tagType: row.status === '1' ? ('success' as const) : ('info' as const)
},
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
]
},
{
title: '菜单权限',
titleStyle: 'field',
fields: [],
slot: 'menuTree'
},
{
title: '数据权限',
fields: dataFields,
...(scopeCode === '5'
? {
slot: 'customDeptTree',
slotTitle: '自定义部门',
slotTitleStyle: 'field' as const
}
: {})
}
]
return sections
})
/** 异步灌入勾选数据后重挂载树并同步勾选态(只读展示) */
async function syncViewReadonlyTreeChecks() {
viewTreeRenderKey.value += 1
await nextTick()
viewMenuTreeRef.value?.setCheckedKeys?.(viewMenuCheckedKeys.value, true)
viewDeptTreeRef.value?.setCheckedKeys?.(viewDeptCheckedKeys.value)
}
async function loadViewDetail(row: Api.Role.RoleItem) {
viewDetailLoading.value = true
viewDataScopeCode.value = row.dataScope || ''
viewMenuTreeData.value = []
viewMenuCheckedKeys.value = []
viewDeptTreeData.value = []
viewDeptCheckedKeys.value = []
viewCustomUserLabels.value = []
try {
const [menuTree, menuRes, scopeRes] = await Promise.all([
fetchMenuTree(),
fetchRoleMenuIds(row.id),
fetchRoleDataScope(row.id)
])
viewMenuTreeData.value = menuTree || []
viewMenuCheckedKeys.value = [...(menuRes?.menuIds || [])]
const scope = scopeRes?.dataScope || row.dataScope
viewDataScopeCode.value = scope
if (scope === '5') {
const [deptTree, users] = await Promise.all([fetchDeptTree(), fetchAllUsersForDataScope()])
const details = scopeRes?.scopeDetails || []
viewDeptTreeData.value = deptTree || []
viewDeptCheckedKeys.value = details
.filter((d) => d.scopeType === 'dept')
.map((d) => d.scopeValue)
const userLabels = details
.filter((d) => d.scopeType === 'user')
.map((d) => {
const u = users.find((x) => x.id === d.scopeValue)
return u ? userOptionLabel(u) : d.scopeValue
})
viewCustomUserLabels.value = userLabels
}
await syncViewReadonlyTreeChecks()
} finally {
viewDetailLoading.value = false
}
}
function handleView(row: Api.Role.RoleItem) {
viewRow.value = row
viewVisible.value = true
loadViewDetail(row)
}
onMounted(() => {
@@ -897,6 +1068,11 @@
.data-scope-user-row {
padding: 4px 0;
:deep(.el-checkbox__label) {
line-height: 1.45;
white-space: normal;
}
}
.data-scope-selection-summary {
@@ -949,4 +1125,30 @@
line-height: 1.5;
color: var(--mint-text-muted, var(--el-text-color-secondary));
}
.role-view-tree-block {
min-height: 48px;
}
.role-view-tree-scroll {
max-height: 320px;
overflow-y: auto;
padding: 8px;
border: 1px solid var(--el-border-color-lighter);
border-radius: 8px;
}
.role-view-readonly-tree {
:deep(.el-tree-node__content) {
cursor: default;
}
:deep(.el-checkbox) {
pointer-events: none;
}
:deep(.el-tree-node__expand-icon) {
pointer-events: auto;
}
}
</style>
+1 -1
View File
@@ -86,7 +86,7 @@
<el-table-column prop="contactName" label="联系人" min-width="100" align="center" header-align="center" />
<el-table-column prop="contactPhone" label="联系电话" min-width="140" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="handleEdit(row)">编辑</el-button>
+1 -1
View File
@@ -71,7 +71,7 @@
<el-table-column prop="unitName" label="单位名称" min-width="150" align="center" header-align="center" />
<el-table-column prop="unitCode" label="单位编码" min-width="120" align="center" header-align="center" />
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="320" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="320" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"
><el-icon><View /></el-icon>查看</el-button
+1 -1
View File
@@ -106,7 +106,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="180" align="center" header-align="center" />
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
<el-button class="btn-op-item primary" @click="handleEdit(row)">编辑</el-button>
@@ -97,7 +97,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="160" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="160" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"><el-icon><View /></el-icon>查看详情</el-button>
</template>
@@ -109,7 +109,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleDesign(row)"><el-icon><SetUp /></el-icon>流程设计</el-button>
<el-button class="btn-op-item" @click="handleEdit(row)"><el-icon><Edit /></el-icon>编辑</el-button>
@@ -98,7 +98,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"><el-icon><View /></el-icon>查看详情</el-button>
</template>
@@ -86,7 +86,7 @@
align="center"
header-align="center"
/>
<el-table-column label="操作" width="260" fixed="right" align="center" header-align="center">
<el-table-column label="操作" min-width="260" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleApprove(row)"><el-icon><EditPen /></el-icon>审批</el-button>
<el-button class="btn-op-item" @click="handleViewDetail(row)"><el-icon><View /></el-icon>查看详情</el-button>