微调
This commit is contained in:
@@ -87,7 +87,7 @@ export const changeErrorSystem = (params: {
|
||||
deviceId: string,
|
||||
code: string
|
||||
}) => {
|
||||
return http.post("/result/changeErrorSystem", params, {loading: false});
|
||||
return http.post("/result/changeErrorSystem", params, {loading: true});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
@@ -7,57 +7,65 @@ import http from '@/api'
|
||||
|
||||
//获取被检设备
|
||||
export const getPqDevList = (params: Device.ReqPqDevParams) => {
|
||||
return http.post(`/pqDev/list`, params)
|
||||
return http.post(`/pqDev/list`, params)
|
||||
}
|
||||
|
||||
//添加被检设备
|
||||
export const addPqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/add`, params)
|
||||
return http.post(`/pqDev/add`, params)
|
||||
}
|
||||
|
||||
//编辑被检设备
|
||||
export const updatePqDev = (params: Device.ResPqDev) => {
|
||||
return http.post(`/pqDev/update`, params)
|
||||
return http.post(`/pqDev/update`, params)
|
||||
}
|
||||
|
||||
//删除被检设备
|
||||
export const deletePqDev = (params: string[]) => {
|
||||
return http.post(`/pqDev/delete`, params)
|
||||
return http.post(`/pqDev/delete`, params)
|
||||
}
|
||||
|
||||
// export const downloadTemplate = () => {
|
||||
// return http.download(`/pqDev/downloadTemplate`)
|
||||
//导出被检设备
|
||||
export const exportPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/pqDev/export`, params)
|
||||
}
|
||||
// 下载导入文件模板
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/pqDev/downloadTemplate`)
|
||||
}
|
||||
|
||||
//导入被检设备
|
||||
export const importPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/import`, params)
|
||||
}
|
||||
|
||||
//导入比对式被检设备
|
||||
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.upload(`/pqDev/importContrast`, params)
|
||||
}
|
||||
|
||||
// //导出灿能二楼设备
|
||||
// export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||
// return http.download(`/pqDev/exportCNDev`, params)
|
||||
// }
|
||||
//
|
||||
// // 下载灿能二楼设备导入文件模板
|
||||
// export const downloadCNDevTemplate = () => {
|
||||
// return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||
// }
|
||||
//
|
||||
// //导入灿能二楼设备
|
||||
// export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||
// return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||
// }
|
||||
|
||||
// //导入被检设备(比对)
|
||||
// export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
||||
// return http.upload(`/pqDev/import`, params)
|
||||
// }
|
||||
// //导入比对式被检设备
|
||||
// export const importContrastPqDev=(params: Device.ReqPqDevParams)=>{
|
||||
// return http.upload(`/pqDev/importContrast`, params)
|
||||
// }
|
||||
|
||||
//导出灿能二楼设备
|
||||
export const exportCNDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.download(`/pqDev/exportCNDev`, params)
|
||||
}
|
||||
|
||||
// 下载灿能二楼设备导入文件模板
|
||||
export const downloadCNDevTemplate = () => {
|
||||
return http.download(`/pqDev/downloadCNDevTemplate`)
|
||||
}
|
||||
|
||||
//导入灿能二楼设备
|
||||
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
||||
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
||||
}
|
||||
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||
export const getPqDev = () => {
|
||||
return http.get(`/devType/listAll`)
|
||||
return http.get(`/devType/listAll`)
|
||||
}
|
||||
|
||||
//被检设备归档
|
||||
export const documentedPqDev = (ids: string[]) => {
|
||||
return http.post(`/pqDev/documented`, ids)
|
||||
return http.post(`/pqDev/documented`, ids)
|
||||
}
|
||||
|
||||
@@ -38,3 +38,8 @@ export const refreshToken = () => {
|
||||
)
|
||||
}
|
||||
|
||||
//获取场景
|
||||
export const getCurrentScene = () => {
|
||||
return http.get('/admin/getCurrentScene', {}, { loading: false })
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import { ElMessage } from "element-plus";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||
import { ref } from "vue";
|
||||
import {getCurrentScene} from "@/api/user/login";
|
||||
const authStore = useAuthStore();
|
||||
const modeStore = useModeStore(); // 使用模式 store
|
||||
const AppSceneStore = useAppSceneStore();
|
||||
@@ -82,7 +83,9 @@ const modeList = [
|
||||
];
|
||||
const handelOpen = async (item: any) => {
|
||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||
AppSceneStore.setCurrentMode('1');//0:省级平台,1:设备出厂,2:研发自测
|
||||
const {data:scene} = await getCurrentScene(); // 获取当前场景
|
||||
// AppSceneStore.setCurrentMode(scene+'');//0:省级平台,1:设备出厂,2:研发自测
|
||||
AppSceneStore.setCurrentMode('0');//0:省级平台,1:设备出厂,2:研发自测
|
||||
await authStore.setShowMenu();
|
||||
return;
|
||||
// if (isActive) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class='table-box' ref='popupBaseView'>
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getTableList'
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getTableList'
|
||||
>
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
@@ -32,32 +32,25 @@
|
||||
|
||||
</ProTable>
|
||||
</div>
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' />
|
||||
<ImportExcel ref='deviceImportExcel' />
|
||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
|
||||
<ImportExcel ref='deviceImportExcel'/>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import { type Device } from '@/api/device/interface/device.ts'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import {type Device} from '@/api/device/interface/device.ts'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
|
||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {
|
||||
getPqDevList,
|
||||
deletePqDev,
|
||||
getPqDev,
|
||||
exportCNDev,
|
||||
downloadCNDevTemplate,
|
||||
importCNDev,
|
||||
} from '@/api/device/device/index.ts'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { onBeforeMount, reactive, ref } from 'vue'
|
||||
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
|
||||
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
||||
import {ElMessageBox} from 'element-plus'
|
||||
import {onBeforeMount, reactive, ref} from 'vue'
|
||||
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||
|
||||
// defineOptions({
|
||||
// name: 'device',
|
||||
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
||||
// 存储设备类型选项
|
||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
search: {el: 'input'},
|
||||
// isShow: appSceneStore.currentScene != '1',
|
||||
// ...(appSceneStore.currentScene != '1' ? {
|
||||
// search: { el: 'input' },
|
||||
@@ -115,12 +109,12 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
search: {
|
||||
render: () => {
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
<div class='flx-flex-start'>
|
||||
<TimeControl
|
||||
default={'月'}
|
||||
onUpdate-dates={handleDateChange}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||
isShow: appSceneStore.currentScene != '1',
|
||||
...(appSceneStore.currentScene != '1' ? {
|
||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||
fieldNames: {label: 'name', value: 'id'},
|
||||
} : {}),
|
||||
minWidth: 200,
|
||||
},
|
||||
@@ -174,19 +168,19 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
width: 200,
|
||||
render: scope => {
|
||||
if (scope.row.createTime) {
|
||||
const date = new Date(scope.row.createTime);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return '';
|
||||
const date = new Date(scope.row.createTime);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
||||
{prop: 'operation', label: '操作', fixed: 'right', width: 200},
|
||||
])
|
||||
|
||||
|
||||
@@ -206,8 +200,8 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
||||
// 批量删除设备
|
||||
const batchDelete = async (id: string[]) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||
await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
|
||||
|
||||
await useHandleData(deletePqDev, {'ids': id, 'pattern': patternId}, '删除所选设备')
|
||||
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
@@ -215,9 +209,9 @@ const batchDelete = async (id: string[]) => {
|
||||
// 删除设备
|
||||
const handleDelete = async (params: Device.ResPqDev) => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`)
|
||||
await useHandleData(deletePqDev, {'ids': [params.id], 'pattern': patternId}, `删除【${params.name}】设备`)
|
||||
proTable.value?.getTableList()
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 导出设备
|
||||
@@ -229,9 +223,9 @@ const downloadFile = async () => {
|
||||
searchParam.searchBeginTime = startDate.value
|
||||
searchParam.searchEndTime = endDate.value
|
||||
|
||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => {
|
||||
ElMessageBox.confirm('确认导出被检设备?', '温馨提示', {type: 'warning'}).then(() => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
useDownload(exportCNDev, '被检设备导出数据', { ...proTable.value?.searchParam, pattern: patternId }, false, '.xlsx')
|
||||
useDownload(exportPqDev, '被检设备导出数据', {...proTable.value?.searchParam, pattern: patternId}, false, '.xlsx')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -254,8 +248,8 @@ const importFile = async (pattern: string) => {
|
||||
title: '被检设备',
|
||||
showCover: false,
|
||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||
tempApi: downloadCNDevTemplate,
|
||||
importApi: importCNDev,
|
||||
tempApi: downloadTemplate,
|
||||
importApi: importPqDev,
|
||||
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user