Ver código fonte

新增APP 管理

zcy 4 anos atrás
pai
commit
6dfa7e3a7e

+ 5 - 5
src/components/JImageUpload/index.vue

@@ -141,11 +141,11 @@ export default {
       this.fileList = fileList
     },
     beforeUpload: function(file) {
-      var fileType = file.type
-      if (fileType.indexOf('image') < 0) {
-        this.$message.warning('请上传图片')
-        return false
-      }
+      // var fileType = file.type
+      // if (fileType.indexOf('image') < 0) {
+      //   this.$message.warning('请上传图片')
+      //   return false
+      // }
     },
     handleChange(info) {
       this.picUrl = false

+ 19 - 13
src/router/index.js

@@ -102,7 +102,7 @@ export const constantRoutes = [
     name: 'security',
     meta: {
       title: '安全工具管理',
-      icon: 'icon-jiechuwang'
+      icon: 'icon-anquangongju'
     },
     children: [
       {
@@ -110,13 +110,13 @@ export const constantRoutes = [
         component: () => import('@/views/security/stand/index'),
         name: 'stand',
         meta: { title: '安全工具台账', icon: 'el-icon-collection-tag' }
+      },
+      {
+        path: 'checklist',
+        component: () => import('@/views/security/checkList/index'),
+        name: 'checklist',
+        meta: { title: '安全工具检验记录', icon: 'el-icon-collection-tag' }
       }
-      // {
-      //   path: 'checklist',
-      //   component: () => import('@/views/security/checkList/index'),
-      //   name: 'checklist',
-      //   meta: { title: '安全工具检验记录', icon: 'el-icon-collection-tag' }
-      // }
     ]
   },
   {
@@ -208,37 +208,43 @@ export const asyncRoutes = [
         path: 'dept',
         component: () => import('@/views/sys/dept/index'), // Parent router-view
         name: 'dept',
-        meta: { title: '部门数据', pages: ['pc:system:dept:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '部门数据', pages: ['pc:system:dept:list'] }
       },
       {
         path: 'role',
         component: () => import('@/views/sys/role/index'), // Parent router-view
         name: 'role',
-        meta: { title: '职务管理', pages: ['pc:system:role:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '职务管理', pages: ['pc:system:role:list'] }
       },
       {
         path: 'user',
         component: () => import('@/views/sys/user/index'), // Parent router-view
         name: 'user',
-        meta: { title: '职工管理', pages: ['pc:system:user:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '职工管理', pages: ['pc:system:user:list'] }
       },
       {
         path: 'dict',
         component: () => import('@/views/sys/dict/index'), // Parent router-view
         name: 'dict',
-        meta: { title: '字典管理', pages: ['pc:system:dict:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '字典管理', pages: ['pc:system:dict:list'] }
       },
       {
         path: 'menu',
         component: () => import('@/views/sys/menu/index'), // Parent router-view
         name: 'menu',
-        meta: { title: '菜单管理', pages: ['pc:system:menu:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '菜单管理', pages: ['pc:system:menu:list'] }
+      },
+      {
+        path: 'app',
+        component: () => import('@/views/sys/app/index'), // Parent router-view
+        name: 'app',
+        meta: { title: 'APP管理', pages: ['pc:system:app:list'] }
       },
       {
         path: 'log',
         component: () => import('@/views/sys/log/index'), // Parent router-view
         name: 'log',
-        meta: { title: '日志管理', pages: ['pc:system:operlog:list'], icon: 'el-icon-collection-tag' }
+        meta: { title: '日志管理', pages: ['pc:system:operlog:list'] }
       }
     ]
   },

+ 101 - 0
src/views/sys/app/CheckAndEditModel.vue

@@ -0,0 +1,101 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="700"
+    :visible="visible"
+    :mask-closable="false"
+    cancel-text="关闭"
+    @close="close"
+  >
+    <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :rules="validatorRules" :model="model">
+      <a-form-model-item label="版本号" prop="apkVersion">
+        <a-input v-model="model.apkVersion" />
+      </a-form-model-item>
+      <a-form-model-item label="版本描述" prop="description">
+        <a-input v-model="model.description" />
+      </a-form-model-item>
+      <a-form-model-item label="安装包" prop="url">
+        <j-image-upload v-model="model.url" :is-multiple="false" biz-path="scott/pic" />
+      </a-form-model-item>
+    </a-form-model>
+  </j-modal>
+</template>
+<script>
+import { httpAction } from '@/api/request'
+import JModal from '@/components/JModal'
+import JImageUpload from '@/components/JImageUpload'
+export default {
+  name: 'CheckAndEditModel',
+  components: {
+    JModal,
+    JImageUpload
+  },
+  data() {
+    return {
+      labelCol: { span: 4 },
+      wrapperCol: { span: 19 },
+      dataSource: [],
+      title: '',
+      visible: false,
+      isCheck: false,
+      model: {},
+      validatorRules: {
+        apkVersion: [{ required: true, message: '请输入' }],
+        description: [{ required: true, message: '请输入' }],
+        url: [{ required: true, message: '请上传' }]
+      },
+      url: {
+        add: '/app/upgrade/add',
+        edit: '/app/upgrade/update'
+      }
+    }
+  },
+  created() {
+  },
+  methods: {
+    add() {
+      this.model = {}
+      this.visible = true
+    },
+    edit(record) {
+      this.model = Object.assign({}, record)
+      this.visible = true
+    },
+    close(isSubmit) {
+      if (isSubmit) {
+        this.checkData()
+      } else {
+        this.visible = false
+      }
+    },
+    checkData() {
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          this.saveData()
+        } else {
+          return false
+        }
+      })
+    },
+    saveData() {
+      let url, type
+      if (!this.model.id) {
+        url = this.url.add
+        type = 'post'
+      } else {
+        url = this.url.edit
+        type = 'put'
+      }
+      httpAction(url, this.model, type).then((res) => {
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+          this.$emit('ok')
+          this.visible = false
+        } else {
+          console.log(res)
+        }
+      })
+    }
+  }
+}
+</script>

+ 109 - 0
src/views/sys/app/index.vue

@@ -0,0 +1,109 @@
+<template>
+  <el-card class="content-z">
+    <!-- 操作按钮区域 -->
+    <div class="table-operator" style="margin: 5px 0;float: right">
+      <a-button v-permission="['pc:system:dict:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" v-permission="['pc:system:dict:remove']" @click="batchDel">
+            <a-icon type="delete" />
+            删除
+          </a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px">
+          批量操作
+          <a-icon type="down" />
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-form-item>
+          <a-input
+            v-model="queryParam.apkVersion"
+            style="width: 250px"
+            placeholder="请输入版本号"
+          />
+        </a-form-item>
+        <a-form-item>
+          <a-button type="primary" @click="searchQuery">查询</a-button>
+          <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
+        </a-form-item>
+      </a-form>
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
+        <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
+          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        row-key="id"
+        :columns="columns"
+        :data-source="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        @change="handleTableChange"
+      >
+
+        <span slot="action" slot-scope="text, record">
+          <a-button size="small" type="primary" @click="handleEdit(record)">
+            编辑
+          </a-button>
+          <a-divider type="vertical" />
+          <a-popconfirm
+            title="确定删除吗?"
+            @confirm="() => handleDelete(record.id)"
+          >
+            <a-button size="small" type="danger">
+              删除
+            </a-button>
+          </a-popconfirm>
+        </span>
+      </a-table>
+      <check-and-edit-model ref="modalForm" @ok="modalFormOk" />
+    </div>
+    <!-- table区域-end -->
+    <!-- 表单区域 -->
+  </el-card>
+</template>
+<script>
+import { listMixin } from '@/mixin/listMixin'
+import columns from './indexColumns'
+import CheckAndEditModel from './CheckAndEditModel'
+
+export default {
+  components: {
+    CheckAndEditModel,
+  },
+  mixins: [listMixin],
+  data() {
+    return {
+      // 查询条件
+      queryParam: {},
+      // 表头
+      columns: columns(this),
+      url: {
+        list: '/app/upgrade/list',
+        delete: '/app/upgrade/'
+      }
+    }
+  },
+  created() {
+  },
+  methods: {
+  }
+}
+</script>
+<style scoped>
+  @import '~@/assets/less/common.less'
+</style>

+ 42 - 0
src/views/sys/app/indexColumns.js

@@ -0,0 +1,42 @@
+function columns(vm) {
+  const cols = [
+    {
+      title: '序号',
+      key: 'rowIndex',
+      width: 60,
+      align: 'center',
+      customRender: function(t, r, index) {
+        return parseInt(index) + 1
+      }
+    },
+    {
+      title: '版本号',
+      align: 'center',
+      dataIndex: 'apkVersion',
+      key: 'apkVersion'
+    },
+    {
+      title: '版本描述',
+      align: 'center',
+      dataIndex: 'description',
+      key: 'description'
+    },
+    {
+      title: '上传时间',
+      align: 'center',
+      dataIndex: 'createTime',
+      key: 'createTime'
+    },
+    {
+      title: '操作',
+      dataIndex: 'action',
+      width: 200,
+      align: 'center',
+      slots: { title: 'actionName' },
+      scopedSlots: { customRender: 'action' }
+    }
+  ]
+  return cols
+}
+
+export default columns