Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

lizhenhao 2 vuotta sitten
vanhempi
commit
71138914ff

+ 39 - 0
src/api/materialManagement/ContractService.js

@@ -0,0 +1,39 @@
+import request from '@/utils/httpRequest'
+
+export default class ContractService {
+  save (param) {
+    return request({
+      url: '/material/contract/save',
+      method: 'post',
+      data: param
+    })
+  }
+  list (param) {
+    return request({
+      url: '/material/contract/list',
+      method: 'get',
+      params: param
+    })
+  }
+  findById (id) {
+    return request({
+      url: '/material/contract/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  updateStatusById (param) {
+    return request({
+      url: '/material/contract/updateStatusById',
+      method: 'post',
+      data: param
+    })
+  }
+  remove (id) {
+    return request({
+      url: '/material/contract/remove',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+}

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

@@ -473,6 +473,7 @@
       // Process_1672729521837 物资管理-领用申请
       // Process_1673332958749 财务-报告签章-实体章
       // Process_1673492595431 物资管理-入库修改
+      // Process_1673600899831 物资管理-合同
       // 驳回
       reject (vars) {
         if (this.procDefId.includes('Process_1667978088459') ||
@@ -503,7 +504,8 @@
           this.procDefId.includes('Process_1669961023358') ||
           this.procDefId.includes('Process_1672729521837') ||
           this.procDefId.includes('Process_1673332958749') ||
-          this.procDefId.includes('Process_1673492595431')
+          this.procDefId.includes('Process_1673492595431') ||
+          this.procDefId.includes('Process_1673600899831')
         ) {
           console.log('进入新版驳回')
           this.$confirm(`确定驳回流程吗?`, '提示', {

+ 661 - 0
src/views/modules/materialManagement/contract/ContractForm.vue

@@ -0,0 +1,661 @@
+<template>
+  <div>
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="formReadOnly"
+             label-width="200px" @submit.native.prevent>
+
+      <el-divider content-position="left"><i class="el-icon-document"></i> 客户信息</el-divider>
+      <el-row :gutter="0">
+        <el-col :span="10">
+          <el-form-item label="客户名称" prop="name" :rules="[
+                   ]">
+            <span slot="label"><span style="color: red;border-top: 20px">*</span> 客户名称</span>
+            <el-input maxlength="64" v-model="inputForm.name" placeholder="请输入客户名称" clearable></el-input>
+            <div class="usc_code_append_message">{{nameMessage}}</div>
+          </el-form-item>
+        </el-col>
+        <el-col :span="2">
+          <el-popover
+            v-model="visiblePop"
+            placement="left"
+            width="400"
+            height="800"
+            trigger="click"
+            :popper-options="{ boundariesElement: 'viewport', removeOnDestroy: true }"
+            ref="pops">
+            <vxe-table
+              border="inner"
+              auto-resize
+              resizable
+              :row-config="{isHover: true}"
+              :data="gridData"
+              :checkbox-config="{}"
+              :row-style="rowStyle"
+              :key="tableKey"
+              @cell-click="rowClick"
+              :show-header="false"
+            >
+              <vxe-column title="" field="entname" ></vxe-column>
+            </vxe-table>
+            <el-button type="info" slot="reference" @click="getPopTable" style="width: 100%" plain>查询</el-button>
+          </el-popover>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="是否有统一社会信用代码" prop="isUscCode"
+                        :rules="[
+                          {required: true, message:'请选择是否有统一社会信用代码', trigger:'blur'}
+                   ]">
+            <el-radio-group v-model="inputForm.isUscCode">
+              <el-radio v-for="item in $dictUtils.getDictList('yes_no')" :label="item.value" >{{item.label}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        </el-row>
+        <el-row :gutter="15">
+          <el-col v-if="inputForm.isUscCode === '1'" :span="12">
+            <el-form-item label="统一社会信用代码" prop="uscCode"
+                          :rules="[
+                                    {required: true, message:'统一社会信用代码不能为空', trigger:'blur'}
+                     ]">
+              <el-input v-model="inputForm.uscCode" placeholder="请填写统一社会信用代码" clearable></el-input>
+              <div class="usc_code_append_message">{{uscCodeMessage}}</div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="注册地址" prop="companyAddress"
+                          :rules="[
+                     ]">
+              <el-input v-model="inputForm.companyAddress" placeholder="注册地址" clearable></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="详细地址" prop="address"
+                          :rules="[
+                                  {required: true, message:'详细地址不能为空', trigger:'blur'}
+                     ]">
+              <el-input v-model="inputForm.address" placeholder="详细地址" clearable></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="公司电话" prop="mobile"
+                          :rules="[
+                     ]">
+              <el-input v-model="inputForm.mobile" placeholder="公司电话" clearable></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remarks1"
+                          :rules="[
+                   ]">
+              <el-input type="textarea" maxlength="500" v-model="inputForm.remarks1" placeholder="请填写备注" show-word-limit></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      <el-divider content-position="left"><i class="el-icon-document"></i> 合同信息</el-divider>
+      <el-row  :gutter="0">
+        <el-col :span="12">
+          <el-form-item label="合同名称" prop="contractName"
+                        :rules="[{required: true, message: '合同名称不能为空', trigger: 'blur'}
+                 ]">
+            <el-input v-model="inputForm.contractName" placeholder="请输入合同名称" clearable></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="签订日期" prop="signingDate"
+                        :rules="[
+                {required: true, message:'请输入签订日期', trigger:'blur'}
+               ]">
+            <el-date-picker
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              v-model="inputForm.signingDate"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="合同生效日期" prop="effectiveDate"
+                        :rules="[
+                {required: true, message:'请输入合同生效日期', trigger:'blur'}
+               ]">
+            <el-date-picker
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              v-model="inputForm.effectiveDate"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="合同终止日期" prop="endTime"
+                        :rules="[
+                {required: true, message:'请输入合同终止日期', trigger:'blur'}
+               ]">
+            <el-date-picker
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              v-model="inputForm.endTime"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remarks2"
+                        :rules="[
+                   ]">
+            <el-input type="textarea" maxlength="500" v-model="inputForm.remarks2" placeholder="请填写备注" show-word-limit></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-tabs v-model="activeName" type="border-card" @tab-click="tabHandleClick">
+        <el-tab-pane label="客户联系人" name="contact">
+          <span slot="label"><span style="color: red;border-top: 20px">*</span> 客户联系人</span>
+          <el-row :gutter="15">
+            <el-button type="primary" style="margin-bottom: 15px" size="mini" :disabled="status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('contact')">
+              新增客户联系人
+            </el-button>
+          </el-row>
+          <el-row  :gutter="15">
+            <el-form :disabled="status === 'audit' || status === 'taskFormDetail'">
+              <vxe-table
+                border
+                show-overflow
+                show-footer
+                :column-config="{resizable: true}"
+                ref="contactTable"
+                :key="tableKeyContact"
+                class="vxe-table-element"
+                :data="inputForm.cwProjectClientContactDTOList"
+                style=""
+                @cell-click=""
+                @edit-closed=""
+                highlight-current-row
+                :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: true, icon: '-'}"
+              >
+                <vxe-table-column align="center" field="name" title="姓名" :edit-render="{}">
+                  <template v-slot:edit="scope">
+                    <el-input v-model="scope.row.name" placeholder="姓名" clearable></el-input>
+                  </template>
+                </vxe-table-column>
+                <vxe-table-column align="center" field="position" title="职务" :edit-render="{}">
+                  <template v-slot:edit="scope">
+                    <el-input v-model="scope.row.position" placeholder="职务" clearable></el-input>
+                  </template>
+                </vxe-table-column>
+                <vxe-table-column align="center" field="contactFirst" title="联系方式1" :edit-render="{}">
+                  <template v-slot:edit="scope">
+                    <el-input v-model="scope.row.contactFirst" oninput="value=value.replace(/[^\d]/g,'')" placeholder="联系方式1" clearable></el-input>
+                  </template>
+                </vxe-table-column>
+                <vxe-table-column align="center" field="contactSecond" title="联系方式2" :edit-render="{}">
+                  <template v-slot:edit="scope">
+                    <el-input v-model="scope.row.contactSecond" oninput="value=value.replace(/[^\d]/g,'')" placeholder="联系方式2" clearable></el-input>
+                  </template>
+                </vxe-table-column>
+                <vxe-table-column align="center" field="remarks" title="备注" :edit-render="{}">
+                  <template v-slot:edit="scope">
+                    <el-input maxlength="500" v-model="scope.row.remarks" 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,'contact')">删除</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-form>
+  </div>
+</template>
+
+<script>
+  import EnterpriseSearchService from '@/api/cw/common/EnterpriseSearchService'
+  import WorkClientService from '@/api/cw/workClientInfo/WorkClientService'
+  import UserSelect from '@/components/userSelect'
+  import CommonApi from '@/api/cw/common/CommonApi'
+  import MaterialManagementService from '@/api/materialManagement/MaterialManagementService'
+  import ContractService from '@/api/materialManagement/ContractService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import UserService from '@/api/sys/UserService'
+  export default {
+    data () {
+      return {
+        validRules: {
+          purchaserAgent: [
+            {required: true, message: '采购人不能为空'}
+          ],
+          procurementOffice: [
+            {required: true, message: '采购部门不能为空'}
+          ],
+          procurementType: [
+            {required: true, message: '采购类型不能为空'}
+          ]
+        },
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        indexRow: '',
+        inputForm: {
+          id: '',
+          createDate: '',
+          name: '',
+          uscCode: '',
+          isUscCode: '',
+          address: '',
+          companyAddress: '',
+          mobile: '',
+          remarks1: '',
+          remarks2: '',
+          contractName: '',
+          signingDate: '',
+          effectiveDate: '',
+          endTime: '',
+          cwProjectClientContactDTOList: [],
+          files: [] // 附件信息
+        },
+        activeName: 'contact',
+        uscCodeMessage: '',
+        nameMessage: '',
+        tableKey: '',
+        tableKeyContact: '2',
+        keyWatch: '',
+        visiblePop: false,
+        gridData: []
+      }
+    },
+    enterpriseSearchService: null,
+    workClientService: null,
+    materialManagementService: null,
+    contractService: null,
+    userService: null,
+    commonApi: null,
+    created () {
+      this.enterpriseSearchService = new EnterpriseSearchService()
+      this.workClientService = new WorkClientService()
+      this.materialManagementService = new MaterialManagementService()
+      this.contractService = new ContractService()
+      this.userService = new UserService()
+      this.commonApi = new CommonApi()
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      UserSelect,
+      UpLoadComponent,
+      SelectUserTree,
+      SelectTree
+    },
+    computed: {
+      bus: {
+        get () {
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      },
+      name () {
+        return JSON.parse(localStorage.getItem('user')).name
+      },
+      officeName () {
+        return JSON.parse(localStorage.getItem('user')).officeDTO.name
+      },
+      purchaserAgentId () {
+        return JSON.parse(localStorage.getItem('user')).id
+      },
+      procurementTypeId () {
+        return ''
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      }
+    },
+    methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          id: '',
+          createDate: '',
+          name: '',
+          isUscCode: '',
+          mobile: '',
+          uscCode: '',
+          address: '',
+          companyAddress: '',
+          remarks1: '',
+          remarks2: '',
+          contractName: '',
+          signingDate: '',
+          effectiveDate: '',
+          endTime: '',
+          cwProjectClientContactDTOList: [],
+          files: [] // 附件信息
+        }
+        this.activeName = 'contact'
+        this.uscCodeMessage = ''
+        this.nameMessage = ''
+        if (method === 'add') {
+          this.title = `新建采购类型`
+        } else if (method === 'edit') {
+          this.title = '修改采购类型'
+        }
+        this.inputForm.id = id
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          if (this.formReadOnly === true && this.businessId !== 'false') {
+            method = 'view'
+          }
+          if (this.commonJS.isEmpty(this.inputForm.handledByOffice)) {
+            this.inputForm.handledByOffice = JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.status === 'audit' || this.status === 'taskFormDetail') {
+            method = 'view'
+          }
+          this.loading = true
+          this.$refs.inputForm.resetFields()
+          this.contractService.findById(this.inputForm.id).then(({data}) => {
+            if (this.inputForm.id !== 'false') {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement')
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            } else {
+              this.inputForm.cwProjectClientContactDTOList = []
+              this.loading = false
+            }
+          })
+          if (method !== 'edit' && method !== 'view') {
+            this.$refs.uploadComponent.newUpload(method, [], 'reimbursement')
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.id = this.businessId
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.contractService.save(this.inputForm).then(({data}) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.inputForm.detailInfos = []
+        this.$refs.uploadComponent.clearUpload()
+        this.visible = false
+        this.nameMessage = ''
+        this.uscCodeMessage = ''
+      },
+      reapplyForm (callback) {
+        this.contractService.findById(this.inputForm.id).then(({data}) => {
+          if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+          } else {
+            this.startForm(callback)
+          }
+        })
+      },
+      // 暂存
+      async saveForm (callback) {
+        this.loading = true
+        if (this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          return
+        }
+        if (this.commonJS.isEmpty(this.inputForm.files)) {
+          this.inputForm.files = []
+        }
+        this.inputForm.files = this.$refs.uploadComponent.getDataList()
+        this.inputForm.status = '1'
+        this.contractService.save(this.inputForm).then(({data}) => {
+          callback()
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        }).catch(() => {
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        })
+      },
+      // 送审
+      async startForm (callback) {
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            if (this.commonJS.isEmpty(this.inputForm.cwProjectClientContactDTOList)) {
+              this.$message.error('最少添加一个联系人')
+              this.loading = false
+              throw new Error()
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.inputForm.status = '2'
+            this.contractService.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
+            })
+          }
+        })
+      },
+      // 通过
+      async agreeForm (callback) {
+        this.$refs['inputForm'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            if (this.$refs.uploadComponent.checkProgress()) {
+              this.loading = false
+              return
+            }
+            if (this.commonJS.isEmpty(this.inputForm.files)) {
+              this.inputForm.files = []
+            }
+            this.inputForm.files = this.$refs.uploadComponent.getDataList()
+            this.inputForm.status = '5'
+            this.contractService.save(this.inputForm).then(({data}) => {
+              callback(data.businessTable, data.businessId, this.inputForm)
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+            // this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then(({data}) => {
+            //   if (this.commonJS.isNotEmpty(data)) {
+            //     console.log('进来了', data)
+            //     if (data === '公司领导审批') {
+            //       this.inputForm.status = '5'
+            //     }
+            //   }
+            //   this.contractService.save(this.inputForm).then(({data}) => {
+            //     callback(data.businessTable, data.businessId, this.inputForm)
+            //     this.loading = false
+            //   }).catch(() => {
+            //     this.loading = false
+            //   })
+            // })
+          }
+        })
+      },
+      async updateStatusById (type, callback) {
+        if (await this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            this.contractService.findById(this.inputForm.id).then(({data}) => {
+              if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                if (type === 'reject') {
+                  // 驳回
+                  this.inputForm.status = '4'
+                }
+                if (type === 'reback') {
+                  // 撤回
+                  this.inputForm.status = '3'
+                }
+                if (type === 'reject' || type === 'reback') {
+                  let param = {status: this.inputForm.status, id: this.inputForm.id}
+                  this.contractService.updateStatusById(param).then(() => {
+                    callback()
+                  })
+                }
+              }
+            })
+          } else if (type === 'hold') {
+            this.contractService.findById(this.inputForm.id).then(({data}) => {
+              if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                // 终止
+                let param = {status: '1', id: this.inputForm.id}
+                this.contractService.updateStatusById(param).then(() => {
+                  callback()
+                })
+              }
+            })
+          }
+        }
+      },
+      async getPopTable () {
+        let name = this.inputForm.name
+        if (this.commonJS.isNotEmpty(name)) {
+          await this.enterpriseSearchService.enterpriseSearchByName(name).then(({data}) => {
+            this.gridData = data.data.items
+            this.$refs.pops.updatePopper()
+            this.tableKey = Math.random()
+          })
+        }
+        this.$refs.pops.updatePopper()
+      },
+      closePop () {
+        this.visiblePop = false
+      },
+      rowStyle (event) {
+        return 'cursor:pointer;'
+      },
+      async rowClick (event) {
+        let id = this.gridData[event.rowIndex].companyid
+        await this.enterpriseSearchService.enterpriseTicketInfo(id).then((data) => {
+          this.inputForm.name = data.data.ENTNAME
+          this.inputForm.uscCode = data.data.UNCID
+          this.inputForm.address = data.data.OPLOC
+        })
+        this.visiblePop = false
+      },
+      tabHandleClick (event) {
+        // console.log(event)
+      },
+      insertEvent (type) {
+        if (type === 'contact') {
+          let d = {
+            contactFirst: '',
+            contactSecond: '',
+            email: '',
+            fax: '',
+            name: '',
+            officeId: '',
+            position: '',
+            remarks: '',
+            sex: ''
+          }
+          if (this.commonJS.isEmpty(this.inputForm.cwProjectClientContactDTOList)) {
+            this.inputForm.cwProjectClientContactDTOList = []
+          }
+          this.$refs.contactTable.insertAt(d)
+          this.inputForm.cwProjectClientContactDTOList.push(d)
+          this.tableKeyContact = Math.random()
+        }
+      },
+      // 删除
+      removeEvent (row, rowIndex, type) {
+        if (type === 'contact') {
+          this.$refs.contactTable.remove(row)
+          this.inputForm.cwProjectClientContactDTOList.splice(rowIndex, 1)
+        }
+      }
+    }
+  }
+</script>
+<style scoped>
+  /deep/ .el-input-number .el-input__inner {
+    text-align: left;
+  }
+</style>
+<style>
+  .usc_code_append_message {
+    color: #F56C6C;
+    font-size: 12px;
+    line-height: 1;
+    padding-top: 4px;
+    position: absolute;
+    top: 100%;
+    left: 0;
+  }
+</style>

