微调
This commit is contained in:
@@ -87,7 +87,7 @@ export const changeErrorSystem = (params: {
|
|||||||
deviceId: string,
|
deviceId: string,
|
||||||
code: 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'
|
import http from '@/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,33 +25,41 @@ 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 importPqDev=(params: Device.ReqPqDevParams)=>{
|
export const downloadTemplate = () => {
|
||||||
// return http.upload(`/pqDev/import`, params)
|
return http.download(`/pqDev/downloadTemplate`)
|
||||||
// }
|
|
||||||
// //导入比对式被检设备
|
|
||||||
// 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 = () => {
|
export const importPqDev = (params: Device.ReqPqDevParams) => {
|
||||||
return http.download(`/pqDev/downloadCNDevTemplate`)
|
return http.uploadExcel(`/pqDev/import`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入灿能二楼设备
|
//导入比对式被检设备
|
||||||
export const importCNDev = (params: Device.ReqPqDevParams) => {
|
export const importContrastPqDev = (params: Device.ReqPqDevParams) => {
|
||||||
return http.uploadExcel(`/pqDev/importCNDev`, params)
|
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、模板、通道数、额定电压、额定电流);
|
//根据设备类型决定(电源、icd、模板、通道数、额定电压、额定电流);
|
||||||
export const getPqDev = () => {
|
export const getPqDev = () => {
|
||||||
return http.get(`/devType/listAll`)
|
return http.get(`/devType/listAll`)
|
||||||
|
|||||||
@@ -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 { useAuthStore } from "@/stores/modules/auth";
|
||||||
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
import { useModeStore, useAppSceneStore } from "@/stores/modules/mode"; // 引入模式 store
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import {getCurrentScene} from "@/api/user/login";
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const modeStore = useModeStore(); // 使用模式 store
|
const modeStore = useModeStore(); // 使用模式 store
|
||||||
const AppSceneStore = useAppSceneStore();
|
const AppSceneStore = useAppSceneStore();
|
||||||
@@ -82,7 +83,9 @@ const modeList = [
|
|||||||
];
|
];
|
||||||
const handelOpen = async (item: any) => {
|
const handelOpen = async (item: any) => {
|
||||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
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();
|
await authStore.setShowMenu();
|
||||||
return;
|
return;
|
||||||
// if (isActive) {
|
// if (isActive) {
|
||||||
|
|||||||
@@ -32,32 +32,25 @@
|
|||||||
|
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup' />
|
<DevicePopup :refresh-table='proTable?.getTableList' ref='devicePopup'/>
|
||||||
<ImportExcel ref='deviceImportExcel' />
|
<ImportExcel ref='deviceImportExcel'/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang='tsx' name='useRole'>
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
import { type Device } from '@/api/device/interface/device.ts'
|
import {type Device} from '@/api/device/interface/device.ts'
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import {useHandleData} from '@/hooks/useHandleData'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import {useDownload} from '@/hooks/useDownload'
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import ImportExcel from '@/components/ImportExcel/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 DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import {useDictStore} from '@/stores/modules/dict'
|
||||||
import {
|
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index.ts'
|
||||||
getPqDevList,
|
import {ElMessageBox} from 'element-plus'
|
||||||
deletePqDev,
|
import {onBeforeMount, reactive, ref} from 'vue'
|
||||||
getPqDev,
|
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||||
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'
|
|
||||||
|
|
||||||
// defineOptions({
|
// defineOptions({
|
||||||
// name: 'device',
|
// name: 'device',
|
||||||
@@ -72,6 +65,7 @@ const boundPqDevList = ref<Device.ReqPqDevParams[]>([])//根据检测计划id查
|
|||||||
// 存储设备类型选项
|
// 存储设备类型选项
|
||||||
const devTypeOptions = ref<Device.ResDev[]>([])
|
const devTypeOptions = ref<Device.ResDev[]>([])
|
||||||
|
|
||||||
|
|
||||||
const getTableList = async (params: any) => {
|
const getTableList = async (params: any) => {
|
||||||
let newParams = JSON.parse(JSON.stringify(params))
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
newParams.searchEndTime = endDate.value
|
newParams.searchEndTime = endDate.value
|
||||||
@@ -84,12 +78,12 @@ const getTableList = async (params: any) => {
|
|||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{type: 'selection', fixed: 'left', width: 70},
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
search: { el: 'input' },
|
search: {el: 'input'},
|
||||||
// isShow: appSceneStore.currentScene != '1',
|
// isShow: appSceneStore.currentScene != '1',
|
||||||
// ...(appSceneStore.currentScene != '1' ? {
|
// ...(appSceneStore.currentScene != '1' ? {
|
||||||
// search: { el: 'input' },
|
// search: { el: 'input' },
|
||||||
@@ -163,8 +157,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||||
isShow: appSceneStore.currentScene != '1',
|
isShow: appSceneStore.currentScene != '1',
|
||||||
...(appSceneStore.currentScene != '1' ? {
|
...(appSceneStore.currentScene != '1' ? {
|
||||||
search: { el: 'select', props: { filterable: true }, order: 1 },
|
search: {el: 'select', props: {filterable: true}, order: 1},
|
||||||
fieldNames: { label: 'name', value: 'id' },
|
fieldNames: {label: 'name', value: 'id'},
|
||||||
} : {}),
|
} : {}),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
@@ -186,7 +180,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
|
{prop: 'operation', label: '操作', fixed: 'right', width: 200},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +200,7 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
|||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
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?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
@@ -215,7 +209,7 @@ const batchDelete = async (id: string[]) => {
|
|||||||
// 删除设备
|
// 删除设备
|
||||||
const handleDelete = async (params: Device.ResPqDev) => {
|
const handleDelete = async (params: Device.ResPqDev) => {
|
||||||
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
|
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()
|
proTable.value?.getTableList()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -229,9 +223,9 @@ const downloadFile = async () => {
|
|||||||
searchParam.searchBeginTime = startDate.value
|
searchParam.searchBeginTime = startDate.value
|
||||||
searchParam.searchEndTime = endDate.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
|
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: '被检设备',
|
title: '被检设备',
|
||||||
showCover: false,
|
showCover: false,
|
||||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id,
|
||||||
tempApi: downloadCNDevTemplate,
|
tempApi: downloadTemplate,
|
||||||
importApi: importCNDev,
|
importApi: importPqDev,
|
||||||
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
// importApi: modeStore.currentMode === "比对式"? importContrastPqDev: importCNDev,
|
||||||
getTableList: proTable.value?.getTableList,
|
getTableList: proTable.value?.getTableList,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user