Browse Source

页面展示调整

qule 3 years ago
parent
commit
9833c1995f
2 changed files with 73 additions and 56 deletions
  1. 10 0
      src/views/syncManage/constant.js
  2. 63 56
      src/views/syncManage/index.vue

+ 10 - 0
src/views/syncManage/constant.js

@@ -3,4 +3,14 @@ export const ENUM_OBJECT_TABLE = {
     dt_define_info: '信息点定义表',
     dt_object: '对象实例表',
     dt_relation: '关系实例表'
+}
+// 对象类型map
+export const OBJ_TYPE = {
+    building: '建筑',
+    floor: '楼层',
+    equipment: '设备',
+    component: '部件',
+    space: '空间',
+    system: '系统',
+    shaft: '竖井'
 }

+ 63 - 56
src/views/syncManage/index.vue

@@ -33,20 +33,21 @@
                         </el-select>
                     </li>
                     <li>
-                        <span>对象类型:</span>
-                        <el-select v-model="objTypeValue" :clearable="true" @change="objTypeChange" placeholder="请选择">
-                            <el-option v-for="item in objType" :key="item.value" :label="item.label" :value="item.value"> </el-option>
-                        </el-select>
+                        <span>目标id:</span>
+                        <el-input v-model="targetId" :clearable="true" placeholder="请输入对象id" style="width: 220px" @change="objIdChange"></el-input>
                     </li>
+                    
                     <li>
                         <span>对象表:</span>
-                        <el-select v-model="tableName" :clearable="true" @change="objTableChange" placeholder="请选择">
+                        <el-select v-model="tableName" @change="objTableChange" placeholder="请选择">
                             <el-option v-for="(item, key) in ENUM_OBJECT_TABLE" :key="key" :label="item"  :value="key"></el-option>
                         </el-select>
                     </li>
-                    <li>
-                        <span>对象id:</span>
-                        <el-input v-model="targetId" :clearable="true" placeholder="请输入对象id" style="width: 220px" @change="objIdChange"></el-input>
+                    <li v-if="tableName === 'dt_object'">
+                        <span>对象类型:</span>
+                        <el-select v-model="objTypeValue" :clearable="true" @change="objTypeChange" placeholder="请选择">
+                            <el-option v-for="item in objType" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+                        </el-select>
                     </li>
                 </ul>
 
@@ -57,66 +58,64 @@
                     :data="data"
                     :stripe="true"
                     :maxHeight="620"
+                    size='small'
                     @sort-change="handleSort"
                 >
-                    <el-table-column label="对象id" :width="370">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.objId ? scope.row.objId : "--" }}</span>
-                        </template>
-                    </el-table-column>
-                    <el-table-column label="时间" sortable="custom">
+
+                    <el-table-column label="对象id" >
                         <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.createTime ? scope.row.createTime : "--" }}</span>
+                            <span style="margin-left: 10px">{{ scope.row.targetId ? scope.row.targetId : "--" }}</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="名称" :width="120">
+                    <el-table-column label="名称" >
                         <template slot-scope="scope">
                             <span style="margin-left: 10px">{{ scope.row.name ? scope.row.name : "--" }}</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="本地名称" :width="120">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.localName ? scope.row.localName : "--" }}</span>
-                        </template>
-                    </el-table-column>
-                    <el-table-column label="本地编码" :width="120">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.localId ? scope.row.localId : "--" }}</span>
-                        </template>
-                    </el-table-column>
-                    <el-table-column label="对象类型">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.objName ? scope.row.objName : "--" }}</span>
-                        </template>
-                    </el-table-column>
                     <el-table-column label="操作类型">
                         <template slot-scope="scope">
                             <span style="margin-left: 10px">{{ typeObj[scope.row.type] ? typeObj[scope.row.type] : "--" }}</span>
                         </template>
                     </el-table-column>
-                    <el-table-column label="对象分类">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">
-                                {{
-                                    scope.row.classCode && scope.row.classCodeName
-                                        ? `${scope.row.classCodeName} - ${scope.row.classCode}`
-                                        : scope.row.classCode
-                                        ? scope.row.classCode
-                                        : "--"
-                                }}
-                            </span>
-                        </template>
-                    </el-table-column>
-                     <el-table-column label="对象表">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{  ENUM_OBJECT_TABLE[scope.row.tableName] ? ENUM_OBJECT_TABLE[scope.row.tableName] : "--" }}</span>
-                        </template>
-                    </el-table-column>
-                    <el-table-column label="报错信息" :show-overflow-tooltip="false">
-                        <template slot-scope="scope">
-                            <span style="margin-left: 10px">{{ scope.row.error ? scope.row.error : "--" }}</span>
-                        </template>
-                    </el-table-column>
+                    <!-- 关系实例表 -->
+                    <template v-if="tableName === 'dt_relation'">
+                        <el-table-column label="fromId" >
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.targetId ? scope.row.targetId : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="toId" >
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.targetId ? scope.row.targetId : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                    </template>
+                    <!-- 对象实例表 -->
+                    <template v-else-if="tableName === 'dt_object'">
+                        <el-table-column label="本地名称" >
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.localName ? scope.row.localName : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="本地编码">
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.localId ? scope.row.localId : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="对象类型" >
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.objectType ? OBJ_TYPE[scope.row.objectType] : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                    </template>
+                    <!-- 其他表 -->
+                     <template v-else>
+                        <el-table-column label="编码" >
+                            <template slot-scope="scope">
+                                <span style="margin-left: 10px">{{ scope.row.code ? scope.row.code : "--" }}</span>
+                            </template>
+                        </el-table-column>
+                    </template>
                 </el-table>
                 <!-- {/* 分页 */} -->
                 <div class="pages">
@@ -148,7 +147,8 @@ import {
     queryRecordUpdata,
     dHttpExport
 } from "@/api/synclog";
-import { ENUM_OBJECT_TABLE } from './constant'
+import moment from 'moment'
+import { ENUM_OBJECT_TABLE, OBJ_TYPE } from './constant'
 export default {
     data() {
         return {
@@ -211,7 +211,7 @@ export default {
             operationValue: "", //操作符状态
             objTypeValue: "", //对象类型状态
             targetId: '',   //对象id
-            tableName: '',  //对象表
+            tableName: 'dt_object',  //对象表
             loading: false, //是否加载
             order: "lastUpdate asc, objId asc", //顺序
             pageObj: {
@@ -231,6 +231,12 @@ export default {
     computed: {
         ...mapGetters("layout", ["projectId", "projectName"]),
     },
+    filters: {
+        timeFormat(val) { 
+            if(!val) return '--';
+            return moment(val).format('YYYY-MM-DD HH:mm:ss')
+        }
+    },
     methods: {
         // 同步数据
 
@@ -451,6 +457,7 @@ export default {
     mounted() {
         this.getData();
         this.ENUM_OBJECT_TABLE = ENUM_OBJECT_TABLE;
+        this.OBJ_TYPE = OBJ_TYPE
     },
     watch: {
         projectId() {