Sfoglia il codice sorgente

调整列表字段

hjs 1 anno fa
parent
commit
de59a0a740

+ 16 - 16
src/router/index.js

@@ -71,22 +71,6 @@ export const constantRoutes = [
     ]
   },
 
-  {
-    path: '/device',
-    component: Layout,
-    redirect: '/device/index',
-    name: 'device',
-    meta: { title: '设备授权管理', icon: 'el-icon-s-platform' },
-    children: [
-      {
-        path: 'index',
-        name: 'index',
-        component: () => import('@/views/device/index'),
-        meta: { title: '设备授权列表' }
-      }
-    ]
-  },
-
   {
     path: '/scene',
     component: Layout,
@@ -119,6 +103,22 @@ export const constantRoutes = [
     ]
   },
 
+  {
+    path: '/device',
+    component: Layout,
+    redirect: '/device/index',
+    name: 'device',
+    meta: { title: '设备授权管理', icon: 'el-icon-s-platform' },
+    children: [
+      {
+        path: 'index',
+        name: 'index',
+        component: () => import('@/views/device/index'),
+        meta: { title: '设备授权列表' }
+      }
+    ]
+  },
+
   {
     path: '/auth',
     component: Layout,

+ 11 - 11
src/views/device/index.vue

@@ -29,31 +29,31 @@
           {{ scope.row.sn }}
         </template>
       </el-table-column>
-      <el-table-column label="设备appId">
+      <el-table-column label="公司名称">
         <template slot-scope="scope">
-          {{ scope.row.tenantMachineAppId }}
+          {{ scope.row.company }}
         </template>
       </el-table-column>
-      <el-table-column label="名称">
+      <el-table-column label="服务商平台名称">
         <template slot-scope="scope">
           {{ scope.row.tenantName }}
         </template>
       </el-table-column>
-      <el-table-column label="商户平台地址">
+      <!-- <el-table-column label="设备appId">
         <template slot-scope="scope">
-          {{ scope.row.tenantServiceAddress }}
+          {{ scope.row.tenantMachineAppId }}
         </template>
-      </el-table-column>
-      <el-table-column label="商户appId">
+      </el-table-column> -->
+      <!-- <el-table-column label="商户appId">
         <template slot-scope="scope">
           {{ scope.row.tenantServiceAppId }}
         </template>
-      </el-table-column>
-      <el-table-column label="公司名称">
+      </el-table-column> -->
+      <!-- <el-table-column label="商户平台地址">
         <template slot-scope="scope">
-          {{ scope.row.company }}
+          {{ scope.row.tenantServiceAddress }}
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="场景名称">
         <template slot-scope="scope">
           {{ scope.row.sceneName }}

+ 5 - 11
src/views/device/modal/AddModal.vue

@@ -13,21 +13,21 @@
       <el-form-item label="设备sn" prop="sn" required>
         <el-input v-model="form.sn" />
       </el-form-item>
-      <el-form-item label="商户" prop="tenantId" required>
-        <el-select v-model="form.tenantId" class="filter-item" placeholder="请选择商户">
+      <el-form-item label="服务商平台名称" prop="tenantId" required>
+        <el-select v-model="form.tenantId" class="filter-item" placeholder="服务商平台名称">
           <el-option v-for="(item, index) in merchantLists" :key="index" :label="item.name" :value="item.id" />
         </el-select>
       </el-form-item>
-      <el-form-item label="公司名" prop="company" required>
+      <el-form-item label="公司名" prop="company" required>
         <el-input v-model="form.company" />
       </el-form-item>
       <el-form-item label="场景" prop="sceneId" :required="false">
-        <el-select v-model="form.sceneId" class="filter-item" placeholder="请选择场景">
+        <el-select v-model="form.sceneId" class="filter-item" placeholder="请选择场景" clearable>
           <el-option v-for="(item, index) in sceneLists" :key="index" :label="item.sceneName" :value="item.id" />
         </el-select>
       </el-form-item>
       <el-form-item label="⽤户库" prop="userLibId" :required="false">
-        <el-select v-model="form.userLibId" class="filter-item" placeholder="请选择⽤户库">
+        <el-select v-model="form.userLibId" class="filter-item" placeholder="请选择⽤户库" clearable>
           <el-option v-for="(item, index) in userlibLists" :key="index" :label="item.userLibName" :value="item.id" />
         </el-select>
       </el-form-item>
@@ -72,12 +72,6 @@ export default {
         ],
         company: [
           { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
-        ],
-        sceneId: [
-          { required: false, type: 'number', whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
-        ],
-        userLibId: [
-          { required: false, type: 'number', whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
         ]
       },
       visible: false,

+ 26 - 14
src/views/merchant/index.vue

@@ -23,14 +23,19 @@
           {{ ((pagination.current - 1) * pagination.pageSize) + (scope.$index + 1) }}
         </template>
       </el-table-column>
+      <el-table-column label="名称">
+        <template slot-scope="scope">
+          {{ scope.row.name }}
+        </template>
+      </el-table-column>
       <el-table-column label="设备appId">
         <template slot-scope="scope">
           {{ scope.row.machineAppId }}
         </template>
       </el-table-column>
-      <el-table-column label="名称">
+      <el-table-column label="商户appId">
         <template slot-scope="scope">
-          {{ scope.row.name }}
+          {{ scope.row.serviceAppId }}
         </template>
       </el-table-column>
       <el-table-column label="商户平台地址">
@@ -38,24 +43,31 @@
           {{ scope.row.serviceAddress }}
         </template>
       </el-table-column>
-      <el-table-column label="商户appId">
+      <el-table-column label="是否第三方应用" align="center" width="120">
         <template slot-scope="scope">
-          {{ scope.row.serviceAppId }}
+          <el-tag :type="scope.row.thirdAuthAppId | statusFilter">
+            {{ scope.row.thirdAuthAppId ? '是' : '否' }}
+          </el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="授权token">
+      <el-table-column label="三方授权appId">
         <template slot-scope="scope">
-          {{ scope.row.appAuthToken }}
+          {{ scope.row.thirdAuthAppId }}
         </template>
       </el-table-column>
-      <el-table-column label="状态" align="center" class-name="status-col" width="100">
+      <!-- <el-table-column label="授权token">
+        <template slot-scope="scope">
+          {{ scope.row.appAuthToken }}
+        </template>
+      </el-table-column> -->
+      <el-table-column label="授权状态" align="center" class-name="status-col" width="100">
         <template slot-scope="{row}">
-          <el-tag :type="row.appAuthTokenStatus | statusFilter">
-            {{ row.appAuthTokenStatus | statusFilterStr }}
+          <el-tag :type="(row.thirdAuthAppId ? (row.appAuthTokenStatus ? true : false) : false) | statusFilter">
+            {{ row | statusFilterStr }}
           </el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
         <template slot-scope="{row,$index}">
           <el-button type="primary" size="mini" @click="handleUpdate(row)">
             编辑
@@ -63,10 +75,10 @@
           <el-button size="mini" type="danger" @click="handleDelete(row, $index)">
             删除
           </el-button>
-          <template>
+          <!-- <template>
             <el-button v-if="row.appAuthTokenStatus" size="mini" type="danger" @click="statusChange(row, false)">停用</el-button>
             <el-button v-else size="mini" type="danger" @click="statusChange(row, true)">启用</el-button>
-          </template>
+          </template> -->
         </template>
       </el-table-column>
     </el-table>
@@ -93,8 +105,8 @@ export default {
     statusFilter(status) {
       return status ? 'success' : 'info'
     },
-    statusFilterStr(status) {
-      return status ? '已启用' : '已停用'
+    statusFilterStr(obj) {
+      return obj.thirdAuthAppId ? (obj.appAuthTokenStatus ? '已授权' : '未授权') : '未启用'
     }
   },
   mixins: [tableMixins],

+ 24 - 5
src/views/merchant/modal/AddModal.vue

@@ -10,17 +10,26 @@
   >
     <el-form ref="form" :rules="rules" :model="form" label-position="left" label-width="120px">
       <el-form-item prop="id" style="margin-bottom: 0;">&nbsp;</el-form-item>
+      <el-form-item label="名称" prop="name" required>
+        <el-input v-model="form.name" />
+      </el-form-item>
       <el-form-item label="设备appId" prop="machineAppId" required>
         <el-input v-model="form.machineAppId" />
       </el-form-item>
-      <el-form-item label="名称" prop="name" required>
-        <el-input v-model="form.name" />
+      <el-form-item label="	商户appId" prop="serviceAppId" required>
+        <el-input v-model="form.serviceAppId" />
       </el-form-item>
       <el-form-item label="商户平台地址" prop="serviceAddress" required>
         <el-input v-model="form.serviceAddress" />
       </el-form-item>
-      <el-form-item label="	商户appId" prop="serviceAppId" required>
-        <el-input v-model="form.serviceAppId" />
+      <el-form-item label="是否三方应用" required>
+        <el-radio-group v-model="isThirdApp">
+          <el-radio :label="false">否</el-radio>
+          <el-radio :label="true">是</el-radio>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item v-if="isThirdApp" label="三方授权appId" prop="thirdAuthAppId" required>
+        <el-input v-model="form.thirdAuthAppId" />
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -40,12 +49,14 @@ import { add } from '@/api/merchant'
 export default {
   data() {
     return {
+      isThirdApp: false,
       form: {
         id: null,
         machineAppId: null,
         name: null,
         serviceAddress: null,
-        serviceAppId: null
+        serviceAppId: null,
+        thirdAuthAppId: null
       },
       rules: {
         machineAppId: [
@@ -59,6 +70,9 @@ export default {
         ],
         serviceAppId: [
           { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
+        ],
+        thirdAuthAppId: [
+          { required: true, whitespace: true, message: '不能为空!', trigger: ['change', 'blur'] }
         ]
       },
       visible: false,
@@ -75,8 +89,10 @@ export default {
         if (obj && Object.keys(obj).length > 0) {
           this.form = obj
           this.isEdit = true
+          this.isThirdApp = !!this.form.thirdAuthAppId
         } else {
           this.isEdit = false
+          this.isThirdApp = false
         }
       })
     },
@@ -91,6 +107,9 @@ export default {
         }
         this.submitLoading = true
         try {
+          if (!this.isThirdApp) {
+            this.form.thirdAuthAppId = null
+          }
           await add(this.form)
           this.visible = false
           this.$emit('success', this.isEdit)