Selaa lähdekoodia

+ h5 增加指令下发

chen.cheng 7 kuukautta sitten
vanhempi
commit
449d5b0607

+ 2 - 2
.env.h5dev

@@ -1,6 +1,6 @@
 //.env.dev
 VITE_BASE_API=/aiot-api
 
-VITE_BASE_URL=http://172.192.13.145:8019/aiot-api
+VITE_BASE_URL=https://aiot.huashoubilin.com:8090/aiot-api
 
-VITE_IMG_CDN=http://172.192.13.145:8019/
+VITE_IMG_CDN=https://aiot.huashoubilin.com:8090/

+ 12 - 9
src/pages/workbenchsub/device/detail.vue

@@ -112,11 +112,16 @@
               <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">
+          <up-cell
+              v-if="state.selectedService && state.selectedService.inputData"
+              v-for="item in state.selectedService.inputData"
+              :title="item.name"
+              :isLink="false"
+          >
             <template #value>
               <up-input
-                  :placeholder="`请输入${state.selectedService.inputData.name}`"
-                  v-model="state.orderInfo"
+                  :placeholder="`请输入${item.name}`"
+                  v-model="state.orderInfo[item.identifier]"
               ></up-input>
             </template>
           </up-cell>
@@ -308,7 +313,7 @@ const state = reactive({
   serviceDic: {},
   serviceList: [],
   selectedService: null,
-  orderInfo: ""
+  orderInfo: {}
 });
 const deviceId = ref('')
 onLoad((option) => {
@@ -345,7 +350,7 @@ const qryDeviceService = (metaId) => {
     if (res && res.length > 0) {
       state.serviceList = res.map((item) => {
         const {identifier, inputData, name} = item;
-        const inputDataFormat = JSON.parse(inputData)[0];
+        const inputDataFormat = JSON.parse(inputData);
         state.serviceDic[identifier] = {
           identifier,
           name,
@@ -396,7 +401,7 @@ const submit = () => {
 const selectClick = (e) => {
   state.serviceShow = false;
   state.selectedService = e;
-  state.orderInfo = null;
+  state.orderInfo = {};
 }
 
 const onCommand = () => {
@@ -407,9 +412,7 @@ const onCommand = () => {
     });
     return
   }
-  deviceServiceApply(deviceId.value, state.selectedService.value, {
-    [state.selectedService.inputData.identifier]: state.orderInfo
-  }).then(() => {
+  deviceServiceApply(deviceId.value, state.selectedService.value, state.orderInfo).then(() => {
     uToastRef.value.show({
       type: 'default',
       message: "操作成功",

+ 2 - 0
src/pages/workbenchsub/workorder/submit.vue

@@ -236,10 +236,12 @@ const formRef = ref(null);
 const orderTypeSelect = (item) => {
   state.model.order.type = item.id;
   state.showOrderType = false;
+  formRef.value.validateField('order.type');
 };
 const orderLevelSelect = (item) => {
   state.model.order.level = item.id;
   state.showOrderLevel = false;
+  formRef.value.validateField('order.level');
 };
 
 // 删除图片

+ 4 - 1
src/util/index.js

@@ -117,6 +117,9 @@ export const getDevImg = (devImg) => {
   const parse = JSON.parse(devImg);
   if (parse.length > 0 && parse[0].url) {
     const url = parse[0].url;
+    if (!Rules.domainPort.test(url)) {
+      return `${config.imgCdn}${url}`;
+    }
     return url.replace(Rules.domainPort, config.imgCdn);
   } else {
     return defaultImg;
@@ -176,6 +179,6 @@ export const hideKeyboard = () => {
   uni.hideKeyboard()
 }
 
-export const timestampToDate = (date, format=DateFormat.YYYYMMDDHHMM) => {
+export const timestampToDate = (date, format = DateFormat.YYYYMMDDHHMM) => {
   return dayjs(date).format(format)
 }