Selaa lähdekoodia

代码提交:
0922合同管理-合同登记

sunruiqi 2 vuotta sitten
vanhempi
commit
12f98b481d

+ 7 - 0
src/api/sys/UserService.js

@@ -88,4 +88,11 @@ export default class UserService {
       data: data
     })
   }
+
+  is () {
+    return request({
+      url: `/sys/user/isAdmin`,
+      method: 'get'
+    })
+  }
 }

+ 32 - 0
src/api/sys/WorkContractFileService.js

@@ -0,0 +1,32 @@
+import request from '@/utils/httpRequest'
+
+export default class WorkContractService {
+  save (param) {
+    return request({
+      url: '/workContract/workContractFile/save',
+      method: 'post',
+      data: param
+    })
+  }
+  updateStatusById (param) {
+    return request({
+      url: '/workContract/workContractFile/updateStatusById',
+      method: 'post',
+      data: param
+    })
+  }
+  findById (id) {
+    return request({
+      url: '/workContract/workContractFile/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  findByContractInfoId (id) {
+    return request({
+      url: '/workContract/workContractFile/findByContractInfoId',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+}

+ 19 - 3
src/views/modules/flowable/task/TaskForm.vue

@@ -4,7 +4,7 @@
 
   <el-tabs type="border-card" v-model="taskSelectedTab">
     <el-tab-pane label="表单信息" name="form-first">
-      <component id="printForm" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''"  ref="form" :businessId="businessId" :is="form"></component>
+      <component id="printForm" :status="status" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''"  ref="form" :businessId="businessId" :is="form"></component>
 
       <PreviewForm  id="printForm"   v-if="formType !== '2'"  :processDefinitionId="procDefId" :edit="true" :taskFormData="taskFormData" ref="form"/>
     </el-tab-pane>
@@ -163,6 +163,10 @@
         this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'startAndHold') {  // 送审、暂存、关闭
         this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_save', name: '暂存', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
+      } else if (this.status === 'startAndCloseFiled') { // 送审、关闭
+        this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
+      } else if (this.status === 'startAndHoldFiled') {  // 送审、暂存、关闭
+        this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_save', name: '暂存', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'reback') {
         this.buttons = [{code: '_flow_reback', name: '撤回', isHide: '0'}]
       } else if (this.procDefKey && this.taskDefKey) {
@@ -273,6 +277,7 @@
               assignee = inputForm.assignee
             }
             this.taskService.start({
+              procDefId: this.procDefId,
               procDefKey: this.procDefKey,
               businessTable: businessTable,
               businessId: businessId,
@@ -305,9 +310,20 @@
       },
       // 同意
       agree (vars) {
-        this.commit(vars) // 同意
-        if (this.formType === '2') {
+        if (this.formType === '2' && this.formUrl !== '/sys/workContract/WorkContractFileForm') {
+          this.commit(vars) // 同意
           this.$refs.form.updateStatusById('agree')
+          this.businessId = 'false'
+        }
+        if (this.formType === '2' && this.formUrl === '/sys/workContract/WorkContractFileForm') {
+          console.log('1111', this.status)
+          this.$refs.form.filedNoIsEmpty((item) => {
+            if (item !== 'false') {
+              this.commit(vars) // 同意
+              this.$refs.form.updateStatusById('agree')
+              this.businessId = 'false'
+            }
+          })
         }
       },
       // 驳回

+ 754 - 0
src/views/modules/sys/workContract/WorkContractFileForm.vue

@@ -0,0 +1,754 @@
+<template>
+  <div>
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+             label-width="150px">
+      <el-row  :gutter="0">
+        <el-col :span="12">
+          <el-form-item label="客户名称" prop="clientId" :rules="[
+                {required: true, message:'请输入客户名称', trigger:'blur'},
+                {required: true, message:'请输入客户名称', trigger:'change'}
+              ]">
+            <work-client-select
+              :size="'medium'"
+              :value="inputForm.clientId"
+              :disabled="method==='view'"
+              @getValue='(clientId,clientName) => {inputForm.clientId=clientId;inputForm.clientName=clientName}'
+            >
+            </work-client-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同名称" prop="name"
+                        :rules="[
+                 {required: true, message:'请输入合同名称', trigger:'blur'}
+               ]">
+            <el-input maxlength="64" v-model="inputForm.name" placeholder="请输入合同名称"></el-input>
+          </el-form-item>
+        </el-col>
+
+      </el-row>
+
+      <el-row  :gutter="0">
+
+        <el-col :span="12">
+          <el-form-item label="签订日期" prop="contractDate"
+                        :rules="[
+                {required: true, message:'请输入签订日期', trigger:'blur'}
+               ]">
+            <el-date-picker
+              placement="bottom-start"
+              v-model="inputForm.contractDate"
+              type="date"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同生效日期" prop="effectiveDate">
+            <el-date-picker
+              placement="bottom-start"
+              v-model="inputForm.effectiveDate"
+              type="date"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同终止日期" prop="closingDate">
+            <el-date-picker
+              @change="checkData"
+              placement="bottom-start"
+              v-model="inputForm.closingDate"
+              type="date"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同类型" prop="contractType"
+                        :rules="[
+                {required: true, message:'请选择合同类型', trigger:'blur'}
+              ]">
+            <el-select v-model="inputForm.contractType" placeholder="请选择" style="width:100%;">
+              <el-option
+                v-for="item in $dictUtils.getDictList('contract_type')"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同金额类别" prop="contractAmountType"
+                        :rules="[
+                  {required: true, message:'请选择合同金额类别', trigger:'blur'}
+               ]">
+            <el-radio-group v-model="inputForm.contractAmountType">
+              <el-radio v-for="item in $dictUtils.getDictList('contract_amount_type')" :label="item.value" >{{item.label}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="合同/预计金额(元)" prop="contractAmount" v-if="inputForm.contractAmountType === '1'"
+                        :rules="[
+                  {required: true, message:'请输入合同/预计金额(元)', trigger:'blur'}
+               ]">
+            <el-input maxlength="15" v-model="inputForm.contractAmount" placeholder="请输入合同/预计金额(元)"
+                      @keyup.native="inputForm.contractAmount = twoDecimalPlaces(inputForm.contractAmount)"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="对方合同编号" prop="contractOpposite">
+            <el-input maxlength="64" v-model="inputForm.contractOpposite" placeholder="请填写对方合同编号"></el-input>
+          </el-form-item>
+        </el-col>
+
+      </el-row>
+
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="收费标准" prop="contractFees">
+            <el-checkbox-group v-model="inputForm.contractFees">
+              <el-checkbox @change="changeContractFee" v-for="item in $dictUtils.getDictList('contract_fee')" :label="item.value">
+                {{item.label}}
+              </el-checkbox>
+            </el-checkbox-group>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-row>
+        <el-col :span="24">
+          <el-form-item prop="contractFee">
+            <el-input style="width: 100%" placeholder="请选择收费标准" v-model="inputForm.contractFee"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-row></el-row>
+
+      <el-form-item label="描述内容" prop="describes">
+        <el-input v-model="inputForm.describes"
+                  type="textarea"
+                  :rows="5"
+                  maxlength="500"
+                  placeholder="请输入描述内容"
+                  show-word-limit>
+        </el-input>
+      </el-form-item>
+
+      <el-form-item label="合同特别条款" prop="contractSpecial">
+        <el-input v-model="inputForm.contractSpecial"
+                  type="textarea"
+                  :rows="5"
+                  maxlength="500"
+                  placeholder="请输入合同特别条款"
+                  show-word-limit>
+        </el-input>
+      </el-form-item>
+
+      <el-form-item label="备注" prop="remarks">
+        <el-input v-model="inputForm.remarks"
+                  type="textarea"
+                  :rows="5"
+                  maxlength="500"
+                  placeholder="请输入合同备注"
+                  show-word-limit>
+        </el-input>
+      </el-form-item>
+
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="合同编号" prop="no">
+            <el-input :disabled="true" v-model="inputForm.no"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="归档人" prop="fileCreateName">
+            <el-input :disabled="true" v-model="this.userName"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-row v-if="this.inputForm.filedType === '3'">
+        <el-col :span="12">
+          <el-form-item label="案卷号" prop="filedNo" :rules="[
+                  {required: true, message:'请输入案卷号', trigger:'blur'}
+               ]">
+            <el-input v-model="inputForm.filedNo"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="确认案卷号" prop="confirmFiledNo" :rules="[
+                  {required: true, message:'请输入确认案卷号', trigger:'blur'}
+               ]">
+            <el-input @change="checkFiledNo" v-model="inputForm.confirmFiledNo"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+    </el-form>
+    <el-image-viewer
+      v-if="showViewer"
+      :on-close="closeViewer"
+      :url-list="[url]"
+      zIndex="9999"/>
+    <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+  </div>
+</template>
+
+<script>
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import WorkContractService from '@/api/sys/WorkContractService'
+  import WorkContractFileService from '@/api/sys/WorkContractFileService'
+  import WorkClientService from '@/api/sys/WorkClientService'
+  import WorkClientSelect from '@/components/workClientInfoSelect'
+  import UserService from '@/api/sys/UserService'
+  import OSSSerive, {
+    httpRequest,
+    toHref,
+    openWindowOnUrl,
+    handleRemove,
+    fileName
+  } from '@/api/sys/OSSService'
+  import moment from 'moment'
+  import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
+  export default {
+    data () {
+      return {
+        visable: false,
+        gridData: [],
+        radio: 0,
+        tableData: [],
+        dataList: [],
+        dataListNew: [],
+        title: '',
+        method: '',
+        isSubmit: false,
+        isFiled: false,
+        isFileApproval: false,
+        visible: false,
+        loading: false,
+        returnForm: {
+          clientId: '',
+          name: '',
+          contractDate: '',
+          effectiveDate: '',
+          closingDate: '',
+          contractType: '',
+          contractAmountType: '',
+          contractAmount: '',
+          contractOpposite: '',
+          contractFees: [],
+          fees: '',
+          contractFee: '',
+          describes: '',
+          contractSpecial: '',
+          remarks: '',
+          clientName: '',
+          workAttachmentList: [],
+          status: ''
+        },
+        inputForm: {
+          clientId: '',
+          name: '',
+          contractDate: '',
+          effectiveDate: '',
+          closingDate: '',
+          contractType: '',
+          contractAmountType: '',
+          contractAmount: '',
+          contractOpposite: '',
+          contractFees: [],
+          fees: '',
+          contractFee: '',
+          describes: '',
+          contractSpecial: '',
+          remarks: '',
+          clientName: '',
+          permissionFlag: '',
+          showVi: true,
+          workAttachmentList: [],
+          status: '',
+          contractFileId: '',
+          contractInfoId: '',
+          filedType: '',
+          filedNo: '',
+          confirmFiledNo: ''
+        },
+        filesArra2: [],
+        fileList: [],
+        isFlag: true,
+        showViewer: false, // 显示查看器
+        url: '',
+        rowurl: '',
+        src: '',
+        onedit: false,
+        type: '',
+        loadProgress: 0, // 动态显示进度条
+        progressFlag: false, // 关闭进度条
+        promi: null
+      }
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      ElImageViewer,
+      UpLoadComponent,
+      WorkClientSelect
+    },
+    computed: {
+      userName () {
+        return JSON.parse(localStorage.getItem('user')).name
+      }
+    },
+    ossService: null,
+    workContractService: null,
+    workContractFileService: null,
+    workClientService: null,
+    userService: null,
+    created () {
+      this.ossService = new OSSSerive()
+      this.workContractService = new WorkContractService()
+      this.workContractFileService = new WorkContractFileService()
+      this.workClientService = new WorkClientService()
+      this.userService = new UserService()
+    },
+    mounted () {
+      window.onPreview = this.onPreview
+    },
+    watch: {
+      'businessId': {
+        handler (newVal) {
+          console.log('businessId', this.businessId)
+          console.log('status', this.status)
+          if (this.status && this.status === 'startAndHoldFiled') {
+            this.isFiled = true
+          }
+          if (this.businessId && this.businessId !== 'false') {
+            this.ossService = new OSSSerive()
+            this.init('edit', this.businessId)
+          } else {
+            // this.$refs.inputForm.resetFields()
+            // this.visible = false
+            // this.showVi = true
+            // this.$refs.uploadComponent.clearUpload()
+            this.init('clean', '')
+          }
+        },
+        immediate: true,
+        deep: false
+      }
+    },
+    methods: {
+      uploadVideoProcess (event, file, fileList) {
+        this.progressFlag = true // 显示进度条
+        this.loadProgress = parseInt(event.percent) // 动态获取文件上传进度
+        if (this.loadProgress >= 100) {
+          this.loadProgress = 100
+          setTimeout(() => { this.progressFlag = false }, 1000) // 一秒后关闭进度条
+        }
+      },
+      async toHref (row) {
+        toHref(row)
+      },
+      onPreview (url) {
+        this.url = url
+        this.showViewer = true
+      },
+      // 关闭查看器
+      closeViewer () {
+        this.url = ''
+        this.showViewer = false
+      },
+      init (method, id) {
+        console.log(method)
+        this.dataList = []
+        this.dataListNew = []
+        this.method = method
+        this.inputForm = {
+          clientId: '',
+          name: '',
+          contractDate: '',
+          effectiveDate: '',
+          closingDate: '',
+          contractType: '',
+          contractAmountType: '',
+          contractAmount: '',
+          contractOpposite: '',
+          contractFees: [],
+          fees: '',
+          contractFee: '',
+          describes: '',
+          contractSpecial: '',
+          remarks: '',
+          clientName: '',
+          filesArra2: [],
+          fileList: [],
+          isFlag: true,
+          showViewer: false, // 显示查看器
+          url: '',
+          rowurl: '',
+          src: '',
+          showVi: true,
+          workAttachmentList: [],
+          status: '',
+          filedType: ''
+        }
+        this.inputForm.id = id
+        if (method === 'add') {
+          // this.inputForm.contractAmountType = '1'
+          this.title = `新建合同登记`
+        } else if (method === 'edit') {
+          this.title = '修改合同登记'
+        } else if (method === 'view') {
+          this.inputForm.showVi = false
+          this.title = '查看合同登记'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.workContractService.findById(this.inputForm.id).then(({data}) => {
+              if (this.commonJS.isEmpty(data.id)) {
+                this.workContractFileService.findById(this.inputForm.id).then(({data}) => {
+                  this.workContractService.findById(data.contractInfoId).then(({data}) => {
+                    this.inputForm = this.recover(this.inputForm, data)
+                  })
+                })
+              } else {
+                this.inputForm = this.recover(this.inputForm, data)
+              }
+              console.log('125798459398', this.inputForm)
+              const f = []
+              if (data.fees !== null && data.fees !== undefined && data.fees !== '') {
+                data.fees.split(',').forEach(item => {
+                  if (item !== null && item !== undefined && item !== '') {
+                    f.push(item)
+                  }
+                })
+              }
+              this.inputForm.contractFees = f
+              this.$refs.uploadComponent.newUpload(method, this.inputForm.workAttachmentList, 'workContract')
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      // 暂存
+      async saveForm (callback) {
+        // 合同登记暂存
+        if (this.status === 'startAndHold' || this.status === 'startAndHoldFiled') {
+          this.loading = true
+          this.inputForm.workAttachmentList = this.$refs.uploadComponent.getDataList()
+          this.inputForm.fees = this.inputForm.contractFees.join(',')
+          if (this.status === 'startAndHold') {
+            this.inputForm.status = '1'
+          }
+          if (this.status === 'startAndHoldFiled') {
+            this.inputForm.status = '5'
+          }
+          await this.workContractService.save(this.inputForm)
+        }
+        // 合同登记归档暂存
+        if (this.status === 'startAndHoldFiled') {
+          this.inputForm.filedType = '2'
+          this.inputForm.contractInfoId = this.businessId
+          this.workContractFileService.save(this.inputForm)
+        }
+        this.$refs.inputForm.resetFields()
+        this.loading = false
+        this.businessId = ''
+        callback()
+      },
+      // 送审
+      startForm (callback) {
+        console.log('filedType', this.inputForm.filedType)
+        let id = this.inputForm.id
+        this.loading = true
+        this.inputForm.workAttachmentList = this.$refs.uploadComponent.getDataList()
+        this.inputForm.status = '5'
+        if (this.inputForm.contractFees !== undefined && this.inputForm.contractFees !== null) {
+          this.inputForm.fees = this.inputForm.contractFees.join(',')
+        }
+        this.workContractService.save(this.inputForm)
+        console.log('inputForm', this.inputForm)
+        this.inputForm.filedType = '3'
+        this.inputForm.contractInfoId = id
+        this.workContractFileService.save(this.inputForm).then(({data}) => {
+          console.log('data', data)
+          callback(data.businessTable, data.businessId, this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+          this.businessId = ''
+        })
+      },
+      // 通过
+      agreeForm (callback) {
+        let id = this.inputForm.id
+        this.loading = true
+        this.inputForm.workAttachmentList = this.$refs.uploadComponent.getDataList()
+        this.inputForm.status = '5'
+        if (this.inputForm.contractFees !== undefined && this.inputForm.contractFees !== null) {
+          this.inputForm.fees = this.inputForm.contractFees.join(',')
+        }
+        this.workContractService.save(this.inputForm)
+        console.log('inputForm', this.inputForm)
+        this.inputForm.filedType = '3'
+        this.inputForm.contractInfoId = id
+        this.workContractFileService.save(this.inputForm).then(({data}) => {
+          callback(data.businessTable, data.businessId, this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+          this.businessId = ''
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.inputForm.clientName = ''
+        this.visible = false
+        this.showVi = true
+        this.businessId = ''
+        this.$refs.uploadComponent.clearUpload()
+      },
+      httpRequest (file) {
+        httpRequest(file, fileName(file), 'workContract')
+      },
+      handleRemove () {
+        this.fileList = handleRemove()
+      },
+      changes (file, fileList) {
+        this.dataListNew = []
+        this.dataList.forEach((item) => {
+          this.dataListNew.push(item)
+        })
+        fileList.forEach((item) => {
+          item.createDate = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
+          item.createBy = this.$store.state.user.name
+          this.dataListNew.push(item)
+        })
+        const isLt2M = file.size / 1024 / 1024 < 300
+        if (isLt2M === false) {
+          this.$message.error('文件大小不能超过 ' + 300 + 'M !')
+          this.fileList = []
+          this.filesArra2 = []
+        }
+      },
+      async showFile (row) {
+        await openWindowOnUrl(row)
+      },
+      // 排序
+      sortChangeHandle (column) {
+        this.orders = []
+        if (column.order != null) {
+          this.orders.push({column: this.$utils.toLine(column.prop), asc: column.order === 'ascending'})
+        }
+        this.refreshList()
+      },
+      deleteMsgById (row, index) {
+        this.dataListNew.splice(index, 1)
+        if (row.id !== null && row.id !== '' && row.id !== undefined) {
+          this.ossService.deleteMsgById(row.id)
+        }
+      },
+      twoDecimalPlaces (num) {
+        let str = num.toString()
+        var len1 = str.substr(0, 1)
+        var len2 = str.substr(1, 1)
+        // eslint-disable-next-line eqeqeq
+        if (str.length > 1 && len1 == 0 && len2 != '.') {
+          str = str.substr(1, 1)
+        }
+        // eslint-disable-next-line eqeqeq
+        if (len1 == '.') {
+          str = ''
+        }
+        // eslint-disable-next-line eqeqeq
+        if (str.indexOf('.') != -1) {
+          var str_ = str.substr(str.indexOf('.') + 1)
+          // eslint-disable-next-line eqeqeq
+          if (str_.indexOf('.') != -1) {
+            str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+          }
+          if (str_.length > 2) {
+            this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
+            return (str = '')
+          }
+        }
+        // eslint-disable-next-line no-useless-escape
+        str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+        return str
+      },
+      positiveInteger (num) {
+        let str = num.toString()
+        var len1 = str.substr(0, 1)
+        var len2 = str.substr(1, 1)
+        // eslint-disable-next-line eqeqeq
+        if (str.length > 1 && len1 == 0 && len2 != '.') {
+          str = str.substr(1, 1)
+        }
+        // eslint-disable-next-line eqeqeq
+        if (len1 == '.') {
+          str = ''
+        }
+        // eslint-disable-next-line no-useless-escape
+        str = str.replace(/[^\d^]+/g, '') // 保留数字
+        return str
+      },
+      tableRowClassName ({row, rowIndex}) {
+        row.index = rowIndex
+      },
+      handleRadioChange (val) {
+        if (val) {
+          this.radio = val.index
+        }
+      },
+      // 关闭窗口时调用
+      closeXTable () {
+        this.closePop()
+      },
+      rowStyle (event) {
+        return 'cursor:pointer;'
+      },
+      async rowClick (event) {
+        let id = this.gridData[event.rowIndex].id
+        this.inputForm.clientId = id
+        await this.workClientService.findById(id).then((data) => {
+          this.inputForm.clientName = data.data.workClientInfo.name
+        })
+        this.visable = false
+      },
+      async getPopTable () {
+        let name = this.inputForm.clientName
+        await this.workClientService.list(name).then(({data}) => {
+          this.gridData = data.records
+        })
+        this.$refs.pops.updatePopper()
+      },
+      closePop () {
+        this.visable = false
+      },
+      changeContractFee () {
+        let fee = ''
+        let fees = this.inputForm.contractFees
+        if (fees.length > 0) {
+          fees.forEach(i => {
+            if (i === '1') {
+              i = '计价格(2002)1980号文下浮%'
+            }
+            if (i === '2') {
+              i = '苏价服(2014)383号文下浮%'
+            }
+            if (i === '3') {
+              i = '标段 元/标段'
+            }
+            if (i === '4') {
+              i = '其他'
+            }
+            fee = fee + ';' + i
+            this.inputForm.contractFee = fee.substring(1, fee.length)
+          })
+        }
+      },
+      updateStatusById (type) {
+        console.log('updateStatusById', this.inputForm)
+        if (type === 'agree') {
+          this.inputForm.filedType = '6'
+          this.workContractFileService.updateStatusById(this.inputForm)
+        }
+        if (type === 'reject') {
+          this.inputForm.filedType = '5'
+          this.workContractFileService.updateStatusById(this.inputForm)
+        }
+        if (type === 'reback') {
+          this.inputForm.filedType = '4'
+          this.workContractFileService.updateStatusById(this.inputForm)
+        }
+      },
+      checkData () {
+        let begin = this.inputForm.effectiveDate
+        let close = this.inputForm.closingDate
+        if (close < begin) {
+          this.$message.warning(`合同终止日期要大于合同开始日期`)
+          this.inputForm.closingDate = ''
+        }
+      },
+      checkFiledNo () {
+        let filedNo = this.inputForm.filedNo
+        let confirmFiledNo = this.inputForm.confirmFiledNo
+        if (filedNo !== confirmFiledNo) {
+          this.$message.warning(`案卷号和确认案卷号不一致`)
+          this.inputForm.confirmFiledNo = ''
+        }
+      },
+      filedNoIsEmpty (callback) {
+        if (this.commonJS.isEmpty(this.inputForm.filedNo) || this.commonJS.isEmpty(this.inputForm.filedNo)) {
+          this.$message.warning(`请输入案卷号和确认案卷号`)
+          let i = 'false'
+          console.log('callback', 'false')
+          // callback(new Error('请输入案卷号和确认案卷号'))
+          callback(i)
+          return
+        }
+        console.log('callback', 'true')
+        callback()
+      }
+    }
+  }
+</script>
+
+<style>
+  .tid_40 .vxe-body--column .vxe-cell{
+    padding: 1px;
+    text-align: center;
+  }
+  .tid_40 .vxe-header--row .col--last{
+    text-align: center;
+  }
+  .tid_45 .vxe-body--column .vxe-cell{
+    padding: 1px;
+    text-align: center;
+  }
+  .tid_45 .vxe-header--row .col--last{
+    text-align: center;
+  }
+</style>
+
+<style scoped>
+  .avatar{
+    height: 100px;
+  }
+  .el-divider__text {
+    font-weight: bold;
+    font-size: 16px;
+  }
+</style>

+ 26 - 21
src/views/modules/sys/workContract/WorkContractForm.vue

@@ -47,10 +47,7 @@
         </el-col>
 
         <el-col :span="12">
-          <el-form-item label="合同生效日期" prop="effectiveDate"
-                        :rules="[
-                 {required: true, message:'请输入合同生效日期', trigger:'blur'}
-               ]">
+          <el-form-item label="合同生效日期" prop="effectiveDate">
             <el-date-picker
               placement="bottom-start"
               v-model="inputForm.effectiveDate"
@@ -62,10 +59,7 @@
         </el-col>
 
         <el-col :span="12">
-          <el-form-item label="合同终止日期" prop="closingDate"
-              :rules="[
-                {required: true, message:'请选择合同终止日期', trigger:'blur'}
-              ]">
+          <el-form-item label="合同终止日期" prop="closingDate">
             <el-date-picker
               @change="checkData"
               placement="bottom-start"
@@ -402,30 +396,41 @@
       },
       // 表单提交
       // 暂存
-      async saveForm1 () {
+      async saveForm (callback) {
         this.loading = true
         this.inputForm.workAttachmentList = this.$refs.uploadComponent.getDataList()
         this.inputForm.fees = this.inputForm.contractFees.join(',')
         this.inputForm.status = '1'
-        let _p = null
         await this.workContractService.save(this.inputForm).then(({data}) => {
+          callback()
+          this.$refs.inputForm.resetFields()
           this.loading = false
-          _p = new Promise((resolve, reject) => {
-            resolve({
-              'businessTable': data.businessTable,
-              'businessId': data.businessId,
-              'inputForm': this.inputForm
-            })
-            this.$refs.inputForm.resetFields()
-          })
         }).catch(() => {
           this.$refs.inputForm.resetFields()
           this.loading = false
         })
-        return _p
       },
       // 送审
-      saveForm (callback) {
+      startForm (callback) {
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            this.inputForm.workAttachmentList = this.$refs.uploadComponent.getDataList()
+            this.inputForm.status = '2'
+            this.inputForm.fees = this.inputForm.contractFees.join(',')
+            await this.workContractService.save(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            }).catch(() => {
+              this.$refs.inputForm.resetFields()
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 通过
+      agreeForm (callback) {
         this.$refs['inputForm'].validate(async (valid) => {
           if (valid) {
             this.loading = true
@@ -607,7 +612,7 @@
         let begin = this.inputForm.effectiveDate
         let close = this.inputForm.closingDate
         if (close < begin) {
-          this.$message.warning(`合同终止日期异常,请重新选择`)
+          this.$message.warning(`合同终止日期要大于合同开始日期`)
           this.inputForm.closingDate = ''
         }
       }

+ 122 - 21
src/views/modules/sys/workContract/WorkContractList.vue

@@ -32,16 +32,16 @@
           </el-select>
         </el-form-item>
 
-<!--        <el-form-item label="归档状态" prop="filedType">-->
-<!--          <el-select v-model="searchForm.filedType" placeholder="请选择" style="width:100%;">-->
-<!--            <el-option-->
-<!--              v-for="item in $dictUtils.getDictList('filed_type')"-->
-<!--              :key="item.value"-->
-<!--              :label="item.label"-->
-<!--              :value="item.value">-->
-<!--            </el-option>-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
+        <el-form-item label="归档状态" prop="filedType">
+          <el-select v-model="searchForm.filedType" placeholder="请选择" style="width:100%;">
+            <el-option
+              v-for="item in $dictUtils.getDictList('filed_type')"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
 
         <el-form-item label="合同金额" prop="contractAmounts">
           <InputNumber :disabled="false" :precision="num" v-model="searchForm.contractAmounts"></InputNumber>
@@ -126,11 +126,12 @@
                     <el-button  type="text" @click="detail(scope.row)" :type="$dictUtils.getDictLabel('approval_type_status', scope.row.status, '-')"   effect="dark" size="mini">{{$dictUtils.getDictLabel("approval_type", scope.row.status, '-')}} </el-button>
                   </template>
                 </vxe-column>
-<!--                <vxe-column width="100px"  title="归档状态" field="filedType" >-->
-<!--                  <template slot-scope="scope">-->
+                <vxe-column width="100px"  title="归档状态" field="filedType" >
+                  <template slot-scope="scope">
 <!--                    {{ $dictUtils.getDictLabel("filed_type", scope.row.filedType, '-') }}-->
-<!--                  </template>-->
-<!--                </vxe-column>-->
+                    <el-button  type="text" @click="detailFiled(scope.row)" :type="$dictUtils.getDictLabel('filed_type', scope.row.filedType, '-')"   effect="dark" size="mini">{{$dictUtils.getDictLabel("filed_type", scope.row.filedType, '-')}} </el-button>
+                  </template>
+                </vxe-column>
 <!--                <vxe-column width="100px"  title="借用状态" field="borrowType" >-->
 <!--                  <template slot-scope="scope">-->
 <!--                    {{ $dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-') }}-->
@@ -140,10 +141,12 @@
                 <vxe-column title="操作" width="200px" fixed="right" align="center">
                     <template  slot-scope="scope">
                       <el-button v-if="hasPermission('sys:workContract:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
-                      <el-button v-if="hasPermission('sys:workContract:edit') && scope.row.status !== '2' && scope.row.status !== '5' && scope.row.createId === create && create !== '1'" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row)">修改</el-button>
-                      <el-button v-if="hasPermission('sys:workContract:edit') && scope.row.status === '5' && create === '1'" type="text" icon="el-icon-edit" size="small" @click="editForm(scope.row.id)">修改</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:edit') && scope.row.status !== '2' && scope.row.status !== '5' && scope.row.createId === create && !isAdmin" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row)">修改</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:edit') && scope.row.status === '5' && isAdmin" type="text" icon="el-icon-edit" size="small" @click="editForm(scope.row.id)">修改</el-button>
                       <el-button v-if="hasPermission('sys:workContract:del') && (scope.row.status === '1' || scope.row.status === '3')" type="text"  icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
                       <el-button v-if="hasPermission('sys:workContract:back') && scope.row.status === '2'" type="text"  icon="el-icon-back" size="small" @click="reback(scope.row)">撤回</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:filed') && scope.row.status === '5' && scope.row.createId === create && (scope.row.filedType === '1' || scope.row.filedType === '2' || scope.row.filedType === '4' || scope.row.filedType === '5' || scope.row.filedType === undefined)" type="text"  icon="el-icon-s-order" size="small" @click="filed(scope.row.id)">归档</el-button>
+                      <el-button v-if="hasPermission('sys:workContract:back') && scope.row.status === '5' && scope.row.filedType === '3'" type="text"  icon="el-icon-back" size="small" @click="rebackFiled(scope.row)">撤回</el-button>
                     </template>
                 </vxe-column>
             </vxe-table>
@@ -170,10 +173,12 @@
   import WorkContractForm2 from './WorkContractForm2'
   import WorkClientForm from '../workClient/WorkClientForm'
   import WorkContractService from '@/api/sys/WorkContractService'
+  import WorkContractFileService from '@/api/sys/WorkContractFileService'
   import SelectUserTree from '@/views/modules/utils/treeUserSelect'
   import TaskService from '@/api/flowable/TaskService'
   import ProcessService from '@/api/flowable/ProcessService'
   import pick from 'lodash.pick'
+  import UserService from '@/api/sys/UserService'
   export default {
     data () {
       return {
@@ -200,16 +205,21 @@
         processDefinitionId: '',
         procDefKey: '',
         loading: false,
-        create: ''
+        create: '',
+        isAdmin: false
       }
     },
     workContractService: null,
+    workContractFileService: null,
     taskService: null,
     processService: null,
+    userService: null,
     created () {
       this.workContractService = new WorkContractService()
+      this.workContractFileService = new WorkContractFileService()
       this.taskService = new TaskService()
       this.processService = new ProcessService()
+      this.userService = new UserService()
     },
     components: {
       InputNumber,
@@ -218,6 +228,7 @@
       SelectUserTree
     },
     activated () {
+      this.is()
       this.refreshList()
     },
     computed: {
@@ -226,6 +237,7 @@
       },
       user () {
         this.create = JSON.parse(localStorage.getItem('user')).id
+        console.log('createId', this.create)
         return JSON.parse(localStorage.getItem('user'))
       }
     },
@@ -340,7 +352,6 @@
         // 读取流程表单
         let tabTitle = `发起流程【合同登记新建】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记新建]`
-        let contractTitle = '合同【' + this.searchForm.name + '】登记待审批'
         this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           status: 'startAndHold'}).then((data) => {
             this.$router.push({
@@ -355,7 +366,7 @@
                 formTitle: processTitle,
                 businessId: 'false',
                 isShow: false,
-                contractTitle: contractTitle
+                routePath: '/sys/workContract/WorkContractList'
               }
             })
           })
@@ -380,7 +391,8 @@
                 formTitle: processTitle,
                 businessTable: 'work_contract_info',
                 businessId: row.id,
-                isShow: false
+                isShow: false,
+                routePath: '/sys/workContract/WorkContractList'
               }
             })
           })
@@ -406,7 +418,8 @@
               formTitle: processTitle,
               businessTable: 'work_contract_info',
               businessId: row.id,
-              isShow: false
+              isShow: false,
+              routePath: '/sys/workContract/WorkContractList'
             }
           })
         })
