caiaa1 1 year ago
parent
commit
2dcd283708

+ 1 - 1
mock/dict.js

@@ -12,7 +12,7 @@ module.exports = [
           records: [
             { 'id': 1, 'value': '1', 'label': 'Type1', 'sort': 1 },
             { 'id': 2, 'value': '2', 'label': 'Type2', 'sort': 2 },
-            { 'id': 3, 'value': '3', 'label': '派出所常用系统', 'sort': 3 },
+            { 'id': 3, 'value': '3', 'label': 'Type3', 'sort': 3 },
             { 'id': 4, 'value': '4', 'label': 'Type4', 'sort': 4 }
           ]
         }

+ 3 - 3
mock/system.js

@@ -20,9 +20,9 @@ module.exports = [
             { 'id': '8', 'systemName': 'system9', 'appType': 3, 'deptName': 'dept8', 'url': 'http://system9.com', 'icon': 'el-icon-plus' },
             { 'id': '9', 'systemName': 'system10', 'appType': 4, 'deptName': 'dept9', 'url': 'http://system10.com', 'icon': 'el-icon-plus' },
             { 'id': '10', 'systemName': 'system11', 'appType': 1, 'deptName': 'dept10', 'url': 'http://system11.com', 'icon': 'el-icon-plus' },
-            { 'id': '11', 'systemName': 'system12', 'appType': 1, 'deptName': 'dept11', 'url': 'http://system12.com', 'icon': 'el-icon-plus' },
-            { 'id': '12', 'systemName': 'system13', 'appType': 3, 'deptName': 'dept12', 'url': 'http://system13.com', 'icon': 'el-icon-plus' },
-            { 'id': '13', 'systemName': 'system14', 'appType': 2, 'deptName': 'dept13', 'url': 'http://system14.com', 'icon': 'el-icon-plus' },
+            // { 'id': '11', 'systemName': 'system12', 'appType': 1, 'deptName': 'dept11', 'url': 'http://system12.com', 'icon': 'el-icon-plus' },
+            // { 'id': '12', 'systemName': 'system13', 'appType': 3, 'deptName': 'dept12', 'url': 'http://system13.com', 'icon': 'el-icon-plus' },
+            // { 'id': '13', 'systemName': 'system14', 'appType': 2, 'deptName': 'dept13', 'url': 'http://system14.com', 'icon': 'el-icon-plus' },
             { 'id': '14', 'systemName': 'system15', 'appType': 4, 'deptName': 'dept14', 'url': 'http://system15.com', 'icon': 'el-icon-plus' }
           ]
         }

+ 17 - 0
src/layout/components/AppMain.vue

@@ -5,6 +5,9 @@
         <router-view :key="key" />
       </keep-alive>
     </transition>
+    <span class="footer">
+      Copyright
+    </span>
   </section>
 </template>
 
