|
|
@@ -15,10 +15,10 @@
|
|
|
<div class="version-body">
|
|
|
<BasicTable @register="registerTable">
|
|
|
<template #toolbar>
|
|
|
- <Button type="primary" @click="openDialog(null)">
|
|
|
+ <Button type="primary" @click="handleAdd">
|
|
|
新增版本
|
|
|
</Button>
|
|
|
- <Button type="primary" danger :disabled="hasSelected" @click="delAllData">
|
|
|
+ <Button type="primary" danger :disabled="hasSelected" @click="handleDelAll">
|
|
|
批量删除
|
|
|
</Button>
|
|
|
</template>
|
|
|
@@ -27,49 +27,47 @@
|
|
|
{
|
|
|
label: '查看',
|
|
|
tooltip: '查看',
|
|
|
- onClick: openModal.bind(null, record.vid),
|
|
|
+ onClick: handleLook.bind(null, record),
|
|
|
},
|
|
|
{
|
|
|
label: '编辑',
|
|
|
tooltip: '编辑',
|
|
|
- onClick: openDialog.bind(null, record),
|
|
|
+ onClick: handleEdit.bind(null, record),
|
|
|
},
|
|
|
{
|
|
|
label: '删除',
|
|
|
tooltip: '删除',
|
|
|
- onClick: onDelete.bind(null, record.vid),
|
|
|
+ onClick: handleDel.bind(null, record.vid),
|
|
|
},
|
|
|
]" />
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
</div>
|
|
|
|
|
|
- <VersionDrawer v-if="ifShowDialog" @closeDialog="ifShowDialog = false" :formData="formData"
|
|
|
- :drawerTitle="drawerTitle" @onSubmit="onSubmit" ref="drawerRef">
|
|
|
- </VersionDrawer>
|
|
|
+ <VersionManageModal @register="registerModal" @success="onSubmit"></VersionManageModal>
|
|
|
<VersionModal v-if="ifShowModal" @closeModal="ifShowModal = false" :versionId="versionId" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { defineComponent, reactive, ref, toRefs, computed, onMounted, watch, createVNode } from 'vue';
|
|
|
+import { defineComponent, reactive, ref, toRefs, computed, onMounted, watch } from 'vue';
|
|
|
// 导入表格组件,表格事件
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
import { Button, notification } from 'ant-design-vue';
|
|
|
-
|
|
|
-import VersionDrawer from './VersionDrawer.vue';
|
|
|
+import { useModal } from '/@/components/Modal';
|
|
|
+import VersionManageModal from './VersionManageModal.vue';
|
|
|
import VersionModal from './VersionModal.vue';
|
|
|
-import { getVersionList, delVersionByIds, getVersionDetail } from '/@/api/sys/version';
|
|
|
-import { message, Modal } from 'ant-design-vue';
|
|
|
-import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
|
+import { getVersionList, delVersion } from '/@/api/sys/version';
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
import moment from 'moment'
|
|
|
import { session } from '/@/utils/Memory';
|
|
|
+import uiTool from '/@/utils/uiTool';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'version',
|
|
|
- components: { VersionDrawer, ExclamationCircleOutlined, VersionModal, BasicTable, TableAction, Button },
|
|
|
+ components: { VersionManageModal, VersionModal, BasicTable, TableAction, Button },
|
|
|
setup() {
|
|
|
- const drawerRef = ref(null)
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
const data = reactive({
|
|
|
searchValue: "",//查询值
|
|
|
formData: {
|
|
|
@@ -81,8 +79,6 @@ export default defineComponent({
|
|
|
updateTime: "",
|
|
|
vid: "",
|
|
|
},
|
|
|
- drawerTitle: "新增版本",
|
|
|
- ifShowDialog: false,
|
|
|
ifShowModal: false,
|
|
|
versionId: ''
|
|
|
});
|
|
|
@@ -126,62 +122,58 @@ export default defineComponent({
|
|
|
//获取所有标签
|
|
|
const getVersionData = () => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- let param = {
|
|
|
- 1: session.getItem('tokenV2'),
|
|
|
- 2: JSON.stringify({}),
|
|
|
- 3: 1,
|
|
|
- 4: 10000000
|
|
|
+ let params = {
|
|
|
+ keyStr: data.searchValue
|
|
|
}
|
|
|
- getVersionList(param).then(res => {
|
|
|
- let resData = JSON.parse(res.result)
|
|
|
- resolve(resData)
|
|
|
+ getVersionList(params).then(res => {
|
|
|
+ if (res.resp_code === 0 && res.datas) {
|
|
|
+ let resData = []
|
|
|
+ for (let key in res.datas) {
|
|
|
+ resData.concat(res.datas[key])
|
|
|
+ }
|
|
|
+ resolve(resData)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ resolve([])
|
|
|
+ message.error(res.resp_msg)
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- //筛选数据,用于表格
|
|
|
- const filteredInfo = ref({
|
|
|
- name: null
|
|
|
- });
|
|
|
//表格列
|
|
|
- const columns = computed(() => {
|
|
|
- const filtered = filteredInfo.value || {};
|
|
|
- return [
|
|
|
- {
|
|
|
- title: '版本名称',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
- filteredValue: filtered.name || null,
|
|
|
- onFilter: (value, record) => record.name.includes(value)
|
|
|
- },
|
|
|
- {
|
|
|
- title: '版本说明',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'description',
|
|
|
- key: 'description'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '发布时间',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'insertTime',
|
|
|
- key: 'insertTime'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '修改时间',
|
|
|
- align: 'center',
|
|
|
- dataIndex: 'updateTime',
|
|
|
- key: 'updateTime'
|
|
|
- }
|
|
|
- ];
|
|
|
- });
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ title: '版本名称',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '版本说明',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'description',
|
|
|
+ key: 'description'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '发布时间',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'insertTime',
|
|
|
+ key: 'insertTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '修改时间',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'updateTime',
|
|
|
+ key: 'updateTime'
|
|
|
+ }
|
|
|
+ ];
|
|
|
//表格查询功能
|
|
|
const searchTable = () => {
|
|
|
- filteredInfo.value.name = [data.searchValue]
|
|
|
+ reload()
|
|
|
}
|
|
|
//重置
|
|
|
- const resetTable = ()=>{
|
|
|
- filteredInfo.value.name = null
|
|
|
- data.searchValue=''
|
|
|
+ const resetTable = () => {
|
|
|
+ data.searchValue = ''
|
|
|
reload()
|
|
|
}
|
|
|
//判断是否选中数据
|
|
|
@@ -189,119 +181,69 @@ export default defineComponent({
|
|
|
const rowSelection = getRowSelection();
|
|
|
return !rowSelection.selectedRowKeys?.length;
|
|
|
});
|
|
|
- //删除所有选中的数据
|
|
|
- const delAllData = () => {
|
|
|
- Modal.confirm({
|
|
|
- title: '删除提示',
|
|
|
- icon: createVNode(ExclamationCircleOutlined),
|
|
|
- content: '确定删除版本?',
|
|
|
- centered: true,
|
|
|
- okText: '确定',
|
|
|
- okType: 'danger',
|
|
|
- cancelText: '取消',
|
|
|
- onOk: (() => {
|
|
|
- const rowKeys = getSelectRowKeys();
|
|
|
- let ids = rowKeys.toString()
|
|
|
- let param = {
|
|
|
- 1: session.getItem('tokenV2'),
|
|
|
- 2: ids,
|
|
|
- }
|
|
|
- delVersionByIds(param).then(res => {
|
|
|
- if (res.status === "0") {
|
|
|
- message.success('操作成功');
|
|
|
- reload();
|
|
|
- setSelectedRowKeys([])
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ //新增
|
|
|
+ const handleAdd = () => {
|
|
|
+ openModal(true, {
|
|
|
+ status: 'add'
|
|
|
});
|
|
|
- };
|
|
|
- //新增或修改数据,打开弹窗
|
|
|
- const openDialog = (record) => {
|
|
|
- if (!record) {
|
|
|
- data.formData = {
|
|
|
- dataVersionConfs: [],
|
|
|
- description: "",
|
|
|
- insertTime: "",
|
|
|
- name: "",
|
|
|
- type: "",
|
|
|
- updateTime: "",
|
|
|
- vid: "",
|
|
|
+ }
|
|
|
+ //查看
|
|
|
+ const handleLook = (id) => {
|
|
|
+ openModal(true, {
|
|
|
+ status: 'look',
|
|
|
+ form: {
|
|
|
+
|
|
|
}
|
|
|
- data.drawerTitle = '新增版本'
|
|
|
- data.ifShowDialog = true
|
|
|
- } else {
|
|
|
- data.formData = {
|
|
|
- dataVersionConfs: record.dataVersionConfs,
|
|
|
- description: record.description,
|
|
|
- insertTime: record.insertTime,
|
|
|
- name: record.name,
|
|
|
- type: record.type,
|
|
|
- updateTime: record.updateTime,
|
|
|
- vid: record.vid,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //修改
|
|
|
+ const handleEdit = () => {
|
|
|
+ openModal(true, {
|
|
|
+ status: 'edit',
|
|
|
+ form: {
|
|
|
+
|
|
|
}
|
|
|
- data.drawerTitle = '修改版本'
|
|
|
- data.ifShowDialog = true
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
//删除单个数据
|
|
|
- const onDelete = (id) => {
|
|
|
- Modal.confirm({
|
|
|
- title: '删除提示',
|
|
|
- icon: createVNode(ExclamationCircleOutlined),
|
|
|
- content: '确定删除版本?',
|
|
|
- centered: true,
|
|
|
- okText: '确定',
|
|
|
- okType: 'danger',
|
|
|
- cancelText: '取消',
|
|
|
- onOk: (() => {
|
|
|
- let param = {
|
|
|
- 1: session.getItem('tokenV2'),
|
|
|
- 2: id,
|
|
|
+ const handleDel = (id) => {
|
|
|
+ uiTool.delModal('确定删除版本?', (() => {
|
|
|
+ const rowKeys = getSelectRowKeys();
|
|
|
+ let ids = rowKeys.toString()
|
|
|
+ let param = {
|
|
|
+ 1: session.getItem('tokenV2'),
|
|
|
+ 2: id,
|
|
|
+ }
|
|
|
+ delVersion(param).then(res => {
|
|
|
+ if (res.status === "0") {
|
|
|
+ message.success('操作成功');
|
|
|
+ reload();
|
|
|
+ setSelectedRowKeys([])
|
|
|
}
|
|
|
- delVersionByIds(param).then(res => {
|
|
|
- if (res.status === "0") {
|
|
|
- message.success('操作成功');
|
|
|
- reload();
|
|
|
- }
|
|
|
- })
|
|
|
})
|
|
|
- });
|
|
|
- }
|
|
|
- //打开弹窗展示资源
|
|
|
- const openModal = (id) => {
|
|
|
- data.versionId = id
|
|
|
- data.ifShowModal = true
|
|
|
- // 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 handleDelAll = () => {
|
|
|
+ uiTool.delModal('确定删除版本?', (() => {
|
|
|
+ const rowKeys = getSelectRowKeys();
|
|
|
+ let ids = rowKeys.toString()
|
|
|
+ let param = {
|
|
|
+ 1: session.getItem('tokenV2'),
|
|
|
+ 2: ids,
|
|
|
+ }
|
|
|
+ delVersion(param).then(res => {
|
|
|
+ if (res.status === "0") {
|
|
|
+ message.success('操作成功');
|
|
|
+ reload();
|
|
|
+ setSelectedRowKeys([])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }))
|
|
|
+ };
|
|
|
//弹窗确认
|
|
|
- const onSubmit = (e) => {
|
|
|
- data.ifShowDialog = false
|
|
|
- if (e) {
|
|
|
- reload();
|
|
|
- }
|
|
|
+ const onSubmit = () => {
|
|
|
+ reload();
|
|
|
}
|
|
|
const [
|
|
|
registerTable,
|
|
|
@@ -321,7 +263,6 @@ export default defineComponent({
|
|
|
},
|
|
|
showIndexColumn: true,
|
|
|
pagination: {
|
|
|
- // pageSize: 10,
|
|
|
hideOnSinglePage: false
|
|
|
},
|
|
|
rowKey: (record) => record.vid,
|
|
|
@@ -336,21 +277,21 @@ export default defineComponent({
|
|
|
},
|
|
|
});
|
|
|
return {
|
|
|
- drawerRef,
|
|
|
- filteredInfo,
|
|
|
columns,
|
|
|
hasSelected,
|
|
|
...toRefs(data),
|
|
|
...toRefs(sourcesData),
|
|
|
// func
|
|
|
registerTable,
|
|
|
+ registerModal,
|
|
|
getVersionData,
|
|
|
searchTable,
|
|
|
resetTable,
|
|
|
- delAllData,
|
|
|
- onDelete,
|
|
|
- openModal,
|
|
|
- openDialog,
|
|
|
+ handleAdd,
|
|
|
+ handleLook,
|
|
|
+ handleEdit,
|
|
|
+ handleDelAll,
|
|
|
+ handleDel,
|
|
|
onSubmit
|
|
|
};
|
|
|
},
|
|
|
@@ -382,6 +323,7 @@ export default defineComponent({
|
|
|
.handle-btns {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
+
|
|
|
.btn {
|
|
|
margin-left: 10px;
|
|
|
}
|