|
@@ -12,7 +12,7 @@
|
|
|
class="tag-stat"/>
|
|
|
</template>
|
|
|
<template v-slot:content>
|
|
|
- <view class="order-info">
|
|
|
+ <view class="order-info" style="width: 100%">
|
|
|
<view class="mix-wrap">
|
|
|
<view class="info-column">
|
|
|
<label-text
|
|
@@ -100,6 +100,34 @@
|
|
|
</up-cell-group>
|
|
|
</template>
|
|
|
</panel>
|
|
|
+ <panel>
|
|
|
+ <template v-slot:header>
|
|
|
+ <up-icon size="28rpx" :name="list"></up-icon>
|
|
|
+ 设备调试
|
|
|
+ </template>
|
|
|
+ <template v-slot:content>
|
|
|
+ <up-cell-group :border="false">
|
|
|
+ <up-cell title="选择服务" :isLink="true" arrow-direction="left-arrow" @click="state.serviceShow = true">
|
|
|
+ <template v-slot:value>
|
|
|
+ <up-text v-if="state.selectedService" :lines="1" align="right" :text="state.selectedService.name"/>
|
|
|
+ </template>
|
|
|
+ </up-cell>
|
|
|
+ <up-cell v-if="state.selectedService && state.selectedService.inputData" :title="state.selectedService.inputData.name" :isLink="false">
|
|
|
+ <template #value>
|
|
|
+ <up-input
|
|
|
+ :placeholder="`请输入${state.selectedService.inputData.name}`"
|
|
|
+ v-model="state.orderInfo"
|
|
|
+ ></up-input>
|
|
|
+ </template>
|
|
|
+ </up-cell>
|
|
|
+ <up-cell :border="false">
|
|
|
+ <template v-slot:value>
|
|
|
+ <up-button type="primary" size="small" text="下发指令" @click="onCommand"></up-button>
|
|
|
+ </template>
|
|
|
+ </up-cell>
|
|
|
+ </up-cell-group>
|
|
|
+ </template>
|
|
|
+ </panel>
|
|
|
<up-tabbar
|
|
|
:fixed="true"
|
|
|
:placeholder="false"
|
|
@@ -187,7 +215,14 @@
|
|
|
</up-form>
|
|
|
</view>
|
|
|
</up-action-sheet>
|
|
|
-
|
|
|
+ <up-action-sheet
|
|
|
+ :actions="state.serviceList"
|
|
|
+ @select="selectClick"
|
|
|
+ title="选择服务"
|
|
|
+ :show="state.serviceShow"
|
|
|
+ @close="state.serviceShow = false"
|
|
|
+ :closeOnClickOverlay="true"
|
|
|
+ />
|
|
|
<up-modal
|
|
|
:show="state.showDisableModal"
|
|
|
title="禁用设备"
|
|
@@ -201,7 +236,6 @@
|
|
|
设备禁用后将导致该设备无法连接
|
|
|
</view>
|
|
|
</up-modal>
|
|
|
-
|
|
|
<up-modal
|
|
|
:show="state.showEnableModal"
|
|
|
title="启用设备"
|
|
@@ -215,7 +249,6 @@
|
|
|
设备禁用后将导致该设备无法连接
|
|
|
</view>
|
|
|
</up-modal>
|
|
|
-
|
|
|
<up-datetime-picker
|
|
|
:show="state.showStartClendar"
|
|
|
v-model="state.model.order.startDate"
|
|
@@ -235,7 +268,15 @@ import list from "@/static/aiot/list.svg";
|
|
|
import Panel from "@/components/pannel/index.vue";
|
|
|
import LabelText from "@/components/labeltext/index.vue";
|
|
|
import {onMounted, reactive, ref} from 'vue';
|
|
|
-import {forbidDevice, getDeviceDetail, getDeviceMeta, scrapDevice, startDevice} from "@/api/device.js";
|
|
|
+import {
|
|
|
+ deviceServiceApply,
|
|
|
+ forbidDevice,
|
|
|
+ getDeviceDetail,
|
|
|
+ getDeviceMeta,
|
|
|
+ getDeviceService,
|
|
|
+ scrapDevice,
|
|
|
+ startDevice
|
|
|
+} from "@/api/device.js";
|
|
|
import {onLoad} from "@dcloudio/uni-app";
|
|
|
import {DateFormat, formatTxt, getDevImg, hideKeyboard, reloadPage, timestampToDate} from "@/util/index.js";
|
|
|
import {valueToConst} from "@/common/consts/CommonConst.js";
|
|
@@ -248,6 +289,7 @@ const state = reactive({
|
|
|
showDisableModal: false,
|
|
|
showEnableModal: false,
|
|
|
deviceInfo: {},
|
|
|
+ serviceShow: false,
|
|
|
metaInfo: {
|
|
|
dataMetaRunInfo: [],
|
|
|
dataOnlineRunInfo: [],
|
|
@@ -263,6 +305,10 @@ const state = reactive({
|
|
|
{required: true, message: '请选择报废日期'},
|
|
|
],
|
|
|
},
|
|
|
+ serviceDic: {},
|
|
|
+ serviceList: [],
|
|
|
+ selectedService: null,
|
|
|
+ orderInfo: ""
|
|
|
});
|
|
|
const deviceId = ref('')
|
|
|
onLoad((option) => {
|
|
@@ -271,6 +317,10 @@ onLoad((option) => {
|
|
|
onMounted(() => {
|
|
|
getDeviceDetail(deviceId.value).then((data) => {
|
|
|
state.deviceInfo = data
|
|
|
+
|
|
|
+ if (data.metadataId) {
|
|
|
+ qryDeviceService(data.metadataId);
|
|
|
+ }
|
|
|
})
|
|
|
getDeviceMeta(deviceId.value).then((res) => {
|
|
|
if (res.metadataList) {
|
|
@@ -280,6 +330,7 @@ onMounted(() => {
|
|
|
state.metaInfo.dataOnlineRunInfo = res.onlineList
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
});
|
|
|
const onConfirmDisable = () => {
|
|
|
forbidDevice([deviceId.value]).then(() => {
|
|
@@ -287,6 +338,28 @@ const onConfirmDisable = () => {
|
|
|
state.showDisableModal = false;
|
|
|
})
|
|
|
};
|
|
|
+const qryDeviceService = (metaId) => {
|
|
|
+ getDeviceService({
|
|
|
+ metadataId: metaId
|
|
|
+ }).then((res) => {
|
|
|
+ if (res && res.length > 0) {
|
|
|
+ state.serviceList = res.map((item) => {
|
|
|
+ const {identifier, inputData, name} = item;
|
|
|
+ const inputDataFormat = JSON.parse(inputData)[0];
|
|
|
+ state.serviceDic[identifier] = {
|
|
|
+ identifier,
|
|
|
+ name,
|
|
|
+ inputData: inputDataFormat
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ name: name,
|
|
|
+ value: identifier,
|
|
|
+ inputData: inputDataFormat
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
const onConfirmEnable = () => {
|
|
|
state.showEnableModal = false;
|
|
|
startDevice([deviceId.value]).then(() => {
|
|
@@ -320,7 +393,32 @@ const submit = () => {
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
+const selectClick = (e) => {
|
|
|
+ state.serviceShow = false;
|
|
|
+ state.selectedService = e;
|
|
|
+ state.orderInfo = null;
|
|
|
+}
|
|
|
|
|
|
+const onCommand = () => {
|
|
|
+ if (!state.orderInfo) {
|
|
|
+ uToastRef.value.show({
|
|
|
+ type: 'error',
|
|
|
+ message: "请输入指令",
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ deviceServiceApply(deviceId.value, state.selectedService.value, {
|
|
|
+ [state.selectedService.inputData.identifier]: state.orderInfo
|
|
|
+ }).then(() => {
|
|
|
+ uToastRef.value.show({
|
|
|
+ type: 'default',
|
|
|
+ message: "操作成功",
|
|
|
+ complete() {
|
|
|
+ reloadPage();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
|