Merge branch 'master' of https://git.evo-techina.com/sgc/mes-vue
This commit is contained in:
commit
99cb8771eb
46
src/api/dashboard.ts
Normal file
46
src/api/dashboard.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
|
||||
|
||||
//工单统计
|
||||
export function getorders() {
|
||||
return request({
|
||||
url: '/biz/dashboard/total-orders',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getsctotal(params:any) {
|
||||
return request({
|
||||
url: '/biz/dashboard/stats',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
//获取产能达成率
|
||||
export function getachievement(params:any) {
|
||||
return request({
|
||||
url: '/biz/dashboard/achievement-rate',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 累计质检异常列表
|
||||
export function getquality(params:any) {
|
||||
return request({
|
||||
url: '/biz/dashboard/total-quality-list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 未关闭质检异常列表
|
||||
export function getopenquality(params:any) {
|
||||
return request({
|
||||
url: 'biz/dashboard/open-quality-list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -79,5 +79,9 @@ export const errorNotificationApi = {
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/errorNotification/template`, method: 'get', responseType: 'blob' })
|
||||
},
|
||||
//获取检查项
|
||||
getopt() {
|
||||
return request({ url: `/biz/errorNotification/options`, method: 'get' })
|
||||
}
|
||||
}
|
||||
72
src/api/permissionConfig.ts
Normal file
72
src/api/permissionConfig.ts
Normal file
@ -0,0 +1,72 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
// 数据权限配置 类型定义
|
||||
export interface PermissionConfig {
|
||||
id?: number
|
||||
|
||||
mapperKey?: string
|
||||
|
||||
controlMethod?: string
|
||||
|
||||
permissionControl?: string
|
||||
|
||||
}
|
||||
|
||||
// 数据权限配置 API
|
||||
export const permissionConfigApi = {
|
||||
// 分页查询
|
||||
page(params: { page: number; pageSize: number; mapperKey?: string; controlMethod?: string }) {
|
||||
return request({ url: '/biz/permissionConfig/page', method: 'get', params })
|
||||
},
|
||||
|
||||
// 新增
|
||||
options() {
|
||||
return request({ url: '/biz/permissionConfig/options', method: 'get' })
|
||||
},
|
||||
|
||||
// 获取详情
|
||||
detail(id: string) {
|
||||
return request({ url: `/biz/permissionConfig/${id}`, method: 'get' })
|
||||
},
|
||||
|
||||
// 新增
|
||||
create(data: PermissionConfig) {
|
||||
return request({ url: '/biz/permissionConfig', method: 'post', data })
|
||||
},
|
||||
|
||||
// 修改
|
||||
update(data: PermissionConfig) {
|
||||
return request({ url: '/biz/permissionConfig', method: 'put', data })
|
||||
},
|
||||
|
||||
// 删除
|
||||
delete(ids: string[]) {
|
||||
return request({ url: `/biz/permissionConfig/${ids.join(',')}`, method: 'delete' })
|
||||
},
|
||||
|
||||
// 导出
|
||||
export(params?: { ids?: string[]; mapperKey?: string; controlMethod?: string }) {
|
||||
const p: Record<string, any> = {}
|
||||
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if (params?.mapperKey !== undefined && params?.mapperKey !== null) p.mapperKey = params.mapperKey
|
||||
if (params?.controlMethod !== undefined && params?.controlMethod !== null) p.controlMethod = params.controlMethod
|
||||
return request({ url: `/biz/permissionConfig/export`, method: 'get', params: p, responseType: 'blob' })
|
||||
},
|
||||
|
||||
// 导入
|
||||
importData(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request<{ success: number; fail: number; errors: string[] }>({
|
||||
url: `/biz/permissionConfig/import`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/permissionConfig/template`, method: 'get', responseType: 'blob' })
|
||||
}
|
||||
}
|
||||
@ -230,6 +230,12 @@ const routes: RouteRecordRaw[] = [
|
||||
meta: { title: '甘特图排产', icon: 'CalendarOutline' }
|
||||
},
|
||||
// 开发工具
|
||||
{
|
||||
path: 'biz/permissionConfig',
|
||||
name: 'permissionConfig',
|
||||
component: () => import('@/views/biz/permissionConfig/index.vue'),
|
||||
meta: { title: '数据权限配置', icon: 'ListOutline' }
|
||||
},
|
||||
{
|
||||
path: 'tool/gen',
|
||||
name: 'ToolGen',
|
||||
|
||||
@ -860,7 +860,7 @@ function issuehand(row:any) {
|
||||
issueModel.value = true
|
||||
issarr = []
|
||||
ncid = row.id
|
||||
ncCode.value = row.code
|
||||
ncCode.value = row.ncCode
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
<!-- 搜索表单 -->
|
||||
<div class="search-form">
|
||||
<n-form inline :model="searchForm" label-placement="left">
|
||||
<n-form-item label="订阅的异常">
|
||||
<n-input v-model:value="searchForm.subscriptionKey" placeholder="请输入订阅的异常" />
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-space>
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
@ -26,7 +29,7 @@
|
||||
<template #icon><n-icon><AddOutline /></n-icon></template>
|
||||
新增
|
||||
</n-button>
|
||||
<n-button @click="importModalVisible = true">
|
||||
<!-- <n-button @click="importModalVisible = true">
|
||||
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
|
||||
导入
|
||||
</n-button>
|
||||
@ -37,7 +40,7 @@
|
||||
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
|
||||
<template #icon><n-icon><TrashOutline /></n-icon></template>
|
||||
删除
|
||||
</n-button>
|
||||
</n-button> -->
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
@ -46,9 +49,11 @@
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:bordere="false"
|
||||
striped
|
||||
remote
|
||||
:pagination="pagination"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
:row-key="(row:any) => row.id"
|
||||
@update:page="handlePageChange"
|
||||
@update:page-size="handlePageSizeChange"
|
||||
@update:checked-row-keys="handleCheck"
|
||||
@ -56,46 +61,105 @@
|
||||
</n-card>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
|
||||
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
|
||||
<n-form-item label="订阅的异常key" path="subscriptionKey">
|
||||
<n-select v-model:value="formData.subscriptionKey" placeholder="请选择订阅的异常key" :options="[]" />
|
||||
<n-modal
|
||||
v-model:show="modalVisible"
|
||||
preset="card"
|
||||
:title="modalTitle"
|
||||
style="width: 900px"
|
||||
>
|
||||
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="120px">
|
||||
<n-grid :cols="2" :x-gap="24">
|
||||
<n-gi>
|
||||
<n-form-item label="订阅的异常" path="subscriptionKey">
|
||||
<n-select
|
||||
remote
|
||||
v-model:value="formData.subscriptionKey"
|
||||
placeholder="请选择订阅的异常"
|
||||
:options="keyopt"
|
||||
@update:value="keyupdate"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="订阅的异常字段" path="subscriptionDiscoverField">
|
||||
<n-select v-model:value="formData.subscriptionDiscoverField" placeholder="请选择订阅的异常字段" :options="yiczdopt" />
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="异常名称" path="title">
|
||||
<n-input v-model:value="formData.title" placeholder="请输入异常名称" />
|
||||
</n-form-item>
|
||||
<n-form-item label="订阅的设备集合" path="subscriptionDeviceIds">
|
||||
<n-input v-model:value="formData.subscriptionDeviceIds" placeholder="请输入订阅的设备集合" />
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="订阅的设备" path="subscriptionDeviceIds">
|
||||
<!-- <n-input v-model:value="formData.subscriptionDeviceIds" placeholder="请输入订阅的设备集合" /> -->
|
||||
<n-select
|
||||
remote
|
||||
multiple
|
||||
v-model:value="formData.subscriptionDeviceIds"
|
||||
placeholder="请选择订阅的设备"
|
||||
:options="deviclist"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="订阅的异常字段" path="subscriptionDiscoverField">
|
||||
<n-select v-model:value="formData.subscriptionDiscoverField" placeholder="请选择订阅的异常字段" :options="[]" />
|
||||
</n-form-item>
|
||||
<n-form-item label="发送方式, 多选 1站内信 2终端推送 3APP 4第三方" path="sendingMethod">
|
||||
</n-gi>
|
||||
|
||||
<n-gi>
|
||||
<n-form-item label="发送方式" path="sendingMethod"> <!--, 多选 1站内信 2终端推送 3APP 4第三方-->
|
||||
<n-checkbox-group v-model:value="formData.sendingMethod">
|
||||
<n-space>
|
||||
<n-checkbox v-for="opt in sendingMethodOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-checkbox>
|
||||
</n-space>
|
||||
</n-checkbox-group>
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="检验值" path="discoverValue">
|
||||
<n-input v-model:value="formData.discoverValue" placeholder="请输入检验值" />
|
||||
</n-form-item>
|
||||
<n-form-item label="检测方法, 1大于 2大于等于 3小于 4小于等于 5不等" path="detectionMethod">
|
||||
<n-select v-model:value="formData.detectionMethod" placeholder="请选择检测方法, 1大于 2大于等于 3小于 4小于等于 5不等" :options="detectionMethodOptions" />
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="检测方法" path="detectionMethod"> <!--1大于 2大于等于 3小于 4小于等于 5不等-->
|
||||
<n-select v-model:value="formData.detectionMethod" placeholder="请选择检测方法" :options="detectionMethodOptions" /> <!--1大于 2大于等于 3小于 4小于等于 5不等-->
|
||||
</n-form-item>
|
||||
<n-form-item label="通知人集合" path="notifier">
|
||||
<n-input v-model:value="formData.notifier" placeholder="请输入通知人集合" />
|
||||
</n-form-item>
|
||||
<n-form-item label="通知内容" path="notifierContent">
|
||||
<n-input v-model:value="formData.notifierContent" type="textarea" placeholder="请输入通知内容" />
|
||||
</n-form-item>
|
||||
<n-form-item label="是否需要异常填报" path="abnormalReporting">
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="是否异常填报" path="abnormalReporting">
|
||||
<n-radio-group v-model:value="formData.abnormalReporting">
|
||||
<n-space>
|
||||
<n-radio v-for="opt in abnormalReportingOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
|
||||
</n-space>
|
||||
</n-radio-group>
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="通知人方式" path="notifierMethod">
|
||||
<n-radio-group v-model:value="formData.notifierMethod">
|
||||
<n-space>
|
||||
<n-radio :key="1" :value="1">操作人</n-radio>
|
||||
<n-radio :key="2" :value="2">设备负责人</n-radio>
|
||||
<n-radio :key="3" :value="3">指定人员</n-radio>
|
||||
</n-space>
|
||||
</n-radio-group>
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<n-form-item label="通知人" path="notifier">
|
||||
<n-select
|
||||
:disabled="formData.notifierMethod != 3"
|
||||
remote
|
||||
multiple
|
||||
v-model:value="formData.notifier"
|
||||
placeholder="请选择通知人"
|
||||
:options="userlist"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
<n-gi span="24">
|
||||
<n-form-item label="通知内容" path="notifierContent">
|
||||
<n-input v-model:value="formData.notifierContent" type="textarea" placeholder="请输入通知内容" />
|
||||
</n-form-item>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<n-space justify="end">
|
||||
@ -145,13 +209,19 @@ import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline,
|
||||
import { errorNotificationApi, type ErrorNotification } from '@/api/errorNotification'
|
||||
import { dictDataApi } from '@/api/org'
|
||||
|
||||
import { deviceApi } from '@/api/device'
|
||||
|
||||
import { userApi } from '@/api/system'
|
||||
|
||||
const message = useMessage()
|
||||
const dialog = useDialog()
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
subscriptionKey:''
|
||||
})
|
||||
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref<ErrorNotification[]>([])
|
||||
const loading = ref(false)
|
||||
@ -169,11 +239,12 @@ const modalVisible = ref(false)
|
||||
const modalTitle = ref('')
|
||||
const importModalVisible = ref(false)
|
||||
const formRef = ref()
|
||||
const defaultFormData: ErrorNotification = {
|
||||
const defaultFormData = {
|
||||
subscriptionKey: '',
|
||||
title: '',
|
||||
subscriptionDeviceIds: '',
|
||||
subscriptionDiscoverField: '',
|
||||
notifierMethod:1,
|
||||
sendingMethod: [],
|
||||
discoverValue: '',
|
||||
detectionMethod: '',
|
||||
@ -181,43 +252,164 @@ const defaultFormData: ErrorNotification = {
|
||||
notifierContent: '',
|
||||
abnormalReporting: undefined,
|
||||
}
|
||||
const formData = reactive<ErrorNotification>({ ...defaultFormData })
|
||||
let formData = reactive<any>({ ...defaultFormData })
|
||||
|
||||
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||
const sendingMethodOptions = ref<{ label: string; value: any }[]>([])
|
||||
const detectionMethodOptions = ref<{ label: string; value: any }[]>([])
|
||||
const abnormalReportingOptions = ref<{ label: string; value: any }[]>([])
|
||||
|
||||
//查询异常项
|
||||
let keyopt = ref<any>([])
|
||||
//异常子项
|
||||
let yclist = ref<any>([])
|
||||
//选中异常子项
|
||||
let yiczdopt = ref<any>({})
|
||||
errorNotificationApi.getopt().then(rps => {
|
||||
keyopt.value = rps
|
||||
rps.forEach((n:any) => {
|
||||
yclist.value[n.value] = n.childList
|
||||
})
|
||||
// keyopt.value = rps.map((n:any) => ({
|
||||
// label: n.label,
|
||||
// value: n.value
|
||||
// }))
|
||||
})
|
||||
|
||||
//获取设备列表
|
||||
let deviclist = ref<any>([])
|
||||
deviceApi.page({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
deviceCode:'',
|
||||
deviceFlag: 'mes_equipment'
|
||||
}).then(rps => {
|
||||
if(rps.list && rps.list.length > 0){
|
||||
deviclist.value = rps.list.map((n:any) => ({
|
||||
label:n.deviceName,
|
||||
value:n.id
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
//获取员工列表
|
||||
let userlist = ref<any>([])
|
||||
|
||||
userApi.getPathList().then(rps => {
|
||||
userlist.value = rps.map((n:any) =>{
|
||||
return {
|
||||
label: n.username,
|
||||
value: n.id
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
|
||||
function keyupdate(v:any,n:any) {
|
||||
formData.subscriptionDiscoverField = ''
|
||||
yiczdopt.value = n.childList
|
||||
console.log(v)
|
||||
console.log(n)
|
||||
}
|
||||
|
||||
// 表单校验规则
|
||||
const formRules = {
|
||||
}
|
||||
|
||||
// 表格列
|
||||
const columns: DataTableColumns<ErrorNotification> = [
|
||||
{ type: 'selection' },
|
||||
{ title: '订阅的异常key', key: 'subscriptionKey' },
|
||||
{ title: '异常名称', key: 'title' },
|
||||
{ title: '订阅的设备集合', key: 'subscriptionDeviceIds' },
|
||||
{ title: '订阅的异常字段', key: 'subscriptionDiscoverField' },
|
||||
{ title: '发送方式, 多选 1站内信 2终端推送 3APP 4第三方', key: 'sendingMethod',
|
||||
// {
|
||||
// type: 'selection'
|
||||
// },
|
||||
{
|
||||
align:"center",
|
||||
title: '订阅的异常',
|
||||
key: 'subscriptionName',
|
||||
minWidth:200,
|
||||
},
|
||||
{
|
||||
align:"center",
|
||||
title: '订阅的异常字段',
|
||||
key: 'subscriptionDiscoverFieldNames',
|
||||
minWidth:150
|
||||
},
|
||||
{
|
||||
align:"center",
|
||||
title: '异常名称',
|
||||
key: 'title',
|
||||
minWidth:150
|
||||
},
|
||||
{
|
||||
align:"center",
|
||||
title: '订阅的设备',
|
||||
key: 'subscriptionDeviceIds' ,
|
||||
minWidth:150,
|
||||
render(row) {
|
||||
const vals = Array.isArray(row.subscriptionDeviceIds) ? row.subscriptionDeviceIds : (row.subscriptionDeviceIds ? String(row.subscriptionDeviceIds).split(',') : [])
|
||||
return vals.map(v => deviclist.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
align:"center",
|
||||
title: '发送方式', // 1站内信 2终端推送 3APP 4第三方
|
||||
key: 'sendingMethod',
|
||||
render(row) {
|
||||
const vals = Array.isArray(row.sendingMethod) ? row.sendingMethod : (row.sendingMethod ? String(row.sendingMethod).split(',') : [])
|
||||
return vals.map(v => sendingMethodOptions.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
||||
}
|
||||
},
|
||||
{ title: '检验值', key: 'discoverValue' },
|
||||
{ title: '检测方法, 1大于 2大于等于 3小于 4小于等于 5不等', key: 'detectionMethod',
|
||||
minWidth:150
|
||||
},
|
||||
{
|
||||
title: '检验值',
|
||||
key: 'discoverValue',
|
||||
align:"center",
|
||||
minWidth:150,
|
||||
},
|
||||
{
|
||||
align:"center",
|
||||
title: '检测方法', //, 1大于 2大于等于 3小于 4小于等于 5不等
|
||||
key: 'detectionMethod',
|
||||
minWidth:150,
|
||||
render(row) {
|
||||
const val = row.detectionMethod
|
||||
const opt = detectionMethodOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
||||
return opt ? opt.label : (val ?? '-')
|
||||
}
|
||||
},
|
||||
{ title: '通知人集合', key: 'notifier' },
|
||||
{ title: '创建人', key: 'createBy' },
|
||||
{ title: '创建时间', key: 'crateTime' },
|
||||
{ title: '通知内容', key: 'notifierContent' },
|
||||
{ title: '是否需要异常填报', key: 'abnormalReporting',
|
||||
{
|
||||
title: '通知人',
|
||||
key: 'notifier',
|
||||
align:"center",
|
||||
minWidth:150,
|
||||
render(row) {
|
||||
const vals = Array.isArray(row.notifier) ? row.notifier : (row.notifier ? String(row.notifier).split(',') : [])
|
||||
return vals.map(v => userlist.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
key: 'createBy',
|
||||
minWidth:150
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'crateTime',
|
||||
minWidth:150
|
||||
},
|
||||
{
|
||||
title: '通知内容',
|
||||
key: 'notifierContent',
|
||||
minWidth:150,
|
||||
align:"center",
|
||||
},
|
||||
{
|
||||
title: '是否需要异常填报',
|
||||
key: 'abnormalReporting',
|
||||
minWidth:150,
|
||||
align:"center",
|
||||
render(row) {
|
||||
const val = row.abnormalReporting
|
||||
const opt = abnormalReportingOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
||||
@ -229,6 +421,7 @@ const columns: DataTableColumns<ErrorNotification> = [
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
align:"center",
|
||||
render(row) {
|
||||
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
||||
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
||||
@ -247,6 +440,7 @@ async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await errorNotificationApi.page({
|
||||
...searchForm,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
})
|
||||
@ -258,6 +452,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
// 搜索
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
@ -265,6 +460,7 @@ function handleSearch() {
|
||||
|
||||
// 重置
|
||||
function handleReset() {
|
||||
searchForm.subscriptionKey = ''
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
@ -287,18 +483,46 @@ function handleCheck(keys: Array<string | number>) {
|
||||
|
||||
// 新增
|
||||
function handleAdd() {
|
||||
modalTitle.value = '新增ErrorNotification'
|
||||
modalTitle.value = '新增'
|
||||
Object.assign(formData, defaultFormData)
|
||||
yiczdopt.value = []
|
||||
modalVisible.value = true
|
||||
formData.abnormalReporting = 1
|
||||
}
|
||||
|
||||
// 编辑
|
||||
function handleEdit(row: ErrorNotification) {
|
||||
modalTitle.value = '编辑ErrorNotification'
|
||||
modalTitle.value = '编辑'
|
||||
Object.assign(formData, row)
|
||||
if (formData.crateTime && typeof formData.crateTime === 'string') {
|
||||
formData.crateTime = new Date(formData.crateTime.replace(' ', 'T')).getTime()
|
||||
}
|
||||
|
||||
//异常字段回显
|
||||
if(row.subscriptionKey){
|
||||
yiczdopt.value = yclist.value[row.subscriptionKey]
|
||||
}
|
||||
|
||||
//发送方式
|
||||
if(row.sendingMethod){
|
||||
formData.sendingMethod = formData.sendingMethod.split(',')
|
||||
//formData.sendingMethod = formData.sendingMethod.map((n:any) => n*1)
|
||||
}
|
||||
|
||||
|
||||
//设备回显
|
||||
if(row.subscriptionDeviceIds){
|
||||
formData.subscriptionDeviceIds = formData.subscriptionDeviceIds.split(',')
|
||||
formData.subscriptionDeviceIds = formData.subscriptionDeviceIds.map((n:any) => n*1)
|
||||
}
|
||||
|
||||
//通知人回显
|
||||
if(formData.notifierMethod == 3 && row.notifier){
|
||||
formData.notifier = formData.notifier.split(',')
|
||||
formData.notifier = formData.notifier.map((n:any) => n*1)
|
||||
}
|
||||
|
||||
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
@ -310,6 +534,20 @@ async function handleSubmit() {
|
||||
if (typeof submitData.crateTime === 'number') {
|
||||
submitData.crateTime = new Date(submitData.crateTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||
}
|
||||
|
||||
if(Array.isArray(submitData.sendingMethod)){
|
||||
submitData.sendingMethod = submitData.sendingMethod.join(',')
|
||||
}
|
||||
|
||||
if(Array.isArray(submitData.subscriptionDeviceIds)){
|
||||
submitData.subscriptionDeviceIds = submitData.subscriptionDeviceIds.join(',')
|
||||
}
|
||||
|
||||
if(Array.isArray(submitData.notifier)){
|
||||
submitData.notifier = submitData.notifier.join(',')
|
||||
}
|
||||
|
||||
|
||||
if (submitData.id) {
|
||||
await errorNotificationApi.update(submitData)
|
||||
message.success('修改成功')
|
||||
@ -432,6 +670,7 @@ async function loadDictOptions() {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadDictOptions()
|
||||
|
||||
452
src/views/biz/permissionConfig/index.vue
Normal file
452
src/views/biz/permissionConfig/index.vue
Normal file
@ -0,0 +1,452 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<n-card>
|
||||
<!-- 搜索表单 -->
|
||||
<div class="search-form">
|
||||
<n-form inline :model="searchForm" label-placement="left">
|
||||
<n-form-item label="mapper">
|
||||
<n-select v-model:value="searchForm.mapperKey" placeholder="请选择mapper" clearable style="width: 300px" :options="mapperOptions"
|
||||
@update:value="mapperSearchUpdate" />
|
||||
</n-form-item>
|
||||
<n-form-item label="控制方法">
|
||||
<n-select v-model:value="searchForm.controlMethod" placeholder="请选择控制方法" clearable style="width: 200px" :options="methodSearchOptions" />
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-space>
|
||||
<n-button type="primary" @click="handleSearch">
|
||||
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
||||
搜索
|
||||
</n-button>
|
||||
<n-button @click="handleReset">
|
||||
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
||||
重置
|
||||
</n-button>
|
||||
</n-space>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<div class="table-toolbar">
|
||||
<n-space>
|
||||
<n-button type="primary" @click="handleAdd">
|
||||
<template #icon><n-icon><AddOutline /></n-icon></template>
|
||||
新增
|
||||
</n-button>
|
||||
<n-button @click="importModalVisible = true">
|
||||
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
|
||||
导入
|
||||
</n-button>
|
||||
<n-button @click="handleExport">
|
||||
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
||||
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
|
||||
</n-button>
|
||||
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
|
||||
<template #icon><n-icon><TrashOutline /></n-icon></template>
|
||||
删除
|
||||
</n-button>
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
<n-data-table
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
@update:page="handlePageChange"
|
||||
@update:page-size="handlePageSizeChange"
|
||||
@update:checked-row-keys="handleCheck"
|
||||
/>
|
||||
</n-card>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 800px" :mask-closable=false>
|
||||
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
|
||||
<n-grid :cols="2" :x-gap="24">
|
||||
<n-form-item-gi label="mapper" path="mapperKey">
|
||||
<n-select v-model:value="formData.mapperKey" placeholder="请选择mapper" :options="mapperOptions" @update:value="mapperUpdate" />
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi label="控制方法" path="controlMethod">
|
||||
<n-select v-model:value="formData.controlMethod" multiple placeholder="请选择控制方法" :options="methodOptions" />
|
||||
</n-form-item-gi>
|
||||
</n-grid>
|
||||
<n-grid :cols="1" :x-gap="24">
|
||||
<n-form-item-gi label="权限控制方案" path="permissionControl">
|
||||
<n-dynamic-input
|
||||
v-model:value="permissionControl"
|
||||
key-field="sole"
|
||||
preset="pair"
|
||||
:min="1"
|
||||
:max="5"
|
||||
@create="handleCreate"
|
||||
>
|
||||
<template #default="{ value,index }">
|
||||
<n-space>
|
||||
<n-select
|
||||
v-model:value="value.key"
|
||||
:options="roleOptions"
|
||||
placeholder="请选择角色"
|
||||
style="width: 150px"
|
||||
/>
|
||||
<n-input
|
||||
v-model:value="value.value"
|
||||
placeholder="请输入权限内容"
|
||||
readonly
|
||||
style="width: 400px"
|
||||
@click="clickPermission(index)"
|
||||
/>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-dynamic-input>
|
||||
</n-form-item-gi>
|
||||
</n-grid>
|
||||
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<n-space justify="end">
|
||||
<n-button @click="modalVisible = false">取消</n-button>
|
||||
<n-button type="primary" @click="handleSubmit">确定</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-modal>
|
||||
|
||||
<n-modal v-model:show="updatePermissionModal" :draggable="true" :on-after-leave="closePermission">
|
||||
<n-card style="width: 600px" :bordered="false" size="huge" role="dialog" aria-modal="true" >
|
||||
<n-input v-model:value="updatePermissionContent" placeholder="请输入权限内容" type="textarea" />
|
||||
</n-card>
|
||||
</n-modal>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, h, onMounted } from 'vue'
|
||||
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
|
||||
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
|
||||
import { permissionConfigApi, type PermissionConfig } from '@/api/permissionConfig'
|
||||
import { roleApi, SysRole } from '@/api/system'
|
||||
|
||||
const message = useMessage()
|
||||
const dialog = useDialog()
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
mapperKey: '',
|
||||
controlMethod: '',
|
||||
})
|
||||
|
||||
const permissionControl = ref([
|
||||
{
|
||||
sole:Date.now(),
|
||||
key: '',
|
||||
value: '123'
|
||||
}
|
||||
])
|
||||
|
||||
// 下拉选项
|
||||
const roleOptions = ref<Array<{ label: string; value: number; disabled:false }>>([])
|
||||
|
||||
const handleCreate = () => {
|
||||
return {
|
||||
sole: Date.now() + Math.random(), // key‑field使用的唯一主键
|
||||
key:"",
|
||||
value: null // select绑定的业务字段,不要和key混淆
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref<PermissionConfig[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedIds = ref<number[]>([])
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
itemCount: 0,
|
||||
showSizePicker: true,
|
||||
pageSizes: [10, 20, 50]
|
||||
})
|
||||
|
||||
// 弹窗
|
||||
const modalVisible = ref(false)
|
||||
const modalTitle = ref('')
|
||||
const importModalVisible = ref(false)
|
||||
const formRef = ref()
|
||||
const defaultFormData: PermissionConfig = {
|
||||
mapperKey: '',
|
||||
controlMethod: '',
|
||||
permissionControl: '',
|
||||
}
|
||||
const formData = reactive<PermissionConfig>({ ...defaultFormData })
|
||||
|
||||
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||
|
||||
// 表单校验规则
|
||||
const formRules = {
|
||||
}
|
||||
|
||||
// 表格列
|
||||
const columns: DataTableColumns<PermissionConfig> = [
|
||||
{ type: 'selection' },
|
||||
{ title: 'mapper', key: 'mapperKey' },
|
||||
{ title: '控制方法', key: 'controlMethod' },
|
||||
{ title: '权限控制方案', key: 'permissionControl' },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
render(row) {
|
||||
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
||||
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
||||
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
|
||||
}),
|
||||
h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
|
||||
default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 删除']
|
||||
})
|
||||
])
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const updatePermissionIndex = ref<number>(-1)
|
||||
const updatePermissionContent = ref<string>('')
|
||||
const updatePermissionModal = ref(false)
|
||||
|
||||
function clickPermission(index:number){
|
||||
updatePermissionIndex.value = index
|
||||
updatePermissionContent.value = permissionControl.value[index].value;
|
||||
updatePermissionModal.value = true
|
||||
}
|
||||
function closePermission(){
|
||||
permissionControl.value[updatePermissionIndex.value].value = updatePermissionContent.value;
|
||||
}
|
||||
|
||||
// 加载数据
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await permissionConfigApi.page({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
mapperKey: searchForm.mapperKey || undefined,
|
||||
controlMethod: searchForm.controlMethod || undefined,
|
||||
})
|
||||
tableData.value = res.list
|
||||
pagination.itemCount = res.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
// 重置
|
||||
function handleReset() {
|
||||
searchForm.mapperKey = ''
|
||||
|
||||
searchForm.controlMethod = ''
|
||||
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
// 分页
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
// 选择
|
||||
function handleCheck(keys: Array<string | number>) {
|
||||
selectedIds.value = keys as number[]
|
||||
}
|
||||
|
||||
// 新增
|
||||
function handleAdd() {
|
||||
modalTitle.value = '新增数据权限配置'
|
||||
Object.assign(formData, defaultFormData)
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
// 编辑
|
||||
function handleEdit(row: PermissionConfig) {
|
||||
modalTitle.value = '编辑数据权限配置'
|
||||
Object.assign(formData, row)
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
// 提交
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
try {
|
||||
const submitData = { ...formData } as PermissionConfig
|
||||
if (submitData.id) {
|
||||
await permissionConfigApi.update(submitData)
|
||||
message.success('修改成功')
|
||||
} else {
|
||||
await permissionConfigApi.create(submitData)
|
||||
message.success('新增成功')
|
||||
}
|
||||
modalVisible.value = false
|
||||
loadData()
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
function handleDelete(row: PermissionConfig) {
|
||||
dialog.warning({
|
||||
title: '提示',
|
||||
content: '确定要删除该记录吗?',
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try {
|
||||
await permissionConfigApi.delete([row.id!])
|
||||
message.success('删除成功')
|
||||
loadData()
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
function handleBatchDelete() {
|
||||
dialog.warning({
|
||||
title: '提示',
|
||||
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try {
|
||||
await permissionConfigApi.delete(selectedIds.value)
|
||||
message.success('删除成功')
|
||||
selectedIds.value = []
|
||||
loadData()
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 导出
|
||||
async function handleExport() {
|
||||
try {
|
||||
const params: Record<string, any> = {}
|
||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||
if (searchForm.mapperKey) params.mapperKey = searchForm.mapperKey
|
||||
if (searchForm.controlMethod) params.controlMethod = searchForm.controlMethod
|
||||
const blob = await permissionConfigApi.export(params)
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '数据权限配置数据.xlsx'
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
|
||||
// 下载导入模板
|
||||
async function handleDownloadTemplate() {
|
||||
try {
|
||||
const blob = await permissionConfigApi.downloadTemplate()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '数据权限配置导入模板.xlsx'
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
|
||||
// 导入上传
|
||||
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
||||
if (!file.file) return
|
||||
try {
|
||||
const result = await permissionConfigApi.importData(file.file)
|
||||
if (result.fail > 0) {
|
||||
dialog.warning({
|
||||
title: '导入结果',
|
||||
content: `成功: ${result.success} 条,失败: ${result.fail} 条\n错误信息: ${(result.errors || []).join('\n') || '无'}`,
|
||||
positiveText: '确定'
|
||||
})
|
||||
} else {
|
||||
message.success(`导入成功,共 ${result.success} 条数据`)
|
||||
importModalVisible.value = false
|
||||
}
|
||||
loadData()
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
|
||||
const mapperOptions = ref<{ label: string; value: any }[]>([])
|
||||
const methodSearchOptions = ref<{ label: string; value: any }[]>([])
|
||||
const methodOptions = ref<{ label: string; value: any }[]>([])
|
||||
function mapperUpdate(v:any,opt:any) {
|
||||
formData.controlMethod=''
|
||||
methodOptions.value = opt.childList;
|
||||
}
|
||||
|
||||
function mapperSearchUpdate(v:any,opt:any) {
|
||||
searchForm.controlMethod=''
|
||||
methodSearchOptions.value = opt.childList;
|
||||
}
|
||||
|
||||
// 加载字典选项
|
||||
async function loadDictOptions() {
|
||||
try {
|
||||
mapperOptions.value = await permissionConfigApi.options();
|
||||
}catch{}
|
||||
try {
|
||||
const roles = await roleApi.list()
|
||||
roleOptions.value = roles.map((role: SysRole) => ({
|
||||
label: role.name,
|
||||
value: role.id!,
|
||||
disabled:false
|
||||
}))
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadDictOptions()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search-form {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.table-toolbar {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
@ -4,10 +4,10 @@
|
||||
<n-gi :span="19">
|
||||
<n-grid x-gap="20">
|
||||
<n-gi :span="3" style="padding:10px;border-radius: 10px;box-shadow: 0 0 20px -5px rgba(84, 151, 232, 0.5);background: #fff;">
|
||||
<n-button type="success" style="width: 100%;margin:10px 0 30px;">今天</n-button>
|
||||
<n-button type="tertiary" style="width: 100%; margin-bottom: 30px;">昨天</n-button>
|
||||
<n-button type="tertiary" style="width: 100%; margin-bottom: 30px;">近7天</n-button>
|
||||
<n-button type="tertiary" style="width: 100%; margin-bottom: 20px;">近30天</n-button>
|
||||
<n-button :type="tabindex == 1?'success':'tertiary'" style="width: 100%;margin:10px 0 30px;" @click="gettotal(1)">今天</n-button>
|
||||
<n-button :type="tabindex == 2?'success':'tertiary'" style="width: 100%; margin-bottom: 30px;" @click="gettotal(2)">昨天</n-button>
|
||||
<n-button :type="tabindex == 3?'success':'tertiary'" style="width: 100%; margin-bottom: 30px;" @click="gettotal(3)">近7天</n-button>
|
||||
<n-button :type="tabindex == 4?'success':'tertiary'" style="width: 100%; margin-bottom: 20px;" @click="gettotal(4)">近30天</n-button>
|
||||
</n-gi>
|
||||
<n-gi :span="21">
|
||||
|
||||
@ -22,16 +22,16 @@
|
||||
</div>
|
||||
|
||||
<div style="color: #1890ff;">
|
||||
<span style="font-size: 36px;font-weight: bold;">890</span>
|
||||
<span style="font-size: 36px;font-weight: bold;">{{totalobj.totalOrders}}</span>
|
||||
<span style="padding-left: 5px;">单</span>
|
||||
</div>
|
||||
<div style="font-size: 12px;">所选时间范围内全部工单</div>
|
||||
</div>
|
||||
<div style="padding-left: 20px;border-left:1px solid #e1e0e0;">
|
||||
<div>已完成</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">260单</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">{{totalobj.completedOrders}}单</div>
|
||||
<div>进行中</div>
|
||||
<div style="color: #161718;">5800单</div>
|
||||
<div style="color: #161718;">{{ totalobj.inProgressOrders }}单</div>
|
||||
</div>
|
||||
</n-gi>
|
||||
<n-gi :span="8" style="display: flex;align-items: center;justify-content: space-between;padding:10px;border-radius: 10px;box-shadow: 0 0 20px -5px rgba(84, 151, 232, 0.5);background: #fff;">
|
||||
@ -44,16 +44,16 @@
|
||||
</div>
|
||||
|
||||
<div style="color: #0891b2;">
|
||||
<span style="font-size: 36px;font-weight: bold;">560</span>
|
||||
<span style="font-size: 36px;font-weight: bold;">{{ totalobj.inProgressOrders }}</span>
|
||||
<span style="padding-left: 5px;">单</span>
|
||||
</div>
|
||||
<div style="font-size: 12px;">当前正在执行的工单数里</div>
|
||||
<div style="font-size: 12px;">当前正在执行的工单数量</div>
|
||||
</div>
|
||||
<div style="padding-left: 20px;border-left:1px solid #e1e0e0;">
|
||||
<div>已完成</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">260单</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">{{totalobj.completedOrders}}单</div>
|
||||
<div>工单完成率</div>
|
||||
<div style="color: #161718;">68%</div>
|
||||
<div style="color: #161718;">{{totalobj.achievementRate}}%</div>
|
||||
</div>
|
||||
</n-gi>
|
||||
<n-gi :span="8" style="display: flex;align-items: center;justify-content: space-between;padding:10px;border-radius: 10px;box-shadow: 0 0 20px -5px rgba(84, 151, 232, 0.5);background: #fff;">
|
||||
@ -66,16 +66,16 @@
|
||||
<div style="padding-left: 8px;">工单完成率</div>
|
||||
</div>
|
||||
<div style="color: #18181b;">
|
||||
<span style="font-size: 36px;font-weight: bold;">65</span>
|
||||
<span style="font-size: 36px;font-weight: bold;">{{totalobj.achievementRate}}</span>
|
||||
<span style="padding-left: 5px;">%</span>
|
||||
</div>
|
||||
<div style="font-size: 12px;">按工单数量统计的完成比例</div>
|
||||
</div>
|
||||
<div style="padding-left: 20px;border-left:1px solid #e1e0e0;">
|
||||
<div>已结工单</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">260单</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">{{totalobj.completedOrders}}单</div>
|
||||
<div>工单总数</div>
|
||||
<div style="color: #161718;">5800单</div>
|
||||
<div style="color: #161718;">{{totalobj.totalOrders}}单</div>
|
||||
</div>
|
||||
</n-gi>
|
||||
<n-gi :span="8" style="display: flex;align-items: center;justify-content: space-between;margin-top: 20px;padding:10px;border-radius: 10px;box-shadow: 0 0 20px -5px rgba(84, 151, 232, 0.5);background: #fff;">
|
||||
@ -88,16 +88,16 @@
|
||||
</div>
|
||||
|
||||
<div style="color: #15803d;">
|
||||
<span style="font-size: 36px;font-weight: bold;">560</span>
|
||||
<span style="font-size: 36px;font-weight: bold;">{{totalobj.completedTotal}}</span>
|
||||
<span style="padding-left: 5px;">件</span>
|
||||
</div>
|
||||
<div style="font-size: 12px;">所选时间范围内合格完工产量</div>
|
||||
</div>
|
||||
<div style="padding-left: 20px;border-left:1px solid #e1e0e0;">
|
||||
<div>产能达成率</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">26%</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">{{totalobj.rate}}%</div>
|
||||
<div>已结工单</div>
|
||||
<div style="color: #161718;">46单</div>
|
||||
<div style="color: #161718;">{{totalobj.completedOrders}}单</div>
|
||||
</div>
|
||||
</n-gi>
|
||||
<n-gi :span="8" style="display: flex;align-items: center;justify-content: space-between;margin-top: 20px;padding:10px;border-radius: 10px;box-shadow: 0 0 20px -5px rgba(84, 151, 232, 0.5);background: #fff;">
|
||||
@ -140,9 +140,9 @@
|
||||
</div>
|
||||
<div style="padding-left: 20px;border-left:1px solid #e1e0e0;">
|
||||
<div>未关闭异常</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">0</div>
|
||||
<div style="padding-bottom: 20px;color: #161718;">{{ totalobj.openexcepttotal }}</div>
|
||||
<div>累计异常</div>
|
||||
<div style="color: #161718;">75</div>
|
||||
<div style="color: #161718;">{{totalobj.exceptiontotal}}</div>
|
||||
</div>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
@ -215,32 +215,83 @@ import {
|
||||
LayersOutline,
|
||||
DiceOutline,
|
||||
ChevronForward,
|
||||
//MenuOutline,
|
||||
GitNetworkOutline,
|
||||
GameControllerOutline,
|
||||
//ShieldCheckmarkOutline,
|
||||
ListOutline,
|
||||
IdCardOutline,
|
||||
// LogoWechat,
|
||||
// Globe,
|
||||
// Mail,
|
||||
// Star,
|
||||
// Refresh,
|
||||
// DocumentText,
|
||||
// SettingsOutline,
|
||||
// TimerOutline,
|
||||
// ServerOutline,
|
||||
// RocketOutline,
|
||||
// SparklesOutline,
|
||||
// CodeSlashOutline,
|
||||
// CloudOutline,
|
||||
// ChatbubbleOutline
|
||||
|
||||
} from '@vicons/ionicons5'
|
||||
|
||||
import {
|
||||
getorders,
|
||||
getsctotal,
|
||||
getachievement,
|
||||
getquality,
|
||||
getopenquality
|
||||
} from '@/api/dashboard'
|
||||
|
||||
function getDateBeforeToday(days:any, format:any = 'YYYY-MM-DD') {
|
||||
const date = new Date()
|
||||
date.setDate(date.getDate() - days)
|
||||
if (format === 'YYYY-MM-DD') {
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
let tabindex = ref(1)
|
||||
let totalobj = ref<any>({})
|
||||
let dateRange:any = ''
|
||||
function gettotal(index:any) {
|
||||
tabindex.value = index
|
||||
if(index == 1){
|
||||
dateRange = getDateBeforeToday(0)
|
||||
}else if(index == 2){
|
||||
dateRange = getDateBeforeToday(1)
|
||||
}else if(index == 3){
|
||||
dateRange = getDateBeforeToday(7)
|
||||
}else{
|
||||
dateRange = getDateBeforeToday(30)
|
||||
}
|
||||
//getorders()
|
||||
getsctotal({dateRange}).then(rps => {
|
||||
totalobj.value = {
|
||||
...totalobj.value,
|
||||
...rps
|
||||
}
|
||||
})
|
||||
|
||||
//产能达成率
|
||||
getachievement({dateRange}).then(rps => {
|
||||
totalobj.value = {
|
||||
...totalobj.value,
|
||||
...rps
|
||||
}
|
||||
})
|
||||
|
||||
//累计质检异常
|
||||
getquality({dateRange}).then(rps => {
|
||||
totalobj.value = {
|
||||
...totalobj.value,
|
||||
exceptiontotal:rps.total
|
||||
}
|
||||
})
|
||||
|
||||
//未关闭异常
|
||||
getopenquality({dateRange}).then(rps => {
|
||||
totalobj.value = {
|
||||
...totalobj.value,
|
||||
openexcepttotal:rps.total
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
gettotal(1)
|
||||
|
||||
function topage(path:any) {
|
||||
router.push(path)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user