qinzhipeng_v 5 سال پیش
والد
کامیت
5ea9cb18c4

+ 4 - 3
package.json

@@ -20,24 +20,25 @@
     "element-ui": "^2.9.1",
     "file-saver": "^2.0.2",
     "html2canvas": "^1.0.0-rc.3",
+    "isomorphic-fetch": "^2.2.1",
     "jodit": "^3.2.58",
     "js-cookie": "2.2.0",
     "jspdf": "^1.5.3",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
     "path-to-regexp": "2.4.0",
+    "qrcodejs2": "0.0.2",
     "simditor": "^2.3.26",
     "swiper": "^4.5.0",
     "v-jsoneditor": "^1.2.2",
     "vue": "2.6.10",
     "vue-json-viewer": "^2.2.8",
+    "vue-qr": "^2.2.1",
     "vue-router": "3.0.6",
     "vuedraggable": "^2.23.2",
     "vuex": "3.1.0",
     "wangeditor": "^3.1.1",
-    "xlsx": "^0.15.0",
-    "qrcodejs2": "0.0.2",
-    "vue-qr": "^2.2.1"
+    "xlsx": "^0.15.0"
   },
   "devDependencies": {
     "@babel/core": "7.0.0",

+ 25 - 56
src/views/Platform/bugManage/bugCreate.vue

@@ -118,57 +118,25 @@
       <div class="block-end">
         <div class="font">备注</div>
         <el-input v-model="form.remark" type="textarea" autocomplete="off" rows="5" style="margin: 20px 0;" />
-        <div>
-          <el-upload
-            ref="upload"
-            class="upload-demo"
-            multiple
-            :file-list="fileList"
-            action="http://star.xiaojukeji.com/upload/img.node"
-            :on-success="handleChange"
-            :auto-upload="false"
-          >
-            <!-- action="http://page-daily.kuaidadi.com/upload/img.node" 线下 -->
-            <!-- action="http://star.xiaojukeji.com/upload/img.node" 线上 -->
-            <!-- action="https://jsonplaceholder.typicode.com/posts/" 原始地址-->
-            <!-- <el-button size="small">点击上传</el-button> -->
-            <el-button slot="trigger" size="small" type="primary" @click="createdDis">选取文件</el-button>
-            <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
-          </el-upload>
-        </div>
-        <!-- accept="image/jpeg, image/png, image/gif, audio/mp4, video/mp4, application/pdf, audio/mpeg, text/plain, application/vnd.ms-excel, application/vnd.ms-works, application/msword" -->
+        <el-upload
+          class="upload-demo"
+          action="http://star.xiaojukeji.com/upload/img.node"
+          :on-preview="handlePictureCardPreview"
+          :on-success="handleChange"
+          :file-list="fileList"
+          list-type="picture-card"
+        >
+          <el-button size="small" type="primary" @click="dis = true">上传附件</el-button>
+          <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+        </el-upload>
+        <el-dialog :visible.sync="dialogVisible">
+          <img width="100%" :src="dialogImageUrl" alt="">
+        </el-dialog>
         <el-form-item class="submit">
-          <el-button size="mini" type="primary" @click="createFormData(form)">提 交</el-button>
+          <el-button :disabled="dis" size="mini" type="primary" @click="createFormData(form)">提 交</el-button>
           <el-button class="move-button" size="mini" @click="$router.go(-1)">取 消</el-button>
         </el-form-item>
       </div>
-      <!-- <div style="flex:1">
-        <el-form-item v-show="statusShow" label="问题原因和修复方法" :label-width="formLabelWidth"><el-input v-model="form.reasonsAndSolutionForTheProblem" type="textarea" placeholder="问题原因和修复方法" rows="4" style="width:77.2%;" /></el-form-item>
-      </div>
-      <div style="flex:1">
-        <el-form-item v-show="repairShow" label="修复结果" :label-width="formLabelWidth">
-          <el-select v-model="form.repairResult" placeholder="发现方法">
-            <el-option v-for="item in repairResultStr" :key="item.name" :label="item.name" :value="item.name" />
-          </el-select>
-        </el-form-item>
-      </div> -->
-      <!-- <el-form-item label="逻辑删" :label-width="formLabelWidth">
-            <el-select v-model="form.isDelete" placeholder="发现方法">
-              <el-option v-for="item in isDeleteStr" :key="item.value" :label="item.name" :value="item.value" />
-            </el-select>
-          </el-form-item> -->
-      <!-- <el-form-item label="reopen的次数" :label-width="formLabelWidth"> <el-input v-model="form.reopenTimes" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="业务线" prop="bizId" :label-width="formLabelWidth"><el-input v-model="form.bizId" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="模块" :label-width="formLabelWidth"><el-input v-model="form.moduleId" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="项目名" :label-width="formLabelWidth"><el-input v-model="form.projectName" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="项目ID" :label-width="formLabelWidth"><el-input v-model="form.projectId" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="测试计划ID" prop="planId" :label-width="formLabelWidth"><el-input v-model="form.planId" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="caseID" :label-width="formLabelWidth"><el-input v-model="form.caseId" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="bug创建人" :label-width="formLabelWidth"> <el-input v-model="form.creator" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="开始开发时间" :label-width="formLabelWidth"><el-input v-model="form.startDevTime" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="开始等待测试时间" :label-width="formLabelWidth"><el-input v-model="form.waitTestTime" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="创建时间" :label-width="formLabelWidth"><el-input v-model="form.gmtCreate" autocomplete="off" /></el-form-item> -->
-      <!-- <el-form-item label="修改时间" :label-width="formLabelWidth"><el-input v-model="form.gmtModify" autocomplete="off" /></el-form-item> -->
     </el-form>
   </div>
 </template>
@@ -192,6 +160,8 @@ export default {
         currentHandler: [],
         assigner: []
       },
+      dialogImageUrl: '',
+      dialogVisible: false,
       businessTypeStr: [],
       optionsAssigner: [],
       optionsCurrentHandler: [],
@@ -242,14 +212,11 @@ export default {
     this.forkDown()
   },
   methods: {
-    createdDis() {
-      this.dis = true
-    },
-    submitUpload() {
-      this.$refs.upload.submit()
-      this.dis = true
-      this.$message({ showClose: true, message: '文件正在上传······', type: 'success' })
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url
+      this.dialogVisible = true
     },
+    // 上传成功回调
     handleChange(response, file, fileList) {
       this.fileDbList = []
       this.fileList = fileList.slice(-3)
@@ -257,9 +224,11 @@ export default {
         this.fileDbList.push({ 'name': a.name, 'url': 'http:' + a.response.url })
       }
       this.accessory = JSON.stringify(this.fileDbList)
-      this.dis = false
+      console.log(this.accessorys)
+      this.dis = true
       this.$message({ showClose: true, message: '文件上传成功', type: 'success' })
     },
+
     async bugListSelect() {
       await bugGetEnum().then(res => {
         this.stageStr = res.data.bugStageEnumList
@@ -307,7 +276,7 @@ export default {
           })
           var title = res.data[0].caseInfo.title
           const arrString = e.reduce((sumString, item) => { return sumString + '测试步骤:' + item['测试步骤'] + '   ' + '预期结果:' + item['预期结果'] + '\n' }, '')
-          var case_caseCondition = '前置条件 : "' + caseInfo.caseCondition + ' \n ' + 'api : ' + caseInfo.api + ' \n ' + '问题描述 : ' + ' \n ' + arrString
+          var case_caseCondition = '前置条件 : ' + caseInfo.caseCondition + ' \n ' + 'api : ' + caseInfo.api + ' \n ' + '问题描述 : ' + ' \n ' + arrString
           this.$set(this.form, 'bugName', title)
           this.$set(this.form, 'bugDescribe', case_caseCondition)
           this.$set(this.form, 'taskId', caseInfo.taskId)

+ 74 - 66
src/views/Platform/testPage.vue

@@ -10,7 +10,9 @@
               <br>
               <el-tree :data="data1" :default-expanded-keys="key_arr" :expand-on-click-node="true" node-key="id" @node-click="clickFun">
                 <span slot-scope="{ node, data }" style="width:100%;" class="custom-tree-node" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)">
-                  <span :title="data.label" class="span_el">{{ node.label }}</span>
+                  <el-tooltip class="item" effect="dark" :content="data.label" placement="right">
+                    <span :title="data.label" class="span_el">{{ node.label }}</span>
+                  </el-tooltip>
                   <el-dropdown v-show="data.del" style="margin-left:10px" trigger="click">
                     <span v-show="data.codes === '1' ? false : true" class="el-dropdown-link">
                       ···<i class="el-icon--right" />
@@ -37,7 +39,7 @@
                   </el-select>
                   <el-button type="primary" @click="queryCaseData(test_plan)">查询</el-button>
                   <el-button type="primary" style="margin: 3% 2%" @click="createGetShow">新增</el-button>
-                  <el-button @click="implement">执行结果</el-button>
+                  <!-- <el-button @click="implement">执行结果</el-button> -->
                 </el-col>
               </el-row>
             </el-header>
@@ -49,11 +51,12 @@
                 <el-col :span="6" style=" color:#73C5FA;"><img :src="clicked_4" style="margin-right: 6%;width:5%;">未执行{{ num.Count4 }}个,占比{{ num.Rate4 }}%</el-col>
               </el-row>
             </div>
-            <el-main style="background:#ffffff; width:98%;margin:0% 1% 1% 1%; font-size:14px;border-radius:8px;"><!-- 主页table -->
+            <el-main style="background:#ffffff; width:98%;margin:0% 1% 1% 1%; font-size:14px;border-radius:8px;">
+              <!-- 主页table -->
               <el-table :data="gridData" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" border fit tooltip-effect="dark" size="mini" style="width: 100%">
-                <el-table-column prop="id" label="序列号" min-width="100" align="center"><template slot-scope="scope">{{ scope.row.ids }}</template></el-table-column>
+                <el-table-column label="序列号" min-width="100" align="center"><template slot-scope="scope">{{ scope.row.ids }}</template></el-table-column>
 
-                <el-table-column prop="caseName" label="用例名" min-width="200" align="center">
+                <el-table-column label="用例名" min-width="200" align="center">
                   <template slot-scope="scope"><span style="color:#409EFF; cursor: pointer" @click="go_query(scope.row)">{{ scope.row.title }}</span></template>
                 </el-table-column>
 
@@ -77,7 +80,7 @@
               </el-table>
 
               <div align="center"> <!--分页-->
-                <el-pagination :current-page="curIndex" :page-size="pageSize" :hide-on-single-page="true" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
+                <el-pagination :current-page="curIndex" :page-size="pageSize" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
               </div>
 
             </el-main>
@@ -99,11 +102,6 @@
                 <el-option v-for="item in taskTypeStrings" :key="item.code" :label="item.msg" :value="item.code" />
               </el-select>
             </el-form-item>
-            <!-- <el-form-item label="工程模块" prop="casePriority">
-              <el-select v-model="caseData.casePriority" clearable placeholder="请选择【多选组件】" style="width: 90%">
-                <el-option v-for="item in priorityStrings" :key="item.value" :label="item.name" :value="item.value" />
-              </el-select>
-            </el-form-item> -->
           </el-form>
           <div slot="footer" class="dialog-footer">
             <el-button @click="caseCreateCase(caseData, titleName)">确 定</el-button>
@@ -151,7 +149,7 @@
                 <template slot-scope="scope">{{ scope.row.modifier }}</template>
               </el-table-column>
             </el-table>
-            <el-pagination :current-page="curIndex" :page-sizes="[5, 10, 20]" :page-size="pageSize" layout="total, prev, pager, next" :total="total" background :hide-on-single-page="true" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
+            <el-pagination :current-page="curIndex" :page-sizes="[5, 10, 20]" :page-size="pageSize" layout="total, prev, pager, next" :total="total_one" background @size-change="handleSizeChange1" @current-change="handleCurrentChange1" />
           </div>
 
           <div slot="footer" class="dialog-footer">
@@ -202,6 +200,8 @@ export default {
       createTimeData: '',
       pageSize: 8,
       curIndex: 1,
+      pageSize_one: 8,
+      curIndex_one: 1,
       startId: '',
       Parentids: '',
       createParticipation: {},
@@ -221,11 +221,13 @@ export default {
       data1: [],
       data2: [],
       total: 0,
+      total_one: 0,
       excelData: [],
       imFile: '',
       failNum: '',
       successNum: '',
       startKey: '',
+      caseFolderId: '',
       obj: '',
       grid_Data: [],
       case_from: {},
@@ -399,6 +401,24 @@ export default {
     pageIndex() {
       queryTestPlanCaseList({ pageSize: this.pageSize, curIndex: this.curIndex, testPlanId: this.startId }).then(res => {
         this.gridData = res.data
+        this.total = res.total
+      })
+    },
+
+    handleSizeChange1(size) {
+      console.log(size, '1')
+      this.pageSize_one = size
+      this.pageIndex1()
+    },
+    handleCurrentChange1(curIndex) {
+      this.curIndex_one = curIndex
+      this.pageIndex1()
+    },
+
+    pageIndex1() {
+      queryCasesData({ pageSize: this.pageSize_one, curIndex: this.curIndex_one, caseFolderId: this.caseFolderId }).then(res => {
+        this.grid_Data = res.data.list
+        this.total_one = res.data.total
       })
     },
 
@@ -452,7 +472,13 @@ export default {
         this.createParticipation.pageSize = this.pageSize
         this.createParticipation.curIndex = this.curIndex
         queryTestPlanCaseList(this.createParticipation).then(res => {
-          this.gridData = res.data
+          this.gridData = []
+          res.data.map(item => {
+            item.caseInfo.ids = item.id
+            item.caseInfo.status_case = item.status
+            item.caseInfo.keys = item.status
+            this.gridData.push(item.caseInfo)
+          })
           this.total = res.data.length
         })
       }
@@ -462,6 +488,10 @@ export default {
     createGetShow() {
       this.titleName = '新增'
       this.case_from = {}
+      this.caseShwo_three = false
+      this.caseShwo_two = false
+      this.caseShwo_four = false
+      this.grid_Data = []
       if (this.pegs !== '3') {
         this.$message({ message: '提示, 👈请选择目录', type: 'success', duration: 1000, offset: 150 })
       } else {
@@ -478,11 +508,12 @@ export default {
       }
     },
 
-    // 新建table保存
+    // 新建tableData
     case_CreateCase() {
       createTestPlanCaseList({ testPlanId: this.startId, caseIds: this.Selection, creator: this.userInformation, modifier: this.userInformation }).then(res => {
         this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })
         this.dialogFormVisibleUpdateOne = false
+        this.queryCaseData('')
       })
     },
 
@@ -497,6 +528,7 @@ export default {
     },
     // 改变case_one
     case_fromOne(e) {
+      this.caseFolderId = e
       if (e === '') {
         this.caseShwo_two = false
         this.$set(this.case_from, 'two', '')
@@ -508,7 +540,7 @@ export default {
       } else {
         queryCasesData({ pageSize: this.pageSize, curIndex: this.curIndex, caseFolderId: e }).then(res => {
           this.grid_Data = res.data.list
-          this.total = res.data.total
+          this.total_one = res.data.total
         })
 
         for (var one of this.data2) {
@@ -525,6 +557,7 @@ export default {
     },
     // 改变case_two
     case_fromTwo(e) {
+      this.caseFolderId = e
       if (e === '') {
         this.caseShwo_three = false
         this.$set(this.case_from, 'three', '')
@@ -534,7 +567,7 @@ export default {
       } else {
         queryCasesData({ pageSize: this.pageSize, curIndex: this.curIndex, caseFolderId: e }).then(res => {
           this.grid_Data = res.data.list
-          this.total = res.data.total
+          this.total_one = res.data.total
         })
         for (var two of this.case_two) {
           if (two.id === e) {
@@ -551,6 +584,7 @@ export default {
 
     // 改变case_three
     case_fromThree(e) {
+      this.caseFolderId = e
       if (e === '') {
         this.caseShwo_four = false
         this.$set(this.case_from, 'four', '')
@@ -558,7 +592,7 @@ export default {
       } else {
         queryCasesData({ pageSize: this.pageSize, curIndex: this.curIndex, caseFolderId: e }).then(res => {
           this.grid_Data = res.data.list
-          this.total = res.data.total
+          this.total_one = res.data.total
         })
         for (var three of this.case_three) {
           if (three.id === e) {
@@ -574,16 +608,18 @@ export default {
     },
     // 改变case_four
     case_fromFour(e) {
+      this.caseFolderId = e
       this.grid_Data = []
       queryCasesData({ pageSize: this.pageSize, curIndex: this.curIndex, caseFolderId: e }).then(res => {
         this.grid_Data = res.data.list
-        this.total = res.data.total
+        this.total_one = res.data.total
       })
     },
 
     // 点击节点
     clickFun(e) {
       console.log(e)
+      this.test_plan = {}
       this.pegs = ''
       e.codes === '1' ? this.Parentids = e.id : ''
       e.codes === '2' ? this.taskids = e.id : ''
@@ -607,58 +643,19 @@ export default {
 
     Unclicked(e, index, ele) {
       this.gridData[index].keys = 1
-      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 1, testPlanId: ele.thrr }).then(res => {
-        if (res.code === 200) {
-          this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })
-        } else {
-          this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
-        }
-      })
+      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 1, testPlanId: ele.thrr }).then(res => { this.implement() })
     },
     Unclicked2(e, index, ele) {
       this.gridData[index].keys = 2
-      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 2, testPlanId: ele.thrr }).then(res => {
-        if (res.code === 200) {
-          this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })
-        } else {
-          this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
-        }
-      })
+      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 2, testPlanId: ele.thrr }).then(res => { this.implement() })
     },
     Unclicked3(e, index, ele) {
       this.gridData[index].keys = 3
-      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 3, testPlanId: ele.thrr }).then(res => {
-        if (res.code === 200) {
-          this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })
-        } else {
-          this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
-        }
-      })
+      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 3, testPlanId: ele.thrr }).then(res => { this.implement() })
     },
     Unclicked4(e, index, ele) {
       this.gridData[index].keys = 0
-      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 0, testPlanId: ele.thrr }).then(res => {
-        if (res.code === 200) {
-          this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })
-        } else {
-          this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
-        }
-      })
-    },
-
-    // 查询接口list
-    query_get(e) {
-      var data_status = { testPlanId: e, pageSize: this.pageSize, curIndex: this.curIndex }
-      queryTestPlanCaseList(data_status).then(res => {
-        this.gridData = []
-        res.data.map(item => {
-          item.caseInfo.ids = item.id
-          item.caseInfo.status_case = item.status
-          item.caseInfo.keys = item.status
-          this.gridData.push(item.caseInfo)
-        })
-        this.total = this.gridData.total
-      })
+      updateTestPlanCase({ creator: this.userInformation, modifier: this.userInformation, id: ele.ids, status: 0, testPlanId: ele.thrr }).then(res => { this.implement() })
     },
 
     // 跳转bug页面
@@ -677,10 +674,10 @@ export default {
         this.num = {
           Count1: res.data.successCount,
           Rate1: Math.floor(res.data.successRate * 1000) / 1000,
-          Count2: res.data.blockCount,
-          Rate2: Math.floor(res.data.blockRate * 1000) / 1000,
-          Count3: res.data.failCount,
-          Rate3: Math.floor(res.data.failRate * 1000) / 1000,
+          Count2: res.data.failCount,
+          Rate2: Math.floor(res.data.failRate * 1000) / 1000,
+          Count3: res.data.blockCount,
+          Rate3: Math.floor(res.data.blockRate * 1000) / 1000,
           Count4: res.data.defaultCount,
           Rate4: Math.floor(res.data.defaultRate * 1000) / 1000
         }
@@ -689,6 +686,7 @@ export default {
 
     // 删除table信息
     deleteCaseData(e) {
+      console.log(e, '删除')
       this.$confirm('是否确认删除', '确认信息', {
         distinguishCancelAndClose: true,
         confirmButtonText: '确定',
@@ -696,7 +694,17 @@ export default {
       }).then(() => {
         deleteTestPlanCase({ id: e.ids, modifier: this.userInformation }).then(res => {
           if (res.code === 200) {
-            this.query_get(e.thrr)
+            queryTestPlanCaseList({ testPlanId: e.thrr, pageSize: this.pageSize, curIndex: this.curIndex }).then(res => {
+              this.gridData = []
+              res.data.map(item => {
+                item.caseInfo.thrr = e.thrr
+                item.caseInfo.ids = item.id
+                item.caseInfo.status_case = item.status
+                item.caseInfo.keys = item.status
+                this.gridData.push(item.caseInfo)
+              })
+              this.total = this.gridData.total
+            })
             this.$message({ type: 'success', message: '已删除' })
           } else {
             this.$message({ message: res.msg, type: 'success', duration: 1000, offset: 150 })

+ 3 - 3
src/views/Platform/useCase/createUse.vue

@@ -65,7 +65,7 @@
             <el-form-item label="执行步骤" style="flex:1"><el-input v-model="item.description" placeholder="请填写【此处可能20字以上】…" /></el-form-item>
             <el-form-item label="预期结果" style="flex:1"><el-input v-model="item.expectedResult" placeholder="请填写" /></el-form-item>
             <div style="flex:0.1; margin:0.26% 3%;">
-              <el-button size="mini" type="primary" icon="el-icon-plus" @click="add" />
+              <el-button size="mini" type="primary" icon="el-icon-plus" @click="add(index)" />
               <el-button size="mini" icon="el-icon-minus" @click="deleteData(index)" />
             </div>
           </div>
@@ -155,8 +155,8 @@ export default {
     },
 
     // 添加事件
-    add() {
-      this.data.push({ description: '', expectedResult: '' })
+    add(e) {
+      this.data.splice(e + 1, 0, { description: '', expectedResult: '' })
     },
 
     // 删除事件

+ 12 - 0
src/views/Platform/useCase/queryUse.vue

@@ -3,6 +3,10 @@
     <el-container>
       <el-main style="background:#ffffff;height:auto; width:94%;margin:3%; font-size:14px;border-radius:8px;">
         <el-form label-position="left" label-width="100px" :model="formLabelAlign">
+          <el-form-item label="用例名称:">
+            {{ formLabelAlign.title }}
+          </el-form-item>
+
           <el-form-item label="用例优先级:">
             {{ formLabelAlign.casePriorityName }}
           </el-form-item>
@@ -15,6 +19,14 @@
             {{ formLabelAlign.caseCondition }}
           </el-form-item>
 
+          <el-form-item label="项目名称:">
+            {{ formLabelAlign.projectName }}
+          </el-form-item>
+
+          <el-form-item label="需求名称:">
+            {{ formLabelAlign.taskName }}
+          </el-form-item>
+
           <el-form-item label="备注:">
             {{ formLabelAlign.remark }}
           </el-form-item>

+ 52 - 22
src/views/Platform/useCasePage.vue

@@ -1,8 +1,5 @@
 <template>
   <div id="init-window" style="position:relative; min-height:95vh; background:#F2F3F6;">
-    <div style="background: #FFFFFF; z-index:9999;">
-      <!-- <router-view /> -->
-    </div>
     <div style="position: absolute;width: 100%;">
       <div style="background:#F2F3F6;">
         <el-container>
@@ -28,6 +25,7 @@
                 @node-drop="handleDrop"
                 @node-click="clickFun"
               >
+
                 <span slot-scope="{ node, data }" style="width:100%;" class="custom-tree-node" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)">
                   <span :title="data.label" class="span_el" @dblclick="dblclick(data)">{{ node.label }}</span>
                   <el-input v-if="data.que" ref="get_Input" v-model="node_Name.name" size="mini" @blur="queryNodeName(node_Name.name, data)">输入框</el-input>
@@ -79,8 +77,8 @@
                     <el-date-picker v-model="createParticipation.modifyTime" size="mini" style="width:40%;margin: 0 4% 0 3%;" type="datetime" placeholder="结束日期" />
                   </div>
                   <div style="flex:1;display: flex;justify-content: center; align-items: center">
-                    项目名称 <el-input v-model="createParticipation.projectName" size="mini" placeholder="创建人" clearable style="width: 50%;margin: 0 2% 0 1%;" class="filter-item" />
-                    需求名称<el-input v-model="createParticipation.taskName" size="mini" placeholder="创建人" clearable style="width: 50%;margin-left:2%;" class="filter-item" />
+                    项目名称 <el-input v-model="createParticipation.projectName" size="mini" clearable style="width: 50%;margin: 0 2% 0 1%;" class="filter-item" />
+                    需求名称<el-input v-model="createParticipation.taskName" size="mini" clearable style="width: 50%;margin-left:2%;" class="filter-item" />
                   </div>
                   <input id="imFile" ref="imFile" type="file" style="display: none" @change="importFile(this)">
                   <input id="im_File" ref="im_File" type="file" style="display: none" @change="import_File(this)">
@@ -139,8 +137,8 @@
                 </el-table-column>
                 <el-table-column label="操作" min-width="150px" align="center">
                   <template slot-scope="scope">
-                    <el-button size="mini" type="primary" plain @click="dowload(scope.row, 2)">下载</el-button>
-                    <el-button size="mini" type="primary" plain @click="queryUpdateCreatd(scope.row, 2)">编辑</el-button>
+                    <el-button size="mini" type="primary" plain @click="data_load(scope.row)">下载</el-button>
+                    <!-- <el-button size="mini" type="primary" plain >编辑</el-button> -->
                     <el-button size="mini" type="danger" plain @click="deleteCaseData(scope.row.id)">删除</el-button>
                   </template>
                 </el-table-column>
@@ -156,6 +154,8 @@
 <script>
 import { createFolderData, queryAllFolderData, queryCasesData, deleteFolderData, deleteCaseData, updateFolderData, caseUpdateFolderName, updateXmindUrl, uploadCaseByXmind } from '@/api/caseProject.js'
 import { mockUrl } from '@/apiConfig/api'
+// import fetch from "isomorphic-fetch"
+require('isomorphic-fetch')
 // import FileSaver from 'file-saver'
 import axios from 'axios'
 // import XLSX from 'xlsx'
@@ -442,6 +442,7 @@ export default {
         this.createParticipation.curIndex = this.curIndex
         queryCasesData(this.createParticipation).then(res => {
           this.gridData = res.data.list
+          this.total = res.data.total
         })
       }
     },
@@ -544,6 +545,7 @@ export default {
       this.startId = e.id
       queryCasesData({ pageSize: 5, curIndex: 1, caseFolderId: e.id }).then(res => {
         this.gridData = res.data.list
+        this.grid_xmind = res.data.subList
         this.total = res.data.total
       })
     },
@@ -569,6 +571,7 @@ export default {
                 }
                 queryCasesData(data).then(res => {
                   this.gridData = res.data.list
+                  this.total = res.data.total
                   this.$message({ type: 'success', message: '已删除' })
                 })
               } else {
@@ -630,22 +633,29 @@ export default {
         var formData_s = new FormData()
         formData_s.append('file', f)
         this.grid_xmind.push({ 'name': f.name, 'url': 'http://pt-starfile.didistatic.com/static/starfile/node/hjvKFStkqD1574316045070.xmind' })
-        axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' }}).then(res => {
-          console.log(res.url)
-          if (res.url) {
-            this.grid_xmind.push({ 'name': f.name, 'url': 'http:' + res.url })
-            var xmind_code = {
-              id: this.startId,
-              xmindUrl: JSON.stringify(this.grid_xmind),
-              modifier: this.userInformation
-            }
-            updateXmindUrl(xmind_code).then(res => {
-              if (res.code === 200) {
-                this.$message({ type: 'success', message: '导入成功' })
-              }
-            })
-          }
+        // url (必须), init对象 (可选)
+        fetch('http://star.xiaojukeji.com/upload/img.node', formData_s).then(function(res) {
+          console.log(res)
+          return res.json()
+        }).catch(err => {
+          console.log(err)
         })
+        // axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' }}).then(res => {
+        //   console.log(res.url)
+        //   if (res.url) {
+        //     this.grid_xmind.push({ 'name': f.name, 'url': 'http:' + res.url })
+        //     var xmind_code = {
+        //       id: this.startId,
+        //       xmindUrl: JSON.stringify(this.grid_xmind),
+        //       modifier: this.userInformation
+        //     }
+        //     updateXmindUrl(xmind_code).then(res => {
+        //       if (res.code === 200) {
+        //         this.$message({ type: 'success', message: '导入成功' })
+        //       }
+        //     })
+        //   }
+        // })
       } else {
         this.$message({ type: 'error', message: '导入失败,不支持文件类型(只支持xmind)' })
       }
@@ -708,6 +718,25 @@ export default {
       }
     },
 
+    data_load(e) {
+      console.log(e)
+      var url = 'http://pt-starfile.didistatic.com/static/starfile/node/hjvKFStkqD1574316045070.xmind'
+      var eleLink = document.createElement('a')
+      eleLink.style.display = 'none'
+      eleLink.download = this.filerName(url)
+      var blob = new Blob([url])
+      eleLink.href = URL.createObjectURL(blob)
+      document.body.appendChild(eleLink)
+      eleLink.click()
+      document.body.removeChild(eleLink)
+    },
+
+    filerName(url) {
+      // 提取下载的文件名
+      var a = url.split('/')
+      return a[a.length - 1]
+    },
+
     // 按钮导入
     uploadFile() {
       if (this.startId === '') {
@@ -731,6 +760,7 @@ export default {
       this.createParticipation.curIndex = this.curIndex
       queryCasesData(this.createParticipation).then(res => {
         this.gridData = res.data.list
+        this.total = res.data.total
         this.$message({ type: res.msg, message: res.msg, duration: 1000 })
       })
     }