|
|
@@ -4,24 +4,18 @@
|
|
|
<div class="version-title">版本管理</div>
|
|
|
<div class="handle-btns">
|
|
|
<span class="label">版本名称:</span>
|
|
|
- <!-- <a-select v-model:value="searchType" style="width: 120px">
|
|
|
- <a-select-option value="name">标签名称</a-select-option>
|
|
|
- <a-select-option value="code">标签编码</a-select-option>
|
|
|
- <a-select-option value="type">标签类型</a-select-option>
|
|
|
- <a-select-option value="time">创建时间</a-select-option>
|
|
|
- </a-select> -->
|
|
|
<a-input v-model:value="searchValue" placeholder="输入关键字查询" allow-clear />
|
|
|
<a-button class="btn" type="primary" @click="searchTable">查询</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="version-body">
|
|
|
<div class="body-header">
|
|
|
- <div class="item-title">标签列表</div>
|
|
|
+ <div class="item-title">版本列表</div>
|
|
|
<div class="table-btns">
|
|
|
- <a-button class="btn" type="primary" @click="getTagsData" title="刷新">
|
|
|
+ <a-button class="btn" type="primary" @click="getVersionData" title="刷新">
|
|
|
<RedoOutlined />
|
|
|
</a-button>
|
|
|
- <a-button class="btn" type="primary" @click="openDialog('add', {})">新增标签</a-button>
|
|
|
+ <a-button class="btn" type="primary" @click="openDialog('add', {})">新增版本</a-button>
|
|
|
<a-popconfirm :title="delAllBtnTitle" @confirm="delAllData">
|
|
|
<a-button class="btn" :disabled="!hasSelected">批量删除</a-button>
|
|
|
</a-popconfirm>
|
|
|
@@ -31,41 +25,42 @@
|
|
|
<a-table :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :columns="columns"
|
|
|
:data-source="tableData" :bordered="true" @change="tableChange">
|
|
|
<template #operation="{ record }">
|
|
|
- <a-tooltip title="编辑" color="yellow">
|
|
|
- <a @click="openDialog('edit', record)">
|
|
|
- <EditOutlined />
|
|
|
- </a>
|
|
|
- </a-tooltip>
|
|
|
- <a-popconfirm v-if="tableData.length" title="确定删除该标签?" @confirm="onDelete(record.id)">
|
|
|
- <a-tooltip title="删除" color="red">
|
|
|
- <a>
|
|
|
- <DeleteOutlined />
|
|
|
- </a>
|
|
|
- </a-tooltip>
|
|
|
+ <a @click="openModal(record.vid)">查看</a>
|
|
|
+ <a @click="openDialog('edit', record)">编辑</a>
|
|
|
+ <a-popconfirm v-if="tableData.length" title="确定删除该版本?" @confirm="onDelete(record.vid)">
|
|
|
+ <a>删除</a>
|
|
|
</a-popconfirm>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <TagDrawer v-if="ifShowDialog" @closeDialog="ifShowDialog = false" :formData="formData" :drawerTitle="drawerTitle"
|
|
|
- @onSubmit="onSubmit" ref="drawerRef">
|
|
|
- </TagDrawer>
|
|
|
+ <VersionDrawer v-if="ifShowDialog" @closeDialog="ifShowDialog = false" :formData="formData"
|
|
|
+ :drawerTitle="drawerTitle" @onSubmit="onSubmit" ref="drawerRef">
|
|
|
+ </VersionDrawer>
|
|
|
+ <VersionModal v-if="ifShowModal" @closeModal="ifShowModal = false" :width="modalWidth" :title="sourcesTableTitle">
|
|
|
+ <template #modalContent>
|
|
|
+ <div class="sources-body" style="padding: 20px;">
|
|
|
+ <div class="sources-title" style="margin-bottom: 20px;font-size: 16px;">资源列表</div>
|
|
|
+ <a-table :columns="sourcesColumns" :data-source="sourcesTableData" :bordered="true"></a-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </VersionModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { defineComponent, reactive, ref, toRefs, computed, onMounted, watch } from 'vue';
|
|
|
-import TagDrawer from './TagDrawer.vue';
|
|
|
-import { getAllTags, deleteTag } from '/@/api/sys/tag';
|
|
|
-import { getVersionList, delVersionByIds } from '/@/api/sys/version';
|
|
|
+import VersionDrawer from './VersionDrawer.vue';
|
|
|
+import VersionModal from './VersionModal.vue';
|
|
|
+import { getVersionList, delVersionByIds, getVersionDetail } from '/@/api/sys/version';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
-import { EditOutlined, DeleteOutlined, RedoOutlined } from '@ant-design/icons-vue';
|
|
|
+import { RedoOutlined } from '@ant-design/icons-vue';
|
|
|
import moment from 'moment'
|
|
|
import { session } from '/@/utils/Memory';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'version',
|
|
|
- components: { TagDrawer, EditOutlined, DeleteOutlined, RedoOutlined },
|
|
|
+ components: { VersionDrawer, RedoOutlined, VersionModal },
|
|
|
setup() {
|
|
|
const drawerRef = ref(null)
|
|
|
onMounted(() => {
|
|
|
@@ -74,19 +69,59 @@ export default defineComponent({
|
|
|
const data = reactive({
|
|
|
tableData: [],//表格数据
|
|
|
selectedRowKeys: [],//选中的key
|
|
|
- searchType: "name",//查询类型
|
|
|
searchValue: "",//查询值
|
|
|
formData: {
|
|
|
- id: "",
|
|
|
+ dataVersionConfs: [],
|
|
|
+ description: "",
|
|
|
+ insertTime: "",
|
|
|
name: "",
|
|
|
- codeName: "",
|
|
|
- code: "",
|
|
|
type: "",
|
|
|
- px: "",
|
|
|
+ updateTime: "",
|
|
|
+ vid: "",
|
|
|
},
|
|
|
- drawerTitle: "新增标签",
|
|
|
- ifShowDialog: false
|
|
|
+ drawerTitle: "新增版本",
|
|
|
+ ifShowDialog: false,
|
|
|
+ ifShowModal: false
|
|
|
});
|
|
|
+ //资源列表数据
|
|
|
+ const sourcesData = reactive({
|
|
|
+ sourcesTableData: [],//资源表格数据
|
|
|
+ sourcesColumns: [
|
|
|
+ {
|
|
|
+ title: '资源ID',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'rid',
|
|
|
+ key: 'rid'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '版本号',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'versionNum',
|
|
|
+ key: 'versionNum'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '最新版本',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'isNew',
|
|
|
+ key: 'isNew'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '发布时间',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'insertTime',
|
|
|
+ key: 'insertTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '修改时间',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'updateTime',
|
|
|
+ key: 'updateTime'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ sourcesTableTitle: "",
|
|
|
+ modalWidth: '1200px',
|
|
|
+ wrapClassName: "sources-body"
|
|
|
+ })
|
|
|
//获取所有标签
|
|
|
const getVersionData = () => {
|
|
|
data.tableData = []
|
|
|
@@ -177,15 +212,19 @@ export default defineComponent({
|
|
|
const delAllBtnTitle = computed(() => `确定删除${data.selectedRowKeys.length}个版本?`)
|
|
|
//删除所有选中的数据
|
|
|
const delAllData = () => {
|
|
|
+ let ids = ''
|
|
|
+ data.selectedRowKeys.forEach(item => {
|
|
|
+ ids += item + ','
|
|
|
+ })
|
|
|
let param = {
|
|
|
1: session.getItem('tokenV2'),
|
|
|
- 2: JSON.stringify({}),
|
|
|
- 3: JSON.stringify(data.selectedRowKeys)
|
|
|
+ 2: ids,
|
|
|
}
|
|
|
- deleteTag(param).then(res => {
|
|
|
- message.success('操作成功');
|
|
|
- getTagsData();
|
|
|
- data.selectedRowKeys = [];
|
|
|
+ delVersionByIds(param).then(res => {
|
|
|
+ if (res.status === "0") {
|
|
|
+ message.success('操作成功');
|
|
|
+ getVersionData();
|
|
|
+ }
|
|
|
})
|
|
|
};
|
|
|
//表格行选中事件
|
|
|
@@ -196,25 +235,27 @@ export default defineComponent({
|
|
|
const openDialog = (flag, record) => {
|
|
|
if (flag === 'add') {
|
|
|
data.formData = {
|
|
|
- id: "",
|
|
|
+ dataVersionConfs: [],
|
|
|
+ description: "",
|
|
|
+ insertTime: "",
|
|
|
name: "",
|
|
|
- codeName: "",
|
|
|
- code: "",
|
|
|
type: "",
|
|
|
- px: "",
|
|
|
+ updateTime: "",
|
|
|
+ vid: "",
|
|
|
}
|
|
|
- data.drawerTitle = '新增标签'
|
|
|
+ data.drawerTitle = '新增版本'
|
|
|
data.ifShowDialog = true
|
|
|
} else {
|
|
|
data.formData = {
|
|
|
- id: record.id,
|
|
|
+ dataVersionConfs: record.dataVersionConfs,
|
|
|
+ description: record.description,
|
|
|
+ insertTime: record.insertTime,
|
|
|
name: record.name,
|
|
|
- code: record.code,
|
|
|
- codeName: record.codeName,
|
|
|
type: record.type,
|
|
|
- px: record.px,
|
|
|
+ updateTime: record.updateTime,
|
|
|
+ vid: record.vid,
|
|
|
}
|
|
|
- data.drawerTitle = '修改标签'
|
|
|
+ data.drawerTitle = '修改版本'
|
|
|
data.ifShowDialog = true
|
|
|
}
|
|
|
}
|
|
|
@@ -222,19 +263,46 @@ export default defineComponent({
|
|
|
const onDelete = (id) => {
|
|
|
let param = {
|
|
|
1: session.getItem('tokenV2'),
|
|
|
- 2: JSON.stringify({}),
|
|
|
- 3: JSON.stringify([id])
|
|
|
+ 2: id,
|
|
|
}
|
|
|
- deleteTag(param).then(res => {
|
|
|
- message.success('操作成功');
|
|
|
- getTagsData();
|
|
|
+ delVersionByIds(param).then(res => {
|
|
|
+ if (res.status === "0") {
|
|
|
+ message.success('操作成功');
|
|
|
+ getVersionData();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //打开弹窗展示资源
|
|
|
+ const openModal = (id) => {
|
|
|
+ let param = {
|
|
|
+ 1: session.getItem('tokenV2'),
|
|
|
+ 2: id,
|
|
|
+ }
|
|
|
+ getVersionDetail(param).then(res => {
|
|
|
+ if (res.status === "0") {
|
|
|
+ let resData = JSON.parse(res.result)
|
|
|
+ if (resData.dataVersionConfs.length) {
|
|
|
+ sourcesData.sourcesTableData = []
|
|
|
+ sourcesData.sourcesTableTitle = `版本:${resData.name}`
|
|
|
+ resData.dataVersionConfs.forEach(item => {
|
|
|
+ sourcesData.sourcesTableData.push({
|
|
|
+ isNew: item.active === 'N' ? '否' : '是',
|
|
|
+ key: item.id,
|
|
|
+ ...item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ data.ifShowModal = true
|
|
|
+ } else {
|
|
|
+ message.info('该版本暂无资源')
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
//弹窗确认
|
|
|
const onSubmit = (e) => {
|
|
|
data.ifShowDialog = false
|
|
|
if (e) {
|
|
|
- getTagsData();
|
|
|
+ getVersionData();
|
|
|
}
|
|
|
}
|
|
|
return {
|
|
|
@@ -244,12 +312,14 @@ export default defineComponent({
|
|
|
hasSelected,
|
|
|
delAllBtnTitle,
|
|
|
...toRefs(data),
|
|
|
+ ...toRefs(sourcesData),
|
|
|
// func
|
|
|
getVersionData,
|
|
|
tableChange,
|
|
|
searchTable,
|
|
|
delAllData,
|
|
|
onDelete,
|
|
|
+ openModal,
|
|
|
onSelectChange,
|
|
|
openDialog,
|
|
|
onSubmit
|