Browse Source

项目登记功能

lizhenhao 2 years atrás
parent
commit
4314abd349

+ 46 - 0
src/api/cw/projectRecords/ProjectRecordsService.js

@@ -0,0 +1,46 @@
+import request from '@/utils/httpRequest'
+
+export default class ProjectRecordsService {
+  list (params) {
+    return request({
+      url: '/cwProjectRecords/list',
+      method: 'get',
+      params: params
+    })
+  }
+  queryById (id) {
+    return request({
+      url: '/cwProjectRecords/queryById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  save (inputForm) {
+    return request({
+      url: `/cwProjectRecords/save`,
+      method: 'post',
+      data: inputForm
+    })
+  }
+  saveForm (inputForm) {
+    return request({
+      url: `/cwProjectRecords/saveForm`,
+      method: 'post',
+      data: inputForm
+    })
+  }
+  delete (ids) {
+    return request({
+      url: '/cwProjectRecords/delete',
+      method: 'delete',
+      params: {ids: ids}
+    })
+  }
+  updateStatusById (data) {
+    return request({
+      url: '/cwProjectRecords/updateStatusById',
+      method: 'post',
+      data: data
+    })
+  }
+}

+ 572 - 0
src/views/modules/cw/projectRecords/ProjectRecordsForm.vue

@@ -0,0 +1,572 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1200px"
+      height="500px"
+      @close="close"
+      @keyup.enter.native=""
+      :visible.sync="visible">
+    <el-row>
+      <el-col :span="24">
+
+        <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method === 'view'"
+                     label-width="135px" @submit.native.prevent>
+              <el-row  :gutter="15">
+                <el-col :span="12">
+                  <el-form-item label="项目名称" prop="projectName"
+                                :rules="[
+                                {required: true, message:'项目名称不能为空', trigger:'blur'}
+                   ]">
+                    <el-input v-model="inputForm.projectName" placeholder="请填写项目名称" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目编号" prop="projectNumber"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.projectNumber" placeholder="请填写项目编号" ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目所属部门" prop="officeId"
+                                :rules="[
+                                {required: true, message:'项目所属部门不能为空', trigger:'blur'}
+                   ]">
+                    <SelectTree
+                      ref="officeTree"
+                      :props="{
+                          value: 'id',             // ID字段名
+                          label: 'name',         // 显示名称
+                          children: 'children'    // 子级字段名
+                        }"
+                      :url="`/sys/office/treeData?type=2`"
+                      :value="inputForm.officeId"
+                      :accordion="true"
+                      size="large"
+                      @getValue="(value) => {inputForm.officeId=value}"/>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目金额" prop="projectMoney"
+                                :rules="[
+                   ]">
+                    <el-input-number
+                      v-model="inputForm.projectMoney"
+                      controls-position="right"
+                      style="width:100%"
+                      :precision="2"
+                      :max="9999999999"
+                      :step="0.01"
+                      :min="0"
+                      placeholder="请填写项目金额"
+                      :controls="false"
+                      >
+                    </el-input-number>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="审计期间" prop="auditYear"
+                                :rules="[
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.auditYear"
+                      type="year"
+                      value-format="yyyy"
+                      placeholder="选择评审计期间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      >
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目预计开始时间" prop="planStartDate"
+                                :rules="[
+                                {required: true, message:'项目预计开始时间不能为空', trigger:'blur'}
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.planStartDate"
+                      type="date"
+                      value-format="yyyy-MM-dd"
+                      placeholder="选择项目预计开始时间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      >
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目预计结束时间" prop="planEndDate"
+                                :rules="[
+                                {required: true, message:'项目预计结束时间不能为空', trigger:'blur'}
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.planEndDate"
+                      type="date"
+                      value-format="yyyy-MM-dd"
+                      placeholder="选择项目预计结束时间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      >
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目经理" prop="projectMasterId"
+                                :rules="[
+                                {required: true, message:'项目经理不能为空', trigger:'blur'}
+                   ]">
+                    <!--                    <el-input v-model="inputForm.projectMasterId" placeholder="请填写项目经理" clearable></el-input>-->
+                    <UserSelect size="medium" :disabled="method === 'view'" :limit='1' :value="inputForm.projectMasterId" @getValue='(value) => {inputForm.projectMasterId = value}'></UserSelect>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="现场负责人" prop="projectLeaderId"
+                                :rules="[
+                   ]">
+                    <UserSelect size="medium" :disabled="method === 'view'" :limit='1' :value="inputForm.projectLeaderId" @getValue='(value) => {inputForm.projectLeaderId = value}'></UserSelect>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="创建人" prop="createBy.name"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.createBy.name" placeholder="请填写创建人" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="创建时间" prop="createDate"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.createDate" placeholder="请填写创建时间" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </el-form>
+        <el-tabs v-model="activeName" type="border-card" @tab-click="tabHandleClick">
+          <el-tab-pane label="被服务单位" name="client">
+            <el-row :gutter="15">
+              <el-button type="info" style="margin-bottom: 15px" size="mini" :disabled="method === 'view'" @click="openWorkClient">
+                新增被服务单位
+              </el-button>
+            </el-row>
+            <el-row  :gutter="15">
+              <el-form :disabled="method === 'view'">
+                <vxe-table
+                  border
+                  show-overflow
+                  show-footer
+                  :column-config="{resizable: true}"
+                  ref="clientTable"
+                  :key="tableKeyClient"
+                  class="vxe-table-element"
+                  :data="inputForm.cwProjectClientInfoDTOList"
+                  style=""
+                  @cell-click=""
+                  @edit-closed=""
+                  highlight-current-row
+                  :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: false}"
+                >
+                  <vxe-table-column align="center" field="no" title="客户编号" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.no" placeholder="客户编号" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" field="name" title="客户名称" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.name" placeholder="客户名称" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" field="companyLevel" title="层级" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.companyLevel" placeholder="层级" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" title="操作" width="100">
+                    <template v-slot="scope">
+                      <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'client')">删除</el-button>
+                    </template>
+                  </vxe-table-column>
+                </vxe-table>
+              </el-form>
+            </el-row>
+          </el-tab-pane>
+          <el-tab-pane label="附件" name="files">
+            <!--        附件-->
+            <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+          </el-tab-pane>
+
+        </el-tabs>
+      </el-col>
+    </el-row>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" v-if="method === 'edit'" type="primary" icon="el-icon-circle-check" @click="doSubmit('save')">确定</el-button>
+    </span>
+    <WorkClientChooseForm ref="workClientChooseForm" @getWorkClientChoose="getWorkClientChoose"></WorkClientChooseForm>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import UserSelect from '@/components/userSelect'
+  import ProjectRecordsService from '@/api/cw/projectRecords/ProjectRecordsService'
+  import EnterpriseSearchService from '@/api/cw/common/EnterpriseSearchService'
+  import WorkClientChooseForm from '../workClientInfo/WorkClientChooseForm'
+  export default {
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    data () {
+      return {
+        title: '',
+        method: '',
+        loading: false,
+        inputForm: {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: ''
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        },
+        keyWatch: '',
+        activeName: 'client',
+        tableKey: '',
+        tableKeyClient: '1',
+        visible: false
+      }
+    },
+    projectRecordsService: null,
+    enterpriseSearchService: null,
+    created () {
+      this.enterpriseSearchService = new EnterpriseSearchService()
+      this.projectRecordsService = new ProjectRecordsService()
+    },
+    computed: {
+      bus: {
+        get () {
+          this.$refs.uploadComponent.setDividerName('附件', false)
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      }
+    },
+    components: {
+      SelectUserTree,
+      UpLoadComponent,
+      SelectTree,
+      UserSelect,
+      WorkClientChooseForm
+    },
+    methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
+      init (method, id) {
+        this.visible = true
+        if (method === 'edit') {
+          this.title = '项目信息修改'
+          this.method = method
+        } else {
+          this.title = '项目详情'
+          this.method = 'view'
+        }
+        this.activeName = 'client'
+        this.projectRecordsService = new ProjectRecordsService()
+        this.method = method
+        this.inputForm = {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: JSON.parse(localStorage.getItem('user')).name
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        }
+        this.inputForm.id = id
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = true
+          this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+            this.$refs.uploadComponent.clearUpload()
+            this.inputForm = this.recover(this.inputForm, data)
+            this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+            if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList)) {
+              this.inputForm.workAttachmentDtoList = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.createDate)) {
+              this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+            }
+            if (this.commonJS.isEmpty(this.inputForm.createBy.name)) {
+              this.inputForm.createBy.name = JSON.parse(localStorage.getItem('user')).name
+            }
+            if (this.commonJS.isEmpty(this.inputForm.officeId)) {
+              this.inputForm.officeId = JSON.parse(localStorage.getItem('user')).officeDTO.id
+            }
+            // if (this.formReadOnly) {
+            //   this.method = 'view'
+            // }
+            this.$refs.uploadComponent.newUpload(this.method, this.inputForm.workAttachmentDtoList, 'cw_project_records', null, null, null, null, false)
+            if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+              this.inputForm.cwProjectClientInfoDTOList = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectMasterId)) {
+              this.inputForm.projectMasterId = JSON.parse(localStorage.getItem('user')).id
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectLeaderId)) {
+              this.inputForm.projectLeaderId = JSON.parse(localStorage.getItem('user')).id
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectMoney)) {
+              this.inputForm.projectMoney = 0
+            }
+            this.loading = false
+          })
+        })
+      },
+      saveForm (callback) {
+        this.doSubmit('save', callback)
+      },
+      startForm (callback) {
+        this.doSubmit('start', callback)
+      },
+      async agreeForm (callback) {
+        await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+          if (this.inputForm.status !== '2') { // 审核状态不是“待审核”,就弹出提示
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error()
+          } else {
+            this.doSubmit('agree', callback)
+          }
+        })
+      },
+      // 表单提交
+      doSubmit (status, callback) {
+        if (status === 'save') {
+          // 暂存
+          // this.inputForm.status = '1'
+          this.loading = true
+          if (this.$refs.uploadComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
+          this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+          // this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+          this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
+            // callback(data.businessTable, data.businessId, this.inputForm)
+            this.close()
+            this.loading = false
+          }).catch(() => {
+            this.loading = false
+          })
+          return
+        } else if (status === 'start') {
+          // 送审  待审核
+          this.inputForm.status = '2'
+        } else if (status === 'agree') {
+          // 审核同意
+          this.inputForm.agreeDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+          this.inputForm.agreeUserId = this.$store.state.user.id
+          this.inputForm.status = '5'
+        }
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+            if (this.commonJS.isEmpty(this.inputForm.createDate)) {
+              this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+            }
+            this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      async updateStatusById (type) {
+        if (type === 'reject' || type === 'reback') {
+          if (await this.$refs.uploadComponent.checkProgress()) {
+            this.loading = false
+            throw new Error()
+          }
+          await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+            if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
+              this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+              throw new Error()
+            } else {
+              if (type === 'reject') {
+                // 驳回
+                this.inputForm.status = '4'
+                let param = {status: '4', id: this.inputForm.id}
+                this.projectRecordsService.updateStatusById(param)
+              }
+              if (type === 'reback') {
+                // 撤回
+                let param = {status: '3', id: this.inputForm.id}
+                this.projectRecordsService.updateStatusById(param)
+              }
+            }
+          })
+        }
+      },
+      close () {
+        this.inputForm = {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: ''
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        }
+        this.$refs.uploadComponent.clearUpload()
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      },
+      tabHandleClick (event) {
+        // console.log(event)
+      },
+      // 新增
+      // eslint-disable-next-line no-dupe-keys
+      insertEvent (type) {
+        if (type === 'client') {
+          let d = {
+            no: '',
+            name: '',
+            companyLevel: ''
+          }
+          if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+            this.inputForm.cwProjectClientInfoDTOList = []
+          }
+          this.$refs.clientTable.insertAt(d)
+          this.inputForm.cwProjectClientInfoDTOList.push(d)
+          this.tableKeyClient = Math.random()
+        }
+      },
+      // 删除
+      removeEvent (row, rowIndex, type) {
+        if (type === 'client') {
+          this.$refs.clientTable.remove(row)
+          this.inputForm.cwProjectClientInfoDTOList.splice(rowIndex, 1)
+        }
+      },
+      openWorkClient () {
+        this.$refs.workClientChooseForm.init()
+      },
+      getWorkClientChoose (list) {
+        if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+          this.inputForm.cwProjectClientInfoDTOList = []
+        }
+        let _this = this
+        let _list = list
+        const waitForEach = function () {
+          return new Promise(function (resolve, reject) {
+            _list.forEach((item) => {
+              _this.inputForm.cwProjectClientInfoDTOList.forEach(client => {
+                if (item.no === client.no) {
+                  _this.$message.error('已存在客户 “' + client.name + '”,请重新选择')
+                  throw new Error('已存在客户 “' + client.name + '”,请重新选择')
+                }
+              })
+            })
+            resolve()
+          })
+        }
+        waitForEach().then(() => {
+          list.forEach(item => {
+            this.$refs.clientTable.insertAt(item)
+            this.inputForm.cwProjectClientInfoDTOList.push(item)
+            this.tableKeyClient = Math.random()
+          })
+        })
+      }
+    }
+  }
+</script>
+<style scoped>
+  /deep/ .el-input-number .el-input__inner {
+    text-align: left;
+  }
+</style>

