| | |
| | | * @Author: 胡思旗 931347610@qq.com |
| | | * @Date: 2023-08-28 15:23:47 |
| | | * @LastEditors: husq 931347610@qq.com |
| | | * @LastEditTime: 2023-08-30 15:30:19 |
| | | * @LastEditTime: 2023-09-01 17:29:16 |
| | | * @FilePath: \Cloud-API-Demo-Web\src\pages\page-web\projects\project_list\list_page\components\ProjectList.vue |
| | | * @Description:项目列表组件 |
| | | * |
| | |
| | | <template #overlay> |
| | | <a-menu> |
| | | <a-menu-item> |
| | | <a href="javascript:;">编辑</a> |
| | | <a @click="goEdit(item)">编辑</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 { ERouterName } from '/@/types/index' |
| | | import { status, projectCard } from './data' |
| | | import { del, edit } from '/@/api/project-page' |
| | | import { Modal, message } from 'ant-design-vue' |
| | | const router = useRouter() |
| | | 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') |
| | | } |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | const goEdit = (item:any) => { |
| | | console.log(item) |
| | | router.push({ |
| | | name: ERouterName.EDIT_PROJECT, |
| | | query: { id: item.id } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |