| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取分页数据 |
| | | * @param query |
| | | */ |
| | | export const getPage = async function (query:any): Promise<IWorkspaceResponse<any>> { |
| | | const url = `api/${HTTP_PREFIX}/project/getPage` |
| | | const result = await request.get(url, query) |
| | | return result.data |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param query |
| | | */ |
| | | export const edit = async function (query:any): Promise<IWorkspaceResponse<any>> { |
| | | const url = `api/${HTTP_PREFIX}/project/edit` |
| | | const result = await request.post(url, query) |
| | | return result.data |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param id |
| | | */ |
| | | export const del = async function (id:any):Promise<IWorkspaceResponse<any>>{ |
| | | const url = `api/${HTTP_PREFIX}/project/delete` |
| | | const result = await request.get(url, {params:{id}}) |
| | | return result.data |
| | | } |
| | |
| | | <a href="javascript:;">编辑</a> |
| | | </a-menu-item> |
| | | <a-menu-item> |
| | | <a href="javascript:;">归档</a> |
| | | <a @click="editStatus(item)">归档</a> |
| | | </a-menu-item> |
| | | <a-menu-item> |
| | | <a href="javascript:;">删除</a> |
| | | <a @click="deleteItem(item)">删除</a> |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { DashOutlined, UserOutlined, ExportOutlined } from '@ant-design/icons-vue' |
| | | import { defineProps } from 'vue' |
| | | import { DashOutlined, UserOutlined, ExportOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue' |
| | | import { defineEmits, defineProps, createVNode } from 'vue' |
| | | import { status, projectCard } from './data' |
| | | import { del, edit } from '/@/api/project-page' |
| | | import { Modal, message } from 'ant-design-vue' |
| | | |
| | | const emit = defineEmits(['refreshList']) |
| | | const props = defineProps({ |
| | | cardList: { |
| | | type: Array as () => projectCard[], |
| | | required: true, |
| | | }, |
| | | }) |
| | | |
| | | // 删除方法 |
| | | const deleteItem = (item:projectCard) => { |
| | | Modal.confirm({ |
| | | title: () => '确认删除?', |
| | | icon: () => createVNode(ExclamationCircleOutlined), |
| | | content: () => '删除后项目内容将不可恢复,您确定要删除该项目吗?', |
| | | okText: () => '确定', |
| | | okType: 'danger', |
| | | cancelText: () => '取消', |
| | | onOk () { |
| | | del(item.id).then(res => { |
| | | if (res.code === 5000) { |
| | | message.success('删除成功') |
| | | emit('refreshList') |
| | | } |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | const editStatus = (item:projectCard) => { |
| | | Modal.confirm({ |
| | | title: () => '确认归档?', |
| | | icon: () => createVNode(ExclamationCircleOutlined), |
| | | content: () => '项目完成后可归档,归档后 Pilot 将无法加入该项目,您确定要归档该项目吗?', |
| | | okText: () => '确定', |
| | | okType: 'danger', |
| | | cancelText: () => '取消', |
| | | onOk () { |
| | | const obj = { id: item.id, projectStatus: 2 } |
| | | edit(obj).then(res => { |
| | | if (res.code === 5000) { |
| | | message.success('归档成功') |
| | | emit('refreshList') |
| | | } |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | |
| | | { label: '未加入', value: '1' }, |
| | | ] |
| | | export const sortOption = [ |
| | | { label: '创建时间倒叙', value: 'createTime' }, |
| | | { label: '创建时间倒序', value: 'createTime' }, |
| | | { label: '创建时间正序', value: 'createTimeAsc' }, |
| | | { label: '项目名称倒叙', value: 'projectName' }, |
| | | { label: '项目名称倒序', value: 'projectName' }, |
| | | { label: '项目名称正序', value: 'projectNameAsc' }, |
| | | ] |
| | | export enum sortEnum{ |
| | |
| | | </div> |
| | | </div> |
| | | <div class="wrap_card"> |
| | | <List :cardList="cardList" /> |
| | | |
| | | <a-spin :spinning="spinning" :delay="delayTime"> |
| | | <List @refreshList="init" :cardList="cardList" /> |
| | | </a-spin> |
| | | |
| | | </div> |
| | | <!-- <button @click="goDetail">列表详情</button> --> |
| | | </div> |
| | |
| | | ], |
| | | projectName: '', |
| | | }) |
| | | // ant 加载 |
| | | const spinning = ref<boolean>(false) |
| | | const delayTime = 500 |
| | | |
| | | const goDetail = () => { |
| | | router.push({ name: ERouterName.WORKSPACE }) |
| | | } |
| | |
| | | } |
| | | // 页面初始化 |
| | | const init = async () => { |
| | | spinning.value = !spinning.value |
| | | const res = await getProjectPage(params.value) |
| | | cardList.value = res.data.records |
| | | spinning.value = !spinning.value |
| | | } |
| | | onMounted(() => { |
| | | init() |