+ 352 - 0
src/views/modules/cw/projectRecords/ProjectRecordsList.vue

@@ -0,0 +1,352 @@
+<template>
+  <div class="page">
+    <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+      <!-- 搜索框-->
+      <el-form-item label="项目名称" prop="projectName">
+        <el-input size="small" v-model="searchForm.projectName" placeholder="请输入项目名称" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="项目编号" prop="projectNumber">
+        <el-input size="small" v-model="searchForm.projectNumber" placeholder="请输入项目编号" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="项目经理" prop="projectMasterName">
+        <el-input size="small" v-model="searchForm.projectMasterName" placeholder="请输入项目经理" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createDates">
+        <el-date-picker
+          placement="bottom-start"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          v-model="searchForm.createDates"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="searchForm.status" placeholder="请选择" style="width:100%;"clearable>
+          <el-option
+            v-for="item in $dictUtils.getDictList('cw_status')"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
+        <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <div class="bg-white top" style="">
+      <vxe-toolbar :refresh="{query: refreshList}" custom>
+        <template #buttons>
+          <el-button v-if="hasPermission('cwProjectRecords:add')" type="primary" size="small" icon="el-icon-plus" @click="start()">新建</el-button>
+          <!--          <el-button v-if="hasPermission('klg:question:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.questionsTable && $refs.questionsTable.getCheckboxRecords().length === 0" plain>删除</el-button>-->
+        </template>
+      </vxe-toolbar>
+      <div style="height: calc(100% - 90px)">
+        <vxe-table
+          :key="tableKey"
+          border="inner"
+          auto-resize
+          resizable
+          height="auto"
+          :loading="loading"
+          size="small"
+          ref="projectTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          @sort-change="sortChangeHandle"
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :checkbox-config="{}">
+          <vxe-column type="seq" width="60" title="序号"></vxe-column>
+          <vxe-column min-width="230" align="center" title="项目名称" field="projectName">
+            <template slot-scope="scope">
+              <el-link  type="primary" :underline="false" v-if="hasPermission('cwProjectRecords:view')" @click="view(scope.row.id)">{{scope.row.projectName}}</el-link>
+              <el-link  type="primary" :underline="false" v-else-if="hasPermission('cwProjectRecords:view')"  @click="view(scope.row.id,)">{{scope.row.projectName}}</el-link>
+              <span v-else>{{scope.row.projectName}}</span>
+            </template>
+          </vxe-column>
+          <vxe-column min-width="160" align="center" title="项目编号" field="projectNumber"></vxe-column>
+          <vxe-column min-width="160" align="center" title="项目经理" field="projectMasterName"></vxe-column>
+          <vxe-column min-width="160" align="center" title="创建人" field="createBy.name"></vxe-column>
+          <vxe-column min-width="160" align="center" title="创建时间" field="createDate"></vxe-column>
+          <vxe-column  min-width="150px"align="center" fixed="right" title="状态" field="status" >
+            <template slot-scope="scope">
+              <el-button  type="text" @click="detail(scope.row)" effect="dark" size="mini"
+                          :type="$dictUtils.getDictLabel('cw_status_flag', scope.row.status, '-')">
+                {{$dictUtils.getDictLabel("cw_status", scope.row.status, '-')}}
+              </el-button>
+            </template>
+          </vxe-column>
+          <vxe-column title="操作" width="150px" fixed="right" align="center">
+            <template  slot-scope="scope">
+              <el-button v-if="hasPermission('cwProjectRecords:edit')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text" icon="el-icon-edit" size="small" @click="push(scope.row)">修改</el-button>
+              <el-button v-else-if="hasPermission('cwProjectRecords:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('cwProjectRecords:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='2'" type="text" icon="el-icon-edit" size="small" @click="reback(scope.row)">撤回</el-button>
+              <el-button v-if="hasPermission('cwProjectRecords:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('cwProjectRecords:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+            </template>
+          </vxe-column>
+        </vxe-table>
+        <vxe-pager
+          background
+          size="small"
+          :current-page="tablePage.currentPage"
+          :page-size="tablePage.pageSize"
+          :total="tablePage.total"
+          :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+          @page-change="currentChangeHandle">
+        </vxe-pager>
+      </div>
+    </div>
+    <ProjectRecordsForm ref="projectRecordsForm"></ProjectRecordsForm>
+  </div>
+</template>
+
+<script>
+  import ProjectRecordsService from '@/api/cw/projectRecords/ProjectRecordsService'
+  import TaskService from '@/api/flowable/TaskService'
+  import ProcessService from '@/api/flowable/ProcessService'
+  import ProjectRecordsForm from './ProjectRecordsForm'
+  import pick from 'lodash.pick'
+  import UserService from '@/api/sys/UserService'
+  export default {
+    data () {
+      return {
+        searchForm: {
+          projectMasterName: '',
+          projectNumber: '',
+          projectName: '',
+          createDates: [],
+          status: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        tableKey: '',
+        loading: false,
+        processDefinitionAuditId: '',
+        procDefAuditKey: '',
+        isAdmin: false
+      }
+    },
+    projectRecordsService: null,
+    taskService: null,
+    processService: null,
+    userService: null,
+    created () {
+      this.projectRecordsService = new ProjectRecordsService()
+      this.taskService = new TaskService()
+      this.processService = new ProcessService()
+      this.userService = new UserService()
+    },
+    components: {
+      ProjectRecordsForm
+    },
+    computed: {
+      userName () {
+        return JSON.parse(localStorage.getItem('user')).name
+      },
+      user () {
+        this.createName = JSON.parse(localStorage.getItem('user')).name
+        return JSON.parse(localStorage.getItem('user'))
+      }
+    },
+    mounted () {
+      this.refreshList()
+    },
+    activated () {
+      this.refreshList()
+    },
+    methods: {
+      // 新增
+      add () {
+        this.$refs.projectRecordsForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.projectTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.projectRecordsForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.projectRecordsForm.init('view', id)
+      },
+      // 查询当前用户是否是管理员用户
+      checkIsAdmin () {
+        this.userService.is().then(({data}) => {
+          this.isAdmin = data
+        })
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.projectRecordsService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.tableKey = Math.random()
+          this.loading = false
+        })
+        this.checkIsAdmin()
+        this.processService.getByName('财务-项目登记').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionAuditId = data.id
+            this.procDefAuditKey = data.key
+          }
+        })
+      },
+      // 当前页
+      currentChangeHandle ({ currentPage, pageSize }) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.refreshList()
+      },
+      // 排序
+      sortChangeHandle (column) {
+        this.tablePage.orders = []
+        if (column.order != null) {
+          this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
+        }
+        this.refreshList()
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.projectTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.projectRecordsService.delete(ids).then(({data}) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      },
+      start () {
+        // 读取流程表单
+        let tabTitle = `发起流程【项目登记】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [项目登记]`
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
+          status: 'startAndHold'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                procDefId: this.processDefinitionAuditId,
+                procDefKey: this.procDefAuditKey,
+                status: 'startAndHold',
+                title: tabTitle,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessId: 'false',
+                isShow: false,
+                routePath: '/cw/projectRecords/ProjectRecordsList'
+              }
+            })
+          })
+      },
+      // 发起项目登记
+      push (row) {
+        // 读取流程表单
+        let title = `发起流程【项目登记】`
+        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[项目登记]`
+        let status = 'startAndHold'
+        if (row.status === '3' || row.status === '4') {
+          status = 'startAndClose'
+        }
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
+          businessId: row.id,
+          businessTable: 'cw_project_records'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                procDefId: this.processDefinitionAuditId,
+                procDefKey: this.procDefAuditKey,
+                title: title,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessTable: 'cw_project_records',
+                businessId: row.id,
+                isShow: 'false',
+                status: status,
+                routePath: '/cw/projectRecords/ProjectRecordsList'
+              }
+            })
+          })
+      },
+      // 查看项目登记流程结果
+      detail (row) {
+        if (row.status !== '0' && row.status !== '1') {
+          // eslint-disable-next-line eqeqeq
+          this.taskService.getTaskDef({
+            procInsId: row.procInsId,
+            procDefId: this.processDefinitionAuditId
+          }).then(({data}) => {
+            this.$router.push({
+              path: '/flowable/task/TaskFormDetail',
+              query: {
+                isShow: 'false',
+                readOnly: true,
+                title: '项目登记' + '流程详情',
+                formTitle: '项目登记' + '流程详情',
+                businessId: row.id,
+                status: 'reback',
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+              }
+            })
+          })
+        }
+      },
+      // 撤回项目登记
+      reback (row) {
+        this.$confirm(`确定要撤回该申请吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(async () => {
+          await this.projectRecordsService.queryById(row.id).then(({data}) => {
+            if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+              this.$message.error('数据已发生改变或不存在,请刷新数据')
+              this.refreshList()
+            } else {
+              this.processService.revokeProcIns(row.procInsId).then(({data}) => {
+                let form = {status: '3', id: row.id}
+                this.projectRecordsService.updateStatusById(form)
+                this.$message.success(data)
+                this.refreshList()
+              })
+            }
+          })
+        })
+      }
+    }
+  }
+</script>

