|
@@ -44,11 +44,11 @@
|
|
|
v-loading="loading"
|
|
|
:data="repoList"
|
|
|
row-key="repoId"
|
|
|
- :default-expand-all="isExpandAll"
|
|
|
>
|
|
|
+ <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="repoType" label="类型" :show-overflow-tooltip="true" width="160"></el-table-column>
|
|
|
- <el-table-column prop="repoPath" 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"/>
|
|
@@ -63,28 +63,40 @@
|
|
|
<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-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-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="680px" append-to-body>
|
|
|
+ <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="!isAdding">
|
|
|
+ <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="!isAdding">
|
|
|
+ <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>
|
|
@@ -99,28 +111,77 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="12" v-if="form.repoType == 'File' && isAdding">
|
|
|
+ <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="3"
|
|
|
+ :limit="1"
|
|
|
:fileSize="2"
|
|
|
- :fileType="['doc', 'docx', 'jpg', 'png']"
|
|
|
- @input="handleFileListUpdate"
|
|
|
+ :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="remark">
|
|
|
- <el-input v-model="form.remark" placeholder="可输入备注"/>
|
|
|
+ <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="submitFile">确 定</el-button>
|
|
|
+ <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>
|
|
@@ -129,14 +190,14 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { addRepo, delRepo, getRepo, listRepo, updateRepo } from '@/api/system/repo'
|
|
|
+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},
|
|
|
+ components: { FileUpload },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -151,8 +212,10 @@ export default {
|
|
|
title: '',
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
- // 是否为新增
|
|
|
- isAdding: false,
|
|
|
+ // 判断是那个按钮(新增,修改,上传新版,版本控制)
|
|
|
+ type: 0,
|
|
|
+ // 是否进行对比
|
|
|
+ comparisonMade: false,
|
|
|
// 重新渲染表格状态
|
|
|
refreshTable: true,
|
|
|
uploadUrl: '/common/upload',
|
|
@@ -161,11 +224,21 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
repoName: undefined,
|
|
|
- repoType: undefined
|
|
|
- },
|
|
|
- form: {
|
|
|
- repoType: 'File'
|
|
|
+ repoType: undefined,
|
|
|
+ repoId: undefined,
|
|
|
},
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ versionList: [],
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ repoName: [
|
|
|
+ { required: true, message: '文件名称不能为空', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ groupId: [
|
|
|
+ { required: true, message: '组名不能为空', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -176,7 +249,8 @@ export default {
|
|
|
getList() {
|
|
|
this.loading = true
|
|
|
listRepo(this.queryParams).then(response => {
|
|
|
- this.repoList = response.data
|
|
|
+ this.repoList = response.data.rows
|
|
|
+ this.total = response.data.total
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
@@ -190,10 +264,12 @@ export default {
|
|
|
this.form = {
|
|
|
repoId: undefined,
|
|
|
repoName: undefined,
|
|
|
- repoType: 'doc',
|
|
|
+ version: undefined,
|
|
|
+ repoType: undefined,
|
|
|
repoStatus: 'Public',
|
|
|
- remark: undefined,
|
|
|
- fileList: []
|
|
|
+ description: undefined,
|
|
|
+ url: undefined,
|
|
|
+ groupId: undefined,
|
|
|
}
|
|
|
this.resetForm('form')
|
|
|
},
|
|
@@ -216,7 +292,7 @@ export default {
|
|
|
}
|
|
|
this.open = true
|
|
|
this.title = '添加菜单'
|
|
|
- this.isAdding = true
|
|
|
+ this.type = 0
|
|
|
},
|
|
|
/** 上传新版按钮操作 */
|
|
|
handleUpload(row) {
|
|
@@ -225,7 +301,7 @@ export default {
|
|
|
this.form = response.data
|
|
|
this.open = true
|
|
|
this.title = '上传新版'
|
|
|
- this.isAdding = false
|
|
|
+ this.type = 1
|
|
|
})
|
|
|
},
|
|
|
/** 查看版本按钮操作 */
|
|
@@ -235,7 +311,12 @@ export default {
|
|
|
this.form = response.data
|
|
|
this.open = true
|
|
|
this.title = '查看版本'
|
|
|
- this.isAdding = false
|
|
|
+ this.type = 2
|
|
|
+ })
|
|
|
+ this.queryParams.repoId = row.repoId
|
|
|
+ getVersion(this.queryParams).then(response => {
|
|
|
+ this.versionList = response.data.rows
|
|
|
+ this.total = response.data.total
|
|
|
})
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
@@ -245,30 +326,40 @@ export default {
|
|
|
this.form = response.data
|
|
|
this.open = true
|
|
|
this.title = '修改菜单'
|
|
|
- this.isAdding = false
|
|
|
+ this.type = 3
|
|
|
})
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitFile: function() {
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (!this.isAdding) {
|
|
|
+ if (this.type == 3) {
|
|
|
updateRepo(this.form).then(response => {
|
|
|
this.$modal.msgSuccess('修改成功')
|
|
|
this.open = false
|
|
|
this.getList()
|
|
|
})
|
|
|
- } else {
|
|
|
- addRepo(this.form.fileList).then(response => {
|
|
|
+ } 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)
|
|
@@ -278,10 +369,21 @@ export default {
|
|
|
}).catch(() => {
|
|
|
})
|
|
|
},
|
|
|
- handleFileListUpdate(updateFileList) {
|
|
|
- this.form.fileList = updateFileList
|
|
|
- }
|
|
|
+ handleFileUpload(updateFileList) {
|
|
|
+ this.form.url = updateFileList
|
|
|
+ },
|
|
|
+ compareFile(){
|
|
|
+ this.reset()
|
|
|
+ getRepo(this.form).then(response => {
|
|
|
+ this.comparisonMade = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDownload(){
|
|
|
|
|
|
+ },
|
|
|
+ handleRollback(){
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|