Commit 3d509f8b by zhangmeng

Merge branch 'test' into 'production'

Test



See merge request !7
parents 42641960 673a3d05
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Vmatrix-admin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
</natures>
<filteredResources>
<filter>
<id>1569403728185</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
...@@ -126,3 +126,26 @@ export function templateUploadZipResourse(resourse) { ...@@ -126,3 +126,26 @@ export function templateUploadZipResourse(resourse) {
export function templateUploadZipUrl() { export function templateUploadZipUrl() {
return process.env.VUE_APP_BASE_API + '/template/upload/zip/resource' return process.env.VUE_APP_BASE_API + '/template/upload/zip/resource'
} }
/**
*
* @param {*} templateId
* 获取版本详情
*/
export function getVersion(templateId) {
return request({
url: `/template/get/version/list/${templateId}`,
method: 'get'
})
}
/**
*
* @param {*} templateId
* 更新版本
*/
export function updateVersion(data) {
return request({
url: '/template/update/version/info',
method: 'post',
data
})
}
...@@ -44,6 +44,20 @@ const templatesRouter = { ...@@ -44,6 +44,20 @@ const templatesRouter = {
name: 'TemplateDetail', name: 'TemplateDetail',
hidden: true, hidden: true,
meta: { title: '模板详情' } meta: { title: '模板详情' }
},
{
path: 'version',
component: () => import('@/views/template/template-version'),
name: 'versionUpdate',
hidden: true,
meta: { title: '版本详情' }
},
{
path: 'updateVersion',
component: () => import('@/views/template/template-version'),
name: 'versionUpdate',
hidden: true,
meta: { title: '更新版本' }
} }
] ]
} }
......
...@@ -6,59 +6,22 @@ ...@@ -6,59 +6,22 @@
</el-select>--> </el-select>-->
</div> </div>
<div v-loading.fullscreen.lock="fullscreenLoading"> <div v-loading.fullscreen.lock="fullscreenLoading">
<el-form <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
ref="dataForm"
:rules="rules"
:model="temp"
label-position="left"
label-width="100px"
style="width: 400px; margin-left:50px;"
>
<el-form-item label="模板类型" prop="typeId"> <el-form-item label="模板类型" prop="typeId">
<el-select <el-select v-model="temp.typeId" placeholder="选择模板类型" clearable class="filter-item" style="width: 200px" @change="typeChange">
v-model="temp.typeId" <el-option v-for="item in typeList" :key="item.typeId" :label="item.typeName" :value="item.typeId" />
placeholder="选择模板类型"
clearable
class="filter-item"
style="width: 200px"
@change="typeChange"
>
<el-option
v-for="item in typeList"
:key="item.typeId"
:label="item.typeName"
:value="item.typeId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="temp.typeId" label="模板标签" prop="tagIds"> <el-form-item v-if="temp.typeId" label="模板标签" prop="tagIds">
<el-select <el-select v-model="temp.tagIds" placeholder="选择模板标签" clearable multiple collapse-tags style="width: 200px" class="filter-item">
v-model="temp.tagIds" <el-option v-for="item in tagsList" :key="item.tagId" :label="item.tagName" :value="item.tagId" />
placeholder="选择模板标签"
clearable
multiple
collapse-tags
style="width: 200px"
class="filter-item"
>
<el-option
v-for="item in tagsList"
:key="item.tagId"
:label="item.tagName"
:value="item.tagId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="模板名称" prop="templateName"> <el-form-item label="模板名称" prop="templateName">
<el-input v-model="temp.templateName" placeholder="请输入模板名称" /> <el-input v-model="temp.templateName" placeholder="请输入模板名称" />
</el-form-item> </el-form-item>
<el-form-item label="模板详情" prop="templateDescribe"> <el-form-item label="模板详情" prop="templateDescribe">
<el-input <el-input v-model="temp.templateDescribe" :autosize="{ minRows: 2, maxRows: 4}" type="textarea" placeholder="请输入模板详情" />
v-model="temp.templateDescribe"
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
placeholder="请输入模板详情"
/>
</el-form-item> </el-form-item>
<el-form-item label="适用设备" prop="templateEnvironment"> <el-form-item label="适用设备" prop="templateEnvironment">
<el-select v-model="temp.templateEnvironment" class="filter-item" placeholder="请选择适用设备"> <el-select v-model="temp.templateEnvironment" class="filter-item" placeholder="请选择适用设备">
...@@ -67,43 +30,25 @@ ...@@ -67,43 +30,25 @@
</el-form-item> </el-form-item>
<el-form-item label="显示方式" prop="templateShow"> <el-form-item label="显示方式" prop="templateShow">
<el-select v-model="temp.templateShow" class="filter-item" placeholder="请选择显示方式"> <el-select v-model="temp.templateShow" class="filter-item" placeholder="请选择显示方式">
<el-option <el-option v-for="item in showStatus" :key="item.id" :label="item.name" :value="item.id" />
v-for="item in showStatus"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="显示比列" prop="templateProportion"> <el-form-item label="显示比列" prop="templateProportion">
<el-input <el-input v-model="temp.templateProportion1" width="100" style="width: 100px;" placeholder />:
v-model="temp.templateProportion1" <el-input v-model="temp.templateProportion2" width="100" style="width: 100px;" placeholder />
width="100"
style="width: 100px;"
placeholder
/>:
<el-input
v-model="temp.templateProportion2"
width="100"
style="width: 100px;"
placeholder
/>
</el-form-item> </el-form-item>
<el-form-item label="模板包名称" prop="templatePackageName"> <el-form-item label="模板包名称" prop="templatePackageName">
<el-input v-model="temp.templatePackageName" placeholder="请输入模板包名称" /> <el-input v-model="temp.templatePackageName" placeholder="请输入模板包名称" />
</el-form-item> </el-form-item>
<el-form-item v-if="!templateId" label="模板包描述" prop="addVersionInfoDTO.versionName">
<el-input v-model="temp.addVersionInfoDTO.versionName" placeholder="请输入模板包描述" />
</el-form-item>
<el-form-item label="模板包排行" prop="templateOrder">
<el-input-number v-model="temp.templateOrder" :min="0" />
</el-form-item>
<el-form-item v-if="!templateId" label="上传模板包"> <el-form-item v-if="!templateId" label="上传模板包">
<el-upload <el-upload class="upload-demo" drag name="resource" accept=".zip" :show-file-list="false" :on-success="uploadZipSuccess" :on-progress="onProgress" :action="templateUploadZipUrl">
class="upload-demo"
drag
name="resource"
accept=".zip"
:show-file-list="false"
:on-success="uploadZipSuccess"
:on-progress="onProgress"
:action="templateUploadZipUrl"
>
<i class="el-icon-upload" /> <i class="el-icon-upload" />
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处,或 将文件拖到此处,或
...@@ -135,7 +80,9 @@ import waves from '@/directive/waves' // waves directive ...@@ -135,7 +80,9 @@ import waves from '@/directive/waves' // waves directive
export default { export default {
name: 'ComplexTable', name: 'ComplexTable',
directives: { waves }, directives: {
waves
},
filters: { filters: {
statusFilter(status) { statusFilter(status) {
const statusMap = { const statusMap = {
...@@ -167,9 +114,14 @@ export default { ...@@ -167,9 +114,14 @@ export default {
sort: '+id' sort: '+id'
}, },
templateId: '', templateId: '',
sortOptions: [ sortOptions: [{
{ label: 'ID Ascending', key: '+id' }, label: 'ID Ascending',
{ label: 'ID Descending', key: '-id' } key: '+id'
},
{
label: 'ID Descending',
key: '-id'
}
], ],
statusOptions: ['published', 'draft', 'deleted'], statusOptions: ['published', 'draft', 'deleted'],
showReviewer: false, showReviewer: false,
...@@ -191,7 +143,12 @@ export default { ...@@ -191,7 +143,12 @@ export default {
templateProportion1: '', templateProportion1: '',
templateProportion2: '', templateProportion2: '',
templatePackageName: '', templatePackageName: '',
templateCount: 0 templateCount: 0,
templateOrder: 0,
addVersionInfoDTO: {
zipUrl: '',
versionName: ''
}
}, },
dialogFormVisible: true, dialogFormVisible: true,
dialogStatus: '', dialogStatus: '',
...@@ -202,47 +159,51 @@ export default { ...@@ -202,47 +159,51 @@ export default {
dialogPvVisible: false, dialogPvVisible: false,
pvData: [], pvData: [],
rules: { rules: {
templateName: [ templateName: [{
{
required: true, required: true,
message: 'templateName is required', message: 'templateName is required',
trigger: 'change' trigger: 'change'
} }],
], templateDescribe: [{
templateDescribe: [
{
required: true, required: true,
message: 'templateDescribe is required', message: 'templateDescribe is required',
trigger: 'change' trigger: 'change'
} }],
], typeId: [{
typeId: [ required: true,
{ required: true, message: 'typeId is required', trigger: 'change' } message: 'typeId is required',
], trigger: 'change'
templateEnvironment: [ }],
{ templateEnvironment: [{
required: true, required: true,
message: 'templateEnvironment is required', message: 'templateEnvironment is required',
trigger: 'change' trigger: 'change'
} }],
], templateShow: [{
templateShow: [
{
required: true, required: true,
message: 'templateShow is required', message: 'templateShow is required',
trigger: 'change' trigger: 'change'
} }],
], templatePackageName: [{
templatePackageName: [
{
required: true, required: true,
message: 'templatePackageName is required', message: 'templatePackageName is required',
trigger: 'change' trigger: 'change'
} }],
], title: [{
title: [ required: true,
{ required: true, message: 'title is required', trigger: 'blur' } message: 'title is required',
] trigger: 'blur'
}],
'addVersionInfoDTO.versionName': [{
required: true,
message: 'versionName is required',
trigger: 'change'
}],
'templateOrder': [{
required: true,
message: '请输入排行值',
trigger: 'change'
}]
}, },
downloadLoading: false downloadLoading: false
} }
...@@ -322,8 +283,7 @@ export default { ...@@ -322,8 +283,7 @@ export default {
this.temp.frameInfo.frameUrl = e.frameUrl this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl this.temp.templateUrl = e.pictureUrl.map(item => {
.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) { if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + '' return item + ''
} else { } else {
...@@ -331,6 +291,7 @@ export default { ...@@ -331,6 +291,7 @@ export default {
} }
}) })
.join(',') .join(',')
this.temp.addVersionInfoDTO.zipUrl = e.zipUrl
console.log(this.temp) console.log(this.temp)
} }
console.log(e) console.log(e)
...@@ -422,4 +383,5 @@ export default { ...@@ -422,4 +383,5 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>
...@@ -26,15 +26,7 @@ ...@@ -26,15 +26,7 @@
</el-checkbox> --> </el-checkbox> -->
</div> </div>
<el-table <el-table :key="tableKey" v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%;">
:key="tableKey"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
style="width: 100%;"
>
<el-table-column label="序号" prop="id" align="center" width="80" type="index" :class-name="getSortClass('id')" /> <el-table-column label="序号" prop="id" align="center" width="80" type="index" :class-name="getSortClass('id')" />
<el-table-column label="模板类型" width="150px" align="center"> <el-table-column label="模板类型" width="150px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -53,7 +45,7 @@ ...@@ -53,7 +45,7 @@
</el-table-column> </el-table-column>
<el-table-column label="资源路径" width="210px" align="center"> <el-table-column label="资源路径" width="210px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.frameUrl.split('/').splice(-2, 3)[0]}}</span> <span>{{ scope.row.frameUrl.split('/').splice(-2, 3)[0] }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="状态" class-name="status-col" width="100"> <!-- <el-table-column label="状态" class-name="status-col" width="100">
...@@ -63,7 +55,7 @@ ...@@ -63,7 +55,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="primary" size="mini"> <el-button type="primary" size="mini">
<a :href="row.frameUrl" target="_blank">预览</a> <a :href="row.frameUrl" target="_blank">预览</a>
...@@ -77,6 +69,9 @@ ...@@ -77,6 +69,9 @@
<!-- <el-button v-if="row.status!='draft'" size="mini" @click="handleDelete(row,'draft')"> <!-- <el-button v-if="row.status!='draft'" size="mini" @click="handleDelete(row,'draft')">
禁用 禁用
</el-button> --> </el-button> -->
<el-button type="primary" size="mini" @click="versionNameUpdate(row)">
版本
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -92,8 +87,12 @@ import Pagination from '@/components/Pagination' // secondary package based on e ...@@ -92,8 +87,12 @@ import Pagination from '@/components/Pagination' // secondary package based on e
export default { export default {
name: 'ComplexTable', name: 'ComplexTable',
components: { Pagination }, components: {
directives: { waves }, Pagination
},
directives: {
waves
},
filters: { filters: {
statusFilter(status) { statusFilter(status) {
const statusMap = { const statusMap = {
...@@ -121,7 +120,13 @@ export default { ...@@ -121,7 +120,13 @@ export default {
sort: '+id' sort: '+id'
}, },
importanceOptions: [1, 2, 3], importanceOptions: [1, 2, 3],
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }], sortOptions: [{
label: 'ID Ascending',
key: '+id'
}, {
label: 'ID Descending',
key: '-id'
}],
statusOptions: ['published', 'draft', 'deleted'], statusOptions: ['published', 'draft', 'deleted'],
showReviewer: false, showReviewer: false,
temp: { temp: {
...@@ -142,9 +147,22 @@ export default { ...@@ -142,9 +147,22 @@ export default {
dialogPvVisible: false, dialogPvVisible: false,
pvData: [], pvData: [],
rules: { rules: {
type: [{ required: true, message: 'type is required', trigger: 'change' }], type: [{
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }], required: true,
title: [{ required: true, message: 'title is required', trigger: 'blur' }] message: 'type is required',
trigger: 'change'
}],
timestamp: [{
type: 'date',
required: true,
message: 'timestamp is required',
trigger: 'change'
}],
title: [{
required: true,
message: 'title is required',
trigger: 'blur'
}]
}, },
downloadLoading: false downloadLoading: false
} }
...@@ -197,6 +215,15 @@ export default { ...@@ -197,6 +215,15 @@ export default {
} }
}) })
}, },
versionNameUpdate(row) {
console.log(row)
this.$router.push({
name: 'versionUpdate',
query: {
templateId: row.templateId
}
})
},
handleDelete(row) { handleDelete(row) {
this.$confirm('此操作将删除该模板, 是否继续?', '提示', { this.$confirm('此操作将删除该模板, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
......
<template>
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
<el-button type="primary" size="mini" @click="update()">
更新版本
</el-button>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="versionId" label="版本ID" width="280" />
<el-table-column prop="versionName" label="版本描述" width="280" />
<el-table-column prop="versionNum" label="版本号" />
<el-table-column label="版本状态">
<template slot-scope="scope">
<div>{{ scope.row.versionState=='YES'?'正在使用版本':'旧版本' }}</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="100">
<template slot-scope="scope">
<el-button size="small" type="warning" @click="load(scope.row.zipUrl)">下载</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="更新模板包" :visible.sync="dialogFormVisible">
<el-form ref="dataForm" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">
<el-form-item label="模板描述" prop="versionName">
<el-input v-model="temp.versionName" />
</el-form-item>
<el-form-item label="版本类型" prop="versionType">
<template slot-scope="scope">
<el-select v-model="temp.versionType" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
</el-form-item>
<el-form-item label="上传模板包">
<el-upload
class="upload-demo"
drag
name="resource"
accept=".zip"
:show-file-list="false"
:on-success="uploadZipSuccess"
:on-progress="onProgress"
:action="templateUploadZipUrl"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传zip包 {{ temp.templateCount ? '上传成功' : '' }}</div>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">
取消
</el-button>
<el-button type="primary" @click="updateVersionHandle()">
确认
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getVersion,
updateVersion,
templateUploadZipUrl
} from '@/api/template'
export default {
name: 'Version',
data() {
return {
temp: {
templateId: '',
frameUrl: '',
resourceUrl: '',
pictureUrl: '',
zipUrl: '',
versionName: '',
versionType: 'BUG'
},
options: [{
value: 'BUG',
label: 'BUG修复'
}, {
value: 'UPDATE',
label: '版本迭代'
}],
fullscreenLoading: false,
dialogStatus: '',
dialogFormVisible: false,
templateUploadZipUrl: templateUploadZipUrl(),
tableData: [{
versionId: '',
versionName: '',
versionNum: '',
versionState: '',
zipUrl: ''
}]
}
},
created() {
this.temp.templateId = this.$route.query.templateId
this.getVersion()
},
methods: {
getVersion() {
this.listLoading = true
getVersion(this.temp.templateId).then(
response => {
console.log(response)
this.tableData = response
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false
}, 1.5 * 1000)
}
)
},
load(a) {
window.open(a)
},
resetTemp() {
this.temp = {
typeMenuName: '',
typeMenuOrder: 0
}
},
update() {
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.temp = {
templateId: this.$route.query.templateId,
frameUrl: '',
resourceUrl: '',
pictureUrl: '',
zipUrl: '',
versionName: '',
versionType: 'BUG'
}
},
uploadZipSuccess(e) {
this.fullscreenLoading = false
if (e.code && e.code !== '0') {
this.$message.error(e.msg)
} else {
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameUrl = e.frameUrl
this.temp.resourceUrl = e.resourceUrl
this.temp.pictureUrl = e.pictureUrl.map(item => {
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + ''
}
})
.join(',')
this.temp.zipUrl = e.zipUrl
console.log(this.temp)
}
console.log(e)
},
onProgress(event) {
console.log(event)
this.fullscreenLoading = true
// if (event.percent === 100) {
// this.fullscreenLoading = false
// }
},
updateVersionHandle() {
this.dialogFormVisible = false
updateVersion(this.temp)
.then(response => {
this.getVersion()
})
/* .catch(() => {
console.log('cathch')
this.listLoading = false
})*/
}
}
}
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment