Browse Source

我的工作台

liqianyi 3 years ago
parent
commit
f163b3eebb
1 changed files with 60 additions and 79 deletions
  1. 60 79
      src/views/modules/works/work.vue

+ 60 - 79
src/views/modules/works/work.vue

@@ -1,24 +1,9 @@
 <!-- 我的工作台 -->
 <template>
   <div class="works">
-    <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
-      <el-form-item label="状态">
-        <el-select
-          v-model="dataForm.state"
-          remote
-          placeholder="请选择">
-          <el-option
-            v-for="item in optionsState"
-            :key="item.code"
-            :label="item.value"
-            :value="item.code">
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item>
-        <el-button @click="queryData()">查询</el-button>
-      </el-form-item>
-    </el-form>
+    <el-radio-group @change="queryData" v-model="dataForm.state" style="margin-bottom: 30px;">
+      <el-radio-button v-for="(item, index) in optionsState" :label="item.code">{{item.value}}</el-radio-button>
+    </el-radio-group>
     <el-table
       :data="dataList"
       border
@@ -109,12 +94,12 @@
         width="180"
         label="操作">
         <template slot-scope="scope">
-          <el-button v-if="isAuth('work:clt:start') && (scope.row.state == 0 || scope.row.state == 1)" :disabled="scope.row.state == 0" type="text" size="small" @click="startTask(scope.row.taskId)">开始</el-button>
-          <el-button v-if="isAuth('work:clt:transfer') && scope.row.state != 3" type="text" size="small" @click="transferTask(scope.row.taskId, scope.row.workTypeId)">移交</el-button>
-          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == null || scope.row.nodeType == 'start' || scope.row.nodeType == 'produce')" type="text" size="small" @click="completeTask(scope.row.taskId)">完成</el-button>
-          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == 'check' || scope.row.nodeType == 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 1)">通过</el-button>
-          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == 'check' || scope.row.nodeType == 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 2)">不通过</el-button>
-          <el-button v-if="isAuth('work:clt:complete') && scope.row.state == 2 && (scope.row.nodeType == null || scope.row.nodeType == 'produce')" type="text" size="small" @click="damageTask(scope.row.nodeId, scope.row.productionId)">操作损坏</el-button>
+          <el-button v-if="isAuth('work:clt:start') && ((scope.row.state) < 2)" :disabled="Number(scope.row.state) === 0" type="text" size="small" @click="startTask(scope.row.taskId)">开始</el-button>
+          <el-button v-if="isAuth('work:clt:transfer') && Number(scope.row.state) !== 3" type="text" size="small" @click="transferTask(scope.row.taskId, scope.row.workTypeId)">移交</el-button>
+          <el-button v-if="isAuth('work:clt:complete') && Number(scope.row.state) === 2 && (scope.row.nodeType == null || scope.row.nodeType === 'start' || scope.row.nodeType === 'produce')" type="text" size="small" @click="completeTask(scope.row.taskId)">完成</el-button>
+          <el-button v-if="isAuth('work:clt:check') && Number(scope.row.state) === 2 && (scope.row.nodeType === 'check' || scope.row.nodeType === 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 1)">通过</el-button>
+          <el-button v-if="isAuth('work:clt:check') && Number(scope.row.state) === 2 && (scope.row.nodeType === 'check' || scope.row.nodeType === 't-check')" type="text" size="small" @click="checkTask(scope.row.taskId, 2)">不通过</el-button>
+          <el-button v-if="isAuth('work:clt:damage') && Number(scope.row.state) === 2 && (scope.row.nodeType == null || scope.row.nodeType === 'produce')" type="text" size="small" @click="damageTask(scope.row.nodeId, scope.row.productionId)">报损</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -163,13 +148,16 @@
 
     <el-dialog title="检验任务" width="30%" :visible.sync="checkDialogFormVisible">
       <el-form :model="checkDialogForm" :rules="checkDialogFormRules" ref="checkDialogForm">
-        <el-form-item label="检验类型" prop="checkType" label-width="80px">
+        <el-form-item v-if="checkDialogForm.checkType !== '1' && checkDialogForm.checkType !== 1" label="检验类型" prop="checkType" label-width="120px">
            <el-select v-model="checkDialogForm.checkType" placeholder="请选择检验类型" style="width:100%">
             <el-option label="返回上一级" value="2"></el-option>
             <el-option label="报损" value="3"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="备注" prop="notes" label-width="80px">
