jiawuxian 2 лет назад
Родитель
Сommit
26746115eb
2 измененных файлов с 9 добавлено и 9 удалено
  1. 6 6
      src/utils/optionEx.js
  2. 3 3
      src/views/menu/protection/components/item.vue

+ 6 - 6
src/utils/optionEx.js

@@ -1,6 +1,6 @@
-const getLabel=(options,value)=>{
-    let option=options.find(o=>o.value===value);
-    // console.info(option)
-    return option?option.text:'';
-  }
-  export { getLabel};
+const getLabel = (options, value, defaultText) => {
+  let option = options.find(o => o.value === value)
+  // console.info(option)
+  return option ? option.text : defaultText != null ? defaultText : ''
+}
+export { getLabel }

+ 3 - 3
src/views/menu/protection/components/item.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="flex flex-col justify-center k-app-protection-list__item van-clearfix">
     <div class="top flex flex-row items-center justify-between">
-      <label style="width: 70%">{{ data.name }}</label>
-      <label style="width: 30%; text-align: right">
+      <label style="width: 50%">{{ data.name }}</label>
+      <label style="width: 50%; text-align: right">
         <van-button size="mini" type="primary" @click="updateStatus(data, '1')" v-if="data.status != '1' && data.orgId==this.orgId"
           >布防时间登记</van-button
         >
@@ -12,7 +12,7 @@
       </label>
     </div>
     <van-cell-group clickable @click="itemClick">
-      <van-cell title="防区状态" :value="getLabel(statusOptions, data.status)" />
+      <van-cell title="防区状态" :value="getLabel(statusOptions, data.status,'未知')" />
       <van-cell
         v-if="data.status == '0' || data.status == '1'"
         :title="data.status == '0' ? '撤防时间' : '布防时间'"