Selaa lähdekoodia

Merge branch 'http_mock' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_mock

reedliuqing_i 5 vuotta sitten
vanhempi
sitoutus
31911de31a

+ 35 - 0
src/api/configure.js

@@ -107,3 +107,38 @@ export function deleteBiz(data) {
     data
   })
 }
+
+// 获取结构化模块列表
+export function queryBizModuleList(data) {
+  return request({
+    url: TeamManagement + `/setting/queryBizModuleList?bizId=` + data,
+    method: 'get'
+  })
+}
+
+// 添加模块
+export function addModule(data) {
+  return request({
+    url: TeamManagement + `/setting/addBizModule`,
+    method: 'post',
+    data
+  })
+}
+
+// 更新模块
+export function updateBizModule(data) {
+  return request({
+    url: TeamManagement + `/setting/updateBizModule`,
+    method: 'post',
+    data
+  })
+}
+
+// 删除模块
+export function deleteBizModule(data) {
+  return request({
+    url: TeamManagement + `/setting/deleteBizModule`,
+    method: 'post',
+    data
+  })
+}

+ 1 - 1
src/components/dialog/normalDialog.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="dialog-main">
-    <el-dialog :title="title" :visible.sync="visible">
+    <el-dialog :title="title" :visible.sync="visible" @close="cancel()">
       <slot />
       <span slot="footer" class="dialog-footer">
         <el-button @click="cancel()">取 消</el-button>

+ 179 - 34
src/views/ToConfigure/configure.vue

@@ -144,31 +144,82 @@
             </el-row>
             <div>
               <el-table
-                :data="tableData1"
+                ref="moduleTable"
+                :data="moduleData"
                 style="width: 100%;margin-bottom: 20px;"
                 row-key="id"
                 border
-                :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+                :tree-props="{children: 'childModules', hasChildren: 'hasChildren'}"
+                :row-class-name="tableRowhidden"
               >
-                <el-table-column prop="date" label="模块名称" width="180" />
-                <el-table-column prop="name" label="创建人" width="180" />
-                <el-table-column prop="address" label="创建时间" />
+                <el-table-column v-if="false" prop="id" label="ID" width="180" />
+                <el-table-column prop="moduleName" label="模块名称" width="180">
+                  <template slot="header">
+                    模块名称<i class="el-icon-circle-plus" @click="handlerModule('add')" />
+                  </template>
+                </el-table-column>
+                <el-table-column prop="creator" label="创建人" width="180" />
+                <el-table-column prop="createTime" label="创建时间" />
                 <el-table-column label="操作">
                   <template slot-scope="scope">
                     <el-button
                       size="mini"
-                      @click="handleEdit(scope.$index, scope.row)"
+                      @click="handlerModule('add', scope.row, scope.$index)"
+                    >添加</el-button>
+                    <el-button
+                      size="mini"
+                      @click="handlerModule('edit', scope.row, scope.$index)"
                     >编辑</el-button>
                     <el-button
                       size="mini"
                       type="danger"
-                      @click="handleDelete(scope.$index, scope.row)"
+                      @click="handlerModule('delete', scope.row, scope.$index)"
                     >删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
             </div>
           </el-main>
+          <normal-dialog :show-dialog="moduleDialog" :title="moduleTitle" @confirm="confirmModule('moduleForm')" @cancel="moduleDialog=false">
+            <el-form ref="moduleForm" :model="moduleForm">
+              <template v-if="curcentModule === 'add'">
+                <el-form-item label="父模块:" :label-width="formLabelWidth">
+                  <el-col :span="11">{{ curcentParent }}</el-col>
+                </el-form-item>
+                <el-form-item
+                  v-for="(moduleName, index) in moduleForm.moduleNames"
+                  :key="index"
+                  label="模块名称:"
+                  :label-width="formLabelWidth"
+                  :prop="'moduleNames.' + index"
+                  :rules="[
+                    { required: true, message: '请输入模块名称', trigger: 'blur' },
+                    { min: 1, max: 20, message: '模块名称过长', trigger: 'blur' }
+                  ]"
+                >
+                  <el-col :span="11">
+                    <el-input v-model="moduleForm.moduleNames[index]" autocomplete="off" placeholder="不超过20个字符" />
+                  </el-col>
+                  <el-col v-show="index === moduleForm.moduleNames.length-1" :span="2" :offset="1">
+                    <i class="el-icon-circle-plus-outline" @click="addModuleForm()" />
+                  </el-col>
+                </el-form-item>
+              </template>
+              <template v-if="curcentModule === 'edit'">
+                <el-form-item label="父模块:" :label-width="formLabelWidth">
+                  <el-col :span="11">{{ curcentParent }}</el-col>
+                </el-form-item>
+                <el-form-item label="模块名称:" :label-width="formLabelWidth">
+                  <el-col :span="11">
+                    <el-input v-model="moduleForm.moduleNames[0]" autocomplete="off" placeholder="不超过20个字符" />
+                  </el-col>
+                </el-form-item>
+              </template>
+              <el-col v-if="curcentModule === 'delete'" :span="11">
+                是否要删除模块:<span style="color: #E6A23C">{{ moduleForm.moduleNames[0] }}</span>
+              </el-col>
+            </el-form>
+          </normal-dialog>
         </el-container>
       </div>
     </section>