+        <el-form-item label="通过记录说明" prop="operationRecords" label-width="120px">
+          <el-input v-model="checkDialogForm.operationRecords" type="textarea" :rows="2" placeholder="请输入通过记录说明"></el-input>
+        </el-form-item>
+        <el-form-item label="备注" prop="notes" label-width="120px">
           <el-input v-model="checkDialogForm.notes" type="textarea" :rows="2" placeholder="请输入备注"></el-input>
         </el-form-item>
       </el-form>
@@ -190,6 +178,18 @@
         <el-button type="primary" @click="damageSubmit">确 定</el-button>
       </div>
     </el-dialog>
+
+    <el-dialog title="完成任务" width="30%" :visible.sync="finishDialogFormVisible">
+      <el-form :model="finishDialogForm" :rules="finishDialogFormRules" ref="finishDialogForm">
+        <el-form-item label="通过记录说明" prop="operationRecords" label-width="120px">
+          <el-input v-model="finishDialogForm.operationRecords" type="textarea" :rows="2" placeholder="请输入通过记录说明"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="finishDialogFormVisible = false">取 消</el-button>
+        <el-button type="primary" @click="finishSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
     <!-- 文件预览 -->
     <preview-component v-if="previewVisible" ref="preview"/>
   </div>
@@ -229,6 +229,11 @@ export default {
       ],
       transferDialogFormVisible: false,
       transferDialogForm: {},
+      finishDialogFormVisible: false,
+      finishDialogForm: {},
+      finishDialogFormRules: {
+        operationRecords: [{required: true, message: '通过记录说明不能为空', trigger: 'blur'}]
+      },
       transferUserList: [],
       transferDialogFormRules: {
         transferType: [{required: true, message: '请选择移交类型', trigger: 'blur'}],
@@ -237,9 +242,11 @@ export default {
       checkDialogFormVisible: false,
       checkDialogForm: {
         checkType: '',
+        operationRecords: '',
         notes: ''
       },
       checkDialogFormRules: {
+        operationRecords: [{required: true, message: '通过记录说明不能为空', trigger: 'blur'}],
         checkType: [{required: true, message: '请选择', trigger: 'blur'}]
       },
       damageDialogFormVisible: false,
@@ -358,30 +365,30 @@ export default {
     },
       // 完成
     completeTask (taskId) {
-      this.$confirm('是否完成任务?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        completeTask({taskId}).then(({data}) => {
-          if (data && data.code === '200') {
-            this.$message({
-              type: 'success',
-              message: '操作成功!'
-            })
-            this.getDataList()
-          } else {
-            this.$message({
-              type: 'error',
-              message: data.msg
-            })
-          }
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消'
-        })
+      this.finishDialogFormVisible = true
+      this.finishDialogForm.taskId = taskId
+    },
+    // 确认完成
+    finishSubmit () {
+      this.$refs['finishDialogForm'].validate((valid) => {
+        if (valid) {
+          let submitData = this.finishDialogForm
+          completeTask(submitData).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                type: 'success',
+                message: '操作成功!'
+              })
+              this.finishDialogFormVisible = false
+              this.getDataList()
+            } else {
+              this.$message({
+                type: 'error',
+                message: data.msg
+              })
+            }
+          })
+        }
       })
     },
       // 检验
@@ -397,33 +404,7 @@ export default {
     },
       // 通过
     passTask () {
-      this.$confirm('是否完成任务?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        let submitData = this.checkDialogForm
-        checkTask(submitData).then(({data}) => {
-          if (data && data.code === '200') {
-            this.$message({
-              type: 'success',
-              message: '移交成功!'
-            })
-            this.checkDialogFormVisible = false
-            this.getDataList()
-          } else {
-            this.$message({
-              type: 'error',
-              message: data.msg
-            })
-          }
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消'
-        })
-      })
+      this.checkDialogFormVisible = true
     },
     refuseTask () {
       this.checkDialogFormVisible = true
@@ -452,13 +433,13 @@ export default {
         }
       })
     },
-      // 操作损坏
+    // 操作损坏
     damageTask (nodeId, productionId) {
       this.damageDialogFormVisible = true
       this.damageDialogForm.nodeId = nodeId
       this.damageDialogForm.productionId = productionId
     },
-      // 确认操作损坏
+    // 确认操作损坏
     damageSubmit () {
       this.$refs['damageDialogForm'].validate((valid) => {
         if (valid) {