Преглед на файлове

分类管理,项目管理

ysc преди 1 година
родител
ревизия
643bf20a30
променени са 6 файла, в които са добавени 347 реда и са изтрити 37 реда
  1. 53 0
      src/api/task/project.js
  2. 1 1
      src/views/system/dept.vue
  3. 1 1
      src/views/system/menu.vue
  4. 2 2
      src/views/system/role.vue
  5. 6 33
      src/views/task/category.vue
  6. 284 0
      src/views/task/project.vue

+ 53 - 0
src/api/task/project.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询项目列表
+export function listProject(query) {
+  return request({
+    url: '/task/project/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询项目详细
+export function getProject(ProjectId) {
+  return request({
+    url: '/task/project/' + ProjectId,
+    method: 'get'
+  })
+}
+
+// 新增项目
+export function addProject(data) {
+  return request({
+    url: '/task/project',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改项目
+export function updateProject(data) {
+  return request({
+    url: '/task/project',
+    method: 'put',
+    data: data
+  })
+}
+
+
+// 删除项目
+export function delProject(ProjectId) {
+  return request({
+    url: '/task/project/' + ProjectId,
+    method: 'delete'
+  })
+}
+
+// 查询分类列表
+export function getCategoryList() {
+  return request({
+    url: '/task/project/getCategoryList',
+    method: 'get'
+  })
+}

+ 1 - 1
src/views/system/dept.vue

@@ -57,7 +57,7 @@
       <el-table-column prop="status" label="状态" width="100">
         <template slot-scope="scope">
           <el-tag type="success" size="small" v-if="scope.row.status==0">正常</el-tag>
-          <el-tag type="info" size="small" v-else>正常</el-tag>
+          <el-tag type="info" size="small" v-else>停用</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" width="200">

+ 1 - 1
src/views/system/menu.vue

@@ -64,7 +64,7 @@
       <el-table-column prop="status" label="状态" width="80">
         <template slot-scope="scope">
           <el-tag type="success" size="small" v-if="scope.row.status==0">正常</el-tag>
-          <el-tag type="info" size="small" v-else>正常</el-tag>
+          <el-tag type="info" size="small" v-else>停用</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime">

+ 2 - 2
src/views/system/role.vue

@@ -349,8 +349,8 @@ export default {
     // 角色状态修改
     handleStatusChange(row) {
       let text = row.status === "0" ? "启用" : "停用";
-      this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function () {
-        return changeRoleStatus(row.id, row.status);
+      this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function () {
+        return changeCStatus(row.id, row.status);
       }).then(() => {
         this.$message.success(text + "成功");
       }).catch(function () {

+ 6 - 33
src/views/task/category.vue

@@ -43,15 +43,11 @@
     <el-table :data="categoryList">
       <el-table-column label="分类编号" prop="id" width="100"/>
       <el-table-column label="分类名称" prop="categoryName" :show-overflow-tooltip="true"/>
-      <el-table-column label="分类描述" prop="categoryKey" :show-overflow-tooltip="true"/>
+      <el-table-column label="分类描述" prop="description" :show-overflow-tooltip="true"/>
       <el-table-column label="状态" align="center">
         <template slot-scope="scope">
-          <el-switch
-            v-model="scope.row.status"
-            active-value="0"
-            inactive-value="1"
-            @change="handleStatusChange(scope.row)"
-          ></el-switch>
+          <el-tag type="success" size="small" v-if="scope.row.status==0">正常</el-tag>
+          <el-tag type="info" size="small" v-else>停用</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -60,7 +56,7 @@
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope" v-if="scope.row.id !== 1">
+        <template slot-scope="scope">
           <el-button
             size="mini"
             type="text"
@@ -132,10 +128,6 @@ export default {
   name: "Category",
   data() {
     return {
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
       // 总条数
       total: 0,
       // 分类表格数据
@@ -146,10 +138,6 @@ export default {
       open: false,
       // 是否显示弹出层(数据权限)
       openDataScope: false,
-      menuExpand: false,
-      menuNodeAll: false,
-      deptExpand: true,
-      deptNodeAll: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -166,9 +154,6 @@ export default {
         categoryName: [
           {required: true, message: "分类名称不能为空", trigger: "blur"}
         ],
-        description: [
-          {required: true, message: "权限字符不能为空", trigger: "blur"}
-        ],
       }
     };
   },
@@ -178,24 +163,12 @@ export default {
   methods: {
     /** 查询分类列表 */
     getList() {
-      listcategory(this.queryParams).then(response => {
+      listCategory(this.queryParams).then(response => {
           this.categoryList = response.data.records;
           this.total = response.data.total;
         }
       );
     },
-
-    // 分类状态修改
-    handleStatusChange(row) {
-      let text = row.status === "0" ? "启用" : "停用";
-      this.$modal.confirm('确认要"' + text + '""' + row.categoryName + '"分类吗?').then(function () {
-        return changecategoryStatus(row.id, row.status);
-      }).then(() => {
-        this.$message.success(text + "成功");
-      }).catch(function () {
-        row.status = row.status === "0" ? "1" : "0";
-      });
-    },
     // 取消按钮
     cancel() {
       this.open = false;
@@ -275,7 +248,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       this.$confirm('是否确认删除分类编号为"' + row.id + '"的数据项?').then(() => {
-        return delcategory(row.id);
+        return delCategory(row.id);
       }).then(() => {
         this.getList();
         this.$message.success("删除成功");

+ 284 - 0
src/views/task/project.vue

@@ -0,0 +1,284 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
+      <el-form-item label="项目名称" prop="projectName">
+        <el-input
+          v-model="queryParams.projectName"
+          placeholder="请输入项目名称"
+          clearable
+          style="width: 240px"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="所属分类" prop="projectName">
+        <el-select
+          v-model="queryParams.categoryId"
+          clearable
+          style="width: 240px">
+          <el-option v-for="item in categoryList" :key="item.id" :label="item.categoryName" :value="item.id"/>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select
+          v-model="queryParams.status"
+          placeholder="项目状态"
+          clearable
+          style="width: 240px">
+          <el-option :key="0" label="正常" :value="0"/>
+          <el-option :key="1" label="停用" :value="1"/>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['task:project:add']"
+        >新增
+        </el-button>
+      </el-col>
+    </el-row>
+
+    <el-table :data="projectList">
+      <el-table-column label="项目编号" prop="id" width="100"/>
+      <el-table-column label="项目名称" prop="projectName" :show-overflow-tooltip="true"/>
+      <el-table-column label="项目描述" prop="description" :show-overflow-tooltip="true"/>
+      <el-table-column label="状态" align="center">
+        <template slot-scope="scope">
+          <el-tag type="success" size="small" v-if="scope.row.status==0">正常</el-tag>
+          <el-tag type="info" size="small" v-else>停用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:project:edit']"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:project:delete']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <div style="margin-top: 10px;text-align: center">
+      <el-pagination
+        background
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="queryParams.pageNum"
+        :page-sizes="[10, 20, 50]"
+        :page-size="queryParams.pageSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total">
+      </el-pagination>
+    </div>
+
+    <!-- 添加或修改项目配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="项目名称" prop="projectName">
+          <el-input v-model="form.projectName" placeholder="请输入项目名称"/>
+        </el-form-item>
+        <el-form-item label="所属分类" prop="categoryId">
+          <el-select
+            v-model="form.categoryId"
+            clearable
+            style="width: 240px">
+            <el-option v-for="item in categoryList" :key="item.id" :label="item.categoryName" :value="item.id"/>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio label="0">正常</el-radio>
+            <el-radio label="1">停用</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="项目描述">
+          <el-input v-model="form.description" type="textarea" placeholder="请输入内容"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import {
+  listProject,
+  getProject,
+  delProject,
+  addProject,
+  updateProject,
+  getCategoryList
+} from "@/api/task/project";
+
+export default {
+  name: "Project",
+  data() {
+    return {
+      categoryList: [],
+      // 总条数
+      total: 0,
+      // 项目表格数据
+      projectList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        projectName: undefined,
+        categoryId: undefined,
+        description: undefined,
+        status: undefined
+      },
+      // 表单参数
+      form: {},
+
+      // 表单校验
+      rules: {
+        projectName: [
+          {required: true, message: "项目名称不能为空", trigger: "blur"}
+        ],
+        categoryId: [
+          {required: true, message: "所属分类不能为空", trigger: "change"}
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询项目列表 */
+    getList() {
+      getCategoryList().then(res => {
+        this.categoryList = res.data;
+      })
+      listProject(this.queryParams).then(response => {
+          this.projectList = response.data.records;
+          this.total = response.data.total;
+        }
+      );
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 取消按钮(数据权限)
+    cancelDataScope() {
+      this.openDataScope = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: undefined,
+        projectName: undefined,
+        categoryId: undefined,
+        description: undefined,
+        status: "0",
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.getList();
+    },
+    handleCurrentChange(val) {
+      this.pageNum = val;
+      this.getList();
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加项目";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      getProject(row.id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改项目";
+      });
+    },
+
+
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != undefined) {
+            updateProject(this.form).then(response => {
+              this.$message.success("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addProject(this.form).then(response => {
+              this.$message.success("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      this.$confirm('是否确认删除项目编号为"' + row.id + '"的数据项?').then(() => {
+        return delProject(row.id);
+      }).then(() => {
+        this.getList();
+        this.$message.success("删除成功");
+      }).catch(() => {
+      });
+    },
+  }
+};
+</script>