Prechádzať zdrojové kódy

修改请求批次字段devOtaFirewareId改为devOtaFirmwareId,修改升级包设备管理

Xiahai 1 rok pred
rodič
commit
1d7323ed40

+ 9 - 8
src/views/iot/ota-update/update/component/batch.vue

@@ -67,14 +67,17 @@
           </template>
         </el-table-column>
         <el-table-column prop="createdAt" label="创建时间" min-width="100" align="center" />
-<!--        <el-table-column label="操作" width="200" align="center">-->
-<!--          <template #default="scope">-->
-<!--            &lt;!&ndash;            <el-button size="small" text type="warning" v-auth="'edit'" @click="CheckUpdate(scope.row)">编辑</el-button>&ndash;&gt;-->
-<!--            &lt;!&ndash;            <el-button size="small" text type="danger" v-auth="'del'" @click="del(scope.row)">删除</el-button>&ndash;&gt;-->
+        <el-table-column label="操作" width="200" align="center">
+          <template #default="scope">
+            <router-link :to="'/iotmanager/operation/ota/update/device/' + scope.row.id" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;">
+              <span>查看</span>
+            </router-link>
+            <!--            <el-button size="small" text type="warning" v-auth="'edit'" @click="CheckUpdate(scope.row)">编辑</el-button>-->
+            <!--            <el-button size="small" text type="danger" v-auth="'del'" @click="del(scope.row)">删除</el-button>-->
 <!--            <el-button size="small" text type="success" v-if="scope.row.active != 1" @click="activation(scope.row)">激活</el-button>-->
 <!--            <el-button size="small" text type="danger" v-else @click="activation(scope.row)">禁用</el-button>-->
-<!--          </template>-->
-<!--        </el-table-column>-->
+          </template>
+        </el-table-column>
       </el-table>
       <!--      <pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize"-->
       <!--        @pagination="getList()" />-->