@@ -435,6 +448,31 @@
           })
         })
       },
+      rebackFiled (row) {
+        this.$confirm(`确定撤回流程吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          taskId: row.taskFiledId,
+          type: 'warning'
+        }).then(() => {
+          console.log('datas', row.taskFiledId)
+          this.taskService.backNodes(row.taskFiledId).then(({data}) => {
+            let backNodes = data
+            if (backNodes.length > 0) {
+              let backTaskDefKey = backNodes[0].taskDefKey
+              this.taskService.back({
+                taskId: row.taskFiledId,
+                backTaskDefKey: backTaskDefKey,
+                isShow: false,
+                ...this.auditForm
+              }).then(({data}) => {
+                this.updateStatusById(row, 'rebackFiled')
+                this.$message.success('回退成功')
+              })
+            }
+          })
+        })
+      },
       updateStatusById (row, type) {
         if (type === 'agree') {
           row.status = '5'
@@ -448,6 +486,69 @@
           row.status = '3'
           this.workContractService.updateStatusById(row)
         }
+        if (type === 'rebackFiled') {
+          row.filedType = '4'
+          this.workContractFileService.updateStatusById(row)
+        }
+      },
+      is () {
+        this.userService.is().then(({data}) => {
+          this.isAdmin = data
+        })
+      },
+      // 归档
+      filed (id) {
+        this.processService.getByName('合同登记归档').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            console.log('data', data)
+            // 读取流程表单
+            let tabTitle = `发起流程【合同登记归档】`
+            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记归档]`
+            this.taskService.getTaskDef({ procDefId: data.id,
+              businessId: id,
+              businessTable: 'work_contract_file',
+              status: 'startAndHoldFiled'}).then((reture) => {
+                this.$router.push({
+                  path: '/flowable/task/TaskForm',
+                  query: {
+                    procDefId: data.id,
+                    procDefKey: data.key,
+                    status: 'startAndHoldFiled',
+                    title: tabTitle,
+                    formType: reture.data.formType,
+                    formUrl: reture.data.formUrl,
+                    formTitle: processTitle,
+                    businessTable: 'work_contract_file',
+                    businessId: id,
+                    isShow: false,
+                    routePath: '/sys/workContract/WorkContractList'
+                  }
+                })
+              })
+          }
+        })
+      },
+      // 详情
+      detailFiled (row) {
+        this.workContractFileService.findByContractInfoId(row.id).then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            console.log('data', data)
+            this.taskService.getTaskDef({
+              procInsId: data.procInsId,
+              procDefId: data.processDefinitionId
+            }).then(({data}) => {
+              this.$router.push({
+                path: '/flowable/task/TaskFormDetail',
+                query: {
+                  readOnly: true,
+                  title: row.name + '归档流程详情',
+                  formTitle: row.name + '归档流程详情',
+                  businessId: row.id,
+                  ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
+              })
+            })
+          }
+        })
       }
     }
   }