明树Git Lab

Commit d259c095 authored by yangyajing's avatar yangyajing

项目管理下拉字典对接

parent 28cffdfd
Pipeline #103972 failed with stage
in 2 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,14 +5,16 @@ import ElementPlus from 'element-plus' ...@@ -5,14 +5,16 @@ import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import * as ElIcons from '@element-plus/icons' import * as ElIcons from '@element-plus/icons'
import router from './router' import router from './router'
import { createPinia } from 'pinia';
import "./assets/fonts/font.less"; // 字体样式 import "./assets/fonts/font.less"; // 字体样式
import "../public/iconFont/iconfont.css"; // 图标字体样式 import "../public/iconFont/iconfont.css"; // 图标字体样式
import { $get, $post } from "@/data/https.js"; import { $get, $post } from "@/data/https.js";
const pinia = createPinia()
const app = createApp(App) const app = createApp(App)
app.config.globalProperties.$get = $get; app.config.globalProperties.$get = $get;
app.config.globalProperties.$post = $post; app.config.globalProperties.$post = $post;
for (const [key, component] of Object.entries(ElIcons)) { for (const [key, component] of Object.entries(ElIcons)) {
app.component(key, component) app.component(key, component)
} }
app.use(ElementPlus).use(router).mount('#app') app.use(ElementPlus).use(router).use(pinia).mount('#app')
...@@ -24,15 +24,15 @@ const routes = [ ...@@ -24,15 +24,15 @@ const routes = [
}, },
{ {
path: '/projectManage', path: '/projectManage',
name: '项目管理', name: 'projectManage',
title: 'projectManage', title: '项目管理',
component: () => import('@/views/managePage/projectManage.vue'), component: () => import('@/views/managePage/projectManage.vue'),
meta: { menuName: '项目管理', icon: 'Management' } meta: { menuName: '项目管理', icon: 'Management' }
}, },
{ {
path: '/addProject', path: '/addProject',
name: '新增项目', name: 'addProject',
title: 'addProject', title: '新增项目',
component: () => import('@/views/managePage/addProject.vue'), component: () => import('@/views/managePage/addProject.vue'),
meta: { meta: {
menuName: '新增项目', menuName: '新增项目',
......
import { defineStore } from "pinia";
export const useProjectStore = defineStore('project', {
state: () => ({
params: {}
}),
actions: {
setParams(data) {
this.params = { ...this.params, ...data }
}
}
})
\ No newline at end of file
.tab-content{
th{
text-align: center;
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
<el-table-column prop="projectCode" label="项目编号" /> <el-table-column prop="projectCode" label="项目编号" />
<el-table-column fixed="right" label="操作" min-width="120"> <el-table-column fixed="right" label="操作" min-width="120">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" size="small">查看</el-button> <el-button link type="primary" size="small" @click="previewProject(scope.row)">查看</el-button>
<el-button link type="primary" size="small">编辑</el-button> <el-button link type="primary" size="small" @click="editProject(scope.row)">编辑</el-button>
<el-button link type="danger" size="small" @click="deleteProject(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -32,6 +33,10 @@ ...@@ -32,6 +33,10 @@
<script setup> <script setup>
import { reactive, ref, onMounted, getCurrentInstance } from "vue"; import { reactive, ref, onMounted, getCurrentInstance } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useProjectStore } from "@/stores/project.js";
import { ElMessage, ElMessageBox } from "element-plus";
const projectStore = useProjectStore();
const router = useRouter(); const router = useRouter();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -52,8 +57,46 @@ ...@@ -52,8 +57,46 @@
const addProject = () => { const addProject = () => {
router.push("/addProject"); router.push("/addProject");
}; };
const editProject = (item) => {
projectStore.setParams({
projectInfo: { ...item }
});
router.push("/addProject");
};
const previewProject = (item) => {
projectStore.setParams({
projectInfo: { ...item }
});
router.push({
name: "addProject",
query: {
isPreview: true
}
})
}
const deleteProject = (item) => {
ElMessageBox.confirm("确认删除该项?", "提示",{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
proxy.$post({
url: "/api/project/deleteProject",
data: {
id: item.id
},
callback: (data) => {
ElMessage.success("删除成功");
getProjectData();
}
}).catch(() => {})
})
}
onMounted(() => { onMounted(() => {
getProjectData(); getProjectData();
projectStore.setParams({
projectInfo: undefined
});
}) })
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment