|
@@ -1,162 +1,213 @@
|
|
|
<template>
|
|
|
<div class="data-list">
|
|
|
-
|
|
|
-
|
|
|
- <el-table :data="dataList" style="width: 100%" header-row-class-name="headerBg" empty-text="没有项目信息">
|
|
|
- <el-table-column prop="id" label="ID" align="center" width="80"/>
|
|
|
- <el-table-column prop="categoryId" label="所属分类" align="left" min-width="180"/>
|
|
|
- <!-- <el-table-column prop="customer.name" label="所属客户" align="left" min-width="180"/> -->
|
|
|
- <el-table-column prop="name" label="项目名称" align="left" min-width="180"/>
|
|
|
- <el-table-column prop="createTime" label="创建时间" align="center" width="180"/>
|
|
|
- <el-table-column prop="statusName" label="项目状态" align="center" width="180">
|
|
|
- <template #default="scope">
|
|
|
- <div v-if="scope.row.status==5">启用</div>
|
|
|
- <div v-if="scope.row.status==6">停用</div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" fixed="right" width="200">
|
|
|
- <template #default="scope">
|
|
|
- <div class="btns">
|
|
|
- <el-button type="primary" size="small" @click="btnEdit(scope.row)"><svg-icon icon-class="edit"/>编辑</el-button>
|
|
|
- <el-button type="danger" size="small" @click="btnDelete(scope.row.id)"><svg-icon icon-class="delete"/>删除</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div class="page-info">
|
|
|
- <el-pagination
|
|
|
- :currentPage="queryForm.page"
|
|
|
- :page-size="queryForm.pageSize"
|
|
|
- :total="recordCount"
|
|
|
- :page-count="pageTotal"
|
|
|
- background
|
|
|
- layout="prev, pager, next"
|
|
|
- @current-change="ChangePage"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-dialog :visible.sync="dialogVisible" append-to-body v-el-drag-dialog width="80%" custom-class="prod-verify" title="创建项目信息">
|
|
|
-
|
|
|
- <dataInfo :id="currentDataId" @onClose="onClose"></dataInfo>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
+ <el-table
|
|
|
+ :data="dataList"
|
|
|
+ style="width: 100%"
|
|
|
+ header-row-class-name="headerBg"
|
|
|
+ empty-text="没有项目信息"
|
|
|
+ >
|
|
|
+ <el-table-column prop="id" label="ID" align="center" width="80" />
|
|
|
+ <el-table-column
|
|
|
+ prop="categoryId"
|
|
|
+ label="所属分类"
|
|
|
+ align="left"
|
|
|
+ min-width="180"
|
|
|
+ >
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ getCategoryName(scope.row.categoryId) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="customer.name" label="所属客户" align="left" min-width="180"/> -->
|
|
|
+ <el-table-column
|
|
|
+ prop="name"
|
|
|
+ label="项目名称"
|
|
|
+ align="left"
|
|
|
+ min-width="180"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ label="创建时间"
|
|
|
+ align="center"
|
|
|
+ width="180"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="statusName"
|
|
|
+ label="项目状态"
|
|
|
+ align="center"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
+ <template #default="scope">
|
|
|
+ <div v-if="scope.row.status == 5">启用</div>
|
|
|
+ <div v-if="scope.row.status == 6">停用</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="btns">
|
|
|
+ <el-button type="primary" size="small" @click="btnEdit(scope.row)"
|
|
|
+ ><svg-icon icon-class="edit" />编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="btnDelete(scope.row.id)"
|
|
|
+ ><svg-icon icon-class="delete" />删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div class="page-info">
|
|
|
+ <el-pagination
|
|
|
+ :currentPage="queryForm.page"
|
|
|
+ :page-size="queryForm.pageSize"
|
|
|
+ :total="recordCount"
|
|
|
+ :page-count="pageTotal"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ @current-change="ChangePage"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ append-to-body
|
|
|
+ v-el-drag-dialog
|
|
|
+ custom-class="prod-verify"
|
|
|
+ title="创建项目信息"
|
|
|
+ >
|
|
|
+ <dataInfo :id="currentDataId" @onClose="onClose"></dataInfo>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import{searchProject,deleteProject} from'@/api/project';
|
|
|
- import dataInfo from './dataInfo.vue';
|
|
|
- import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
- export default{
|
|
|
- components:{
|
|
|
- dataInfo,
|
|
|
- },
|
|
|
- directives: { elDragDialog },
|
|
|
- props:{
|
|
|
- queryForm:{
|
|
|
- type:Object,
|
|
|
- default:()=>{
|
|
|
- return {
|
|
|
- page:1,
|
|
|
- pageSize:10,
|
|
|
- name:'',
|
|
|
- category_id:'',
|
|
|
- status:'',
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+import { searchProject, deleteProject, searchCategory } from "@/api/project";
|
|
|
+import dataInfo from "./dataInfo.vue";
|
|
|
+import elDragDialog from "@/directive/el-drag-dialog";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ dataInfo,
|
|
|
+ },
|
|
|
+ directives: { elDragDialog },
|
|
|
+ props: {
|
|
|
+ queryForm: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: "",
|
|
|
+ category_id: "",
|
|
|
+ status: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
},
|
|
|
- watch:{
|
|
|
-
|
|
|
- 'queryForm': {
|
|
|
- handler: function(val) {
|
|
|
- this.search();
|
|
|
- },
|
|
|
- // immediate: true,//立即执行
|
|
|
- deep: true
|
|
|
-
|
|
|
- },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ queryForm: {
|
|
|
+ handler: function (val) {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // immediate: true,//立即执行
|
|
|
+ deep: true,
|
|
|
},
|
|
|
- data(){
|
|
|
- return{
|
|
|
- dialogVisible:false,//控制产品审核
|
|
|
- currentDataId:0,
|
|
|
- recordCount:0,
|
|
|
- pageTotal:1,
|
|
|
- dataList:[],
|
|
|
- currentData:{},
|
|
|
- }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dialogVisible: false, //控制产品审核
|
|
|
+ currentDataId: 0,
|
|
|
+ recordCount: 0,
|
|
|
+ pageTotal: 1,
|
|
|
+ dataList: [],
|
|
|
+ currentData: {},
|
|
|
+ categoryList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.search();
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getCategoryName(categoryId) {
|
|
|
+ const category = this.categoryList.find((item) => item.id === categoryId);
|
|
|
+ return category ? category.name : categoryId;
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.search();
|
|
|
+ searchData() {
|
|
|
+ let _this = this;
|
|
|
+ _this.dialogVisible = false;
|
|
|
+ _this.search();
|
|
|
},
|
|
|
- methods:{
|
|
|
-
|
|
|
|
|
|
- searchData(){
|
|
|
- let _this=this;
|
|
|
- _this.dialogVisible=false;
|
|
|
- _this.search();
|
|
|
- },
|
|
|
-
|
|
|
- btnDelete(e){
|
|
|
- let _this=this;
|
|
|
- let par={
|
|
|
- id:e,
|
|
|
- }
|
|
|
- _this.$confirm("您是否确认删除该记录?","提示",{
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then((res)=>{
|
|
|
+ btnDelete(e) {
|
|
|
+ let _this = this;
|
|
|
+ let par = {
|
|
|
+ id: e,
|
|
|
+ };
|
|
|
+ _this
|
|
|
+ .$confirm("您是否确认删除该记录?", "提示", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
// console.log("AAA")
|
|
|
- deleteProject(par).then(res=>{
|
|
|
- _this.search();
|
|
|
- })
|
|
|
- }).catch(()=>{
|
|
|
+ deleteProject(par).then((res) => {
|
|
|
+ _this.search();
|
|
|
+ });
|
|
|
})
|
|
|
- },
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
|
|
|
- //编辑
|
|
|
- btnEdit(e){
|
|
|
- let _this=this;
|
|
|
- _this.currentDataId=e.id;
|
|
|
- _this.dialogVisible=true;
|
|
|
- },
|
|
|
+ //编辑
|
|
|
+ btnEdit(e) {
|
|
|
+ let _this = this;
|
|
|
+ _this.currentDataId = e.id;
|
|
|
+ _this.dialogVisible = true;
|
|
|
+ },
|
|
|
|
|
|
- onClose(){
|
|
|
- let _this=this;
|
|
|
- _this.currentDataId=0;
|
|
|
- _this.dialogVisible=false;
|
|
|
- _this.search();
|
|
|
- },
|
|
|
+ onClose(needRefresh) {
|
|
|
+ console.log("onClose triggered with needRefresh:", needRefresh); // 添加调试日志
|
|
|
+ this.currentDataId = 0;
|
|
|
+ this.dialogVisible = false;
|
|
|
+ if (needRefresh) {
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- //搜索
|
|
|
- search(){
|
|
|
- let _this=this;
|
|
|
- searchProject(_this.queryForm).then(res=>{
|
|
|
- if(!res)return;
|
|
|
- _this.dataList=res.data.dataList;
|
|
|
- _this.recordCount=res.data.totalRecord;
|
|
|
- _this.pageTotal=res.data.totalPage;
|
|
|
- })
|
|
|
- },
|
|
|
- //修改分页
|
|
|
- ChangePage(e){
|
|
|
- let _this=this;
|
|
|
- _this.queryForm.page=e;
|
|
|
- _this.search();
|
|
|
- },
|
|
|
- }
|
|
|
- }
|
|
|
+ handleUpdate() {
|
|
|
+ this.search(); // 添加额外的更新处理方法
|
|
|
+ },
|
|
|
+
|
|
|
+ //搜索
|
|
|
+ search() {
|
|
|
+ console.log("search triggered"); // 添加调试日志
|
|
|
+ let _this = this;
|
|
|
+ searchProject(_this.queryForm).then((res) => {
|
|
|
+ if (!res) return;
|
|
|
+ _this.dataList = res.data.dataList;
|
|
|
+ _this.recordCount = res.data.totalRecord;
|
|
|
+ _this.pageTotal = res.data.totalPage;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //修改分页
|
|
|
+ ChangePage(e) {
|
|
|
+ let _this = this;
|
|
|
+ _this.queryForm.page = e;
|
|
|
+ _this.search();
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ searchCategory().then((res) => {
|
|
|
+ if (res.status !== 200) return;
|
|
|
+ this.categoryList = res.data.dataList;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-@import './dataList.scss';
|
|
|
+@import "./dataList.scss";
|
|
|
</style>
|