wanggaokun 1 жил өмнө
parent
commit
a95af325c5

+ 28 - 13
src/views/manage/diagnoseResult/index.vue

@@ -8,12 +8,25 @@
       :init-param="initParam"
       :data-callback="dataCallback"
     >
+      <template #result="scope">
+        <span v-if="scope.row.resultStr">{{ scope.row.resultStr }}</span>
+        <span v-else>{{ scope.row.dataPath }}</span>
+      </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link v-auth="['manage:preHandleResult:edit']" @click="openDetailDialog(3, '结果查看', scope.row)"> 结果 </el-button>
+        <el-button
+          type="primary"
+          link
+          v-auth="['manage:preHandleResult:edit']"
+          @click="scope.row.resultStr ? openResDialog(3, '结果查看', scope.row) : openDetailDialog(3, '结果查看', scope.row)"
+        >
+          结果
+        </el-button>
       </template>
     </ProTable>
-    <FormDialog ref="formDialogRef" />
+    <FormDialog ref="formDialogRef">
+      <template #default="{ parameter }"> {{ parameter.model }} </template>
+    </FormDialog>
     <ImportExcel ref="dialogRef" />
     <DetailDialog ref="detailDialogRef" />
   </div>
@@ -24,7 +37,7 @@ import { ref, reactive } from 'vue'
 import { useRouter } from 'vue-router'
 import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
-import FormDialog from '@/components/DialogOld/form.vue'
+import FormDialog from '@/components/CustomDialog/index.vue'
 import DetailDialog from '@/views/components/result/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
 import { listSortieParameterApi, getSortieDataByIdApi } from '@/api/modules/manage/sortieParameter'
@@ -67,16 +80,21 @@ const openDetailDialog = async (type: number, title: string, row?: any) => {
 }
 
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
-
+// 打开弹框的功能
+const openResDialog = async (type: number, title: string, row?: any) => {
+  const params = {
+    title,
+    model: row.resultStr,
+    isEdit: false
+  }
+  formDialogRef.value?.openDialog(params)
+}
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
   {
     prop: 'batchNo',
-    label: '批次号',
-    search: {
-      el: 'input'
-    }
+    label: '批次号'
   },
   {
     prop: 'sortieNo',
@@ -103,11 +121,8 @@ const columns = reactive<ColumnProps<any>[]>([
     fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   {
-    prop: 'dataPath',
-    label: '数据路径',
-    search: {
-      el: 'input'
-    }
+    prop: 'result',
+    label: '结果'
   },
   {
     prop: 'createTime',

+ 46 - 19
src/views/manage/forecastResult/index.vue

@@ -8,13 +8,27 @@
       :init-param="initParam"
       :data-callback="dataCallback"
     >
+      <template #result="scope">
+        <span v-if="scope.row.resultStr">{{ scope.row.resultStr }}</span>
+        <span v-else>{{ scope.row.dataPath }}</span>
+      </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link v-auth="['manage:preHandleResult:edit']" @click="toExeResult(scope.row)"> 结果 </el-button>
+        <el-button
+          type="primary"
+          link
+          v-auth="['manage:preHandleResult:edit']"
+          @click="scope.row.resultStr ? openResDialog(3, '结果查看', scope.row) : openDetailDialog(3, '结果查看', scope.row)"
+        >
+          结果
+        </el-button>
       </template>
     </ProTable>
-    <FormDialog ref="formDialogRef" />
+    <FormDialog ref="formDialogRef">
+      <template #default="{ parameter }"> {{ parameter.model }} </template>
+    </FormDialog>
     <ImportExcel ref="dialogRef" />
+    <DetailDialog ref="detailDialogRef" />
   </div>
 </template>
 
@@ -23,9 +37,10 @@ import { ref, reactive } from 'vue'
 import { useRouter } from 'vue-router'
 import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
-import FormDialog from '@/components/DialogOld/form.vue'
+import FormDialog from '@/components/CustomDialog/index.vue'
+import DetailDialog from '@/views/components/result/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
-import { listSortieParameterApi } from '@/api/modules/manage/sortieParameter'
+import { listSortieParameterApi, getSortieDataByIdApi } from '@/api/modules/manage/sortieParameter'
 import { getDictsApi } from '@/api/modules/system/dictData'
 const router = useRouter()
 // ProTable 实例
@@ -35,11 +50,6 @@ const toDetail = (row: { sortieNo: any }) => {
   router.push({ path: `/manage/detail/index`, query: { sortieNo: row.sortieNo } })
 }
 
-// 跳转执行
-const toExeResult = async (row: { sortieNo: any }) => {
-  router.push({ path: `/manage/faultDiagnosis/index/${row.sortieNo}`, query: { flagNo: 2 } })
-}
-
 // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
 const initParam = reactive({ type: 6 })
 
@@ -54,17 +64,37 @@ const dataCallback = (data: any) => {
   }
 }
 
-const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
+const detailDialogRef = ref<InstanceType<typeof DetailDialog> | null>(null)
+const openDetailDialog = async (type: number, title: string, row?: any) => {
+  let res = { data: '' }
+  if (row?.id) {
+    res = await getSortieDataByIdApi(row?.id || null)
+  }
+  const params = {
+    id: row?.id,
+    title,
+    type: row.type,
+    tableData: JSON.parse(res.data || '[]')
+  }
+  detailDialogRef.value?.openDialog(params)
+}
 
+const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
+// 打开弹框的功能
+const openResDialog = async (type: number, title: string, row?: any) => {
+  const params = {
+    title,
+    model: row.resultStr,
+    isEdit: false
+  }
+  formDialogRef.value?.openDialog(params)
+}
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
   {
     prop: 'batchNo',
-    label: '批次号',
-    search: {
-      el: 'input'
-    }
+    label: '批次号'
   },
   {
     prop: 'sortieNo',
@@ -91,11 +121,8 @@ const columns = reactive<ColumnProps<any>[]>([
     fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   {
-    prop: 'dataPath',
-    label: '数据路径',
-    search: {
-      el: 'input'
-    }
+    prop: 'result',
+    label: '结果'
   },
   {
     prop: 'createTime',