diff --git a/frontend/src/api/device/interface/device.ts b/frontend/src/api/device/interface/device.ts index dc92f4a..a5e48f1 100644 --- a/frontend/src/api/device/interface/device.ts +++ b/frontend/src/api/device/interface/device.ts @@ -49,9 +49,9 @@ export namespace Device { qRCode?: string| null; //设备关键信息二维码 reCheckNum: number; //复检次数 planId?:string;//检测计划Id - TimeCheckResult?:number;//守时检测结果(0:不符合1:符合) - FactorFlag?:number;//是否支持系数校准(0:不支持,1:支持) - FactorCheckResult?: number;//系数校准结果(0:不符合1:符合) + timeCheckResult?:number;//守时检测结果(0:不符合1:符合) + factorFlag?:number;//是否支持系数校准(0:不支持,1:支持) + factorCheckResult?: number;//系数校准结果(0:不符合1:符合) state: number; //状态 createBy?: string| null; //创建用户 createTime?: string| null; //创建时间 diff --git a/frontend/src/api/device/interface/testSource.ts b/frontend/src/api/device/interface/testSource.ts index 7a66486..549231b 100644 --- a/frontend/src/api/device/interface/testSource.ts +++ b/frontend/src/api/device/interface/testSource.ts @@ -34,9 +34,9 @@ export namespace TestSource { } export interface ParameterType{ id:string; - sourceParamType:string; - sourceParamDesc:string; - sourceParamValue:string; + type:string; + desc:string; + value:string; sort:number; pId:string; children?:ParameterType[]; diff --git a/frontend/src/api/plan/interface/index.ts b/frontend/src/api/plan/interface/index.ts index 19fe4fd..b5b6fc8 100644 --- a/frontend/src/api/plan/interface/index.ts +++ b/frontend/src/api/plan/interface/index.ts @@ -32,7 +32,7 @@ export namespace Plan { export interface ReqPlan extends ResPlan { datasourceIds:string; - sourceIds: string[]; + sourceIds: string; planId:string; scriptName: string ; errorSysName: string; diff --git a/frontend/src/api/plan/plan.ts b/frontend/src/api/plan/plan.ts index 753b706..6e0c566 100644 --- a/frontend/src/api/plan/plan.ts +++ b/frontend/src/api/plan/plan.ts @@ -15,12 +15,12 @@ export const getPlanList = (params: Plan.ReqPlanParams) => { } // 新增检测计划 -export const addPlan = (params: Plan.ResPlan) => { +export const addPlan = (params:any) => { return http.post(`/adPlan/add`, params) } // 编辑检测计划 -export const updatePlan = (params: Plan.ResPlan) => { +export const updatePlan = (params: any) => { return http.post(`/adPlan/update`, params) } @@ -51,10 +51,15 @@ export const getUnboundPqDevList = (params: Plan.ReqPlan) => { //根据检测计划id查询出所有已绑定的设备 export const getBoundPqDevList = (params: any) => { - return http.post(`/pqDev/listBoundByPlanId`,params) + return http.post(`/pqDev/listByPlanId`,params) } //检测计划绑定设备 export const BindPqDevList = (params: any) => { - return http.post(`/adPlan/bindDev`,params) + return http.post(`/pqDev/bindDev`,params) +} + +// 按照模式查询检测计划(用于首页展示) +export const getPlanListByPattern = (params:Plan.ReqPlan) => { + return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`) } \ No newline at end of file diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 2e6e142..4c98b9e 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -3,16 +3,16 @@ @@ -57,17 +57,6 @@ > - 查询重置 - ({ const shouldShowOption = (item) => { return !item.disabled; }; + + + +const plan_devicedata = [ + { + id: '1', //装置序号ID + name: '240001', //设备名称 + dev_Type: 'PQS-882B4',//设备类型 + dev_Chns: 4, //设备通道数 + check_Result: '未检', //检测结果 + report_State: '未生成', //报告状态 + document_State: '未归档', //归档状态 + check_State:'未检',//检测状态 + reCheck_Num: 0, //复检次数 + }] + //console.log(window.innerHeight, "+++++++++"); tableHeight.value = window.innerHeight - 600; //const deviceData = deviceDataList.plan_devicedata -const deviceData = ref([]); +const deviceData = ref([]); deviceData.value = deviceDataList.plan_devicedata.filter((item) => item.document_State === "未归档") const operationShow = ref(false); const documentStateShow = ref(false); @@ -305,6 +311,13 @@ const checkStateShow = ref(true); const operationMinWidth = ref(200); const selectionShow = ref(true); +const props = defineProps({ +id: { + type: String, + required: true, + }, +}) + //下拉框数据 //检测状态数据 let checkStatusList = reactive([ @@ -404,16 +417,33 @@ const dataCallback = (data: any) => { }; // 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口 // 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList" -const getTableList = (params: any) => { - let newParams = JSON.parse(JSON.stringify(params)); - newParams.createTime && (newParams.startTime = newParams.createTime[0]); - newParams.createTime && (newParams.endTime = newParams.createTime[1]); - delete newParams.createTime; - return getPlanList(newParams); +// const getTableList = (params: any) => { +// console.log('11111111111111111',props.id); +// let newParams = JSON.parse(JSON.stringify(params)); +// newParams.createTime && (newParams.startTime = newParams.createTime[0]); +// newParams.createTime && (newParams.endTime = newParams.createTime[1]); +// delete newParams.createTime; +// return getPlanList(newParams); +// }; + +const boundPqDevList=ref([])//根据检测计划id查询出所有已绑定的设备 + +const getTableList = async (params: any) => { + + deviceData.value = plan_devicedata.filter((item) => item.document_State === "未归档") + + + const pqDevList_Result2 = await getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]}); + boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[]; + console.log('qwe',boundPqDevList.value) + console.log('qwe123',props.id) + return getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]}); }; + + // 表格配置项 -const columns = reactive([ +const columns = reactive[]>([ { type: 'selection', fixed: 'left', width: 70, isShow:selectionShow }, { type: 'index', fixed: 'left', width: 70, label: '序号' }, { @@ -422,18 +452,20 @@ const columns = reactive([ minWidth: 220, }, { - prop: 'dev_Type', + prop: 'devType', label: '设备类型', minWidth: 100, + enum: dictStore.getDictData('Dev_Type'), + fieldNames: { label: 'name', value: 'id' }, }, { - prop: 'dev_Chns', + prop: 'devChns', label: '通道数', minWidth: 100, sortable:true, }, { - prop: 'reCheck_Num', + prop: 'reCheckNum', label: '检测次数', minWidth: 100, sortable:true, @@ -445,40 +477,36 @@ const columns = reactive([ // }, { - prop: 'check_State', + prop: 'checkState', label: '检测状态', minWidth: 100, sortable:true, isShow:checkStateShow, }, { - prop: 'check_Result', + prop: 'checkResult', label: '检测结果', minWidth: 100, sortable:true, render: (scope) => { - if(scope.row.check_Result === '不符合') - { - return ( - { scope.row.check_Result } - ) - } - else - { - return ( - { scope.row.check_Result } - ) - } - }, + if (scope.row.checkResult === 2) + { + return ({ scope.row.checkResult }) + } + else + { + return ({ scope.row.checkResult }) + } + }, }, { - prop: 'report_State', + prop: 'reportState', label: '报告状态', minWidth: 100, sortable:true, }, { - prop: 'document_State', + prop: 'documentState', label: '归档状态', minWidth: 100, sortable:true, @@ -487,149 +515,82 @@ const columns = reactive([ { prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 ,isShow: operationShow}, ]) -// const columns = reactive[]>([ -// { type: "selection", fixed: "left", width: 70 }, -// { -// prop: "checkMode", -// label: "设备序列号", -// width: 140, -// render: (scope) => { -// return scope.row.checkMode == 0 -// ? "设备1" -// : scope.row.checkMode == 1 -// ? "设备2" -// : scope.row.checkMode == 2 -// ? "设备3" -// : scope.row.checkMode; + +// // 表格配置项 +// const columns = reactive([ +// { type: 'selection', fixed: 'left', width: 70, isShow:selectionShow }, +// { type: 'index', fixed: 'left', width: 70, label: '序号' }, +// { +// prop: 'name', +// label: '设备名称', +// minWidth: 220, // }, -// }, -// { -// prop: "checkMode", -// label: "设备类型", -// width: 140, -// render: (scope) => { -// return scope.row.checkMode == 0 -// ? "PQS991" -// : scope.row.checkMode == 1 -// ? "PQS882" -// : scope.row.checkMode == 2 -// ? "PQS6666" -// : scope.row.checkMode; +// { +// prop: 'dev_Type', +// label: '设备类型', +// minWidth: 100, // }, -// }, -// { -// prop: "checkFrom", -// label: "制造厂商", -// width: 140, -// render: (scope) => { -// return scope.row.checkFrom == 0 -// ? "南京灿能" -// : scope.row.checkFrom == 1 -// ? "南瑞继保" -// : scope.row.checkFrom == 2 -// ? "/" -// : scope.row.checkFrom; +// { +// prop: 'dev_Chns', +// label: '通道数', +// minWidth: 100, +// sortable:true, // }, -// }, -// { -// prop: "numberFromName", -// label: "MAC/IP", -// render: (scope) => { -// return scope.row.numberFromName == 0 -// ? "192.168.0.1" -// : scope.row.numberFromName == 1 -// ? "192.168.0.2" -// : scope.row.numberFromName == 2 -// ? "192.168.0.3" -// : scope.row.numberFromName; +// { +// prop: 'reCheck_Num', +// label: '检测次数', +// minWidth: 100, +// sortable:true, +// // // }, +// { +// prop: 'check_State', +// label: '检测状态', +// minWidth: 100, +// sortable:true, +// isShow:checkStateShow, +// }, +// { +// prop: 'check_Result', +// label: '检测结果', +// minWidth: 100, +// sortable:true, +// render: (scope) => { +// if(scope.row.check_Result === '不符合') +// { +// return ( +// { scope.row.check_Result } +// ) +// } +// else +// { +// return ( +// { scope.row.check_Result } +// ) +// } // }, - // { - // prop: "checkExe", - // label: "检测脚本", - // render: (scope) => { - // return scope.row.checkExe == 0 - // ? "国网入网检测脚本(单影响量-模拟式)" - // : scope.row.checkExe == 1 - // ? "国网入网检测脚本" - // : scope.row.checkExe == 2 - // ? "/" - // : scope.row.checkExe; - // }, - // }, - // { - // prop: "wctx", - // label: "误差体系", - // render: (scope) => { - // return scope.row.wctx == 0 - // ? "Q/GDW 1650.2- 2016" - // : scope.row.wctx == 1 - // ? "Q/GDW 10650.2 - 2021" - // : scope.row.wctx == 2 - // ? "/" - // : scope.row.wctx; - // }, - // }, - // { - // prop: "checkStatus", - // label: "检测状态", - // width: 120, - // render: (scope) => { - // return scope.row.checkStatus == 1 - // ? "未检" - // : scope.row.checkStatus == 2 - // ? "检测中" - // : scope.row.checkStatus == 3 - // ? "检测完成" - // : scope.row.checkStatus; - // }, - // }, - // { - // prop: "checkReport", - // label: "检测报告", - // width: 120, - // render: (scope) => { - // return scope.row.checkReport == 1 - // ? "未生成" - // : scope.row.checkReport == 2 - // ? "部分生成" - // : scope.row.checkReport == 3 - // ? "全部生成" - // : scope.row.checkReport; - // }, - // }, - // { - // prop: "checkResult", - // label: "检测结果", - // width: 120, - // render: (scope) => { - // return scope.row.checkReport == 1 - // ? "/" - // : scope.row.checkReport == 2 - // ? "符合" - // : scope.row.checkReport == 3 - // ? "不符合" - // : scope.row.checkReport; - // }, - // }, - // { - // prop: "parentNode", - // label: "父节点", - // width: 90, - // render: (scope) => { - // return scope.row.checkReport == 0 - // ? "/" - // : scope.row.checkReport == 1 - // ? "检测计划1" - // : scope.row.checkReport == 2 - // ? "检测计划2" - // : scope.row.checkReport == 3 - // ? "检测计划3" - // : scope.row.checkReport; - // }, - // }, - // { prop: "operation", label: "操作", fixed: "right", width: 250 }, -// ]); +// }, +// { +// prop: 'report_State', +// label: '报告状态', +// minWidth: 100, +// sortable:true, +// }, +// { +// prop: 'document_State', +// label: '归档状态', +// minWidth: 100, +// sortable:true, +// isShow: documentStateShow, +// }, +// { prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 ,isShow: operationShow}, +// ]) + // 跳转详情页 const toDetail = () => { router.push( @@ -1016,6 +977,19 @@ const openDrawer = (title: string, row: any) => { onMounted(() => { //console.log(proTable.value?.tableData); }); + +// 监听 props.id 的变化 +watch( + () => props.id, + (newId) => { + console.log(`props.id changed to ${newId}`); + // 调用获取数据的方法 + getTableList({ type: 1, pageNum: 1, pageSize: 10 }); + }, + { immediate: true } // 立即执行一次 +); + + defineExpose({ changeActiveTabs }); \ No newline at end of file diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index e88b84c..d2278ba 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -21,7 +21,7 @@ @@ -32,8 +32,8 @@ - - + @@ -225,7 +225,7 @@ const columns = reactive[]>([ ) }, }, - { prop: 'operation', label: '操作', fixed: 'right', width: 250 }, + { prop: 'operation', label: '操作', fixed: 'right', width: 200 }, ]) const handleSourceClicked = (id: string) => {