@@ -29,6 +32,7 @@ export default {
   width: 100%;
   position: relative;
   overflow: hidden;
+  padding-bottom: $footerHeight;
 
   &>div:not(.home-container) {
     margin: 10px 0 0 10px;
@@ -46,6 +50,19 @@ export default {
     padding-top: 34px;
   }
 }
+
+.footer {
+  display: block;
+  width: 100%;
+  height: $footerHeight;
+  line-height: $footerHeight;
+  font-size: 12px;
+  color: rgba(0,0,0,0.45);
+  text-align: center;
+  position: absolute;
+  left: 0;
+  bottom: 0;
+}
 </style>
 
 <style lang="scss">

+ 1 - 1
src/main.js

@@ -16,7 +16,7 @@ import * as filters from './filters' // global filters
 import '@/icons' // icon
 import '@/permission' // permission control
 
-Vue.use(ElementUI)
+Vue.use(ElementUI, { size: 'small' })
 
 import SSE from 'vue-sse'
 Vue.use(SSE)

+ 2 - 2
src/utils/convert.js

@@ -119,8 +119,8 @@ export function distinct(arr) {
 export function formatDictData(data, code) {
   if (code !== null && code !== undefined && data !== null && data !== undefined) {
     for (let i = 0; i < data.length; i++) {
-      if (data[i].code === code) {
-        return data[i].name
+      if (data[i].value === (code + '')) {
+        return data[i].label
       }
     }
   }

+ 2 - 2
src/views/home/Message.vue

@@ -19,7 +19,7 @@
           <el-table v-loading="loading" :data="todoData" :show-header="false" size="mini" height="calc(100% - 30px)">
             <el-table-column width="40">
               <template>
-                <el-avatar shape="square" size="small"><svg-icon icon-class="yujing" /></el-avatar>
+                <el-avatar shape="square"><svg-icon icon-class="yujing" /></el-avatar>
               </template>
             </el-table-column>
             <el-table-column show-overflow-tooltip>
@@ -50,7 +50,7 @@
           <el-table v-loading="loading" :data="doneData" :show-header="false" size="mini" height="calc(100% - 30px)">
             <el-table-column width="40">
               <template>
-                <el-avatar shape="square" size="small"><svg-icon icon-class="yujing" /></el-avatar>
+                <el-avatar shape="square"><svg-icon icon-class="yujing" /></el-avatar>
               </template>
             </el-table-column>
             <el-table-column show-overflow-tooltip>

+ 2 - 2
src/views/home/components/BusinessEdit.vue

@@ -86,8 +86,8 @@
         </div>
       </div>
       <div slot="footer">
-        <el-button size="small" @click="close">Cancel</el-button>
-        <el-button type="primary" size="small" @click="saveFavorite">Confirm</el-button>
+        <el-button @click="close">Cancel</el-button>
+        <el-button type="primary" @click="saveFavorite">Confirm</el-button>
       </div>
     </el-dialog>
   </div>

+ 6 - 5
src/views/home/components/MessageList.vue

@@ -18,12 +18,12 @@
           </el-form-item>
           <el-form-item label="所属应用系统">
             <el-select v-model="formData.systemCode" clearable filterable placeholder="请输入">
-              <el-option v-for="(item) in systemData" :key="item.code" :label="item.name" :value="item.code" />
+              <el-option v-for="(item) in systemData" :key="item.systemNumber" :label="item.systemName" :value="item.systemNumber" />
             </el-select>
           </el-form-item>
           <el-form-item label="状态">
             <el-select v-model="formData.status" clearable placeholder="请选择">
-              <el-option v-for="(item) in statusData" :key="item.code" :label="item.name" :value="item.code" />
+              <el-option v-for="(item) in statusData" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
           </el-form-item>
           <el-form-item>
@@ -97,10 +97,11 @@ export default {
         systemCode: '',
         status: null
       },
+      // dict
+      typeData: [{ 'value': '4', 'label': '任务类' }, { 'value': '5', 'label': '通知类' }, { 'value': '6', 'label': '超期提醒类' }],
+      statusData: [{ 'value': '0', 'label': '待办' }, { 'value': '1', 'label': '已办' }],
       // select data
-      typeData: [{ 'code': 4, 'name': '任务类' }, { 'code': 5, 'name': '通知类' }, { 'code': 6, 'name': '超期提醒类' }],
-      systemData: [{ 'code': '1', 'name': 'System1' }, { 'code': '2', 'name': 'System2' }],
-      statusData: [{ 'code': 0, 'name': '待办' }, { 'code': 1, 'name': '已办' }],
+      systemData: [{ 'systemNumber': '1', 'systemName': 'System1' }, { 'systemNumber': '2', 'systemName': 'System2' }],
       // others
       loading: false,
       detailVisible: false,

+ 3 - 3
src/views/home/components/SystemEdit.vue

@@ -14,7 +14,7 @@
         <div v-loading="allLoading" class="drag-left">
           <div class="list-filter">
             <span class="filter-title">list</span>
-            <el-input v-model="formData.systemName" size="small" clearable>
+            <el-input v-model="formData.systemName" clearable>
               <el-button slot="append" icon="el-icon-search" @click="searchTable" />
             </el-input>
           </div>
@@ -73,8 +73,8 @@
         </div>
       </div>
       <div slot="footer">
-        <el-button size="small" @click="close">Cancel</el-button>
-        <el-button type="primary" size="small" @click="saveFavorite">Confirm</el-button>
+        <el-button @click="close">Cancel</el-button>
+        <el-button type="primary" @click="saveFavorite">Confirm</el-button>
       </div>
     </el-dialog>
   </div>

+ 292 - 0
src/views/system/components/SystemDetail.vue

@@ -0,0 +1,292 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :visible.sync="visible"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+      :show-close="false"
+      custom-class="main-edit-dialog"
+      :title="title"
+    >
+      <el-form ref="editForm" :model="formData" label-width="100px">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="Type" required>
+              <el-select v-model="formData.appType" placeholder="placeholder">
+                <el-option v-for="item in typeData" :key="item.value" :label="item.label" :value="item.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="Name" required>
+              <el-input v-model="formData.name" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="Code" required>
+              <el-input v-model="formData.systemNumber" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="Alias" required>
+              <el-input v-model="formData.shortName" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="Dept" required>
+              <el-select v-model="formData.deptName" placeholder="placeholder">
+                <el-option v-for="item in orgData" :key="item.value" :label="item.label" :value="item.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="Url" required>
+              <el-input v-model="formData.url" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="Active" required>
+              <el-select v-model="formData.activeFlag" placeholder="placeholder">
+                <el-option v-for="item in activeFlagData" :key="item.value" :label="item.label" :value="item.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="Category">
+              <el-select v-model="formData.policeCategory" placeholder="placeholder">
+                <el-option v-for="item in policeCategoryData" :key="item.value" :label="item.label" :value="item.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="label" required>
+              <el-upload action="">
+                <el-button icon="el-icon-upload2">Upload</el-button>
+              </el-upload>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { fetchDictData } from '@/api/dict'
+import { isObject, hasValidRecords } from '@/utils/convert'
+
+import { pushSaveFavorite } from '@/api/system'
+
+export default {
+  data() {
+    return {
+      dictSysType: 'system_type',
+      // dialog
+      visible: false,
+      title: 'Edit',
+      formData: {},
+      // select:
+      typeData: [],
+      orgData: [],
+      policeCategoryData: [],
+      activeFlagData: [],
+      // others
+      loading: false
+    }
+  },
+  computed: {
+    myListIds() {
+      return this.myListData.map(item => item.id)
+    }
+  },
+  created() {
+    console.log('aaaaaaaaaaaaaaaaaaa')
+  },
+  mounted() {
+    console.log('bbbbbbbbbbbbbbb')
+  },
+  methods: {
+    /**
+     * 加载dialog
+     */
+    open(type, data) {
+      this.title = type === 'ADD' ? 'Add' : type === 'VIEW' ? 'View' : 'Edit'
+      this.formData = isObject(data) ? data : {}
+      this.getTypeData()
+      this.visible = true
+    },
+    close() {
+      this.visible = false
+    },
+    save() {
+      this.loading = true
+      pushSaveFavorite().then(res => {
+        this.loading = false
+        this.visible = false
+        this.$message({
+          type: 'success',
+          message: 'Save Successfully!'
+        })
+      }).catch(error => {
+        console.log(error)
+        this.loading = false
+        this.$message.error({
+          type: 'error',
+          duration: 0,
+          showClose: true,
+          message: error.message
+        })
+      })
+    },
+    getTypeData() {
+      fetchDictData(this.dictSysType).then(response => {
+        if (hasValidRecords(response)) {
+          this.typeData = response.data.records
+        } else {
+          this.typeData = []
+        }
+      }).catch(error => {
+        console.log(error)
+        this.$message.error({
+          type: 'error',
+          duration: 0,
+          showClose: true,
+          message: ': ' + error.message
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.drag-container {
+  display: flex;
+  justify-content: center;
+
+  .drag-left, .drag-right {
+    width: 50%;
+    padding: 0 0 20px 20px;
+    max-height: 560px;
+  }
+
+  .drag-left {
+    background-color: #F8F9F9;
+    position: relative;
+
+    .page {
+      position: absolute;
+      bottom: 0;
+      left: 0;
+      width: 100%;
+      text-align: center;
+
+      ::v-deep {
+        .btn-prev, .btn-next, .el-pager li{
+          background-color: transparent;
+        }
+      }
+    }
+  }
+
+  .drag-right {
+    .my-scroll-box {
+      // 48 = filter-title + filter-tip - drag-right.margin-bottom
+      height: calc(100% - 36px);
+      margin-top: -2px;
+    }
+
+    ::v-deep {
+      .el-scrollbar__wrap{
+        overflow-x: hidden;
+        padding-top: 2px;
+      }
+      .el-scrollbar__bar.is-horizontal {
+        display: none;
+      }
+    }
+  }
+
+  .list-filter {
+    height: 56px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding-right: 20px;
+
+    .el-input {
+      width: 250px;
+    }
+  }
+
+  .filter-title {
+    font-size: 14px;
+    color: rgba(0,0,0,0.85);
+  }
+
+  .filter-tip {
+    font-size: 12px;
+    color: rgba(0,0,0,0.65);
+  }
+
+  .drag-item-box {
+    display: flex;
+    flex-wrap: wrap;
+  }
+
+  .drag-item {
+    width: 150px;
+    height: 110px;
+    border: 1px solid rgba(0,0,0,0.09);
+    margin-bottom: 10px;
+    margin-right: 20px;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    border-radius: 10px;
+    position: relative;
+    cursor: move;
+    cursor: -webkit-grabbing;
+
+    .handle-icon {
+      display: inline-block;
+      position: absolute;
+      top: -3px;
+      right: -7px;
+      border-radius: 50%;
+      background-color: #FF0000;
+      color: #FFFFFF;
+      cursor: pointer;
+      z-index: 100;
+    }
+
+    &.filtered {
+      cursor: pointer;
+
+      .el-icon-plus {
+        display: none;
+      }
+    }
+
+    .item-system {
+      text-align: center;
+      width: 130px;
+      text-overflow: ellipsis;
+      overflow: hidden;
+      white-space: nowrap;
+      font-size: 14px;
+      color: rgba(0,0,0,0.45);
+      margin-top: 10px
+    }
+  }
+}
+</style>

+ 152 - 20
src/views/system/index.vue

@@ -4,7 +4,7 @@
       <div slot="header" class="clearfix">
         <span>Test</span>
       </div>
-      <el-radio-group v-model="formData.appType">
+      <el-radio-group v-model="formData.appType" @input="searchTable">
         <el-radio-button label="">All</el-radio-button>
         <el-radio-button v-for="item in typeData" :key="item.id" :label="item.value">{{ item.label }}</el-radio-button>
       </el-radio-group>
@@ -20,39 +20,73 @@
           </el-form-item>
           <el-form-item>
             <el-button type="primary" @click="searchTable">Search</el-button>
-            <el-button type="danger" @click="resetTable('filterForm')">Reset</el-button>
           </el-form-item>
         </el-form>
       </div>
-      <div>
-        <div class="item-button">
-          <el-button type="primary">Add</el-button>
-          <el-button type="primary">Upload</el-button>
-        </div>
-        <div class="system-item-box">
-          <div v-for="item in tableData" :key="item.id" class="system-item">
-            <div>
-              <span>{{ item.appType }}</span>
-              <el-button type="text">detail</el-button>
-              <el-button type="text">Edit</el-button>
+      <div class="list-button">
+        <el-button type="primary" @click="showEdit('ADD')">Add</el-button>
+        <!-- <el-button type="primary">Upload</el-button> -->
+        <!-- <el-upload
+          :action="uploadExcel"
+          :headers="uploadHeader"
+          :show-file-list="false"
+          :before-upload="beforeUploadExcel"
+          :on-success="fetchTableDetil"
+          :on-error="uploadError"
+          class="upload-btn"
+        > -->
+        <el-upload action="" class="upload-btn">
+          <el-button>Upload</el-button>
+        </el-upload>
+      </div>
+      <!-- <el-scrollbar> -->
+      <div class="system-item-box">
+        <div v-for="item in tableData" :key="item.id" class="system-item">
+          <div class="item-header">
+            <div class="item-type">{{ formatDictData(item.appType) }}</div>
+            <div class="item-btn">
+              <el-button type="text" @click="showEdit('VIEW', item)">Detail</el-button>
+              <el-button type="text" @click="showEdit('EDIT', item)">Edit</el-button>
               <el-button type="text">Delete</el-button>
             </div>
           </div>
+          <div class="item-content">
+            <div class="item-content-left">
+              <el-avatar :size="43" :src="item.icon" />
+              <span class="item-name">{{ item.systemName }}</span>
+            </div>
+            <el-button class="item-link" @click="jumpTo(item.url)">Open</el-button>
+          </div>
+          <div class="item-footer">{{ item.deptName }}</div>
         </div>
-
+      </div>
+      <!-- </el-scrollbar> -->
+      <div v-if="total > 0" class="page">
+        <el-pagination
+          layout="total, prev, pager, next, jumper"
+          :current-page="current"
+          :total="total"
+          :page-sizes="pageSizeAll"
+          :page-size="size"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+        />
       </div>
     </div>
-
+    <system-detail ref="systemDetail" />
   </div>
 </template>
 
 <script>
+import SystemDetail from './components/SystemDetail'
+
 import { fetchDictData } from '@/api/dict'
 import { fetchAllSystemList } from '@/api/system'
 
-import { hasValidRecords } from '@/utils/convert'
+import { hasValidRecords, formatDictData } from '@/utils/convert'
 
 export default {
+  components: { SystemDetail },
   data() {
     return {
       // type
@@ -60,7 +94,7 @@ export default {
       typeData: [],
       // table
       current: 1,
-      size: 20,
+      size: 12,
       total: 0,
       pageSizeAll: [10, 20, 50, 100, 200, 500],
       tableData: [],
@@ -108,6 +142,7 @@ export default {
         size: this.size,
         params: {
           delFlag: 0,
+          appType: this.formData.appType,
           systemName: this.formData.systemName,
           deptName: this.formData.deptName
         }
@@ -148,19 +183,28 @@ export default {
           message: ': ' + error.message
         })
       })
+    },
+    showEdit(type, data) {
+      this.$refs.systemDetail.open(type, data)
+    },
+    jumpTo(link) {
+      window.open(link, '_blank')
+    },
+    formatDictData(type) {
+      return formatDictData(this.typeData, type)
     }
   }
 }
 </script>
 
 <style lang="scss" scoped>
+@import "~@/styles/variables.scss";
+
 .system-container {
   display: flex;
 
-  .type-box, .system-box {
-  }
   .type-box {
-    width: 300px;
+    width: 250px;
     margin-right: 5px;
 
     .el-radio-group {
@@ -188,13 +232,41 @@ export default {
   }
   .system-box {
     width: 100%;
+    min-height: calc(100vh - #{$headerHeight} - 34px - #{$footerHeight} - 10px);
     padding-left: 20px;
     background-color: #fff;
+
+    .upload-btn {
+      display: inline-block;
+      margin-left: 10px;
+    }
+
+    .page {
+      margin-right: 20px;
+      text-align: right;
+    }
+
+    ::v-deep {
+      .el-scrollbar__wrap{
+        max-height: 520px;
+        // overflow-x: hidden;
+      }
+      .el-scrollbar__bar.is-horizontal {
+        display: none;
+      }
+    }
   }
+
+  .list-button {
+    margin-top: -8px;
+    margin-bottom: 10px;
+  }
+
   .system-item-box {
     display: flex;
     flex-wrap: wrap;
   }
+
   .system-item {
     width: 380px;
     height: 150px;
@@ -202,6 +274,66 @@ export default {
     border-radius: 4px;
     margin-right: 16px;
     margin-bottom: 16px;
+    padding: 0 10px 10px 10px;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    .item-header {
+      height: 35px;
+    }
+
+    .item-type, .item-btn {
+      height: 100%;
+    }
+
+    .item-type {
+      display: inline-block;
+      font-size: 14px;
+      line-height: 35px;
+      color: rgba(0,0,0,0.65);
+    }
+
+    .item-btn {
+      float: right;
+    }
+
+    .item-content {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+
+    .item-content-left {
+      display: flex;
+      align-items: center;
+    }
+
+    .item-name {
+      font-size: 14px;
+      color: rgba(0,0,0,0.85);
+      margin-left: 10px;
+      display: inline-block;
+      width: 230px;
+      text-overflow: ellipsis;
+      overflow: hidden;
+      white-space: nowrap;
+    }
+
+    .item-link {
+      float: right;
+    }
+
+    .item-footer {
+      font-size: 12px;
+      color: rgba(0,0,0,0.65);
+    }
+
+    ::v-deep {
+      .el-button--small {
+        font-size: 14px;
+      }
+    }
   }
 
 }