@@ -176,7 +227,7 @@
 </template>
 <script>
 
-import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition, teamQueryTeamInfo, teamModifyTeam, getBizList, verifyIsAdmin, addBiz, updateBiz, deleteBiz } from '@/api/configure'
+import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition, teamQueryTeamInfo, teamModifyTeam, getBizList, verifyIsAdmin, addBiz, updateBiz, deleteBiz, queryBizModuleList, addModule, updateBizModule, deleteBizModule } from '@/api/configure'
 import normalDialog from '@/components/dialog/normalDialog'
 export default {
   name: 'PersonalWorkbench',
@@ -233,23 +284,13 @@ export default {
           { type: 'number', message: 'id必须为数字值' }
         ]
       },
-      tableData1: [{
-        id: 3,
-        date: '2016-05-01',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1519 弄',
-        children: [{
-          id: 31,
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
-        }, {
-          id: 32,
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
-        }]
-      }]
+      moduleData: [], // 模块数据
+      moduleDialog: false, // 模块操作对话框
+      moduleTitle: '', // 模块对话框title
+      curcentModule: '', // 当前模块类型
+      curcentParent: '', // 当前模块父模块
+      curcentParentId: '', // 当前模块父模块ID
+      moduleForm: { bizId: null, moduleNames: [null], parentId: null, id: null } // 添加模块form
     }
   },
   created() {
@@ -454,6 +495,7 @@ export default {
           return { id: item.code, label: item.name }
         })
         this.curcentTreeData = this.treeData[0]
+        this.getQueryBizModuleList(this.curcentTreeData.id)
         this.$nextTick(() => {
           this.$refs.tree.setCurrentKey(this.treeData[0].id)
         })
@@ -484,8 +526,7 @@ export default {
             return false
           }
         })
-      }
-      if (this.curcentDialog === 'edit') {
+      } else if (this.curcentDialog === 'edit') {
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.editNodeTree(this.nodeForm)
@@ -494,8 +535,7 @@ export default {
             return false
           }
         })
-      }
-      if (this.curcentDialog === 'delete') {
+      } else if (this.curcentDialog === 'delete') {
         this.deteleNodeTree(this.nodeForm)
       }
     },
@@ -530,17 +570,114 @@ export default {
       }
     },
     handleNodeClick(data) { // 选择业务线
-      console.log(data)
       this.curcentTreeData = {
         id: data.id,
         label: data.label
       }
+      this.getQueryBizModuleList(this.curcentTreeData.id)
     },
