From caf8dacebd3063b33c4026d088548e74ddfd1339 Mon Sep 17 00:00:00 2001
From: andy <1042025947@qq.com>
Date: Fri, 7 Aug 2026 14:55:22 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/dashboard.ts | 46 +++
src/api/errorNotification.ts | 4 +
src/views/NCcode/index.vue | 2 +-
src/views/biz/errorNotification/index.vue | 363 ++++++++++++++++++----
src/views/dashboard/index.vue | 123 +++++---
vite.config.ts | 4 +-
6 files changed, 441 insertions(+), 101 deletions(-)
create mode 100644 src/api/dashboard.ts
diff --git a/src/api/dashboard.ts b/src/api/dashboard.ts
new file mode 100644
index 0000000..0153286
--- /dev/null
+++ b/src/api/dashboard.ts
@@ -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
+ })
+}
\ No newline at end of file
diff --git a/src/api/errorNotification.ts b/src/api/errorNotification.ts
index 526afaf..485a300 100644
--- a/src/api/errorNotification.ts
+++ b/src/api/errorNotification.ts
@@ -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' })
}
}
\ No newline at end of file
diff --git a/src/views/NCcode/index.vue b/src/views/NCcode/index.vue
index 2e82b9e..179e740 100644
--- a/src/views/NCcode/index.vue
+++ b/src/views/NCcode/index.vue
@@ -860,7 +860,7 @@ function issuehand(row:any) {
issueModel.value = true
issarr = []
ncid = row.id
- ncCode.value = row.code
+ ncCode.value = row.ncCode
}
diff --git a/src/views/biz/errorNotification/index.vue b/src/views/biz/errorNotification/index.vue
index bd47e00..0e0e07e 100644
--- a/src/views/biz/errorNotification/index.vue
+++ b/src/views/biz/errorNotification/index.vue
@@ -4,6 +4,9 @@
@@ -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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ opt.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ opt.label }}
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ opt.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ opt.label }}
+
+
+
+
+
+
+
+
+ 操作人
+ 设备负责人
+ 指定人员
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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([])
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({ ...defaultFormData })
+let formData = reactive({ ...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([])
+//异常子项
+let yclist = ref([])
+//选中异常子项
+let yiczdopt = ref({})
+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([])
+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([])
+
+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 = [
- { 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(', ') || '-'
- }
+ },
+ minWidth:150
},
- { title: '检验值', key: 'discoverValue' },
- { title: '检测方法, 1大于 2大于等于 3小于 4小于等于 5不等', key: 'detectionMethod',
+ {
+ 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 = [
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) {
// 新增
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()
diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue
index 1d95c0f..95c7f95 100644
--- a/src/views/dashboard/index.vue
+++ b/src/views/dashboard/index.vue
@@ -4,10 +4,10 @@
- 今天
- 昨天
- 近7天
- 近30天
+ 今天
+ 昨天
+ 近7天
+ 近30天
@@ -22,16 +22,16 @@
- 890
+ {{totalobj.totalOrders}}
单
所选时间范围内全部工单
已完成
-
260单
+
{{totalobj.completedOrders}}单
进行中
-
5800单
+
{{ totalobj.inProgressOrders }}单
@@ -44,16 +44,16 @@
- 560
+ {{ totalobj.inProgressOrders }}
单
- 当前正在执行的工单数里
+ 当前正在执行的工单数量
已完成
-
260单
+
{{totalobj.completedOrders}}单
工单完成率
-
68%
+
{{totalobj.achievementRate}}%
@@ -66,16 +66,16 @@
工单完成率
- 65
+ {{totalobj.achievementRate}}
%
按工单数量统计的完成比例
已结工单
-
260单
+
{{totalobj.completedOrders}}单
工单总数
-
5800单
+
{{totalobj.totalOrders}}单
@@ -88,16 +88,16 @@
- 560
+ {{totalobj.completedTotal}}
件
所选时间范围内合格完工产量
产能达成率
-
26%
+
{{totalobj.rate}}%
已结工单
-
46单
+
{{totalobj.completedOrders}}单
@@ -140,9 +140,9 @@
未关闭异常
-
0
+
{{ totalobj.openexcepttotal }}
累计异常
-
75
+
{{totalobj.exceptiontotal}}
@@ -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({})
+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)
}
diff --git a/vite.config.ts b/vite.config.ts
index 0eda763..70a67ac 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -20,8 +20,8 @@ export default defineConfig({
port: 3000,
proxy: {
'/api': {
- target:'http://192.168.12.12:8888/', //'http://192.168.5.230:8888',
- //target:'http://192.168.12.4:8888/',
+ //target:'http://192.168.12.230:8888/', //'http://192.168.5.230:8888',
+ target:'http://192.168.12.4:8888/',
//target:'http://192.168.12.230:8888',
//target:'http://192.168.5.230:8888',
//target:'http://192.168.5.232:8888/',