|
@@ -0,0 +1,390 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
+ <el-form-item label="文件名" prop="repoName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.repoName"
|
|
|
+ placeholder="请输入文件名"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="类型" prop="repoType">
|
|
|
+ <el-select v-model="queryParams.repoType" placeholder="类型" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.sys_repo_type"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['system:repo:add']"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-if="refreshTable"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="repoList"
|
|
|
+ row-key="repoId"
|
|
|
+ >
|
|
|
+ <el-table-column type="index" label="ID" :show-overflow-tooltip="true" width="60"></el-table-column>
|
|
|
+ <el-table-column prop="repoName" label="名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
+ <el-table-column prop="version" label="版本" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
+ <el-table-column prop="groupId" label="组名" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
+ <el-table-column prop="repoStatus" label="状态" width="160">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.sys_repo_status" :value="scope.row.repoStatus"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="updateBy" label="更新人" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="更新时间" align="center" width="160">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.updateTime) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-bottom" @click="handleDownload(scope.row)">下载</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-s-management" @click="handleUpload(scope.row)">上传新版
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-s-management" @click="handleChackVersion(scope.row)">
|
|
|
+ 查看版本
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改菜单对话框 -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="菜单类型" prop="repoType">
|
|
|
+ <el-radio-group v-model="form.repoType" :disabled="type != 0">
|
|
|
+ <el-radio label="File">文件</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12" :disabled="type == 0 || type == 3">
|
|
|
+ <el-form-item label="文件名称" prop="repoName">
|
|
|
+ <el-input v-model="form.repoName" placeholder="请输入文件名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="状态" prop="repoStatus">
|
|
|
+ <el-radio-group v-model="form.repoStatus">
|
|
|
+ <el-radio label="Private">私密</el-radio>
|
|
|
+ <el-radio label="Public">公开</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12" :disabled="type == 1 || type == 2">
|
|
|
+ <el-form-item label="组名" prop="groupId">
|
|
|
+ <el-input v-model="form.groupId" placeholder="请输入组名"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12" v-if="type == 0 || type == 1">
|
|
|
+ <el-form-item label="文件上传" prop="fileUpload">
|
|
|
+ <FileUpload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :limit="1"
|
|
|
+ :fileSize="2"
|
|
|
+ :fileType="['doc', 'docx']"
|
|
|
+ @input="handleFileUpload"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" v-if="type == 2">
|
|
|
+ <el-table :data="this.versionList" style="width: 100%" max-height="250">
|
|
|
+ <el-table-column type="index" label="ID" :show-overflow-tooltip="true" width="60"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="fileVersion"
|
|
|
+ label="版本号"
|
|
|
+ width="120"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="repoId"
|
|
|
+ label="文件名"
|
|
|
+ width="150"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="uploadBy"
|
|
|
+ label="更改人"
|
|
|
+ width="120"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" label="操作" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-bottom" @click="handleDownload(scope.row)">下载</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleRollback(scope.row)">回滚</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注" prop="description" v-if="type != 2">
|
|
|
+ <el-input v-model="form.description" placeholder="可输入备注"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="compareFile" v-if="type == 1">对 比</el-button>
|
|
|
+ <el-button type="primary" @click="submitFile" :disabled="type == 1 && !comparisonMade">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import { addRepo, delRepo, getRepo, getVersion, listRepo, updateRepo, updateVersion } from '@/api/system/repo'
|
|
|
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
+import FileUpload from '@/components/FileUpload'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'Repo',
|
|
|
+ dicts: ['sys_repo_status', 'sys_repo_type'],
|
|
|
+ components: { FileUpload },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 角色表格数据
|
|
|
+ repoList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: '',
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 判断是那个按钮(新增,修改,上传新版,版本控制)
|
|
|
+ type: 0,
|
|
|
+ // 是否进行对比
|
|
|
+ comparisonMade: false,
|
|
|
+ // 重新渲染表格状态
|
|
|
+ refreshTable: true,
|
|
|
+ uploadUrl: '/common/upload',
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ repoName: undefined,
|
|
|
+ repoType: undefined,
|
|
|
+ repoId: undefined,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ versionList: [],
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ repoName: [
|
|
|
+ { required: true, message: '文件名称不能为空', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ groupId: [
|
|
|
+ { required: true, message: '组名不能为空', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询菜单列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ listRepo(this.queryParams).then(response => {
|
|
|
+ this.repoList = response.data.rows
|
|
|
+ this.total = response.data.total
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false
|
|
|
+ this.reset()
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ repoId: undefined,
|
|
|
+ repoName: undefined,
|
|
|
+ version: undefined,
|
|
|
+ repoType: undefined,
|
|
|
+ repoStatus: 'Public',
|
|
|
+ description: undefined,
|
|
|
+ url: undefined,
|
|
|
+ groupId: undefined,
|
|
|
+ }
|
|
|
+ this.resetForm('form')
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.handleQuery()
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd(row) {
|
|
|
+ this.reset()
|
|
|
+ if (row != null && row.repoId) {
|
|
|
+ this.form.parentId = row.repoId
|
|
|
+ } else {
|
|
|
+ this.form.parentId = 0
|
|
|
+ }
|
|
|
+ this.open = true
|
|
|
+ this.title = '添加菜单'
|
|
|
+ this.type = 0
|
|
|
+ },
|
|
|
+ /** 上传新版按钮操作 */
|
|
|
+ handleUpload(row) {
|
|
|
+ this.reset()
|
|
|
+ getRepo(row.repoId).then(response => {
|
|
|
+ this.form = response.data
|
|
|
+ this.open = true
|
|
|
+ this.title = '上传新版'
|
|
|
+ this.type = 1
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 查看版本按钮操作 */
|
|
|
+ handleChackVersion(row) {
|
|
|
+ this.reset()
|
|
|
+ getRepo(row.repoId).then(response => {
|
|
|
+ this.form = response.data
|
|
|
+ this.open = true
|
|
|
+ this.title = '查看版本'
|
|
|
+ this.type = 2
|
|
|
+ })
|
|
|
+ this.queryParams.repoId = row.repoId
|
|
|
+ getVersion(this.queryParams).then(response => {
|
|
|
+ this.versionList = response.data.rows
|
|
|
+ this.total = response.data.total
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset()
|
|
|
+ getRepo(row.repoId).then(response => {
|
|
|
+ this.form = response.data
|
|
|
+ this.open = true
|
|
|
+ this.title = '修改菜单'
|
|
|
+ this.type = 3
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitFile: function() {
|
|
|
+ this.$refs['form'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.type == 3) {
|
|
|
+ updateRepo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess('修改成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ } else if (this.type == 0) {
|
|
|
+ addRepo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ } else if (this.type == 1) {
|
|
|
+ updateVersion(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess('更新版本成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$modal.msgSuccess('没有变化')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$modal.confirm('是否确认删除:' + row.repoName).then(function() {
|
|
|
+ return delRepo(row.repoId)
|
|
|
+ }).then(() => {
|
|
|
+ this.getList()
|
|
|
+ this.$modal.msgSuccess('删除成功')
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFileUpload(updateFileList) {
|
|
|
+ this.form.url = updateFileList
|
|
|
+ },
|
|
|
+ compareFile(){
|
|
|
+ this.reset()
|
|
|
+ getRepo(this.form).then(response => {
|
|
|
+ this.comparisonMade = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDownload(){
|
|
|
+
|
|
|
+ },
|
|
|
+ handleRollback(){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|