Răsfoiți Sursa

修复设备功能执行接口的key的传递,之前把设备key弄成产品key了

yanglzh 2 ani în urmă
părinte
comite
713d3a9205

+ 4 - 3
src/views/iot/device/instance/component/function.vue

@@ -31,7 +31,8 @@ import { ElMessage } from 'element-plus'
 import api from '/@/api/device'
 
 const props = defineProps({
-	funKey: String,
+	productKey: String,
+	deviceKey: String,
 })
 
 interface IListItem {
@@ -44,7 +45,7 @@ interface IListItem {
 
 const list = ref<IListItem[]>([])
 
-api.tabDeviceFucntion.getList({ key: props.funKey }).then((res: IListItem[]) => {
+api.tabDeviceFucntion.getList({ key: props.productKey }).then((res: IListItem[]) => {
 	res.forEach((item) => (item.result = ''))
 	list.value = res
 })
@@ -60,7 +61,7 @@ function run(row: IListItem) {
 	row.inputs.forEach(({ key, value }) => (params[key] = value))
 	api.tabDeviceFucntion
 		.do({
-			deviceKey: props.funKey,
+			deviceKey: props.deviceKey,
 			funcKey: row.key,
 			params,
 		})

+ 3 - 2
src/views/iot/device/instance/detail.vue

@@ -233,7 +233,7 @@
           </div>
         </el-tab-pane>
         <el-tab-pane label="设备功能" name="5">
-          <functionCom :fun-key="prodetail.key" v-if="prodetail.key"></functionCom>
+          <functionCom :device-key="detail.key" :product-key="prodetail.key"  v-if="detail.key && prodetail.key"></functionCom>
         </el-tab-pane>
         <el-tab-pane label="日志管理" name="4">
           <div class="system-user-search mb15">
@@ -398,7 +398,8 @@ export default defineComponent({
 
 		onMounted(() => {
 			const ids = route.params && route.params.id;
-			api.instance.detail(ids).then((res: any) => {
+      api.instance.detail(ids).then((res: any) => {
+        console.log(res)
 				state.detail = res.data;
 				state.developer_status = res.data.status;
 				state.tableData.param.productId = res.data.product.id;