+ 547 - 0
src/views/modules/cw/projectRecords/ProjectRecordsTaskForm.vue

@@ -0,0 +1,547 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+  <div>
+    <el-row>
+      <el-col :span="24">
+
+        <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="formReadOnly"
+                     label-width="135px" @submit.native.prevent>
+              <el-row  :gutter="15">
+                <el-col :span="12">
+                  <el-form-item label="项目名称" prop="projectName"
+                                :rules="[
+                                {required: true, message:'项目名称不能为空', trigger:'blur'}
+                   ]">
+                    <el-input v-model="inputForm.projectName" placeholder="请填写项目名称" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目编号" prop="projectNumber"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.projectNumber" placeholder="请填写项目编号" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目所属部门" prop="officeId"
+                                :rules="[
+                                {required: true, message:'项目所属部门不能为空', trigger:'blur'}
+                   ]">
+                    <SelectTree
+                      ref="officeTree"
+                      :props="{
+                          value: 'id',             // ID字段名
+                          label: 'name',         // 显示名称
+                          children: 'children'    // 子级字段名
+                        }"
+                      :url="`/sys/office/treeData?type=2`"
+                      :value="inputForm.officeId"
+                      :accordion="true"
+                      size="large"
+                      @getValue="(value) => {inputForm.officeId=value}"/>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目金额" prop="projectMoney"
+                                :rules="[
+                   ]">
+                    <el-input-number
+                      v-model="inputForm.projectMoney"
+                      controls-position="right"
+                      style="width:100%"
+                      :precision="2"
+                      :max="9999999999"
+                      :step="0.01"
+                      :min="0"
+                      placeholder="请填写项目金额"
+                      :controls="false"
+                      clearable>
+                    </el-input-number>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="审计期间" prop="auditYear"
+                                :rules="[
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.auditYear"
+                      type="year"
+                      value-format="yyyy"
+                      placeholder="选择评审计期间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      clearable>
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目预计开始时间" prop="planStartDate"
+                                :rules="[
+                                {required: true, message:'项目预计开始时间不能为空', trigger:'blur'}
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.planStartDate"
+                      type="date"
+                      value-format="yyyy-MM-dd"
+                      placeholder="选择项目预计开始时间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      clearable>
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目预计结束时间" prop="planEndDate"
+                                :rules="[
+                                {required: true, message:'项目预计结束时间不能为空', trigger:'blur'}
+                   ]">
+                    <el-date-picker
+                      v-model="inputForm.planEndDate"
+                      type="date"
+                      value-format="yyyy-MM-dd"
+                      placeholder="选择项目预计结束时间"
+                      style="width:100%"
+                      placement="bottom-start"
+                      clearable>
+                    </el-date-picker>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="项目经理" prop="projectMasterId"
+                                :rules="[
+                                {required: true, message:'项目经理不能为空', trigger:'blur'}
+                   ]">
+<!--                    <el-input v-model="inputForm.projectMasterId" placeholder="请填写项目经理" clearable></el-input>-->
+                    <UserSelect size="medium" :disabled="formReadOnly" :limit='1' :value="inputForm.projectMasterId" @getValue='(value) => {inputForm.projectMasterId = value}'></UserSelect>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="现场负责人" prop="projectLeaderId"
+                                :rules="[
+                   ]">
+                    <UserSelect size="medium" :disabled="formReadOnly" :limit='1' :value="inputForm.projectLeaderId" @getValue='(value) => {inputForm.projectLeaderId = value}'></UserSelect>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="创建人" prop="createBy.name"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.createBy.name" placeholder="请填写创建人" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="创建时间" prop="createDate"
+                                :rules="[
+                   ]">
+                    <el-input :disabled="true" v-model="inputForm.createDate" placeholder="请填写创建时间" clearable></el-input>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </el-form>
+        <el-tabs v-model="activeName" type="border-card" @tab-click="tabHandleClick">
+          <el-tab-pane label="被服务单位" name="client">
+            <el-row :gutter="15">
+              <el-button type="info" style="margin-bottom: 15px" size="mini" :disabled="formReadOnly" @click="openWorkClient">
+                新增被服务单位
+              </el-button>
+            </el-row>
+            <el-row  :gutter="15">
+              <el-form :disabled="formReadOnly">
+                <vxe-table
+                  border
+                  show-overflow
+                  show-footer
+                  :column-config="{resizable: true}"
+                  ref="clientTable"
+                  :key="tableKeyClient"
+                  class="vxe-table-element"
+                  :data="inputForm.cwProjectClientInfoDTOList"
+                  style=""
+                  @cell-click=""
+                  @edit-closed=""
+                  highlight-current-row
+                  :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: false}"
+                >
+                  <vxe-table-column align="center" field="no" title="客户编号" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.no" placeholder="客户编号" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" field="name" title="客户名称" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.name" placeholder="客户名称" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" field="companyLevel" title="层级" :edit-render="{}">
+                    <template v-slot:edit="scope">
+                      <el-input :readonly="true" v-model="scope.row.companyLevel" placeholder="层级" clearable></el-input>
+                    </template>
+                  </vxe-table-column>
+                  <vxe-table-column align="center" title="操作" width="100">
+                    <template v-slot="scope">
+                      <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'client')">删除</el-button>
+                    </template>
+                  </vxe-table-column>
+                </vxe-table>
+              </el-form>
+            </el-row>
+          </el-tab-pane>
+          <el-tab-pane label="附件" name="files">
+            <!--        附件-->
+            <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+          </el-tab-pane>
+
+        </el-tabs>
+      </el-col>
+    </el-row>
+    <WorkClientChooseForm ref="workClientChooseForm" @getWorkClientChoose="getWorkClientChoose"></WorkClientChooseForm>
+  </div>
+</template>
+
+<script>
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import UserSelect from '@/components/userSelect'
+  import ProjectRecordsService from '@/api/cw/projectRecords/ProjectRecordsService'
+  import EnterpriseSearchService from '@/api/cw/common/EnterpriseSearchService'
+  import WorkClientChooseForm from '../workClientInfo/WorkClientChooseForm'
+  export default {
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    data () {
+      return {
+        title: '',
+        method: '',
+        loading: false,
+        inputForm: {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: ''
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        },
+        keyWatch: '',
+        activeName: 'client',
+        tableKey: '',
+        tableKeyClient: '1'
+      }
+    },
+    projectRecordsService: null,
+    enterpriseSearchService: null,
+    created () {
+      this.enterpriseSearchService = new EnterpriseSearchService()
+      this.projectRecordsService = new ProjectRecordsService()
+    },
+    computed: {
+      bus: {
+        get () {
+          this.$refs.uploadComponent.setDividerName('附件', false)
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      }
+    },
+    components: {
+      SelectUserTree,
+      UpLoadComponent,
+      SelectTree,
+      UserSelect,
+      WorkClientChooseForm
+    },
+    methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
+      init (method, id) {
+        this.activeName = 'client'
+        this.projectRecordsService = new ProjectRecordsService()
+        this.method = method
+        this.inputForm = {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: JSON.parse(localStorage.getItem('user')).name
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        }
+        this.inputForm.id = id
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = true
+          this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+            this.$refs.uploadComponent.clearUpload()
+            this.inputForm = this.recover(this.inputForm, data)
+            this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+            if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList)) {
+              this.inputForm.workAttachmentDtoList = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.createDate)) {
+              this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+            }
+            if (this.commonJS.isEmpty(this.inputForm.createBy.name)) {
+              this.inputForm.createBy.name = JSON.parse(localStorage.getItem('user')).name
+            }
+            if (this.commonJS.isEmpty(this.inputForm.officeId)) {
+              this.inputForm.officeId = JSON.parse(localStorage.getItem('user')).officeDTO.id
+            }
+            if (this.formReadOnly) {
+              this.method = 'view'
+            }
+            this.$refs.uploadComponent.newUpload(this.method, this.inputForm.workAttachmentDtoList, 'cw_project_records', null, null, null, null, false)
+            if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+              this.inputForm.cwProjectClientInfoDTOList = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectMasterId)) {
+              this.inputForm.projectMasterId = JSON.parse(localStorage.getItem('user')).id
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectLeaderId)) {
+              this.inputForm.projectLeaderId = JSON.parse(localStorage.getItem('user')).id
+            }
+            if (this.commonJS.isEmpty(this.inputForm.projectMoney)) {
+              this.inputForm.projectMoney = 0
+            }
+            this.loading = false
+          })
+        })
+      },
+      saveForm (callback) {
+        this.doSubmit('save', callback)
+      },
+      startForm (callback) {
+        this.doSubmit('start', callback)
+      },
+      async agreeForm (callback) {
+        await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+          if (this.inputForm.status !== '2') { // 审核状态不是“待审核”,就弹出提示
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error()
+          } else {
+            this.doSubmit('agree', callback)
+          }
+        })
+      },
+      // 表单提交
+      doSubmit (status, callback) {
+        if (status === 'save') {
+          // 暂存
+          this.inputForm.status = '1'
+          this.loading = true
+          if (this.$refs.uploadComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
+          this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+          this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+          this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
+            callback(data.businessTable, data.businessId, this.inputForm)
+            this.loading = false
+          }).catch(() => {
+            this.loading = false
+          })
+          return
+        } else if (status === 'start') {
+          // 送审  待审核
+          this.inputForm.status = '2'
+        } else if (status === 'agree') {
+          // 审核同意
+          this.inputForm.agreeDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+          this.inputForm.agreeUserId = this.$store.state.user.id
+          this.inputForm.status = '5'
+        }
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+            if (this.commonJS.isEmpty(this.inputForm.createDate)) {
+              this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+            }
+            this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      async updateStatusById (type) {
+        if (type === 'reject' || type === 'reback') {
+          if (await this.$refs.uploadComponent.checkProgress()) {
+            this.loading = false
+            throw new Error()
+          }
+          await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+            if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
+              this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+              throw new Error()
+            } else {
+              if (type === 'reject') {
+                // 驳回
+                this.inputForm.status = '4'
+                let param = {status: '4', id: this.inputForm.id}
+                this.projectRecordsService.updateStatusById(param)
+              }
+              if (type === 'reback') {
+                // 撤回
+                let param = {status: '3', id: this.inputForm.id}
+                this.projectRecordsService.updateStatusById(param)
+              }
+            }
+          })
+        }
+      },
+      close () {
+        this.inputForm = {
+          id: '',
+          createDate: '',
+          createBy: {
+            id: '',
+            name: ''
+          },
+          remarks: '',
+          projectNumber: '',
+          projectName: '',
+          officeId: '',
+          projectMoney: '',
+          auditYear: '',
+          planStartDate: '',
+          planEndDate: '',
+          projectMasterId: '',
+          projectLeaderId: '',
+          procInsId: '',
+          processDefinitionId: '',
+          status: '',
+          workAttachmentDtoList: [],
+          cwProjectClientInfoDTOList: []
+        }
+        this.$refs.uploadComponent.clearUpload()
+        this.$refs.inputForm.resetFields()
+      },
+      tabHandleClick (event) {
+        // console.log(event)
+      },
+      // 新增
+      // eslint-disable-next-line no-dupe-keys
+      insertEvent (type) {
+        if (type === 'client') {
+          let d = {
+            no: '',
+            name: '',
+            companyLevel: ''
+          }
+          if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+            this.inputForm.cwProjectClientInfoDTOList = []
+          }
+          this.$refs.clientTable.insertAt(d)
+          this.inputForm.cwProjectClientInfoDTOList.push(d)
+          this.tableKeyClient = Math.random()
+        }
+      },
+      // 删除
+      removeEvent (row, rowIndex, type) {
+        if (type === 'client') {
+          this.$refs.clientTable.remove(row)
+          this.inputForm.cwProjectClientInfoDTOList.splice(rowIndex, 1)
+        }
+      },
+      openWorkClient () {
+        this.$refs.workClientChooseForm.init()
+      },
+      getWorkClientChoose (list) {
+        if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
+          this.inputForm.cwProjectClientInfoDTOList = []
+        }
+        let _this = this
+        let _list = list
+        const waitForEach = function () {
+          return new Promise(function (resolve, reject) {
+            _list.forEach((item) => {
+              _this.inputForm.cwProjectClientInfoDTOList.forEach(client => {
+                if (item.no === client.no) {
+                  _this.$message.error('已存在客户 “' + client.name + '”,请重新选择')
+                  throw new Error('已存在客户 “' + client.name + '”,请重新选择')
+                }
+              })
+            })
+            resolve()
+          })
+        }
+        waitForEach().then(() => {
+          list.forEach(item => {
+            this.$refs.clientTable.insertAt(item)
+            this.inputForm.cwProjectClientInfoDTOList.push(item)
+            this.tableKeyClient = Math.random()
+          })
+        })
+      }
+    }
+  }
+</script>
+<style scoped>
+  /deep/ .el-input-number .el-input__inner {
+    text-align: left;
+  }
+</style>

