Browse Source

工单中心

damon227 1 năm trước cách đây
mục cha
commit
7ab06a3e7b

+ 9 - 0
src/api/task.js

@@ -9,6 +9,15 @@ export function getTaskList (params) {
   })
 }
 
+// 我的工单
+export function getMyTaskList (params) {
+  return request({
+    url: request.adornUrl(`/biz-service/WorkController/list/my`),
+    method: 'get',
+    params: params
+  })
+}
+
 // 开始任务
 export function startTask (data) {
   return request({

+ 8 - 0
src/utils/enums.js

@@ -17,3 +17,11 @@ export const rankTypeOption = [
 export const transferTypeOption = [
     { label: '工作转单', value: '1' }
 ]
+
+// 节点状态
+export const nodeStateOPtion = [
+    {label: '等待', value: '0'},
+    {label: '未开始', value: '1'},
+    {label: '进行中', value: '2'},
+    {label: '已完成', value: '3'}
+]

+ 4 - 4
src/views/modules/cus/communicate-add-or-update.vue

@@ -389,7 +389,7 @@
       >
     </span>
     <add-or-update v-if="inboundVisible" ref="inbound" @addItem="addItem" />
-    <worder-add-or-update
+    <worder-add-or-update-dialog
       v-if="worderVisible"
       ref="worder"
       @submit="addWorderItem"
@@ -404,7 +404,7 @@ import { getCustomer, getCoDetail } from '@/api/cus'
 import { getDictList } from '@/api/dict'
 import uploadComponent from '../common/upload-component-v2'
 import AddOrUpdate from '../product/template-add-or-update-v2'
-import WorderAddOrUpdate from '../worder/add-or-update'
+import WorderAddOrUpdateDialog from '../worder/add-or-update-dialog'
 import AttachDetailDialog from '../common/attach-detail-dialog'
 import { taskTypeOption, rankTypeOption } from '@/utils/enums'
 export default {
@@ -412,7 +412,7 @@ export default {
   components: {
     AddOrUpdate,
     uploadComponent,
-    WorderAddOrUpdate,
+    WorderAddOrUpdateDialog,
     AttachDetailDialog
   },
   computed: {
@@ -664,7 +664,7 @@ export default {
     worderAdd () {
       this.worderVisible = true
       this.$nextTick(() => {
-        this.$refs.worder.init(0, null)
+        this.$refs.worder.init(0, null, 'addItem')
       })
     },
     updateWorderHandle (row) {

+ 237 - 0
src/views/modules/worder/add-or-update-dialog.vue

@@ -0,0 +1,237 @@
+<!-- 工单新增或编辑 -->
+<template>
+  <div>
+    <el-dialog
+      :title="!isModify ? '新增工单' : '修改工单'"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible"
+    >
+      <el-form
+        :model="dataForm"
+        :rules="dataRule"
+        ref="dataForm"
+        label-width="120px"
+      >
+        <el-row class="my-row">
+          <el-col :span="8">
+            <el-form-item label="工单类型" prop="taskType">
+              <el-select
+                v-model="dataForm.taskType"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in taskTypeOption"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="工单级别" prop="ranks">
+              <el-select
+                v-model="dataForm.ranks"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in rankTypeOption"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="my-row">
+          <el-col :span="8">
+            <el-form-item label="工单名称" prop="taskName">
+              <el-input
+                v-model="dataForm.taskName"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="工单内容" prop="content">
+              <el-input
+                v-model="dataForm.content"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="要求完成时间" prop="planCompletionTime">
+              <el-date-picker
+                v-model="dataForm.planCompletionTime"
+                value-format="yyyy-MM-dd"
+                type="date"
+                style="width: 100%"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="my-row">
+          <el-col :span="8">
+            <el-form-item label="任务接收人" prop="receiver">
+              <el-select
+                v-model="dataForm.receiver"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in userList"
+                  :key="item.userId"
+                  :label="item.name"
+                  :value="item.userId"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="16">
+            <el-form-item label="备注" prop="notes">
+              <el-input
+                type="textarea"
+                v-model="dataForm.notes"
+                placeholder="备注"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="my-row"> </el-row>
+        <el-row class="my-row">
+          <el-col :span="8">
+            <el-form-item label="工单附件" prop="attachList">
+              <upload-component
+                :display="display"
+                :displayStar="true"
+                :title="'工单附件'"
+                :accept="'*'"
+                v-model="dataForm.attachList"
+                @uploadSuccess="uploadSuccess"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="onChose">取消</el-button>
+        <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import uploadComponent from '../common/upload-component-v2'
+import { getUserList } from '@/api/user'
+import { taskTypeOption, rankTypeOption } from '@/utils/enums'
+export default {
+  name: 'worder-add-or-update',
+  components: { uploadComponent },
+  data () {
+    return {
+      id: 0,
+      type: '',
+      visible: false,
+      isModify: false,
+      display: false,
+      bizType: 1,
+      dataForm: {},
+      attachList: [],
+      userList: [],
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption,
+      dataRule: {
+        taskCode: [
+          { required: true, message: '请输入工单编码', trigger: 'blur' }
+        ],
+        taskType: [
+          { required: true, message: '请选择工单类型', trigger: 'change' }
+        ],
+        ranks: [
+          { required: true, message: '请选择工单级别', trigger: 'change' }
+        ],
+        taskName: [
+          { required: true, message: '请输入工单名称', trigger: 'blur' }
+        ],
+        content: [
+          { required: true, message: '请输入工单内容', trigger: 'blur' }
+        ],
+        planCompletionTime: [
+          { required: true, message: '请选择要求完成时间', trigger: 'blur' }
+        ],
+        receiver: [
+          { required: true, message: '请输入工单任务接收人', trigger: 'blur' }
+        ],
+        attachList: [
+          { required: true, message: '请上传附件', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  methods: {
+    onChose () {
+      this.$emit('onChose')
+      this.visible = false
+    },
+    // 初始化。type:{addItem:仅回调方法返回数据,update:调用接口更新}
+    async init (id, item, type) {
+      this.id = id || 0
+      this.type = type
+      if (item) {
+        this.isModify = true
+        if (item.attachList) {
+          item.attachList.map(t => {
+            if (t.fileName) { t.name = t.fileName }
+          })
+        }
+        this.dataForm = item
+      } else {
+        this.isModify = false
+        this.dataForm = {
+          recordId: Math.round(Math.random() * 1000000)
+        }
+      }
+      this.userList = []
+      this.attachList = []
+      this.visible = true
+      await getUserList().then(({ data }) => {
+        if (data && data.code === '200') {
+          this.userList = data.data.records
+        }
+      })
+    },
+    // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          this.visible = false
+          this.dataForm.receiverName = this.userList.find(
+            (t) => t.userId === this.dataForm.receiver
+          ).name
+          if (this.type === 'addItem') {
+            this.$emit('submit', this.dataForm)
+          } else if (this.type === 'update') {
+
+          }
+        }
+      })
+    },
+    prodSelected (item) {
+      this.dataForm.productId = item.value
+      this.dataForm.relatedProduct = item.label
+    },
+    uploadSuccess (fileList) {
+      this.attachList = fileList
+    }
+  }
+}
+</script>
+
+<style scoped></style>

+ 32 - 21
src/views/modules/worder/add-or-update.vue

@@ -1,12 +1,6 @@
 <!-- 工单新增或编辑 -->
 <template>
-  <div class="product-template">
-    <el-dialog
-      :title="!isModify ? '新增工单' : '修改工单'"
-      width="70%"
-      :close-on-click-modal="false"
-      :visible.sync="visible"
-    >
+  <div>
       <el-form
         :model="dataForm"
         :rules="dataRule"
@@ -14,14 +8,6 @@
         label-width="120px"
       >
         <el-row class="my-row">
-          <!-- <el-col :span="8">
-            <el-form-item label="工单编码" prop="taskCode">
-              <el-input
-                v-model="dataForm.taskCode"
-                placeholder="请输入"
-              ></el-input>
-            </el-form-item>
-          </el-col> -->
           <el-col :span="8">
             <el-form-item label="工单类型" prop="taskType">
               <el-select
@@ -127,11 +113,10 @@
           </el-col>
         </el-row>
       </el-form>
-      <span slot="footer">
+      <span slot="footer" class="dialog-footer">
         <el-button @click="onChose">取消</el-button>
         <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
       </span>
-    </el-dialog>
   </div>
 </template>
 
@@ -145,6 +130,7 @@ export default {
   data () {
     return {
       id: 0,
+      type: '',
       visible: false,
       isModify: false,
       display: false,
@@ -184,12 +170,13 @@ export default {
   },
   methods: {
     onChose () {
+      this.$emit('onChose')
       this.visible = false
     },
-    // 初始化
-    async init (id, item) {
-      console.log(item)
+    // 初始化。type:{addItem:仅回调方法返回数据,update:调用接口更新}
+    async init (id, item, type) {
       this.id = id || 0
+      this.type = type
       if (item) {
         this.isModify = true
         if (item.attachList) {
@@ -221,7 +208,31 @@ export default {
           this.dataForm.receiverName = this.userList.find(
             (t) => t.userId === this.dataForm.receiver
           ).name
-          this.$emit('submit', this.dataForm)
+          if (this.type === 'addItem') {
+            this.$emit('submit', this.dataForm)
+          } else if (this.type === 'update') {
+            this.$http({
+              url: !this.id
+              ? this.$http.adornUrl(`/biz-service//WorkController/add`)
+              : this.$http.adornUrl(`/biz-service/WorkController/update`),
+              method: 'post',
+              data: this.$http.adornData({ ...this.dataForm })
+            }).then(({ data }) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                    this.$emit('refreshDataList')
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
         }
       })
     },

+ 339 - 0
src/views/modules/works/work-center.vue

@@ -0,0 +1,339 @@
+<template>
+  <div class="stock">
+    <template v-if="!addOrUpdateVisible">
+        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
+        <el-form-item label="工单名称">
+          <el-input v-model="dataForm.taskName" placeholder="工单名称" clearable/>
+        </el-form-item>
+        <el-form-item label="内容">
+          <el-input
+            v-model="dataForm.content"
+            placeholder=""
+            clearable
+          />
+        </el-form-item>
+        <el-form-item label="工单类型">
+          <el-select v-model="dataForm.taskType" filterable remote clearable placeholder="请选择">
+            <el-option
+                v-for="item in taskTypeOption"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="接收人">
+            <user-component
+            v-model="dataForm.receiver"
+            :user-id="dataForm.receiver"
+            @userSelected="userChanged"
+            />
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="getDataList()">查询</el-button>
+          <el-button v-if="isAuth('workcenter:clt:add')" type="primary" @click="addOrUpdateHandle('', null)">新增</el-button>
+        </el-form-item>
+      </el-form>
+      <el-table :data="dataList" border v-loading="dataListLoading" style="width:100%">
+        <el-table-column label="序号" type="index" width="50" align="center">
+        </el-table-column>
+        <el-table-column
+            prop="taskCode"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="工单编码"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="ranks"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="工单级别"
+        >
+            <template slot-scope="scope">
+                 <span>{{
+                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1 
+                ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
+                : ''
+              }}</span>
+            </template>
+        </el-table-column>
+        <el-table-column
+            prop="taskType"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="工单类型"
+        >
+            <template slot-scope="scope">
+                <span>{{
+                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1 
+                ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
+                : ''
+              }}</span>
+            </template>
+        </el-table-column>
+        <el-table-column
+            prop="taskName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="工单名称"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="content"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="工单内容"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="planCompletionTime"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="规定完成时间"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="taskCode"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="工单附件"
+        >
+            <template slot-scope="scope">
+                <el-button
+                  :disabled="
+                    !scope.row.attachListVo || scope.row.attachListVo.length === 0
+                  "
+                  type="text"
+                  size="small"
+                  @click="attachDetails(scope.row.attachListVo)"
+                  >查看</el-button
+                >
+            </template>
+        </el-table-column>
+        <el-table-column
+            prop="remark"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="备注"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="state"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="状态"
+        >
+            <template slot-scope="scope">
+                <span>{{
+                nodeStateOPtion.findIndex((t) => t.value == scope.row.state) > -1 
+                ? nodeStateOPtion.find((t) => t.value == scope.row.state).label
+                : ''
+              }}</span>
+            </template>
+        </el-table-column>
+        <el-table-column
+            prop="dispatcherName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="派发人"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="dispatcherOrgName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="派发部门"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="createTime"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="派发时间"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="receiverName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="接收人"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="receiverOrgName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="接收部门"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="endTime"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="完成时间"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="operationRecords"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="完成记录"
+        >
+        </el-table-column>
+        <el-table-column
+            fixed="right"
+            header-align="center"
+            align="center"
+            width="180"
+            label="操作"
+        >
+            <template slot-scope="scope">
+                <el-button
+                    type="text"
+                    size="small"
+                    @click="showDetail(scope.row.taskId)"
+                    >查看</el-button>
+                <el-button
+                    v-if="isAuth('work:clt:start')"
+                    type="text"
+                    size="small"
+                    @click="addOrUpdateHandle(scope.row.taskId, scope.row)"
+                    >编辑</el-button>
+            </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        @size-change="sizeChangeHandle"
+        @current-change="currentChangeHandle"
+        :current-page="pageIndex"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="pageSize"
+        :total="totalPage"
+        layout="total, sizes, prev, pager, next, jumper"
+        >
+        </el-pagination>
+    </template>
+    <attach-detail-dialog ref="attachDetail" />
+    <worder-add-or-update v-if="addOrUpdateVisible" ref="worder" @onChose="onChose" />
+  </div>
+</template>
+
+<script>
+import {
+  getTaskList
+} from '@/api/task'
+import {taskTypeOption, rankTypeOption, nodeStateOPtion} from '@/utils/enums'
+import UserComponent from '@/views/modules/common/user-component'
+import AttachDetailDialog from '../common/attach-detail-dialog'
+import WorderAddOrUpdate from '../worder/add-or-update'
+export default {
+  name: 'works-work-center',
+  components: {UserComponent, AttachDetailDialog, WorderAddOrUpdate},
+  data () {
+    return {
+      addOrUpdateVisible: false,
+      dataListLoading: false,
+      pageIndex: 1,
+      pageSize: 10,
+      totalPage: 0,
+      dataForm: {},
+      dataList: [],
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption,
+      nodeStateOPtion: nodeStateOPtion
+    }
+  },
+  created () {
+    this.getDataList()
+  },
+  methods: {
+    onChose () {
+      this.addOrUpdateVisible = false
+    },
+    userChanged (val) {
+    //   this.dataForm.userId = val
+    //   this.getDataList()
+    },
+    // 每页数
+    sizeChangeHandle (val) {
+      this.pageSize = val
+      this.pageIndex = 1
+      this.getDataList()
+    },
+    // 当前页
+    currentChangeHandle (val) {
+      this.pageIndex = val
+      this.getDataList()
+    },
+    getDataList () {
+      this.dataListLoading = true
+      let params = {
+        current: this.pageIndex,
+        size: this.pageSize,
+        ...this.dataForm
+      }
+      getTaskList(params).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.dataList = data.data.records
+          this.totalPage = Number(data.data.total)
+        } else {
+          this.dataList = []
+          this.totalPage = 0
+        }
+        this.dataListLoading = false
+      })
+    },
+    showDetail () {
+    },
+    addOrUpdateHandle (taskId, item) {
+      this.addOrUpdateVisible = true
+      this.$nextTick(() => {
+        this.$refs.worder.init(taskId, item, 'update')
+      })
+    },
+    startTask () {},
+    attachDetails (attachList) {
+      this.$refs.attachDetail.init(attachList)
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>

+ 2 - 2
src/views/modules/works/work.vue

@@ -447,7 +447,7 @@
 
 <script>
 import {
-  getTaskList,
+  getMyTaskList,
   startTask,
   transferTask,
   completeTask,
@@ -596,7 +596,7 @@ export default {
         state: this.dataForm.state,
         userId: this.dataForm.userId ? this.dataForm.userId : null
       }
-      getTaskList(params).then(({ data }) => {
+      getMyTaskList(params).then(({ data }) => {
         if (data && data.code === '200') {
           this.dataList = data.data.records
           this.totalPage = Number(data.data.total)