PrinceLee 5 лет назад
Родитель
Сommit
544deca433

+ 3 - 1
src/components/input/textArea.vue

@@ -58,7 +58,6 @@ export default {
       inputValue: '',
       edit: false,
       init: {
-        selector: '#tinymce',
         language_url: '/tinymce/langs/zh_CN.js',
         language: 'zh_CN',
         skin_url: '/tinymce/skins/ui/oxide', // 编辑器需要一个skin才能正常工作,所以要设置一个skin_url指向之前复制出来的skin文件
@@ -92,6 +91,9 @@ export default {
   },
   mounted() {
     document.body.addEventListener('click', e => {
+      if (!document.getElementById(this.id)) {
+        return false
+      }
       const isContain = document.getElementById(this.id).contains(e.target)
       if (!isContain) {
         document.getElementById(`inputUpload_${this.id}`).click()

+ 143 - 8
src/views/projectManage/projectList/component/bugsList.vue

@@ -21,17 +21,17 @@
         <template slot-scope="scope">
           <span style=" color: #A7AEBC; font-size: 10px;">{{ 'BUG-' + scope.row.id }}</span>
           <br>
-          <span>{{ scope.row.bugName }}</span>
+          <span class="bug-title" @click="getToDetails(scope.row.id)">{{ scope.row.bugName }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="状态" width="110" align="center">
+      <el-table-column label="状态" width="115" align="center">
         <template slot-scope="scope">
           <el-select
             v-model="scope.row.status"
             :class="['status'+scope.row.status]"
             class="btns"
             size="mini"
-            @change="blurEvent(scope.row, scope.row.status)"
+            @change="statusChange(scope.row)"
           >
             <el-option v-for="item in allStatus" :key="item.code" :label="item.name" :value="item.code" />
           </el-select>
@@ -60,11 +60,87 @@
         />
       </div>
     </el-col>
+    <normal-dialog
+      :show-dialog.sync="statusDialog"
+      :title="statusDialogTitle"
+      :width="'50%'"
+      :is-default-close="false"
+      @confirm="confirmStatus()"
+      @cancel="bugsList()"
+    >
+      <el-form
+        v-if="statusDialogTitle !== '删除确认'"
+        ref="ruleForm"
+        label-width="110px"
+        label-position="left"
+        :model="nowTaskDetail"
+        :rules="rules"
+      >
+        <el-form-item
+          v-if="statusDialogTitle === '待测试' || statusDialogTitle === '已完成'"
+          label="缺陷原因"
+          prop="bugReason"
+        >
+          <el-select v-model="nowTaskDetail.bugReason" style="width: 100%">
+            <el-option
+              v-for="item in bugReasonEnumList"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          v-if="statusDialogTitle === '待测试'"
+          label="修复方式"
+          class="bug_manage_dialog bug_manage_dialog_fixMethod"
+        >
+          <el-input
+            v-model="nowTaskDetail.reasonOrDesc"
+            type="textarea"
+            placeholder="请输入具体原因和修复方式"
+            maxlength="300"
+            show-word-limit
+            rows="4"
+          />
+        </el-form-item>
+        <el-form-item
+          v-if="statusDialogTitle === '已完成'"
+          label="修复结果"
+          prop="repairResult"
+          class="bug_manage_dialog"
+        >
+          <el-select
+            v-model="nowTaskDetail.repairResult"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in repairResultEnumList"
+              :key="item.code"
+              :label="item.name"
+              :value="item.code"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="statusDialogTitle === 'Reopen'" label="Reopen原因" prop="reasonOrDesc">
+          <el-input
+            v-model="nowTaskDetail.reasonOrDesc"
+            type="textarea"
+            placeholder="请输入Reopen"
+            maxlength="300"
+            show-word-limit
+            rows="4"
+          />
+        </el-form-item>
+      </el-form>
+    </normal-dialog>
   </div>
 </template>
 <script>
-import { bugList, bugGetEnum } from '@/api/defectManage'
+import { bugList, bugGetEnum, bugUpdate } from '@/api/defectManage'
+import normalDialog from '@/components/dialog/normalDialog'
 export default {
+  components: { normalDialog },
   filters: {
     naspOut(value) {
       if (!value) return ''
@@ -75,10 +151,35 @@ export default {
   data() {
     return {
       bugsDataList: [],
-      allStatus: [],
+      allStatus: [], // 所有状态列表
+      bugReasonEnumList: [], // 所有bug原因列表
+      repairResultEnumList: [], // 修复原因列表
       pageSize: 10,
       curIndex: 1,
-      total: 0
+      total: 0,
+      nowTaskDetail: null, // 当前需要改变任务的详情
+      statusDialog: false, // 状态修改弹框
+      statusDialogTitle: '',
+      rules: {
+        assigner: [
+          { required: true, message: '责任人不可为空', trigger: 'change' }
+        ],
+        currentHandler: [
+          { required: true, message: '修复人不可为空', trigger: 'change' }
+        ],
+        bugName: [
+          { required: true, message: '标题不可为空', trigger: 'blur' }
+        ],
+        bugReason: [
+          { required: true, message: '请选择缺陷原因', trigger: 'change' }
+        ],
+        repairResult: [
+          { required: true, message: '请选择修复结果', trigger: 'change' }
+        ],
+        reasonOrDesc: [
+          { required: true, message: '请输入Reopen原因', trigger: 'blur' }
+        ]
+      }
     }
   },
   created() {
@@ -90,6 +191,8 @@ export default {
       const res = await bugGetEnum()
       if (res.code === 200) {
         this.allStatus = res.data.bugEnumList
+        this.bugReasonEnumList = res.data.bugReasonEnumList
+        this.repairResultEnumList = res.data.repairResultEnumList
       }
     },
     async bugsList() {
@@ -112,8 +215,37 @@ export default {
       this.curIndex = e
       this.bugsList()
     },
-    blurEvent() { // 状态改变
-
+    getToDetails(id) { // 详情页跳转
+      this.$router.push({ name: '缺陷详情', params: { id: id }})
+    },
+    statusChange(row) { // 状态改变
+      this.nowTaskDetail = row
+      const nowStatusObj = this.allStatus.find(item => item.code === row.status)
+      if (['待修复', '修复中', 'Hold'].some(item => item === nowStatusObj.name)) {
+        this.bugUpdate()
+      } else {
+        this.statusDialogTitle = nowStatusObj.name
+        this.statusDialog = true
+      }
+    },
+    confirmStatus() { // 确认更改状态
+      this.$refs['ruleForm'].validate((valid) => {
+        if (valid) {
+          this.bugUpdate()
+          this.statusDialog = false
+        }
+      })
+    },
+    async bugUpdate() { // 更改状态请求
+      const userData = {
+        id: '',
+        ename: localStorage.getItem('username'),
+        name: localStorage.getItem('realname')
+      }
+      const res = await bugUpdate({ bugBaseInfo: this.nowTaskDetail, user: userData })
+      if (res.code === 200) {
+        this.$message({ message: '状态修改成功', type: 'success', duration: 1000, offset: 150 })
+      }
     }
   }
 }
@@ -138,6 +270,9 @@ export default {
 >>>.el-row .el-col {
   margin: 10px 0;
 }
+.bug-title {
+  cursor: pointer;
+}
 .P0 {
   background-color: #F56C6C;
 }

+ 5 - 1
src/views/projectManage/projectList/component/needsList.vue

@@ -19,7 +19,7 @@
       </el-table-column>
       <el-table-column label="需求名称" width="250" align="center" show-overflow-tooltip>
         <template slot-scope="scope">
-          <div class="table-project-name">
+          <div class="table-project-name" @click="needs_link(scope.row.id)">
             <b>{{ scope.row.requirementDisplayId }}</b>
             <span>{{ scope.row.name }}</span>
           </div>
@@ -96,6 +96,9 @@ export default {
       if (res.code === 200) {
         this.$message({ message: res.msg, type: 'success', offset: 150 })
       }
+    },
+    needs_link(id) {
+      this.$router.push({ name: '需求详情', params: { id: id + '' }})
     }
   }
 }
@@ -165,6 +168,7 @@ export default {
   display: inline-block;
 }
 .table-project-name {
+  cursor: pointer;
   display: flex;
   justify-content: center;
   flex-direction: column;

+ 8 - 2
src/views/projectManage/projectList/component/taskList.vue

@@ -42,7 +42,7 @@
         </template>
       </el-table-column>
       <el-table-column label="任务名称" width="200" align="center" show-overflow-tooltip>
-        <template slot-scope="scope"><span>{{ scope.row.name }}</span></template>
+        <template slot-scope="scope"><span class="task-title" @click="link_task(scope.row.id)">{{ scope.row.name }}</span></template>
       </el-table-column>
       <el-table-column label="所属模块" width="150" align="center" show-overflow-tooltip>
         <template slot-scope="scope">{{ scope.row.moduleInfoName }}</template>
@@ -189,7 +189,7 @@ export default {
         }
       }
     },
-    async confirmStatus() {
+    async confirmStatus() { // 确认更改状态
       const user = {
         name: localStorage.getItem('username'),
         ename: localStorage.getItem('realname'),
@@ -268,6 +268,9 @@ export default {
       this.$nextTick(() => {
         this.$refs.DailyReport.init(7, this.curcentList.map(item => { return item.id }))
       })
+    },
+    link_task(id) { // 跳转到任务详情页
+      this.$router.push({ name: '任务详情', query: { id: id }})
     }
   }
 }
@@ -292,6 +295,9 @@ export default {
 >>>.el-row .el-col {
   margin: 10px 0;
 }
+.task-title {
+  cursor: pointer;
+}
 .P0 {
   background-color: #F56C6C;
 }