@@ -152,10 +155,8 @@ export default defineComponent({
     // 激活操作
     const activation = (row: any) => {
       let active = 0;
-      console.log(row);
       if (row.active === 1) active = 0;
       if (row.active === 0) active = 1;
-      console.log(active);
       api.batch.stop({id: row.id, active: active}).then((res: any) => {
         ElMessage.success('操作成功');
         batchList();

+ 5 - 7
src/views/iot/ota-update/update/component/check.vue

@@ -80,7 +80,7 @@ interface RuleFormState {
   method: string;
   devices: Array;
   stratege: string;
-  devOtaFirewareId: number;
+  devOtaFirmwareId: number;
   push: string;
   pushDisabled: boolean,
   typo: string;
@@ -112,7 +112,7 @@ export default defineComponent({
         method: '1',
         devices: [],
         stratege: '2',
-        devOtaFirewareId: 0,
+        devOtaFirmwareId: 0,
         push: '2',
         pushDisabled: true,
         typo: '1',
@@ -168,9 +168,7 @@ export default defineComponent({
     const openDialog = (row: RuleFormState | null) => {
       resetForm();
       if (row) {
-        // api.manage.detail(row.id).then((res: any) => {
-        state.ruleForm.devOtaFirewareId = row.id;
-        // });
+        state.ruleForm.devOtaFirmwareId = row.id;
         state.ruleForm.productId = row.productId;
       }
       state.isShowDialog = true;
@@ -187,7 +185,7 @@ export default defineComponent({
         method: '1',
         devices: [],
         stratege: '2',
-        devOtaFirewareId: 0,
+        devOtaFirmwareId: 0,
         push: '2',
         pushDisabled: true,
         typo: '1',
@@ -265,7 +263,7 @@ export default defineComponent({
 // 	devices: '',
 // 	stratege: '1',
 // 	waitVersion: '',
-// 	devOtaFirewareId: '',
+// 	devOtaFirmwareId: '',
 // 	productId:'',
 // }
 

+ 96 - 28
src/views/iot/ota-update/update/component/device.vue

@@ -3,12 +3,12 @@
 		<div class="search">
 			<el-form :inline="true" ref="queryRef">
 				<el-form-item label="设备名称:" prop="name">
-					<el-input v-model="params.keyWord" placeholder="请输入设备名称" clearable size="default" style="width: 240px" @submit.prevent />
+					<el-input v-model="tableData.param.keyWord" placeholder="请输入设备名称" clearable size="default" style="width: 240px" @submit.prevent />
 				</el-form-item>
 
 				<el-form-item>
 
-					<el-button size="default" type="primary" class="ml10" @click="getList(1)">
+					<el-button size="default" type="primary" class="ml10" @click="getDetail">
 						<el-icon>
 							<ele-Search />
 						</el-icon>
@@ -18,7 +18,7 @@
 
 			</el-form>
 		</div>
-		<el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading">
+		<el-table :data="tableData.data" style="width: 100%" row-key="id" v-loading="tableData.loading">
 			<el-table-column prop="id" label="ID" width="60" show-overflow-tooltip></el-table-column>
 			<el-table-column prop="deviceName" label="设备名称" show-overflow-tooltip></el-table-column>
 			<el-table-column prop="status" label="状态" show-overflow-tooltip>
@@ -50,39 +50,107 @@
 				</template>
 			</el-table-column> -->
 		</el-table>
-		<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
+<!--		<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />-->
+    <pagination v-show="tableData.total > 0" :total="tableData.total" v-model:page="tableData.param.pageNum" v-model:limit="tableData.param.pageSize" @pagination="getDetail" />
 
 	</el-card>
 </template>
 
-<script lang="ts" setup>
+<script lang="ts">
 import api from '/@/api/ota';
 import { useSearch } from '/@/hooks/useCommon';
 import { ElMessageBox, ElMessage } from 'element-plus';
-import { ref } from 'vue';
-const props = defineProps({
-	detail: {
-		type: Object,
-		default: () => { }
-	},
-})
-const queryRef = ref();
-
+import {ref, onMounted, defineComponent, reactive, toRefs} from 'vue';
+import { useRoute } from 'vue-router'
+import EditForm from "/@/views/iot/ota-update/update/component/edit.vue";
+import InfoList from "/@/views/iot/ota-update/update/component/info.vue";
+import BatchList from "/@/views/iot/ota-update/update/component/batch.vue";
 
-const { params, tableData, getList, loading } = useSearch<any[]>(api.device.getList, 'firmware', { devOtaFirmwareId: props.detail.id });
-
-getList();
+interface TableDataRow {
+  id: number;
+  name: string;
+  typo: string;
+  productName: number;
+  moduleName: string;
+  checkres: string;
+  createdAt: string;
+}
+interface TableDataState {
+  ids: number[];
+  tableData: {
+    data: Array<TableDataRow>;
+    total: number;
+    loading: boolean;
+    param: {
+      pageNum: number;
+      pageSize: number;
+      keyWord: string;
+      devOtaFirmwareId: number;
+    };
+  };
+}
 
+export default defineComponent({
+  setup(props) {
+    const route = useRoute()
+    const state = reactive<TableDataState>({
+      ids: [],
+      tableData: {
+        data: [],
+        total: 0,
+        loading: false,
+        param: {
+          pageNum: 1,
+          pageSize: 10,
+          keyWord: '',
+          devOtaFirmwareId: 0,
+        },
+      },
+    });
+    const getDetail = () => {
+      state.tableData.loading = true;
+      const id = route.params && route.params.id
+      state.tableData.param.devOtaFirmwareId = Number(id);
+      api.device.getList(state.tableData.param).then((res: any) => {
+        state.tableData.data = res.Data;
+        state.tableData.total = res.Total;
+      }).finally(() => (state.tableData.loading = false));
+    };
+    onMounted(() => {
+      getDetail()
+    });
+    return {
+      getDetail,
+      ...toRefs(props),
+      ...toRefs(state),
+    }
+  },
+})
 
-const del = (row: any) => {
-	ElMessageBox.confirm(`此操作将删除图形:“${row.name}”,是否继续?`, '提示', {
-		confirmButtonText: '确认',
-		cancelButtonText: '取消',
-		type: 'warning',
-	}).then(async () => {
-		await api.manage.del(row.id);
-		ElMessage.success('删除成功');
-		getList();
-	});
-};
+// const props = defineProps({
+// 	detail: {
+// 		type: Object,
+// 		default: () => { }
+// 	},
+// })
+// const queryRef = ref();
+//
+// console.log(props.detail);
+//
+// const { params, tableData, getList, loading } = useSearch<any[]>(api.device.getList, 'firmware', { devOtaFirmwareId: props.detail.id });
+//
+// getList();
+//
+//
+// const del = (row: any) => {
+// 	ElMessageBox.confirm(`此操作将删除图形:“${row.name}”,是否继续?`, '提示', {
+// 		confirmButtonText: '确认',
+// 		cancelButtonText: '取消',
+// 		type: 'warning',
+// 	}).then(async () => {
+// 		await api.manage.del(row.id);
+// 		ElMessage.success('删除成功');
+// 		getList();
+// 	});
+// };
 </script>

+ 7 - 14
src/views/iot/ota-update/update/detail.vue

@@ -55,9 +55,9 @@
         <el-tab-pane label="批次管理" name="tab1">
           <BatchList v-if="detail.id" :detail="detail" />
         </el-tab-pane>
-        <el-tab-pane label="设备列表" name="tab2">
-          <DeviceList v-if="detail.id" :detail="detail" />
-        </el-tab-pane>
+<!--        <el-tab-pane label="设备列表" name="tab2">-->
+<!--          <DeviceList v-if="detail.id" :detail="detail" />-->
+<!--        </el-tab-pane>-->
         <el-tab-pane label="升级包信息" name="tab3">
           <InfoList v-if="detail.id" :detail="detail" />
         </el-tab-pane>
@@ -94,30 +94,23 @@ export default defineComponent({
         checkres: 0,
         productId: 0,
       },
-
-    })
+    });
     const getDetail = () => {
       const id = route.params && route.params.id
       api.manage.detail(Number(id)).then((res: any) => {
         state.detail = res
       })
-    }
+    };
     const addOrEdit = async (row?: any) => {
       editFormRef.value.open(row)
-    }
-
+    };
     onMounted(() => {
       getDetail()
-    })
-    const handleClick = (tab: TabsPaneContext, event: Event) => {
-      // console.log(tab, event)
-    }
-
+    });
     return {
       addOrEdit,
       editFormRef,
       getDetail,
-      handleClick,
       ...toRefs(props),
       ...toRefs(state),
     }