Browse Source

fix: 产品中productKey参数修改

yanglzh 1 year ago
parent
commit
6bb4f68d46

+ 7 - 7
src/api/device/index.ts

@@ -11,13 +11,13 @@ export default {
     // 设备属性设置
     propertySet: (data: object) => post('/product/property/set', data),
     // 获取设备接入信息 /product/?id=35
-    connect_intro: (id: string) => get('/product/connect_intro', { id }),
+    connect_intro: (productKey: string) => get('/product/connect_intro', { productKey }),
     getList: (params: object) => get('/product/page_list', params),
     getLists: (params: object) => get('/product/list', params),
     add: (data: object) => post('/product/add', data),
     delete: (ids: number) => del('/product/del', { ids }),
     edit: (data: object) => put('/product/edit', data),
-    detail: (id: number) => get('/product/detail', { id }),
+    detail: (productKey: string) => get('/product/detail', { productKey }),
     message_protocol_list: (params: object) => get('/product/protocol/message_protocol_list', params),
     trunsport_protocol_list: (params: object) => get('/product/protocol/trunsport_protocol_list', params),
     getDataType: (params: object) => get('/product/tsl/data_type', params),
@@ -44,7 +44,7 @@ export default {
     add: (data: object) => post('/product/device/add', data),
     edit: (data: object) => put('/product/device/edit', data),
     del: (ids: number) => del('/product/device/del', { ids }),
-    detail: (id: number) => get('/product/device/detail', { id }),
+    detail: (deviceKey: string) => get('/product/device/detail', { deviceKey }),
     getLogList: (params: object) => get('/product/log/search', params),
     getlogcate: (params: object) => get('/product/log/type', params),
     getrun_status: (params: object) => get('/product/device/run_status', params),
@@ -66,23 +66,23 @@ export default {
     property: (params: object) => get('/product/tsl/property/list', params),
     propertyadd: (data: object) => post('/product/tsl/property/add', data),
     propertyedit: (data: object) => put('/product/tsl/property/edit', data),
-    propertydel: (productId: number, key: string) => del('/product/tsl/property/del', { productId, key }),
+    propertydel: (productKey: string, key: string) => del('/product/tsl/property/del', { productKey, key }),
 
     function: (params: object) => get('/product/tsl/function/list', params),
     functionadd: (data: object) => post('/product/tsl/function/add', data),
     functionedit: (data: object) => put('/product/tsl/function/edit', data),
-    functiondel: (productId: number, key: string) => del('/product/tsl/function/del', { productId, key }),
+    functiondel: (productKey: string, key: string) => del('/product/tsl/function/del', { productKey, key }),
 
 
     event: (params: object) => get('/product/tsl/event/list', params),
     eventadd: (data: object) => post('/product/tsl/event/add', data),
     eventedit: (data: object) => put('/product/tsl/event/edit', data),
-    eventdel: (productId: number, key: string) => del('/product/tsl/event/del', { productId, key }),
+    eventdel: (productKey: string, key: string) => del('/product/tsl/event/del', { productKey, key }),
 
     tag: (params: object) => get('/product/tsl/tag/list', params),
     tagadd: (data: object) => post('/product/tsl/tag/add', data),
     tagedit: (data: object) => put('/product/tsl/tag/edit', data),
-    tagdel: (productId: number, key: string) => del('/product/tsl/tag/del', { productId, key }),
+    tagdel: (productKey: string, key: string) => del('/product/tsl/tag/del', { productKey, key }),
   },
   tree: {
     getList: (params: object) => get('/product/device_tree/list', params),

+ 1 - 1
src/views/iot/device/instance/detail.vue

@@ -81,7 +81,7 @@
             <el-descriptions-item label="设备标识">{{ detail.key }}</el-descriptions-item>
             <el-descriptions-item label="设备名称">{{ detail.name }}</el-descriptions-item>
             <el-descriptions-item label="所属产品">
-              <router-link :to="'/iotmanager/device/product/detail/' + prodetail.id" class="link-type">{{
+              <router-link :to="'/iotmanager/device/product/detail/' + prodetail.key" class="link-type">{{
                 detail.productName }} </router-link>
             </el-descriptions-item>
             <el-descriptions-item label="消息协议">{{ prodetail.messageProtocol }}</el-descriptions-item>

+ 1 - 1
src/views/iot/device/instance/index.vue

@@ -115,7 +115,7 @@
 
         <el-table-column label="操作" width="180" align="center" fixed="right">
           <template #default="scope">
-            <router-link :to="'/iotmanager/device/instance/' + scope.row.id" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;" v-auth="'detail'">
+            <router-link :to="'/iotmanager/device/instance/' + scope.row.key" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;" v-auth="'detail'">
               <span>详情</span>
             </router-link>
             <el-button size="small" text type="warning" @click="onOpenEditDic(scope.row)" v-auth="'edit'">修改</el-button>

+ 1 - 1
src/views/iot/device/product/component/dataParse.vue

@@ -51,7 +51,7 @@ function saveCode() {
 
 function toSave(data: string) {
 	api.product.script({
-		id: route.params.id,
+		key: route.params.id,
 		scriptInfo: data
 	}).then(() => {
 		ElMessage.success('保存成功')

+ 7 - 7
src/views/iot/device/product/component/editAttr.vue

@@ -199,7 +199,7 @@ import { validateNoSpace } from '/@/utils/validator';
 
 interface RuleFormState {
 	id: number;
-	productId: number;
+	productKey: string;
 	name: string;
 	dictType: string;
 	valueType: Object;
@@ -224,7 +224,7 @@ export default defineComponent({
 			typeData: [], //
 			type: '',
 			types: '',
-			productId: 0,
+			productKey: '',
 			valueType: {
 				type: '',
 				maxLength: '',
@@ -248,7 +248,7 @@ export default defineComponent({
 
 			ruleForm: {
 				id: 0,
-				productId: 0,
+				productKey: '',
 				name: '',
 				key: '',
 				transportProtocol: '',
@@ -273,7 +273,7 @@ export default defineComponent({
 		});
 
 		// 打开弹窗
-		const openDialog = (row: RuleFormState | null, productId: number | null) => {
+		const openDialog = (row: RuleFormState | null, productKey: string | null) => {
 			resetForm();
 
 			api.product.getDataType({ status: -1 }).then((res: any) => {
@@ -293,7 +293,7 @@ export default defineComponent({
 			if (row.valueType) {
 				state.ruleForm = row;
 
-				state.productId = productId;
+				state.productKey = productKey;
 				state.valueType = row.valueType;
 				state.ruleForm.valueType.type = row.valueType.type;
 				state.ruleForm.type = row.valueType.type;
@@ -377,7 +377,7 @@ export default defineComponent({
 		}
 
 		const addJson = () => {
-			editOptionRef.value.openDialog({ product_id: 0, id: 0 });
+			editOptionRef.value.openDialog({ productKey: 0, id: 0 });
 		};
 		const getOptionData = (data) => {
 			state.jsondata.push(data);
@@ -425,7 +425,7 @@ export default defineComponent({
 						}
 
 						state.ruleForm.valueType = state.valueType;
-						state.ruleForm.productId = state.productId
+						state.ruleForm.productKey = state.productKey
 						api.model.propertyedit(state.ruleForm).then(() => {
 							ElMessage.success('属性定义类型修改成功');
 							closeDialog(); // 关闭弹窗

+ 7 - 7
src/views/iot/device/product/component/editEvent.vue

@@ -64,7 +64,7 @@ import { ElMessage, UploadProps } from 'element-plus';
 
 interface RuleFormState {
 	id: number;
-	productId: number;
+	productKey: string;
 	level: number;
 	name: string;
 	dictType: string;
@@ -91,7 +91,7 @@ export default defineComponent({
 			typeData: [], //
 			type: '',
 			types: '',
-			productId: 0,
+			productKey: '',
 			elementType: {
 				type: '',
 				maxLength: '',
@@ -107,7 +107,7 @@ export default defineComponent({
 			outputsdata: [],
 
 			ruleForm: {
-				productId: 0,
+				productKey: '',
 				name: '',
 				key: '',
 				outputs: [],
@@ -124,7 +124,7 @@ export default defineComponent({
 		});
 
 		// 打开弹窗
-		const openDialog = (row: RuleFormState | null, productId: number | null) => {
+		const openDialog = (row: RuleFormState | null, productKey: string | null) => {
 			resetForm();
 
 			api.product.getDataType({ status: -1 }).then((res: any) => {
@@ -144,7 +144,7 @@ export default defineComponent({
 			state.ruleForm = row;
 			if (row.outputs) {
 				state.ruleForm = row;
-				state.productId = productId;
+				state.productKey = productKey;
 				state.outputsdata = row.outputs;
 			}
 			state.isShowDialog = true;
@@ -197,7 +197,7 @@ export default defineComponent({
 		}
 
 		const addJson = (type) => {
-			editOptionRef.value.openDialog({ product_id: 0, id: 0, type_data: type });
+			editOptionRef.value.openDialog({ productKey: 0, id: 0, type_data: type });
 		};
 		const getOptionData = (data, type_data) => {
 			if (type_data == 'fun') {
@@ -225,7 +225,7 @@ export default defineComponent({
 					const theApi = state.ruleForm.id !== 0 ? api.model.eventedit : api.model.eventadd;
 
 					if (state.ruleForm.id !== 0) {
-						state.ruleForm.productId = state.productId;
+						state.ruleForm.productKey = state.productKey;
 					}
 
 					theApi(state.ruleForm).then(() => {

+ 8 - 8
src/views/iot/device/product/component/editFun.vue

@@ -82,7 +82,7 @@ import { ElMessage, UploadProps } from 'element-plus';
 
 interface RuleFormState {
 	id: number;
-	productId: number;
+	productKey: string;
 	name: string;
 	dictType: string;
 	valueType: Object;
@@ -110,7 +110,7 @@ export default defineComponent({
 			typeData: [], //
 			type: '',
 			types: '',
-			productId: 0,
+			productKey: '',
 			valueType: {
 				type: '',
 				maxLength: '',
@@ -135,7 +135,7 @@ export default defineComponent({
 			outputsdata: [],
 
 			ruleForm: {
-				productId: 0,
+				productKey: '',
 				name: '',
 				key: '',
 				inputs: [],
@@ -158,10 +158,10 @@ export default defineComponent({
 		});
 
 		// 打开弹窗
-		const openDialog = (row: RuleFormState | null, productId: number | null) => {
+		const openDialog = (row: RuleFormState | null, productKey: number | null) => {
 			resetForm();
 			state.ruleForm = row;
-			state.productId = productId;
+			state.productKey = productKey;
 			state.inputsdata = row.inputs || [];
 			state.outputsdata = row.outputs || [];
 			state.isShowDialog = true;
@@ -236,11 +236,11 @@ export default defineComponent({
 		}
 
 		const addJson = (type) => {
-			editOptionRef.value.openDialog({ product_id: 0, id: 0, type_data: type });
+			editOptionRef.value.openDialog({ productKey: 0, id: 0, type_data: type });
 		};
 
 		const addJsonOut = (type) => {
-			editOptionOutRef.value.openDialog({ product_id: 0, id: 0, type_data: type });
+			editOptionOutRef.value.openDialog({ productKey: 0, id: 0, type_data: type });
 		};
 
 		const getOptionData = (data, type_data) => {
@@ -279,7 +279,7 @@ export default defineComponent({
 					state.ruleForm.inputs = state.inputsdata;
 					state.ruleForm.outputs = state.outputsdata;
 					if (state.ruleForm.id !== 0) {
-						state.ruleForm.productId = state.productId;
+						state.ruleForm.productKey = state.productKey;
 						api.model.functionedit(state.ruleForm).then(() => {
 							ElMessage.success('功能定义类型修改成功');
 							closeDialog(); // 关闭弹窗

+ 1 - 1
src/views/iot/device/product/component/editTab.vue

@@ -371,7 +371,7 @@ export default defineComponent({
 		};
 
 		const addJson = () => {
-			editOptionRef.value.openDialog({ product_id: 0, id: 0 });
+			editOptionRef.value.openDialog({ productKey: 0, id: 0 });
 		};
 		const getOptionData = (data) => {
 			state.jsondata.push(data);

+ 7 - 6
src/views/iot/device/product/detail.vue

@@ -224,6 +224,7 @@ interface TableDataState {
 			pageNum: number;
 			pageSize: number;
 			name: string;
+			productKey: string;
 			deviceType: string;
 			status: string;
 			dateRange: string[];
@@ -258,7 +259,7 @@ export default defineComponent({
 				loading: false,
 				param: {
 					pageNum: 1,
-					productId: route.params && route.params.id,
+					productKey: route.params && route.params.id,
 					pageSize: 10,
 					status: '',
 					dateRange: [],
@@ -303,21 +304,21 @@ export default defineComponent({
 
 		//打开添加属性弹窗
 		const onOpenEditAttr = () => {
-			editAttrRef.value.openDialog({ product_id: route.params.id, id: 0, accessMode: 1 });
+			editAttrRef.value.openDialog({ productKey: route.params.id, id: 0, accessMode: 1 });
 		};
 
 		//打开添加功能弹窗
 		const onOpenEditFun = () => {
-			editFunRef.value.openDialog({ product_id: route.params.id, id: 0 });
+			editFunRef.value.openDialog({ productKey: route.params.id, id: 0 });
 		};
 		//打开添加事件弹窗
 		const onOpenEditEvent = () => {
-			editEventRef.value.openDialog({ product_id: route.params.id, id: 0, level: 0 });
+			editEventRef.value.openDialog({ productKey: route.params.id, id: 0, level: 0 });
 		};
 
 		//打开添加事件弹窗
 		const onOpenEditTab = () => {
-			editTabRef.value.openDialog({ product_id: route.params.id, id: 0, accessMode: 1 });
+			editTabRef.value.openDialog({ productKey: route.params.id, id: 0, accessMode: 1 });
 		};
 
 		// 打开修改产品弹窗
@@ -457,7 +458,7 @@ export default defineComponent({
 		// 导出
 		const onRowExport = () => {
 
-			api.product.export({ key: state.detail.key }).then((res: any) => downloadFile(res, "TSL-" + state.detail.key + "-" + getCurrentTime() + ".json"))
+			api.product.export({ productKey: state.detail.key }).then((res: any) => downloadFile(res, "TSL-" + state.detail.key + "-" + getCurrentTime() + ".json"))
 		};
 
 

+ 1 - 1
src/views/iot/device/product/index.vue

@@ -60,7 +60,7 @@
         </el-table-column>
         <el-table-column label="操作" width="130" align="center" fixed="right">
           <template #default="scope">
-            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.id" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;">
+            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.key" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;">
               <span>详情</span>
             </router-link>
             <el-button size="small" text type="warning" @click="onOpenEditDic(scope.row)" v-auth="'edit'">修改</el-button>

+ 1 - 1
src/views/iot/ota-update/module/index.vue

@@ -38,7 +38,7 @@
         <el-table-column label="模块别名" v-col="'nameAs'" prop="nameAs" show-overflow-tooltip />
         <el-table-column label="所属产品" v-col="'ProductName'" align="center" show-overflow-tooltip>
           <template #default="scope">
-            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.productId" class="link-type">
+            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.productKey" class="link-type">
               <span>{{ scope.row.ProductName }}</span>
             </router-link>
           </template>

+ 1 - 1
src/views/iot/ota-update/update/index.vue

@@ -37,7 +37,7 @@
         </el-table-column>
         <el-table-column label="所属产品" v-col="'productName'" align="center" show-overflow-tooltip>
           <template #default="scope">
-            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.productId" class="link-type">
+            <router-link :to="'/iotmanager/device/product/detail/' + scope.row.productKey" class="link-type">
               <span>{{ scope.row.productName }}</span>
             </router-link>
           </template>

+ 1 - 1
src/views/system/manage/blacklist/index.vue

@@ -55,7 +55,7 @@
         <el-table-column v-col="'createdAt'" prop="createdAt" label="创建时间" align="center" width="180"></el-table-column>
         <el-table-column v-col="'handle'" label="操作" width="150" align="center" fixed="right">
           <template #default="scope">
-            <!-- <router-link :to="'/iotmanager/device/product/detail/' + scope.row.id" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;">
+            <!-- <router-link :to="'/iotmanager/device/product/detail/' + scope.row.key" class="link-type" style="padding-right: 12px;font-size: 12px;color: #409eff;">
               <span>详情</span>
             </router-link> -->
             <el-button size="small" text type="warning" @click="onOpenEditDic(scope.row)" v-auth="'edit'">编辑</el-button>