Przeglądaj źródła

feat: 设备标签分组

Ritchie 1 rok temu
rodzic
commit
6d2d9f67d0

+ 5 - 1
src/App.vue

@@ -110,8 +110,12 @@ body,
 #app,
 div,
 span,
+// p {
+//   color: #404d74 !important;
+// }
 p {
-  // color: #404d74 !important;
+  // color: #333333;
+  font-family: "Arial", sans-serif;
 }
 
 html {

+ 4 - 1
src/assets/language/en.json

@@ -362,12 +362,15 @@
     "equipmentTypePlaceholder": "Please select a Machine type",
     "companyTypeLabel": "Company type",
     "companyTypePlaceholder": "Please select a companytype",
+    "deviceGroupPlaceholder": "Please select device group",
     "equipmentModelLabel": "Equipment model",
     "equipmentModelPlaceholder": "Please select a Machine model",
     "powerOnStatus": "Power on status",
     "pleaseSelectThePowerOnStatus": "Please select the power on status",
-    "equipmentStatus": "Equipment Status",
+    "deviceGrouping": "Equipment grouping",
+    "equipmentStatus": "Equipment status",
     "pleaseSelectTheDeviceStatus": "Please select the Machine status",
+    "plzSelectDeviceGroup": "Please select device group",
     "emptyingConditions": "Clear condition",
     "clickSearch": "Click search",
     "spunSugar": "Cotton candy",

+ 3 - 0
src/assets/language/zh.json

@@ -363,12 +363,15 @@
     "equipmentTypePlaceholder": "请选择设备类型",
     "companyTypeLabel": "公司平台",
     "companyTypePlaceholder": "请选择公司平台",
+    "deviceGroupPlaceholder": "请选择设备分组",
     "equipmentModelLabel": "设备机型",
     "equipmentModelPlaceholder": "请选择设备机型",
     "powerOnStatus": "开机状态",
     "pleaseSelectThePowerOnStatus": "请选择开机状态",
+    "deviceGrouping": "设备分组",
     "equipmentStatus": "设备状态",
     "pleaseSelectTheDeviceStatus": "请选择设备状态",
+    "plzSelectDeviceGroup": "请选择设备分组",
     "emptyingConditions": "清空条件",
     "clickSearch": "点击搜索",
     "spunSugar": "棉花糖",

+ 66 - 1
src/views/device/deviceSearch.vue

@@ -4,12 +4,16 @@
     <van-action-sheet v-model:show="sheetShow" :closeable='false' :title="$t('device.enterAnyInformationToSearch')">
       <div class="content">
         <van-form @submit="onSubmit">
+          <!-- 设备编号 -->
           <van-field v-model="clientId" name="clientId" :label="$t('device.equipmentNoLabel')"
             :placeholder="$t('device.equipmentNoPlaceholder')" />
+          <!-- 设备名称 -->
           <van-field v-model="equipmentName" name="equipmentName" :label="$t('device.equipmentNameLabel')"
             :placeholder="$t('device.equipmentNamePlaceholder')" />
+          <!-- 商家名 -->
           <van-field v-model="adminName" name="adminName" :label="$t('device.merchantNameLabel')"
             :placeholder="$t('device.merchantNamePlaceholder')" />
+          <!-- 公司平台 -->
           <div v-if="isShowCompany()">
             <van-field label-width="86" v-model="companyTypeText" is-link readonly :label="$t('device.companyTypeLabel')"
               :placeholder="$t('device.companyTypePlaceholder')" @click="companyTypeShow = true" class="field" />
@@ -64,6 +68,17 @@
               </van-popup>
             </van-col>
           </van-row>
+
+          <!-- 设备标签分组 -->
+          <div>
+            <van-field label-width="86" v-model="deviceGroupText" is-link readonly :label="$t('device.deviceGrouping')"
+              :placeholder="$t('device.plzSelectDeviceGroup')" @click="deviceGroupShow = true" class="field" />
+            <van-popup v-model:show="deviceGroupShow" round position="bottom">
+              <van-cascader v-model="deviceGroup" :title="$t('device.deviceGroupPlaceholder')"
+                :options="deviceGroupOptions" @close="deviceGroupShow = false" @finish="deviceGroupFinish" />
+            </van-popup>
+          </div>
+
           <!-- 支付方式、信道 -->
           <van-row>
             <!-- <van-col span="12">
@@ -121,9 +136,10 @@
 </template>
 
 <script>
-import { ref } from 'vue';
+import { ref, onMounted } from 'vue';
 import { useI18n } from 'vue-i18n';
 import { getLoginUser, styleUrl } from "../../common/js/utils";
+import { Api_getLabelList } from "../../service/labelMan";
 
 export default {
   setup(prop, context) {
@@ -137,9 +153,14 @@ export default {
     const machineTypeText = ref(''); // 设备类型 - 页面显示
     const machineTypeShow = ref(false); // 设备类型级联状态
     const companyType = ref(''); // 公司平台
+    const deviceGroup = ref(''); // 设备分组
     const companyTypeText = ref(''); // 公司平台 - 页面显示
+    const deviceGroupText = ref(''); // 设备分组 - 页面显示
     const companyTypeShow = ref(false); // 公司平台级联状态
+    const deviceGroupShow = ref(false); // 设备分组级联状态
     const user = getLoginUser(); // 获取登录用户
+    const labelId = ref(""); // 设备标签id
+
     const machineTypeOptions = ref([
       {
         text: t('device.spunSugar'),
@@ -164,15 +185,30 @@ export default {
         value: '1',
       }
     ]);
+
+
+    const deviceGroupOptions = ref([
+
+    ]);
+
     const machineTypeFinish = ({ selectedOptions }) => {
       machineTypeShow.value = false;
       machineTypeText.value = selectedOptions.map((option) => option.text).join('/');
     }; // 设备类型级联选择
+
     const companyTypeFinish = ({ selectedOptions }) => {
       companyTypeShow.value = false;
       companyTypeText.value = selectedOptions.map((option) => option.text).join('/');
     }; // 公司平台级联选择
 
+    const deviceGroupFinish = async ({ selectedOptions }) => {
+      const selectedLabel = selectedOptions[selectedOptions.length - 1];
+      labelId.value = selectedLabel.value;
+      // console.log("labelId >>>", labelId.value);
+      deviceGroupShow.value = false;
+      deviceGroupText.value = selectedOptions.map((option) => option.text).join('/');
+    }; // 设备分组级联选择
+
     const equimentType = ref(''); // 设备机型
     const equimentTypeText = ref(''); // 设备机型 - 页面显示
     const equimentTypeShow = ref(false); // 设备机型级联状态
@@ -296,6 +332,7 @@ export default {
         isUsing: isUsing.value,
         payType: payType.value,
         channel: channel.value,
+        labelId: labelId.value,
       };
       context.emit('search', searchParam);
       sheetShow.value = false;
@@ -310,6 +347,8 @@ export default {
       machineTypeText.value = '';
       companyType.value = '';
       companyTypeText.value = '';
+      deviceGroup.value = '';
+      deviceGroupText.value = '';
       equimentType.value = '';
       equimentTypeText.value = '';
       eqeStatus.value = '';
@@ -322,6 +361,25 @@ export default {
       channelText.value = '';
     };
 
+    onMounted(() => {
+      // 获取标签分组
+      getLabelList();
+    });
+    // 获取设备标签
+    const getLabelList = async () => {
+      // console.log("adminId>>>>", user.id);
+      Api_getLabelList({
+        adminId: user.id,
+        type: "1"
+      }).then((res) => {
+        const { data } = res.data;
+        deviceGroupOptions.value = data.map((label) => ({
+          text: label.name,
+          value: label.id,
+        }));
+      })
+    }
+
     // 加载样式
     styleUrl('deviceSearch');
 
@@ -355,6 +413,13 @@ export default {
       companyTypeOptions,
       companyTypeFinish,
 
+      deviceGroup,
+      deviceGroupText,
+      deviceGroupShow,
+      deviceGroupFinish,
+      deviceGroupOptions,
+      labelId,
+
       eqeStatus,
       eqeStatusText,
       eqeStatusShow,

+ 2 - 0
src/views/device/deviceSet.vue

@@ -63,6 +63,7 @@
           <van-field readonly v-model="deviceDetal.lastUseDate" :label="`${$t('device.expirationTime')}`"
             placeholder="" />
         </template>
+        <!-- 设备标签 -->
         <div class="bd9 l-f">
           <van-field readonly :label="`${$t('device.equipmentLabel')}`" placeholder="">
             <template #input>
@@ -85,6 +86,7 @@
           </van-field>
         </div>
         <div class="custom-line"></div>
+        <!-- 广告规则 -->
         <div v-if="isAdmind" class="bd9 l-f">
           <van-field readonly :label="`${$t('device.adRule')}`" placeholder="">
             <template #input>