-    handleEdit() {
-
+    async getQueryBizModuleList(bizId) { // 获取结构化模块列表
+      const res = await queryBizModuleList(bizId)
+      this.moduleData = res.data
     },
-    handleDelete() {
-
+    tableRowhidden(row, index) { // 隐藏处理
+      if (row.row.isDelete === 1) {
+        return 'hidden-row'
+      }
+      return ''
+    },
+    handlerModule(type, data, index) { // 模块处理
+      console.log(data)
+      this.moduleDialog = true
+      this.moduleTitle = '新增模块'
+      this.curcentModule = type
+      this.moduleForm = { bizId: null, moduleNames: [null], parentId: -1, id: null }// 初始化
+      this.curcentParent = '无'
+      if (data && type === 'add') {
+        this.curcentParent = data.moduleName
+        this.moduleForm.parentId = data.id
+      } else if (data && type === 'edit') {
+        this.moduleForm.id = data.id
+        this.curcentParent = data.parentId === -1 ? '无' : data.parentModuleName
+        this.moduleForm.parentId = data.parentId
+        this.moduleForm.moduleNames[0] = data.moduleName
+      } else if (data && type === 'delete') {
+        this.moduleForm.id = data.id
+        this.moduleForm.moduleNames[0] = data.moduleName
+      }
+    },
+    confirmModule(formName) { // 模块操作确认
+      if (this.curcentModule === 'add') {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.addModule(this.moduleForm)
+          } else {
+            this.$message({ message: '填写格式不正确', type: 'error' })
+            return false
+          }
+        })
+      } else if (this.curcentModule === 'edit') {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.updataModule(this.moduleForm)
+          } else {
+            this.$message({ message: '填写格式不正确', type: 'error' })
+            return false
+          }
+        })
+      } else if (this.curcentModule === 'delete') {
+        this.deleteModule(this.moduleForm)
+      }
+    },
+    addModuleForm() {
+      if (this.moduleForm.moduleNames.length <= 4) {
+        this.moduleForm.moduleNames.push(null)
+      }
+    },
+    async addModule(moduleForm) { // 添加模块
+      const form = {
+        bizId: this.curcentTreeData.id,
+        moduleNames: moduleForm.moduleNames,
+        parentId: moduleForm.parentId || -1
+      }
+      const res = await addModule(form)
+      if (res.code === 200) {
+        this.$message({ message: '添加成功', type: 'success' })
+        this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
+        this.moduleDialog = false
+      } else {
+        this.$message({ message: res.msg, type: 'error' })
+      }
+    },
+    async updataModule(moduleForm) { // 更新模块
+      const form = {
+        id: moduleForm.id,
+        bizId: this.curcentTreeData.id,
+        moduleName: moduleForm.moduleNames[0],
+        parentId: moduleForm.parentId || -1
+      }
+      const res = await updateBizModule(form)
+      if (res.code === 200) {
+        this.$message({ message: '更新成功', type: 'success' })
+        this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
+        this.moduleDialog = false
+      } else {
+        this.$message({ message: res.msg, type: 'error' })
+      }
+    },
+    async deleteModule(moduleForm) { // 删除模块
+      const form = {
+        id: moduleForm.id
+      }
+      const res = await deleteBizModule(form)
+      if (res.code === 200) {
+        this.$message({ message: '删除成功', type: 'success' })
+        this.moduleData = []// 初始化
+        this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
+        this.moduleDialog = false
+      } else {
+        this.$message({ message: res.msg, type: 'error' })
+      }
     }
   }
 }
@@ -610,6 +747,10 @@ export default {
     width: 82.7%;
     margin: 0 0 1.5% 1.5%;
     flex: 0 1 auto !important;
+    i {
+      margin-left: 5%;
+      color: rgb(64, 158, 255);
+    }
     .table-main{
       display: flex;
       align-items: center;
@@ -629,6 +770,10 @@ export default {
       align-items: center;
     }
   }
+  .el-table .hidden-row {
+    display: none;
+  }
+
   .el-popover {
     min-width: 100px !important;
   }

+ 13 - 4
src/views/projectManage/taskList/taskIndex.vue

@@ -131,7 +131,11 @@
         size="small"
         show-overflow-tooltip="true"
       >
-        <!--<el-table-column label min-width="30" align="center">{{ '' }}</el-table-column>-->
+        <el-table-column label="优先级" min-width="100" prop="priority" sortable align="left">
+          <template slot-scope="scope">
+            <div class="div_priority" :style="{background: priorityColors[scope.row.priority]}">{{ scope.row.priorityString }}</div>
+          </template>
+        </el-table-column>
         <el-table-column label="任务名称" min-width="250" show-overflow-tooltip align="left">
           <template slot-scope="scope">
             <span style="font-size: 12px;color: rgba(167,174,188,1);">{{ scope.row.taskIdSting }}</span><br>
@@ -144,9 +148,6 @@
         <el-table-column label="归属需求" min-width="150" align="center" show-overflow-tooltip>
           <template slot-scope="scope">{{ scope.row.requireName }}</template>
         </el-table-column>
-        <!-- <el-table-column label="平台" min-width="100" align="center">
-          <template slot-scope="scope">{{ scope.row.typeString }}</template>
-        </el-table-column> -->
         <el-table-column label="模块" min-width="100" align="center" show-overflow-tooltip>
           <template slot-scope="scope">{{ scope.row.moduleInfoName }}</template>
         </el-table-column>
@@ -213,6 +214,7 @@ export default {
     return {
       header_show: true,
       props: { multiple: true },
+      priorityColors: ['#F56C6C', '#FF8952', '#F5E300', '#7ED321', '#61D3B8', '#69B3FF', '#BDBDBD'],
       arr_priority: [{ value: 0, name: 'p0' }, { value: 1, name: 'p1' }, { value: 2, name: 'p2' }, { value: 3, name: 'p3' }, { value: 4, name: 'p4' }, { value: 5, name: 'p5' }, { value: 6, name: 'p6' }],
       dialog_open: false,
       curIndex: 1,
@@ -439,6 +441,13 @@ export default {
   background-color: #f6f7fa;
   color: #606266;
 }
+.div_priority {
+  color: #ffffff;
+  width:fit-content;
+  padding: 0 12px;
+  border-radius: 4px;
+  margin-left: 4px;
+}
 
 </style>
 <style lang="stylus" scoped>