|
|
@@ -0,0 +1,385 @@
|
|
|
+<template>
|
|
|
+ <div class="p-4">
|
|
|
+ <div class="content">
|
|
|
+ <div class="left-box">
|
|
|
+ <div class="res-list-btn" v-for="(item, index) in resBtns" :key="index"
|
|
|
+ :class="{ 'clicked': currentResType === item.value }" @click="handleChangeRes(item)">
|
|
|
+ {{ item.label }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="right-box">
|
|
|
+ <div class="right-header">
|
|
|
+ <div class="search">
|
|
|
+ <span class="label">资源名称:</span>
|
|
|
+ <a-input v-model:value="searchValue" placeholder="输入关键字查询" allow-clear />
|
|
|
+ <span class="label" style="margin-left: 30px;">版本管理:</span>
|
|
|
+ <a-radio-group v-model:value="searchType" style="display: flex;">
|
|
|
+ <a-radio :value="0">未管理</a-radio>
|
|
|
+ <a-radio :value="1">已管理</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </div>
|
|
|
+ <div class="handle-btns">
|
|
|
+ <a-button class="btn" @click="resetTable">重置</a-button>
|
|
|
+ <a-button class="btn" type="primary" @click="searchTable">查询</a-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="right-body">
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #toolbar>
|
|
|
+ <Button type="primary" :disabled="hasSelected" @click="handleManageAll" v-if="searchType === 0">
|
|
|
+ 批量版本管理
|
|
|
+ </Button>
|
|
|
+ <Button type="primary" danger :disabled="hasSelected" @click="handleDelAll" v-else>
|
|
|
+ 批量取消版本
|
|
|
+ </Button>
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction :actions="[
|
|
|
+ {
|
|
|
+ label: '浏览',
|
|
|
+ tooltip: '浏览',
|
|
|
+ onClick: handleFetchRes.bind(null, record),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '查看',
|
|
|
+ tooltip: '查看',
|
|
|
+ onClick: handleLookRes.bind(null, record),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '版本管理',
|
|
|
+ tooltip: '版本管理',
|
|
|
+ onClick: handleManage.bind(null, record),
|
|
|
+ },
|
|
|
+ ]" />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ResVersionManageModal @register="registerModal"></ResVersionManageModal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+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 { useModal } from '/@/components/Modal';
|
|
|
+import ResVersionManageModal from './ResVersionManageModal.vue';
|
|
|
+// import VersionModal from './VersionModal.vue';
|
|
|
+// import VersionResModal from './VersionResModal.vue';
|
|
|
+import { getResVersionList } 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: 'resVersion',
|
|
|
+ components: { ResVersionManageModal, BasicTable, TableAction, Button },
|
|
|
+ setup() {
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
+ // const [registerResModal, { openModal: openResModal }] = useModal();
|
|
|
+ const data = reactive({
|
|
|
+ searchValue: "",//关键字
|
|
|
+ searchType: 0,//是否已关联
|
|
|
+ });
|
|
|
+ const resBtns = ref([
|
|
|
+ {
|
|
|
+ label: '地图资源',
|
|
|
+ value: 'MR'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '场景资源',
|
|
|
+ value: 'DR'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '文件资源',
|
|
|
+ value: 'ER'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '组件服务',
|
|
|
+ value: 'SR'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '接口服务',
|
|
|
+ value: 'interface'
|
|
|
+ }
|
|
|
+ ]);
|
|
|
+ const typeObj = {
|
|
|
+ MR: "地图资源",
|
|
|
+ DR: "场景资源",
|
|
|
+ ER: "文件资源",
|
|
|
+ SR: "组件服务",
|
|
|
+ interface: "接口服务"
|
|
|
+ }
|
|
|
+ const currentResType = ref("MR");
|
|
|
+ //获取所有标签
|
|
|
+ const getResData = () => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let params = {
|
|
|
+ isgl: data.searchType,
|
|
|
+ keyStr: data.searchValue,
|
|
|
+ serviceType: currentResType.value
|
|
|
+ }
|
|
|
+ getResVersionList(params).then(res => {
|
|
|
+ if (res.resp_code === 0 && res.datas) {
|
|
|
+ let resData = res.datas.pageData;
|
|
|
+ resData.forEach(item => {
|
|
|
+ item.type = typeObj[item.RESOURCE_TYPE]
|
|
|
+ })
|
|
|
+ resolve(resData)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ resolve([])
|
|
|
+ message.error(res.resp_msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //表格列
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ title: '资源类型',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'type',
|
|
|
+ key: 'type'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '资源名称',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'SERVICENAME',
|
|
|
+ key: 'SERVICENAME'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '版本',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'VERSION_NAME',
|
|
|
+ key: 'VERSION_NAME'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '版本号',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'VERSION_NO',
|
|
|
+ key: 'VERSION_NO'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作时间',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'CREATE_DATE',
|
|
|
+ key: 'CREATE_DATE'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作人',
|
|
|
+ align: 'center',
|
|
|
+ dataIndex: 'CREATENAME',
|
|
|
+ key: 'CREATENAME'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ //表格查询功能
|
|
|
+ const searchTable = () => {
|
|
|
+ reload()
|
|
|
+ }
|
|
|
+ //重置
|
|
|
+ const resetTable = () => {
|
|
|
+ data.searchValue = ''
|
|
|
+ reload()
|
|
|
+ }
|
|
|
+ //判断是否选中数据
|
|
|
+ const hasSelected = computed(() => {
|
|
|
+ const rowSelection = getRowSelection();
|
|
|
+ return !rowSelection.selectedRowKeys?.length;
|
|
|
+ });
|
|
|
+ const handleChangeRes = (item) => {
|
|
|
+ currentResType.value = item.value;
|
|
|
+ reload()
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量管理资源的版本
|
|
|
+ const handleManageAll = () => {
|
|
|
+ // openModal(true, {
|
|
|
+ // status: 'add',
|
|
|
+ // form: {}
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ //批量取消选中资源的版本
|
|
|
+ const handleDelAll = () => {
|
|
|
+ uiTool.delModal('确定取消所有资源的版本?', (() => {
|
|
|
+ // const rowKeys = getSelectRowKeys();
|
|
|
+ // let ids = rowKeys.toString()
|
|
|
+ // let param = {
|
|
|
+ // fid: ids
|
|
|
+ // }
|
|
|
+ // delVersion(param).then(res => {
|
|
|
+ // if (res.resp_code === 0) {
|
|
|
+ // message.success('操作成功');
|
|
|
+ // reload();
|
|
|
+ // setSelectedRowKeys([])
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ }))
|
|
|
+ };
|
|
|
+ // 浏览资源
|
|
|
+ const handleFetchRes = (record) => {
|
|
|
+
|
|
|
+ }
|
|
|
+ // 查看资源
|
|
|
+ const handleLookRes = (record) => {
|
|
|
+ // const { FID, VERSION_NAME, VERSION_NO, VERSION_DISP } = record;
|
|
|
+ // openResModal(true, {
|
|
|
+ // status: 'look',
|
|
|
+ // form: { FID, VERSION_NAME, VERSION_NO, VERSION_DISP }
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ //管理资源的版本
|
|
|
+ const handleManage = (record) => {
|
|
|
+ const { RESOURCE_TYPE, type, SERVICENAME, SERVICEID } = record;
|
|
|
+ openModal(true, {
|
|
|
+ status: 'manage',
|
|
|
+ base: { RESOURCE_TYPE, type, SERVICENAME, SERVICEID },
|
|
|
+ version: {}
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //弹窗确认
|
|
|
+ // const onSubmit = () => {
|
|
|
+ // reload();
|
|
|
+ // }
|
|
|
+ const [
|
|
|
+ registerTable,
|
|
|
+ { reload, getRowSelection, getSelectRowKeys, setSelectedRowKeys },
|
|
|
+ ] = useTable({
|
|
|
+ title: '版本列表', //'菜单列表'
|
|
|
+ api: getResData, //加载数据
|
|
|
+ columns: columns,
|
|
|
+ useSearchForm: false, //开启搜索区域
|
|
|
+ bordered: false,
|
|
|
+ showTableSetting: true, // 显示表格设置
|
|
|
+
|
|
|
+ tableSetting: {
|
|
|
+ redo: true,
|
|
|
+ size: true,
|
|
|
+ setting: false,
|
|
|
+ fullScreen: false
|
|
|
+ },
|
|
|
+ showIndexColumn: true,
|
|
|
+ pagination: {
|
|
|
+ hideOnSinglePage: false
|
|
|
+ },
|
|
|
+ rowKey: (record) => record.SERVICEID,
|
|
|
+ actionColumn: {
|
|
|
+ width: 200,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ },
|
|
|
+ rowSelection: {
|
|
|
+ type: 'checkbox',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ resBtns,
|
|
|
+ currentResType,
|
|
|
+ columns,
|
|
|
+ hasSelected,
|
|
|
+ ...toRefs(data),
|
|
|
+ // func
|
|
|
+ // registerResModal,
|
|
|
+ registerModal,
|
|
|
+ registerTable,
|
|
|
+ getResData,
|
|
|
+ searchTable,
|
|
|
+ resetTable,
|
|
|
+ handleChangeRes,
|
|
|
+
|
|
|
+ handleManageAll,
|
|
|
+ handleDelAll,
|
|
|
+ handleFetchRes,
|
|
|
+ handleLookRes,
|
|
|
+ handleManage,
|
|
|
+ // onSubmit
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.p-4 {
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .left-box {
|
|
|
+ padding: 20px;
|
|
|
+ margin-right: 10px;
|
|
|
+ width: 240px;
|
|
|
+ height: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 6px;
|
|
|
+
|
|
|
+ .res-list-btn {
|
|
|
+ height: 35px;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ background-color: #eff0f5;
|
|
|
+ line-height: 35px;
|
|
|
+ text-align: center;
|
|
|
+ color: #333333;
|
|
|
+ cursor: pointer;
|
|
|
+ user-select: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .clicked {
|
|
|
+ background-color: #0671dd;
|
|
|
+ color: #FFFFFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .right-box {
|
|
|
+ width: calc(100% - 250px);
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .right-header {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ height: 74px;
|
|
|
+ padding: 0 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-radius: 6px;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .search {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .label {
|
|
|
+ width: 70px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .handle-btns {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .right-body {
|
|
|
+ padding: 0 20px;
|
|
|
+ height: calc(100% - 84px);
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-radius: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|