默认选中第一条检测计划
This commit is contained in:
@@ -63,3 +63,17 @@ export const BindPqDevList = (params: any) => {
|
||||
export const getPlanListByPattern = (params:Plan.ReqPlan) => {
|
||||
return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`)
|
||||
}
|
||||
|
||||
// 导出检测计划
|
||||
export const exportPlan=(params: Device.ReqPqDevParams)=>{
|
||||
return http.download(`/adPlan/export`, params)
|
||||
}
|
||||
|
||||
// 下载模板
|
||||
export const downloadTemplate = () => {
|
||||
return http.download(`/adPlan/downloadTemplate`)
|
||||
}
|
||||
// 导入检测计划
|
||||
export const importPlan=(params: Device.ReqPqDevParams)=>{
|
||||
return http.upload(`/adPlan/import`, params)
|
||||
}
|
||||
@@ -48,6 +48,7 @@ import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plu
|
||||
export interface ExcelParameterProps {
|
||||
title: string; // 标题
|
||||
showCover?: boolean; // 是否显示”数据覆盖“选项
|
||||
patternId?: string; // 模式ID
|
||||
fileSize?: number; // 上传文件的大小
|
||||
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
||||
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
||||
@@ -84,6 +85,9 @@ const downloadTemp = () => {
|
||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
let excelFormData = new FormData();
|
||||
excelFormData.append("file", param.file);
|
||||
if(parameter.value.patternId){
|
||||
excelFormData.append("patternId",parameter.value.patternId)
|
||||
}
|
||||
isCover.value && excelFormData.append("isCover", isCover.value as unknown as Blob);
|
||||
await parameter.value.importApi!(excelFormData);
|
||||
parameter.value.getTableList && parameter.value.getTableList();
|
||||
|
||||
@@ -385,9 +385,12 @@ const tableList = ref([]);
|
||||
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
const pqDevList_Result2 = await getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]});
|
||||
boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
|
||||
return getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]});
|
||||
debugger
|
||||
if(props.id) {
|
||||
// const pqDevList_Result2 = await getBoundPqDevList({'planId': props.id,'checkStateList':[0,1,2]});
|
||||
// boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
|
||||
return getBoundPqDevList({'planId': props.id,'checkStateList':[0,1,2]});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="已检设备" v-if="tabShow" :style="{ height: tabPaneHeight }">
|
||||
<!-- 列表数据 -->
|
||||
<div class="container_table" :style="{ height: tableHeight }">
|
||||
<Table ref="tableRef2" :id='currentId'></Table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="已检设备" v-if="tabShow" :style="{ height: tabPaneHeight }">-->
|
||||
<!-- <!– 列表数据 –>-->
|
||||
<!-- <div class="container_table" :style="{ height: tableHeight }">-->
|
||||
<!-- <Table ref="tableRef2" :id='currentId'></Table>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-tab-pane>-->
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
@@ -271,7 +271,7 @@ const getPieData = async (id: string) => {
|
||||
handleCheckFunction(0)//切换左侧树,默认css功能是设备检测
|
||||
|
||||
const boundPqDevList=ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||
const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList':[0,1,2]});
|
||||
const pqDevList_Result2 = await getBoundPqDevList({'planId': id,'checkStateList':[0,1,2]});
|
||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[];
|
||||
|
||||
// 初始化计数对象
|
||||
@@ -392,7 +392,7 @@ const resizeObserver = new ResizeObserver(entries => {
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
onBeforeMount(async () => {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||
const reqPlan: Plan.ReqPlan = {
|
||||
pattern: patternId,
|
||||
@@ -415,7 +415,11 @@ onMounted(async () => {
|
||||
code: 0,
|
||||
state: 0
|
||||
};
|
||||
// debugger;
|
||||
const planList = await getPlanListByPattern(reqPlan);
|
||||
if (planList.data[0].children[0]) {
|
||||
currentId.value = planList.data[0].children[0].id;
|
||||
}
|
||||
if (chartsInfoRef.value) {
|
||||
resizeObserver.observe(chartsInfoRef.value);
|
||||
}
|
||||
|
||||
@@ -62,18 +62,17 @@ const modeList = [
|
||||
},
|
||||
];
|
||||
const handelOpen = async (item: any) => {
|
||||
|
||||
await authStore.setShowMenu();
|
||||
modeStore.setCurrentMode(item.code); // 将模式code存入 store
|
||||
await authStore.setShowMenu();
|
||||
return;
|
||||
if (isActive) {
|
||||
router.push({ path: "/static" });
|
||||
} else {
|
||||
ElMessage({
|
||||
message: "当前模式未配置",
|
||||
type: "warning",
|
||||
});
|
||||
}
|
||||
// if (isActive) {
|
||||
// router.push({ path: "/static" });
|
||||
// } else {
|
||||
// ElMessage({
|
||||
// message: "当前模式未配置",
|
||||
// type: "warning",
|
||||
// });
|
||||
// }
|
||||
};
|
||||
const handleSelect = (key: string, keyPath: string[]) => {
|
||||
console.log(key, keyPath);
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
||||
<!-- 查看设备绑定
|
||||
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
||||
|
||||
<ImportExcel ref='deviceImportExcel' />
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
||||
import {getPlanList,deletePlan } from '@/api/plan/plan.ts'
|
||||
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import type { Plan } from '@/api/plan/interface'
|
||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||
@@ -61,6 +61,9 @@ import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
||||
import {getTestSourceById} from '@/api/device/testSource/index'
|
||||
import ImportExcel from "@/components/ImportExcel/index.vue";
|
||||
import {useDownload} from "@/hooks/useDownload";
|
||||
import {exportPqDev} from "@/api/device/device";
|
||||
const dictStore = useDictStore()
|
||||
const openDeviceView = ref()
|
||||
const openSourceView = ref()
|
||||
@@ -73,7 +76,8 @@ const testSourcePopup = ref()
|
||||
const planPopup = ref()
|
||||
const devTransferPopup = ref()
|
||||
const modeStore = useModeStore();
|
||||
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
|
||||
|
||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||
|
||||
const getTableList = async(params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
@@ -232,11 +236,6 @@ const handleSourceClicked = (id: string) => {
|
||||
|
||||
};
|
||||
|
||||
function openFileDialog() {
|
||||
if (fileInput.value) {
|
||||
fileInput.value.click()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function isVisible(row: Plan.ReqPlan) {
|
||||
@@ -312,11 +311,23 @@ function handleFiles(event: Event) {
|
||||
|
||||
// 点击导入按钮
|
||||
const importClick = () => {
|
||||
openFileDialog()
|
||||
const params = {
|
||||
title: '被检设备',
|
||||
showCover: false,
|
||||
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
||||
tempApi: downloadTemplate,
|
||||
importApi: importPlan,
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
deviceImportExcel.value?.acceptParams(params)
|
||||
}
|
||||
// 点击导出按钮
|
||||
const exportClick = () => {
|
||||
openFileDialog()
|
||||
|
||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
|
||||
})
|
||||
}
|
||||
|
||||
// 点击合并按钮
|
||||
|
||||
Reference in New Issue
Block a user