+ 367 - 0
src/views/modules/materialManagement/contract/ContractList.vue

@@ -0,0 +1,367 @@
+<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="name">
+        <el-input size="small" v-model="searchForm.name" placeholder="请输入客户名称" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="合同名称" prop="contractName">
+        <el-input size="small" v-model="searchForm.contractName" placeholder="请输入合同名称" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="searchForm.status" placeholder="请选择" style="width:100%;">
+          <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 label="合同生效日期" prop="effectiveDates">
+        <el-date-picker
+          placement="bottom-start"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          v-model="searchForm.effectiveDates"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
+      </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('contract:add')" type="primary" size="small" icon="el-icon-plus" @click="start()">新建</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="clientTable"
+          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="160" align="center" title="客户名称" field="name"></vxe-column>
+          <vxe-column min-width="160" align="center" title="统一社会信用代码" field="uscCode"></vxe-column>
+          <vxe-column min-width="160" align="center" title="详细地址" field="address"></vxe-column>
+          <vxe-column min-width="160" align="center" title="合同名称" field="contractName"></vxe-column>
+          <vxe-column min-width="160" align="center" title="合同生效日期" field="effectiveDate"></vxe-column>
+          <vxe-column min-width="160" align="center" title="合同终止日期" field="endTime"></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('contract:edit')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
+              <el-button v-else-if="hasPermission('contract:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
+              <el-button v-if="hasPermission('contract:edit')&&scope.row.createBy === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
+              <el-button v-if="hasPermission('contract:del')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('contract:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   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>
+        <UpdateInfoForm ref="updateInfoForm" @refreshList="refreshList"></UpdateInfoForm>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import UserSelect from '@/components/userSelect'
+  import UpdateInfoForm from '../info/UpdateInfoForm'
+  import InputNumber from '@/views/modules/cw/workContract/InputNumber.vue'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import WorkClientService from '@/api/cw/workClientInfo/WorkClientService'
+  import MaterialManagementService from '@/api/materialManagement/MaterialManagementService'
+  import ContractService from '@/api/materialManagement/ContractService'
+  import TaskService from '@/api/flowable/TaskService'
+  import ProcessService from '@/api/flowable/ProcessService'
+  import pick from 'lodash.pick'
+  import UserService from '@/api/sys/UserService'
+  import SelectUserTree from '@/views/modules/utils/treeUserSelect'
+  export default {
+    data () {
+      return {
+        num: 0,
+        searchForm: {
+          contractName: '',
+          name: '',
+          handledBy: '',
+          handledByOffice: '',
+          status: '',
+          effectiveDates: [],
+          procurementType: '',
+          createBy: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        tableKey: '',
+        loading: false,
+        processDefinitionAuditId: '',
+        procDefAuditKey: '',
+        isAdmin: false,
+        create: ''
+      }
+    },
+    workClientService: null,
+    materialManagementService: null,
+    contractService: null,
+    taskService: null,
+    processService: null,
+    userService: null,
+    created () {
+      this.workClientService = new WorkClientService()
+      this.materialManagementService = new MaterialManagementService()
+      this.contractService = new ContractService()
+      this.taskService = new TaskService()
+      this.processService = new ProcessService()
+      this.userService = new UserService()
+    },
+    components: {
+      InputNumber,
+      SelectUserTree,
+      SelectTree,
+      UpdateInfoForm,
+      UserSelect
+    },
+    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.reportManagementForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.clientTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.updateInfoForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.updateInfoForm.init('view', id)
+      },
+      // 查询当前用户是否是管理员用户
+      checkIsAdmin () {
+        this.userService.is().then(({data}) => {
+          this.isAdmin = data
+        })
+      },
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.contractService.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.clientTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.contractService.remove(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: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                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: '/materialManagement/contract/ContractList'
+              }
+            })
+          })
+      },
+      // 发起物资管理-合同申请
+      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') {
+          status = 'startAndClose'
+        } else if (row.status === '4') {
+          status = 'reapplyFlag'
+        }
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
+          businessId: row.id,
+          businessTable: 'material_management_pruchase_request_basics'}).then((data) => {
+            this.$router.push({
+              path: '/flowable/task/TaskForm',
+              query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                procDefId: this.processDefinitionAuditId,
+                procDefKey: this.procDefAuditKey,
+                title: title,
+                formType: data.data.formType,
+                formUrl: data.data.formUrl,
+                formTitle: processTitle,
+                businessTable: 'material_management_pruchase_request_basics',
+                businessId: row.id,
+                isShow: 'false',
+                status: status,
+                routePath: '/materialManagement/contract/ContractList'
+              }
+            })
+          })
+      },
+      // 查看客户登记流程结果
+      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: {
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                isShow: 'false',
+                readOnly: true,
+                title: '质控管理' + '流程详情',
+                formTitle: '质控管理' + '流程详情',
+                businessId: row.id,
+                status: 'reback'
+              }
+            })
+          })
+        }
+      },
+      // 撤回报告流程
+      reback (row) {
+        this.$confirm(`确定要撤回该申请吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(async () => {
+          await this.contractService.findById(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.contractService.updateStatusById(form)
+                this.$message.success(data)
+                this.refreshList()
+              })
+            }
+          })
+        })
+      }
+    }
+  }
+</script>

+ 2 - 2
src/views/modules/materialManagement/purchase/PurchaseList.vue

@@ -141,10 +141,10 @@
 
           <vxe-column title="操作" width="150px" fixed="right" align="center">
             <template  slot-scope="scope">
-              <el-button v-if="hasPermission('material:edit')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
+              <el-button v-if="hasPermission('material:edit')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
               <el-button v-else-if="hasPermission('material:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
               <el-button v-if="hasPermission('material:edit')&&scope.row.createBy === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('material:del')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('material:del')&&scope.row.createBy === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
               <el-button v-else-if="hasPermission('material:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>