+ 159 - 0
src/views/modules/cw/workClientInfo/WorkClientChooseForm.vue

@@ -0,0 +1,159 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="1100px"
+      append-to-body
+      height="500px"
+      @close="close"
+      @keyup.enter.native="getWorkClient"
+      :visible.sync="visibleChoose">
+      <div style="height: calc(100%);">
+
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="400px"
+          :loading="loading"
+          size="small"
+          ref="clientTable"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :print-config="{}"
+          @sort-change=""
+          :sort-config="{remote:true}"
+          :data="dataList"
+          :row-config="{isCurrent: true}"
+          :tree-config="{transform: true, rowField: 'id', parentField: 'oneUpCompany'}"
+          :checkbox-config="{trigger: 'row', checkStrictly: true}">
+          <vxe-column type="seq" width="40"></vxe-column>
+          <vxe-column type="checkbox" width="40px"></vxe-column>
+          <vxe-column width="" title="客户名称" align="center" field="name" tree-node></vxe-column>
+          <vxe-column width="" title="客户编号" align="center" field="no"></vxe-column>
+          <vxe-column width="" title="客户类型" align="center" field="type">
+            <template slot-scope="scope">
+              {{$dictUtils.getDictLabel('cw_work_client_type', scope.row.type, '-')}}
+            </template>
+          </vxe-column>
+          <vxe-column width="" title="所属行业" align="center" field="industry">
+            <template slot-scope="scope">
+              {{$dictUtils.getDictLabel('cw_work_client_industry', scope.row.industry, '-')}}
+            </template>
+          </vxe-column>
+          <vxe-column width="" title="公司级次" align="center" field="companyLevel"></vxe-column>
+        </vxe-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'" @click="getWorkClient()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import InputNumber from '@/views/modules/sys/workContract/InputNumber.vue'
+  import WorkClientService from '@/api/cw/workClientInfo/WorkClientService'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visibleChoose: false,
+        loading: false,
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        dataList: [],
+        searchForm: {
+          name: '',
+          no: ''
+        }
+      }
+    },
+    workClientService: null,
+    created () {
+      this.workClientService = new WorkClientService()
+    },
+    components: {
+      SelectUserTree,
+      InputNumber
+    },
+    methods: {
+      init (deputy) {
+        this.title = '客户选择'
+        this.visibleChoose = true
+        this.list()
+      },
+      // 表单提交
+      getWorkClient () {
+        let rows = this.$refs.clientTable.getCheckboxRecords()
+        if (this.commonJS.isEmpty(rows)) {
+          this.$message.error('请至少选择一条数据')
+          return
+        }
+        let list = []
+        if (!this.commonJS.isEmpty(rows)) {
+          rows.forEach(item => {
+            let p = {
+              id: item.id,
+              name: item.name,
+              no: item.no,
+              type: item.type,
+              industry: item.industry,
+              companyLevel: item.companyLevel
+            }
+            list.push(p)
+          })
+        }
+        this.close()
+        this.$emit('getWorkClientChoose', list)
+      },
+      list () {
+        this.dataList = []
+        this.loading = true
+        this.workClientService.list({
+          'current': 1,
+          'size': -1,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
+      // 当前页
+      currentChangeHandle ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list()
+      },
+      resetSearch () {
+        // this.$refs.searchForm.resetFields()
+        this.list()
+      },
+      close () {
+        // this.$refs.searchForm.resetFields()
+        this.visibleChoose = false
+      }
+    }
+  }
+</script>
+<style scoped>
+  /deep/ .el-dialog__body {
+    padding-top: 0;
+  }
+  /deep/ .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
+    margin-bottom: 0px;
+  }
+</style>

