Browse Source

代码提交:
客户信息List和from表单提交

sunruiqi 2 years ago
parent
commit
aa02a86775

+ 39 - 0
src/api/sys/WorkClientService.js

@@ -0,0 +1,39 @@
+import request from '@/utils/httpRequest'
+
+export default class WorkClientService {
+  list (param) {
+    return request({
+      url: '/workClientInfo/workClientInfo/list',
+      method: 'post',
+      data: param
+    })
+  }
+  add (param) {
+    return request({
+      url: '/workClientInfo/workClientInfo/add',
+      method: 'post',
+      data: param
+    })
+  }
+  remove (url) {
+    return request({
+      url: '/workClientInfo/workClientInfo/remove',
+      method: 'get',
+      params: {id: url}
+    })
+  }
+  findById (id) {
+    return request({
+      url: '/workClientInfo/workClientInfo/findById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  update (param) {
+    return request({
+      url: '/workClientInfo/workClientInfo/update',
+      method: 'post',
+      data: param
+    })
+  }
+}

+ 707 - 0
src/views/modules/sys/workClient/WorkClientForm.vue

@@ -0,0 +1,707 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+      v-dialogDrag
+      width="800px"
+      @close="close"
+      @keyup.enter.native="doSubmit"
+      :visible.sync="visible">
+      <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="150px">
+        <el-row  :gutter="15">
+          <el-col :span="12">
+            <el-form-item label="客户名称" prop="name"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.name" placeholder="请输入客户名称"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="是否拥有信用代码" prop="hasUscc"
+                          :rules="[
+                 ]">
+              <el-radio-group v-model="inputForm.hasUscc">
+                <el-radio v-for="item in $dictUtils.getDictList('yes_no')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="统一社会信用代码" prop="uscCode"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.uscCode" placeholder="请输入统一社会信用代码"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="客户性质" prop="companyType"
+                          :rules="[
+                 ]">
+              <el-select v-model="inputForm.companyType" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in $dictUtils.getDictList('customer_nature')"
+                  :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="companyIndustry"
+                          :rules="[
+                 ]">
+              <el-select v-model="inputForm.companyIndustry" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in $dictUtils.getDictList('industry')"
+                  :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="clientType"
+                          :rules="[
+                 ]">
+              <el-select v-model="inputForm.clientType" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in $dictUtils.getDictList('customer_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="deputy"
+                          :rules="[
+                 ]">
+              <el-select v-model="inputForm.deputy" placeholder="请选择" style="width:100%;">
+                <el-option
+                  v-for="item in $dictUtils.getDictList('representative')"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
+                  <el-checkbox v-model="item.check" @change="isChecked(item)">
+                    {{ item.label }}
+                  </el-checkbox>
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="法人代表" prop="lawerPresint"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.lawerPresint" placeholder="请填写法人代表"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="邮政编码" prop="zipCode"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.zipCode" placeholder="请填写邮政编码"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="传真" prop="fax"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.fax" placeholder="请填写传真"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="公司电话" prop="telephone"
+                          :rules="[
+                   {required: true, message:'公司电话不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.telephone" placeholder="请填写公司电话"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="公司网址" prop="companyUrl"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.companyUrl" placeholder="请填写公司网址"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="归属区域" prop="inputForm.areaId">
+              <SelectTree
+                ref="areaTree"
+                :props="{
+                      value: 'areaId',             // ID字段名
+                      label: 'name',         // 显示名称
+                      children: 'children'    // 子级字段名
+                    }"
+                url="/sys/area/treeData"
+                :value="inputForm.areaId"
+                :clearable="true"
+                :accordion="true"
+                v-if="visible"
+                @getValue="(value) => {inputForm.areaId=value}"/>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="注册地址" prop="registerAddress"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.registerAddress" placeholder="请填写注册地址"     ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="详细地址" prop="address"
+                          :rules="[
+                 ]">
+              <el-input v-model="inputForm.address" placeholder="请填写详细地址"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-form-item label="单位简介" prop="remarks">
+          <el-input v-model="inputForm.remarks"
+                    :disabled="isEdit"
+                    type="textarea"
+                    :rows="5"
+                    maxlength="500"
+                    placeholder="请输入单位简介"
+                    show-word-limit>
+          </el-input>
+        </el-form-item>
+
+        <el-form-item label="开户行信息" prop="bankInfons">
+          <el-button type="primary" size="mini" @click="addRow(banInfos.length)">新增</el-button>
+        </el-form-item>
+        <el-table :data="banInfos" style="width: 90%; margin-left: 5em" ref="tb" :row-class-name="tableRowClassName" @current-change="handleRadioChange">
+          <el-table-column prop="ourBank" label="开户银行" >
+            <el-input v-model="bankInfo.ourBank" placeholder="开户银行"></el-input>
+          </el-table-column>
+          <el-table-column prop="bankNumber" label="开户账号" >
+            <el-input v-model="bankInfo.bankNumber" placeholder="开户账号"></el-input>
+          </el-table-column>
+          <el-table-column prop="remarks" label="备注信息" >
+            <el-input v-model="bankInfo.remarks" placeholder="备注信息"></el-input>
+          </el-table-column>
+          <el-table-column fixed="right" label="操作" >
+            <template slot-scope="scope">
+              <el-button @click.native.prevent="deleteRow(scope.$index, banInfos)" type="text" size="small">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <el-form-item label="联系人信息" prop="linkmanInfos">
+          <el-button type="primary" size="mini" @click="addRow1(linkmanInfos.length)">新增</el-button>
+        </el-form-item>
+        <el-table :data="linkmanInfos" style="width: 90%; margin-left: 5em" ref="tb" :row-class-name="tableRowClassName" @current-change="handleRadioChange">
+          <el-table-column prop="name" label="联系人姓名" >
+            <el-input v-model="linkmanInfo.ourBank" placeholder="联系人姓名"></el-input>
+          </el-table-column>
+          <el-table-column prop="office" label="部门" >
+            <el-input v-model="linkmanInfo.office" placeholder="部门"></el-input>
+          </el-table-column>
+          <el-table-column prop="position" label="职务" >
+            <el-input v-model="linkmanInfo.position" placeholder="职务"></el-input>
+          </el-table-column>
+          <el-table-column prop="qq" label="QQ" >
+            <el-input v-model="linkmanInfo.qq" placeholder="QQ"></el-input>
+          </el-table-column>
+          <el-table-column prop="linkPhone" label="联系方式1" >
+            <el-input v-model="linkmanInfo.linkPhone" placeholder="联系方式1"></el-input>
+          </el-table-column>
+          <el-table-column prop="linkMobile" label="联系方式2" >
+            <el-input v-model="linkmanInfo.linkMobile" placeholder="联系方式2"></el-input>
+          </el-table-column>
+          <el-table-column prop="email" label="E-mail" >
+            <el-input v-model="linkmanInfo.email" placeholder="E-mail"></el-input>
+          </el-table-column>
+          <el-table-column fixed="right" label="操作" >
+            <template slot-scope="scope">
+              <el-button @click.native.prevent="deleteRow1(scope.$index, linkmanInfos)" type="text" size="small">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <el-upload ref="upload" style="display: inline-block; margin-left: 5em; :show-header='status'" action=""
+                   :limit="999" :http-request="httpRequest"
+                   multiple
+                   :on-exceed="(files, fileList) =>{
+                    $message.warning(`当前限制选择 999 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
+                   }"
+                   :on-remove="handleRemove"
+                   :show-file-list="false"
+                   :on-change="changes"
+                   :file-list="filesArra2">
+          <el-button type="info" size="mini" v-if="inputForm.permissionFlag&&showVi">点击上传</el-button>
+          </el-upload>
+          <div style="height: calc(100% - 80px);margin-top: 30px">
+          <vxe-table
+            style="margin-left: 5em"
+            border="inner"
+            auto-resize
+            resizable
+            height="50px"
+            :loading="loading"
+            size="small"
+            ref="projectTable"
+            show-header-overflow
+            show-overflow
+            highlight-hover-row
+            :menu-config="{}"
+            :print-config="{}"
+            @sort-change="sortChangeHandle"
+            :sort-config="{remote:true}"
+            :data="dataListNew"
+            :checkbox-config="{}">
+            <vxe-column type="seq" width="40"></vxe-column>
+            <vxe-column title="文件名称" field="name">
+              <template slot-scope="scope">
+                <el-link  type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.name}}</el-link>
+              </template>
+            </vxe-column>
+            <vxe-column title="创建人" field="createBy"></vxe-column>
+            <vxe-column title="创建时间" field="createDate"></vxe-column>
+            <vxe-column title="操作" width="200px" fixed="right" align="center">
+              <template  slot-scope="scope">
+                <el-button type="text"  icon="el-icon-delete" size="small" v-if="inputForm.permissionFlag&&showVi" @click="deleteMsgById(scope.row, scope.$rowIndex)">删除</el-button>
+                <el-button type="text"  icon="el-icon-edit" size="small" @click="toHref(scope.row)" :disabled="none">下载</el-button>
+              </template>
+            </vxe-column>
+          </vxe-table>
+          </div>
+
+      </el-form>
+      <el-image-viewer
+        v-if="showViewer"
+        :on-close="closeViewer"
+        :url-list="[url]"
+        zIndex="9999"/>
+      <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="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+    </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import WorkClientService from '@/api/sys/WorkClientService'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import OSSSerive, {
+    httpRequest,
+    handleRemove,
+    fileName
+  } from '@/api/sys/OSSService'
+  import moment from 'moment'
+  import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
+  export default {
+    data () {
+      return {
+        radio: 0,
+        tableData: [],
+        //给一个默认行
+        dataList: [],
+        dataListNew: [],
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+          permissionFlag: '', // 判断是否为当前登录人参数
+          name: '',
+          hasUscc: '',
+          uscCode: '',
+          companyType: '',
+          companyIndustry: '',
+          clientType: '',
+          deputy: '',
+          lawerPresint: '',
+          zipCode: '',
+          fax: '',
+          telephone: '',
+          companyUrl: '',
+          areaId: '',
+          registerAddress: '',
+          address: ''
+        },
+        banInfos: [],
+        bankInfo: {
+          ourBank: '',
+          bankNumber: '',
+          remarks: ''
+        },
+        linkmanInfos: [],
+        linkmanInfo: {
+          name: '',
+          office: '',
+          position: '',
+          qq: '',
+          linkPhone: '',
+          linkMobile: '',
+          email: ''
+        },
+        filesArra2: [],
+        fileList: [],
+        isFlag: true,
+        showViewer: false, // 显示查看器
+        url: '',
+        rowurl: '',
+        src: '',
+        showVi: true
+      }
+    },
+    components: {
+      ElImageViewer,
+      SelectTree
+    },
+    ossService: null,
+    workClientService: null,
+    created () {
+      this.ossService = new OSSSerive()
+      this.workClientService = new WorkClientService()
+    },
+    methods: {
+      async toHref (row) {
+        const link = document.createElement('a')
+        if (row.id === null || row.id === undefined || row.id === '') {
+          await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
+            const url = data.data // 完整的url则直接使用
+            // 这里是将url转成blob地址,
+            fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
+              link.href = URL.createObjectURL(blob)
+              console.log(link.href)
+              link.download = row.name || '' // 下载文件的名字
+              // a.download = url.split('/')[url.split('/').length -1] //  // 下载文件的名字
+              document.body.appendChild(link)
+              link.click()
+              // 在资源下载完成后 清除 占用的缓存资源
+              window.URL.revokeObjectURL(link.href)
+              document.body.removeChild(link)
+            })
+          })
+        } else {
+          const url = row.temporaryUrl // 完整的url则直接使用
+          // 这里是将url转成blob地址,
+          fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
+            link.href = URL.createObjectURL(blob)
+            console.log(link.href)
+            link.download = row.name || '' // 下载文件的名字
+            // a.download = url.split('/')[url.split('/').length -1] //  // 下载文件的名字
+            document.body.appendChild(link)
+            link.click()
+            // 在资源下载完成后 清除 占用的缓存资源
+            window.URL.revokeObjectURL(link.href)
+            document.body.removeChild(link)
+          })
+        }
+      },
+      onPreview (url) {
+        this.url = url
+        this.showViewer = true
+      },
+      // 关闭查看器
+      closeViewer () {
+        this.url = ''
+        this.showViewer = false
+      },
+      init (method, id) {
+        this.dataList = []
+        this.dataListNew = []
+        this.ossService.findFileList(id).then(({data}) => {
+          data.forEach((item) => {
+            item.name = item.attachmentName
+            // item.createBy = item.createBy
+            // item.createDate = item.createDate
+            // item.description = item.description
+            this.dataList.push(item)
+            this.dataListNew.push(item)
+          })
+        })
+        this.method = method
+        this.inputForm = {
+          customerName: '',
+          projectName: '',
+          evaluationObjective: '',
+          projectType: '',
+          evaluationBaseDate: '',
+          evaluationBaseDateUi: '',
+          evaluationReportDate: '',
+          evaluationReportDateUi: '',
+          protocolNum: '',
+          documentNum: '',
+          projectHead: '',
+          waystEvaluation: '',
+          fixedAssetsEvaluation: '',
+          netAssetsEvaluation: '',
+          rentEvaluation: '',
+          forensics: '',
+          reportCharges: '',
+          currentDisposePerson: '',
+          isInvoice: '',
+          invoiceDate: '',
+          invoiceDateUi: '',
+          actualCharges: '',
+          isContractArchive: '',
+          isPapersIntact: '',
+          isPapersArchive: '',
+          opsAmount: '',
+          isOpsReimbursement: '',
+          reimbursementAmount: '',
+          unreimbursedAmount: '',
+          reimbursementNum: '',
+          reimbursementDate: '',
+          reimbursementDateUi: '',
+          evaluationPersonOne: '',
+          evaluationPersonTwo: '',
+          status: '',
+          assessReportMessage: '',
+          assessBaseMessage: '',
+          invoiceMessage: '',
+          isCommissionReimbursement: '',
+          itemType: '',
+          workAttachments: []
+        }
+        this.inputForm.id = id
+        if (method === 'add') {
+          this.inputForm.permissionFlag = true
+          this.title = `新建客户信息`
+        } else if (method === 'edit') {
+          this.title = '修改客户信息'
+        } else if (method === 'view') {
+          this.showVi = false
+          this.title = '查看客户详情'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.upload.clearFiles()
+          this.$refs.inputForm.resetFields()
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+            this.workClientService.findById(this.inputForm.id).then(({data}) => {
+              console.log('findById结果:', data)
+              // this.inputForm = this.recover(this.inputForm, data)
+              // this.inputForm.evaluationBaseDateUi = data.evaluationBaseDate
+              // this.inputForm.evaluationReportDateUi = data.evaluationReportDate
+              // this.inputForm.invoiceDateUi = data.invoiceDate
+              // this.inputForm.reimbursementDateUi = data.reimbursementDate
+              // this.inputForm.permissionFlag = data.permissionFlag
+              // this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              // this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+            this.inputForm.itemType = '1'
+            console.log(this.dataListNew)
+            this.inputForm.workAttachments = []
+            this.dataListNew.forEach((item) => {
+              if (item.id === null || item.id === undefined || item.id === '') {
+                item.url = item.raw.url
+              }
+              item.attachmentFlag = 'projectRecords'
+              item.fileSize = item.size
+              item.attachmentName = item.name
+              this.inputForm.workAttachments.push(item)
+            })
+            if (this.inputForm.evaluationReportDateUi === null || this.inputForm.evaluationReportDateUi === undefined || this.inputForm.evaluationReportDateUi === '') {
+              this.inputForm.status = '1'
+            } else {
+              this.inputForm.status = '5'
+            }
+            this.projectService.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.visible = false
+        this.showVi = true
+      },
+      httpRequest (file) {
+        httpRequest(file, fileName(file), 'projectRecords')
+      },
+      handleRemove () {
+        this.fileList = handleRemove()
+      },
+      changes (file, fileList) {
+        console.log('file', file)
+        console.log('22', 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)
+        })
+        console.log('11', this.dataList)
+        console.log('33', this.dataListNew)
+        const isLt2M = file.size / 1024 / 1024 < 300
+        if (isLt2M === false) {
+          this.$message.error('文件大小不能超过 ' + 300 + 'M !')
+          this.fileList = []
+          this.filesArra2 = []
+        }
+      },
+      async showFile (row) {
+        console.log('row', row)
+        let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
+        if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
+          if (row.url !== null && row.url !== undefined && row.url !== '') {
+            this.onPreview(row.url)
+            return
+          } else {
+            await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
+              this.onPreview(data.data)
+            })
+            return
+          }
+        }
+        if (row.url !== null && row.url !== undefined && row.url !== '') {
+          if (suffix === 'pdf') {
+            window.open('https://view.xdocin.com/xdoc?_xdoc=' + row.url, '_blank')
+          } else if (suffix === 'rar' || suffix === 'zip' || suffix === 'jar' || suffix === '7z') {
+            window.open('http://ow365.cn/?i=25008&furl=' + row.url, '_blank')
+          } else {
+            window.open('https://view.officeapps.live.com/op/view.aspx?src=' + row.url, '_blank')
+          }
+        } else if (row.raw.url !== null && row.raw.url !== undefined && row.raw.url !== '') {
+          await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
+            this.rowurl = data.data
+          })
+          if (suffix === 'pdf') {
+            window.open('https://view.xdocin.com/xdoc?_xdoc=' + this.rowurl, '_blank')
+          } else if (suffix === 'rar' || suffix === 'zip' || suffix === 'jar' || suffix === '7z') {
+            window.open('http://ow365.cn/?i=25008&furl=' + this.rowurl, '_blank')
+          } else {
+            window.open('https://view.officeapps.live.com/op/view.aspx?src=' + this.rowurl, '_blank')
+          }
+        }
+      },
+      // 排序
+      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) {
+        console.log(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 > 4) {
+            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; //在原有的数据上加一个index
+      },
+      handleRadioChange(val) {
+        if (val) {
+          console.log(val)
+          this.radio = val.index;
+        }
+      },
+      // 增加一行
+      addRow(length) {
+        if (this.banInfos == undefined) {
+          this.banInfos = new Array();
+        }
+        this.banInfos.push(this.bankInfo);
+      },
+      // 删除一行
+      deleteRow(index) {
+        this.banInfos.splice(index, 1)
+      },
+      // 增加一行
+      addRow1(length) {
+        if (this.linkmanInfos == undefined) {
+          this.linkmanInfos = new Array();
+        }
+        this.linkmanInfos.push(this.linkmanInfo);
+      },
+      // 删除一行
+      deleteRow1(index) {
+        this.linkmanInfos.splice(index, 1)
+      }
+    }
+  }
+</script>

+ 240 - 0
src/views/modules/sys/workClient/WorkClientList.vue

@@ -0,0 +1,240 @@
+<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="searchForm.areaId">
+            <el-select size="small" v-model="searchForm.areaId" placeholder="请选择区域" />
+              <SelectTree
+                ref="areaTree"
+                :props="{
+                      value: 'areaId',             // ID字段名
+                      label: 'name',         // 显示名称
+                      children: 'children'    // 子级字段名
+                    }"
+                url="/sys/area/treeData"
+                :value="searchForm.areaId"
+                :clearable="true"
+                :accordion="true"
+                v-if="visible"
+                @getValue="(value) => {searchForm.areaId=value}"/>
+          </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">
+        <vxe-toolbar :refresh="{query: refreshList}" import export print custom>
+          <template #buttons>
+            <el-button v-if="hasPermission('sys:project:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
+            <el-button v-if="hasPermission('sys:project:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.workClientTable && $refs.workClientTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+          </template>
+        </vxe-toolbar>
+        <div style="height: calc(100% - 80px);">
+            <vxe-table
+                border="inner"
+                auto-resize
+                resizable
+                height="auto"
+                :loading="loading"
+                size="small"
+                ref="workClientTable"
+                show-header-overflow
+                show-overflow
+                highlight-hover-row
+                :menu-config="{}"
+                :print-config="{}"
+                @sort-change="sortChangeHandle"
+                :sort-config="{remote:true}"
+                :data="dataList"
+                :checkbox-config="{}">
+                <vxe-column type="seq" width="40"></vxe-column>
+                <vxe-column type="checkbox"  width="40px"></vxe-column>
+                <vxe-column width="300px"  title="客户名称" field="name">
+                    <template slot-scope="scope">
+                        <el-link  type="primary" :underline="false" v-if="hasPermission('sys:project:edit')" @click="view(scope.row.id)">{{scope.row.name}}</el-link>
+                        <el-link  type="primary" :underline="false" v-else-if="hasPermission('sys:project:view')"  @click="view(scope.row.id)">{{scope.row.name}}</el-link>
+                        <span v-else>{{scope.row.name}}</span>
+                    </template>
+                </vxe-column>
+                <vxe-column width="200px"  title="代表方" field="deputy" >
+                  <template slot-scope="scope">
+                    {{ $dictUtils.getDictLabel("representative", scope.row.deputy, '-') }}
+                  </template>
+                </vxe-column>
+                <vxe-column width="100px"  title="客户性质" field="companyType" >
+                  <template slot-scope="scope">
+                    {{ $dictUtils.getDictLabel("customer_nature", scope.row.companyType, '-') }}
+                  </template>
+                </vxe-column>
+                <vxe-column width="100px"  title="客户行业" field="companyIndustry" >
+                  <template slot-scope="scope">
+                    {{ $dictUtils.getDictLabel("industry", scope.row.companyIndustry, '-') }}
+                  </template>
+                </vxe-column>
+                <vxe-column width="100px"  title="所在地区" field="areaId" >
+                  <SelectTree
+                    ref="areaTree"
+                    :props="{
+                    value: 'areaId',             // ID字段名
+                    label: 'name',         // 显示名称
+                    children: 'children'    // 子级字段名
+                  }"
+                    url="/sys/area/treeData"
+                    :value="scope.row.areaId"
+                    :clearable="true"
+                    :accordion="true"
+                    v-if="visible"
+                    @getValue="(value) => {scope.row.areaId=value}"/>
+                </vxe-column>
+                <vxe-column width="200px" title="统一社会信用代码" field="uscCode" > </vxe-column>
+                <vxe-column width="100px" title="创建人" field="createBy" > </vxe-column>
+                <vxe-column width="150px" title="创建时间" field="createDate" > </vxe-column>
+
+                <vxe-column title="操作" width="200px" fixed="right" align="center">
+                    <template  slot-scope="scope">
+                      <el-button v-if="hasPermission('sys:project:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
+                      <el-button v-if="hasPermission('sys:project:edit') && scope.row.permissionFlag" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
+                      <el-button v-if="hasPermission('sys:project:del') && scope.row.permissionFlag" 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>
+        <!-- 弹窗, 新增 / 修改 -->
+    <WorkClientForm  ref="workClientForm" @refreshDataList="refreshList"></WorkClientForm>
+  </div>
+</template>
+
+<script>
+  import WorkClientForm from './WorkClientForm'
+  import WorkClientService from '@/api/sys/WorkClientService'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  export default {
+    data () {
+      return {
+        visible: false,
+        searchForm: {
+          name: '',
+          areaId: ''
+        },
+        dataList: [],
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    workClientService: null,
+    created () {
+      this.workClientService = new WorkClientService()
+    },
+    components: {
+      WorkClientForm,
+      SelectTree
+    },
+    activated () {
+      this.refreshList()
+    },
+
+    methods: {
+      // 获取数据列表
+      refreshList () {
+        this.loading = true
+        this.workClientService.list({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          'itemType': '1',
+          ...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.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()
+      },
+      // 新增
+      add () {
+        this.$refs.workClientForm.init('add', '')
+      },
+      // 修改
+      edit (id) {
+        id = id || this.$refs.workClientTable.getCheckboxRecords().map(item => {
+          return item.id
+        })[0]
+        this.$refs.workClientForm.init('edit', id)
+      },
+      // 查看
+      view (id) {
+        this.$refs.workClientForm.init('view', id)
+      },
+      // 删除
+      del (id) {
+        let ids = id || this.$refs.workClientTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定删除所选项吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.workClientService.delete(ids).then(({data}) => {
+            this.$message.success(data)
+            this.refreshList()
+            this.loading = false
+          })
+        })
+      },
+      importMethod ({file}) {
+        // 处理表单
+        const formBody = new FormData()
+        formBody.append('file', file)
+        this.loading = true
+        this.workClientService.importExcel(formBody).then(result => {
+          this.$message.success(result.data)
+          this.refreshList()
+        }).catch(() => {
+          this.refreshList()
+          this.loading = false
+        })
+      },
+      resetSearch () {
+        this.$refs.searchForm.resetFields()
+        this.refreshList()
+      }
+    }
+  }
+</script>