瀏覽代碼

feat: 结果上报

wanggaokun 10 月之前
父節點
當前提交
d4f82aade1

+ 9 - 0
src/api/modules/manage/sortieParameter.ts

@@ -182,3 +182,12 @@ export const getWarningListApi = (query: any) => {
 export const abnormalByIdApi = (id: any) => {
   return http.post<any>(`/manage/sortieParameter/abnormal/${id}`)
 }
+
+/**
+ * @name 上报
+ * @param id id
+ * @returns returns
+ */
+export const pushApi = (data: any) => {
+  return http.post<any>(`/netty/push`, data)
+}

+ 0 - 1
src/stores/modules/user.ts

@@ -36,7 +36,6 @@ export const useUserStore = defineStore('admin-user', {
         getInfoApi()
           .then((res: any) => {
             if (res.code === 200) {
-              debugger
               const data = res
               const user = data.user
               const avatar = user.avatar == '' || user.avatar == null ? defAva : import.meta.env.VITE_API_URL + user.avatar

+ 6 - 5
src/views/components/execution/index.vue

@@ -142,7 +142,8 @@
 <script setup lang="ts" name="Execution">
 import { useRoute } from 'vue-router'
 import { getSortieByNoApi } from '@/api/modules/manage/sortie'
-import { listSortieParameterApi, getWarningListApi, modelListAllApi, getSortieParamsApi, exeModelApi } from '@/api/modules/manage/sortieParameter'
+import { listSortieParameterApi, modelListAllApi, getSortieParamsApi, exeModelApi } from '@/api/modules/manage/sortieParameter'
+import { listWarningApi } from '@/api/modules/manage/warning'
 import { updateModelInfoApi } from '@/api/modules/manage/modelInfo'
 import ProTable from '@/components/ProTable/index.vue'
 import DetailDialog from '@/views/components/result/index.vue'
@@ -304,7 +305,7 @@ const rowClick = async (row: any, column: TableColumnCtx<any>) => {
 
 const rowClickWarning = async (row: any, column: TableColumnCtx<any>) => {
   if (column.property == 'radio' && sortieModel.value.exeType == '3') {
-    sortieModel.value.faultCode = row.faultCode
+    sortieModel.value.faultCode = row.code
   }
 }
 
@@ -377,11 +378,11 @@ const warningColumns = reactive<ColumnProps<any>[]>([
     label: '架次号'
   },
   {
-    prop: 'faultName',
+    prop: 'name',
     label: '故障名称'
   },
   {
-    prop: 'faultCode',
+    prop: 'code',
     label: '警告代码'
   }
 ])
@@ -420,7 +421,7 @@ const options = ref({
         rules: [{ required: true, message: '请选择警告', trigger: 'change' }]
       },
       tableColumns: warningColumns,
-      api: getWarningListApi,
+      api: listWarningApi,
       rowClick: rowClickWarning,
       attrs: {
         typeName: 'table-w'

+ 29 - 6
src/views/components/result/index.vue

@@ -20,6 +20,7 @@
     </div>
     <template #footer>
       <span class="dialog-footer">
+        <el-button type="primary" v-if="route.query.taskId" @click="handlePush">结果上报</el-button>
         <!-- <el-button type="primary" @click="handleSubmit">提交手动剔除值</el-button> -->
         <el-button type="primary" v-if="['1', '0'].includes(parameter.type) && parameter.id" @click="handleSubmit">自动剔除异常值</el-button>
         <el-button @click="handleCancel">取消</el-button>
@@ -32,7 +33,10 @@
 import { Filter } from '@element-plus/icons-vue'
 import { ref, onMounted, watch } from 'vue'
 import { generalArrFilterHandler } from '@/utils/el-table-v2-utils'
-import { abnormalByIdApi } from '@/api/modules/manage/sortieParameter'
+import { abnormalByIdApi, pushApi } from '@/api/modules/manage/sortieParameter'
+import { ElMessage } from 'element-plus'
+import { useRoute } from 'vue-router'
+const route = useRoute()
 // import { useRouter } from 'vue-router'
 // const router = useRouter()
 onMounted(() => {
@@ -59,10 +63,10 @@ export interface ParameterProps {
 const dialogVisible = ref(false)
 let columnData = ref([] as any[])
 const initColumnData = () => {
-  columnData.value = [
-    { key: 'index', title: '序号', cellRenderer: ({ rowIndex }) => `${rowIndex + 1}`, align: 'center', width: 50 },
-    { key: '时间', title: '时间', dataKey: '时间', align: 'center', width: 200 }
-  ]
+  columnData.value = [{ key: 'index', title: '序号', cellRenderer: ({ rowIndex }) => `${rowIndex + 1}`, align: 'center', width: 50 }]
+  if (['1', '2'].includes(parameter.value.type)) {
+    columnData.value.push({ key: '时间', title: '时间', dataKey: '时间', align: 'center', width: 200 })
+  }
 }
 let columns = ref([] as any[])
 // 父组件传过来的参数
@@ -73,6 +77,25 @@ const parameter = ref<ParameterProps>({
   type: ''
 })
 
+// 取消按钮,重置表单,关闭弹框
+const handlePush = async () => {
+  let content: any = ''
+  dataTable.value.forEach(el => {
+    let data: any = ''
+    Object.keys(el).forEach(key => {
+      data = `${data}${key}:${el[key]};`
+    })
+    content = `${content}${data}`
+  })
+  let data = {
+    id: route.query.taskId,
+    content: content
+  }
+  const res = await pushApi(data)
+  if (res.code == 200) {
+    ElMessage.success('执行成功')
+  }
+}
 // 取消按钮,重置表单,关闭弹框
 const handleSubmit = async () => {
   const res = await abnormalByIdApi(parameter.value.id)
@@ -95,7 +118,7 @@ const isAbnormalRenderer = (key: string | string[]) => {
   return key.includes('_是否异常')
 }
 const isFalseAlarmRenderer = (key: string | string[]) => {
-  return key.includes('_是否虚警')
+  return key.includes('是否虚警')
 }
 // 前一筛选状态
 let prevFilters = ref([] as any[])

+ 1 - 1
src/views/manage/orderInfo/index.vue

@@ -51,7 +51,7 @@ const toExe = async (row: any) => {
     return
   }
 
-  router.push({ path: `/order/task/${data.sortie}`, query: { type: row.orderType, orderId: row.id } })
+  router.push({ path: `/order/task/${data.sortie}`, query: { type: row.orderType, orderId: row.id, taskId: row.orderBatchId } })
 }
 
 // ProTable 实例

+ 92 - 0
src/views/manage/orderInfo/task/CustomDialog.vue

@@ -0,0 +1,92 @@
+<template>
+  <el-dialog
+    v-model="dialogVisible"
+    :close-on-click-modal="false"
+    :title="parameter.title"
+    :destroy-on-close="true"
+    :width="parameter.width"
+    :top="parameter.top"
+    draggable
+  >
+    <slot name="default" :parameter="parameter"></slot>
+    <template #footer>
+      <span class="dialog-footer">
+        <slot name="footer" :parameter="parameter"></slot>
+        <el-button type="primary" v-if="route.query.taskId" @click="handlePush">结果上报</el-button>
+
+        <!-- <el-button type="primary" v-if="parameter.isEdit" :loading="butLoading" @click="handleSubmit">确认</el-button>
+        <el-button @click="handleCancel">取消</el-button> -->
+      </span>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup lang="ts" name="FormDialog">
+import { ref } from 'vue'
+import { useRoute } from 'vue-router'
+import { ElMessage } from 'element-plus'
+import { pushApi } from '@/api/modules/manage/sortieParameter'
+
+const route = useRoute()
+export interface FormParameterProps {
+  title: string // 标题
+  width?: number // 弹框宽度
+  isEdit?: boolean // 是否编辑
+  top?: string // 离顶部距离
+  model: Record<string, any>
+  api?: (params: any) => Promise<any> // 提交api
+}
+// dialog状态
+const dialogVisible = ref(false)
+const butLoading = ref(false)
+// 父组件传过来的参数
+const parameter = ref<FormParameterProps>({
+  title: '',
+  width: 1250,
+  top: '8vh',
+  isEdit: true,
+  model: {},
+  api: undefined
+})
+const handlePush = async () => {
+  let data = {
+    id: route.query.taskId,
+    content: parameter.value.model
+  }
+  const res = await pushApi(data)
+  if (res.code == 200) {
+    ElMessage.success('执行成功')
+  }
+}
+// 提交
+// const handleSubmit = () => {
+//   butLoading.value = true
+//   parameter.value.api!(parameter.value.model).then(res => {
+//     if (res.code == 200) {
+//       ElMessage.success('操作成功')
+//       dialogVisible.value = false
+//     } else {
+//       console.log('message', res.message)
+//     }
+//   })
+//   butLoading.value = false
+// }
+
+// 取消按钮,重置表单,关闭弹框
+const handleCancel = () => {
+  butLoading.value = false
+  dialogVisible.value = false
+}
+
+// 接收父组件参数
+const openDialog = (params: FormParameterProps) => {
+  parameter.value = { ...parameter.value, ...params }
+  butLoading.value = false
+  dialogVisible.value = true
+}
+
+defineExpose({
+  openDialog,
+  handleCancel
+})
+</script>

+ 8 - 12
src/views/manage/orderInfo/task/index.vue

@@ -57,7 +57,7 @@
             :tool-button="false"
             row-key="id"
             :is-show-search="false"
-            :request-api="getWarningListApi"
+            :request-api="listWarningApi"
             :init-param="initParam"
             max-height="500"
             :data-callback="dataCallback"
@@ -98,17 +98,12 @@ import { ref, reactive, onMounted, nextTick, watch } from 'vue'
 import ProForm from '@/components/ProForm/index.vue'
 import ProTable from '@/components/ProTable/index.vue'
 import DetailDialog from '@/views/components/result/index.vue'
-import FormDialog from '@/components/CustomDialog/index.vue'
+import FormDialog from './CustomDialog.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
 import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'
 import { updateModelInfoApi } from '@/api/modules/manage/modelInfo'
-import {
-  listSortieParameterAllApi,
-  getWarningListApi,
-  modelListAllApi,
-  getSortieParamsApi,
-  exeModelOrderApi
-} from '@/api/modules/manage/sortieParameter'
+import { listSortieParameterAllApi, modelListAllApi, getSortieParamsApi, exeModelOrderApi } from '@/api/modules/manage/sortieParameter'
+import { listWarningApi } from '@/api/modules/manage/warning'
 
 import { getSortieByNoApi } from '@/api/modules/manage/sortie'
 // import { getSortieApi } from '@/api/modules/manage/sortie'
@@ -179,7 +174,7 @@ const rowClick = async (row: any, column: TableColumnCtx<any>) => {
 }
 const rowClickWarning = async (row: any, column: TableColumnCtx<any>) => {
   if (column.property == 'radio' && active.value === 3 && type === '3') {
-    formRef.value!.formModel.faultCode = row.faultCode
+    formRef.value!.formModel.faultCode = row.code
   }
 }
 // 选择诊断类型后触发
@@ -269,6 +264,7 @@ const openResDialog = async (data: any) => {
   const params = {
     title: '结果',
     model: data,
+    id: route.query.taskId,
     isEdit: false
   }
   formDialogRef.value?.openDialog(params)
@@ -421,11 +417,11 @@ const warningColumns = reactive<ColumnProps<any>[]>([
     label: '架次号'
   },
   {
-    prop: 'faultName',
+    prop: 'name',
     label: '故障名称'
   },
   {
-    prop: 'faultCode',
+    prop: 'code',
     label: '警告代码'
   }
 ])

+ 10 - 2
src/views/manage/warning/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="table-box">
-    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listWarningApi">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listWarningApi" :data-callback="dataCallback">
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
         <el-button type="primary" v-auth="['manage:warning:add']" :icon="CirclePlus" @click="openDialog(1, '警告信息新增')"> 新增 </el-button>
@@ -57,7 +57,15 @@ import {
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
-
+const dataCallback = (data: any) => {
+  const page = proTable.value!.pageable
+  return {
+    list: data.data,
+    total: data.total,
+    pageNum: page.pageNum,
+    pageSize: page.pageSize
+  }
+}
 // 删除警告信息信息
 const deleteWarning = async (params: any) => {
   await useHandleData(delWarningApi, params.id, `删除【params.id】警告信息`)

+ 0 - 1
src/views/system/user/profile/userAvatar.vue

@@ -88,7 +88,6 @@ const visible = ref(false)
 const title = ref('修改头像')
 
 const cropper = ref<any>({})
-debugger
 //图片裁剪数据
 const options = reactive<Options>({
   img: userStore.avatar,