Procházet zdrojové kódy

任务按钮优化

sunjh před 6 roky
rodič
revize
5a7927f245
3 změnil soubory, kde provedl 108 přidání a 24 odebrání
  1. 1 1
      src/components/cheat/ProjectAdd.vue
  2. 105 23
      src/components/task/Task.vue
  3. 2 0
      src/main.js

+ 1 - 1
src/components/cheat/ProjectAdd.vue

@@ -552,11 +552,11 @@ export default {
       //   })
     },
     ensureSubmitExcel () {
+      this.hideDialog()
       this.showLoading()
       Http.post(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, this.projectList).then((res) => {
         notify('success', '添加成功')
         this.hideLoading()
-        this.hideDialog()
       }).catch((error) => {
         notify('error', error.data)
         this.hideLoading()

+ 105 - 23
src/components/task/Task.vue

@@ -115,18 +115,69 @@
           <div class="btn btn-small" @click="cancelMode()">取消</div>
         </el-form-item>
         <el-form-item v-if="!isModifyMode">
-          <div class="btn btn-small btn-info"
-               v-if="taskOperationControl.confirmFinish"
-               @click="endTask()">确认结束
-          </div>
-          <div class="btn btn-small btn-info" v-if="taskOperationControl.finish" @click="submitTaskRequest()">结束任务
-          </div>
-          <div class="btn btn-small btn-info" v-if="taskOperationControl.receive" @click="receiveTask()">接收任务</div>
-          <div class="btn btn-small btn-danger" v-if="taskOperationControl.receive" @click="rejectTask()">拒绝任务</div>
-          <div class="btn btn-small btn-info" v-if="taskOperationControl.update" @click="modifyForm()">修改任务</div>
-          <div class="btn btn-small btn-info" v-if="taskOperationControl.uploadReport" @click="toCreateReport()">上传报告
-          </div>
-          <div class="btn btn-small" @click="toProject()">前往项目</div>
+          <el-button size="mini" @click="toProject()">项目详情</el-button>
+          <el-popover
+            placement="top-start"
+            title="确认结束?"
+            width="200"
+            trigger="hover"
+            content="测评机构已提交结束申请,请确认是否结束该任务">
+            <el-button v-if="!taskOperationControl.confirmFinish" type="success" size="mini" slot="reference"
+                       @click="endTask()">确认结束
+            </el-button>
+          </el-popover>
+
+          <el-popover
+            placement="top-start"
+            title="确认提交?"
+            width="200"
+            trigger="hover"
+            content="提交任务后不可更改,等待区域管理员验收">
+            <el-button v-if="!taskOperationControl.finish" type="primary" size="mini" slot="reference"
+                       @click="submitTaskRequest()">提交任务
+            </el-button>
+          </el-popover>
+
+          <el-popover
+            placement="top-start"
+            title="确认拒绝?"
+            width="200"
+            trigger="hover"
+            content="拒绝后不可再接收此任务,且该任务对您不可见">
+            <el-button v-if="!taskOperationControl.reject" type="danger" size="mini" slot="reference"
+                       @click="rejectTask()">拒绝任务
+            </el-button>
+          </el-popover>
+
+          <el-popover
+            placement="top-start"
+            title="确认接收?"
+            width="200"
+            trigger="hover"
+            content="接收任务后请认真完成!">
+            <el-button v-if="!taskOperationControl.receive" type="primary" size="mini" slot="reference"
+                       @click="receiveTask()">接收任务
+            </el-button>
+          </el-popover>
+
+
+          <el-button v-if="taskOperationControl.update" type="primary" size="mini" @click="modifyForm()">修改任务
+          </el-button>
+          <el-button v-if="!taskOperationControl.uploadReport" type="primary" size="mini" @click="toCreateReport()">
+            上传报告
+          </el-button>
+          <!--<div class="btn btn-small btn-info"-->
+          <!--v-if="taskOperationControl.confirmFinish"-->
+          <!--@click="endTask()">确认结束-->
+          <!--</div>-->
+          <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.finish" @click="submitTaskRequest()">提交任务-->
+          <!--</div>-->
+          <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.receive" @click="receiveTask()">接收任务</div>-->
+          <!--<div class="btn btn-small btn-danger" v-if="!taskOperationControl.reject" @click="rejectTask()">拒绝任务</div>-->
+          <!--<div class="btn btn-small btn-info" v-if="taskOperationControl.update" @click="modifyForm()">修改任务</div>-->
+          <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.uploadReport" @click="toCreateReport()">上传报告-->
+          <!--</div>-->
+
         </el-form-item>
       </el-form>
     </div>
@@ -148,6 +199,7 @@ import {
   ensureEndTask,
   getAllAgencies,
   getAllServiceTypes,
+  getFormalTimeFromDate,
   getProvinceCodeByProvinceName,
   getProvinceNameByProvinceCode,
   getTask,
@@ -155,8 +207,7 @@ import {
   rejectTask,
   storageGet,
   submitTaskRequest,
-  updateTask,
-  getFormalTimeFromDate
+  updateTask
 } from '@/js/index'
 
 export default {
@@ -494,8 +545,15 @@ export default {
     },
     //接收任务
     receiveTask () {
-      this.showLoading()
-      receiveTaskRequest(this.projectId, this.taskId, this.user.userVO.id, this.receiveTaskSuccess, this.receiveTaskFail)
+      this.$confirm('确认接收任务?', '提示', {
+        confirmButtonText: '确认接收',
+        cancelButtonText: '取消',
+        type: 'success'
+      }).then(() => {
+        this.showLoading()
+        receiveTaskRequest(this.projectId, this.taskId, this.user.userVO.id, this.receiveTaskSuccess, this.receiveTaskFail)
+      }).catch(() => {
+      })
     },
     //接收任务成功时的回调函数
     receiveTaskSuccess (res) {
@@ -513,8 +571,16 @@ export default {
     },
     //拒绝任务
     rejectTask () {
-      this.showLoading()
-      rejectTask(this.projectId, this.taskId, this.rejectTaskSuccess, this.rejectTaskFail)
+      this.$confirm('确认拒绝任务?拒绝后将不能再接收该任务', '提示', {
+        confirmButtonText: '确认拒绝',
+        cancelButtonText: '取消',
+        type: 'success'
+      }).then(() => {
+        this.showLoading()
+        rejectTask(this.projectId, this.taskId, this.rejectTaskSuccess, this.rejectTaskFail)
+      }).catch(() => {
+
+      })
     },
     //拒绝任务成功时的回调函数
     rejectTaskSuccess (res) {
@@ -531,8 +597,16 @@ export default {
     },
     //提交结束任务申请
     submitTaskRequest () {
-      this.showLoading()
-      submitTaskRequest(this.projectId, this.taskId, this.submitTaskRequestSuccess, this.submitTaskRequestFail)
+      this.$confirm('确认提交任务?提交后将不能再修改', '提示', {
+        confirmButtonText: '确认提交',
+        cancelButtonText: '取消',
+        type: 'success'
+      }).then(() => {
+        this.showLoading()
+        submitTaskRequest(this.projectId, this.taskId, this.submitTaskRequestSuccess, this.submitTaskRequestFail)
+      }).catch(() => {
+
+      })
     },
     //提交结束任务申请成功时的回调函数
     submitTaskRequestSuccess (res) {
@@ -550,8 +624,16 @@ export default {
     },
     //结束任务
     endTask () {
-      this.showLoading()
-      ensureEndTask(this.projectId, this.taskId, this.endTaskSuccess, this.endTaskFail)
+      this.$confirm('确认结束任务?', '提示', {
+        confirmButtonText: '确认结束',
+        cancelButtonText: '取消',
+        type: 'success'
+      }).then(() => {
+        this.showLoading()
+        ensureEndTask(this.projectId, this.taskId, this.endTaskSuccess, this.endTaskFail)
+      }).catch(() => {
+
+      })
     },
     //结束任务成功时的回调函数
     endTaskSuccess (res) {
@@ -578,7 +660,7 @@ export default {
         }
       })
     },
-    reformDate(date){
+    reformDate (date) {
       return getFormalTimeFromDate(date)
     }
   },

+ 2 - 0
src/main.js

@@ -41,6 +41,7 @@ import {
   Notification,
   Option,
   Pagination,
+  Popover,
   Radio,
   RadioButton,
   RadioGroup,
@@ -164,6 +165,7 @@ Vue.use(DropdownItem)
 Vue.use(DropdownMenu)
 Vue.use(Image)
 Vue.use(Badge)
+Vue.use(Popover)
 
 Vue.prototype.$msgbox = MessageBox
 Vue.prototype.$alert = MessageBox.alert