+ 5 - 5
src/views/modules/cw/workClientInfo/WorkClientList.vue

@@ -148,11 +148,11 @@
           </vxe-column>
           <vxe-column title="操作" width="150px" fixed="right" align="center">
             <template  slot-scope="scope">
-              <el-button v-if="hasPermission('cw_work_client:info:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'" type="text" icon="el-icon-edit" size="small" @click="push(scope.row)">修改</el-button>
-              <el-button v-else-if="hasPermission('cw_work_client:info:edit')&&isAdmin&&scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('cw_work_client:info:edit')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text" icon="el-icon-edit" size="small" @click="push(scope.row)">修改</el-button>
+              <el-button v-else-if="hasPermission('cw_work_client:info:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
               <el-button v-if="hasPermission('cw_work_client:info:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='2'" type="text" icon="el-icon-edit" size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('cw_work_client:info:del')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
-              <el-button v-else-if="hasPermission('cw_work_client:info:del')&&isAdmin&&scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5'" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cw_work_client:info:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('cw_work_client:info:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -360,7 +360,7 @@
                 formType: data.data.formType,
                 formUrl: data.data.formUrl,
                 formTitle: processTitle,
-                businessTable: 'klg_base_questions',
+                businessTable: 'cw_work_client_base',
                 businessId: row.id,
                 isShow: 'false',
                 status: status,

+ 1 - 0
src/views/modules/cw/workClientInfo/WorkClientListForm.vue

@@ -7,6 +7,7 @@
       width="1100px"
       height="500px"
       @close="close"
+      append-to-body
       @keyup.enter.native="getWorkClient"
       :visible.sync="visible">
       <div style="height: calc(100%);">

+ 1 - 0
src/views/modules/cw/workClientInfo/manageLevelType/ManageLevelTypeListForm.vue

@@ -6,6 +6,7 @@
       v-dialogDrag
       width="1100px"
       height="500px"
+      append-to-body
       @close="close"
       @keyup.enter.native="getManageLevelType"
       :visible.sync="visible">

+ 1 - 0
src/views/modules/cw/workClientInfo/organizationType/OrganizationTypeListForm.vue

@@ -7,6 +7,7 @@
       width="1100px"
       height="500px"
       @close="close"
+      append-to-body
       @keyup.enter.native="getOrganizationType"
       :visible.sync="visible">
       <div style="height: calc(100% - 50px);">