123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762 |
- <template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
- <div>
- <el-dialog
- :title="title"
- :close-on-click-modal="false"
- draggable
- append-to-body
- width="1300px"
- @close="close"
- @keyup.enter.native="doSubmit"
- v-model="visible">
- <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'"
- label-width="160px" @submit.native.prevent>
- <el-divider content-position="left"><i class="el-icon-document"></i>
- <span style="color: red;border-top: 20px">*</span>项目
- <el-button style="margin-left: 20px" type="primary" :readonly="true" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" @click="insertEvent('base')" plain>
- 新增
- </el-button>
- </el-divider>
- <el-row :gutter="15">
- <el-col :span="24">
- <vxe-table
- border
- :footer-method="footerMethod2"
- show-overflow
- show-footer
- ref="baseTable"
- :key="baseKey"
- class="vxe-table-element"
- :data="inputForm.projectDTOList"
- style="margin-left: 5em"
- @cell-click=""
- @edit-closed=""
- keep-source
- :readonly="true"
- highlight-current-row
- :edit-rules="tableRules"
- :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
- >
- <vxe-table-column field="name" align="center" title="项目名称" :edit-render="{}" show-overflow="title">
- <template v-slot:edit="scope">
- <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" @focus="openProgramPageForm(scope.$rowIndex)" placeholder="请填写项目名称" :readonly="true" v-model="scope.row.name"/>
- </template>
- </vxe-table-column>
- <vxe-table-column field="contractNo" align="center" title="合同编号" :edit-render="{}">
- <template v-slot:edit="scope">
- <el-input :disabled="true" :readonly="true" placeholder="请填写合同编号" v-model="scope.row.ncontractNo"/>
- </template>
- </vxe-table-column>
- <vxe-table-column field="contractName" align="center" title="合同名称" :edit-render="{}">
- <template v-slot:edit="scope">
- <el-input :disabled="true" placeholder="请填写合同名称" v-model="scope.row.contractName"/>
- </template>
- </vxe-table-column>
- <vxe-table-column title="操作" align="center" width="100">
- <template v-slot="scope">
- <el-button :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'base')">删除</el-button>
- </template>
- </vxe-table-column>
- </vxe-table>
- </el-col>
- </el-row>
- <el-divider content-position="left"><i class="el-icon-document"></i>
- 付款信息
- </el-divider>
- <el-row :gutter="15">
- <el-col :span="12">
- <el-form-item label="付款编号" prop="no"
- :rules="[ ]">
- <el-input :disabled="true" placeholder="编号自动生成" v-model="inputForm.no" ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="收款类别" prop="proceedType"
- :rules="[{required: true, message:'收款类别不能为空', trigger:'blur'}]">
- <el-radio-group v-model="inputForm.proceedType">
- <el-radio label="0">单位</el-radio>
- <el-radio label="1">个人</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="收款单位" prop="proceedOfficeName"
- :rules="[
- {required: true, message:'收款单位不能为空', trigger:'blur'},{required: true, message:'收款单位不能为空', trigger:'change'}
- ]">
- <el-input :readonly="true" placeholder="请填写收款单位" v-model="inputForm.proceedOfficeName" @focus="openWorkClientForm()" clearable></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开户银行" prop="ourBank"
- :rules="[
- {required: true, message:'开户银行不能为空', trigger:'blur'},{required: true, message:'开户银行不能为空', trigger:'change'}
- ]">
- <el-select v-model="inputForm.ourBank" @change="changeBank" placeholder="请选择开户银行" clearable style="width: 100%;">
- <el-option
- v-for="item in bankList"
- :key="item.id"
- :label="item.ourBank"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开户账号" prop="bankNumber"
- :rules="[{required: true, message:'开户账号不能为空', trigger:'blur'}]">
- <el-input :disabled="true" placeholder="请输入开户账号" v-model="inputForm.bankNumber"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="税号" prop="dutyNumber"
- :rules="[]">
- <el-input placeholder="请输入税号" v-model="inputForm.dutyNumber"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="累计已支付金额" prop="amountPaid"
- :rules="[{required: true, message:'请输入累计已支付金额', trigger:'blur'}]">
- <el-input v-on:input="inputForm.amountPaid=inputForm.amountPaid.replace(/[^\d.]/g,'')
- .replace(/^\./g,'')
- .replace(/\.{2,}/g,'.')
- .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
- .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入累计已支付金额" v-model="inputForm.amountPaid" clearable></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="付款人" prop="paymentUser"
- :rules="[]">
- <!-- <UserSelectSignatory style="width: 100%" ref="userSelect2" :limit="1"-->
- <!-- :readonly="true" :modelValue="inputForm.paymentUser"-->
- <!-- @update:modelValue='(value) => {inputForm.paymentUser = value}'></UserSelectSignatory>-->
- <UserSelect :readonly="true" :disabled="status === 'audit' || status === 'taskFormDetail'" :limit='1' :modelValue="inputForm.paymentUser" @update:modelValue='(value,label) => {inputForm.paymentUser = value}'></UserSelect>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="付款时间" prop="paymentTime"
- :rules="[]">
- <el-date-picker
- style="width: 100%"
- v-model="inputForm.paymentTime"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="请选择时间"
- :default-value="new Date()"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="付款方式" prop="paymentType"
- :rules="[{required: true, message:'请选择付款方式', trigger:'blur'}]"
- >
- <el-select v-model="inputForm.paymentType" placeholder="请选择付款方式" clearable style="width: 100%;">
- <el-option
- v-for="item in $dictUtils.getDictList('jy_payment_type')"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="付款理由或用途" prop="reason"
- :rules="[{required: true, message:'请输入付款理由或用途', trigger:'blur'} ]">
- <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="textarea" placeholder="请输入付款理由或用途" maxlength="500" style="width:100%" v-model="inputForm.reason" show-word-limit></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="付款金额(小写)" prop="paymentLower"
- :rules="[{required: true, message:'请输入付款金额(小写)', trigger:'blur'}]">
- <el-input v-on:input="inputForm.paymentLower=inputForm.paymentLower.replace(/[^\d.]/g,'')
- .replace(/^\./g,'')
- .replace(/\.{2,}/g,'.')
- .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
- .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.paymentLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入付款金额" v-model="inputForm.paymentLower" clearable></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="付款金额(大写)" prop="payment"
- :rules="[]">
- <el-input :disabled="true" placeholder="请输入付款金额" v-model="inputForm.payment"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="付款项目摘要" prop="remarks"
- :rules="[]">
- <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="textarea" placeholder="请输入付款项目摘要" maxlength="500" style="width:100%" v-model="inputForm.remarks" show-word-limit></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <!-- 附件 -->
- <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
- <ProjectForm ref="projectForm" @getProgram="getProgram"></ProjectForm>
- <WorkClientChooseRadio ref="workClientChooseRadio" @getWorkClientRadioChoose="getWorkClientRadioChoose"></WorkClientChooseRadio>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
- <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- import XEUtils from 'xe-utils'
- import PaymentService from '@/api/jy/PaymentService'
- import { ElDatePicker } from 'element-plus';
- import CommonApi from '@/api/cw/common/CommonApi'
- import ProjectForm from './ProjectForm'
- import WorkClientChooseRadio from '../workClientInfo/WorkClientChooseRadio'
- import UserSelectSignatory from '../workClientInfo/clientUserSelect'
- import WorkClientService from '@/api/jy/WorkClientService'
- import UserSelect from '@/components/userSelect'
- import UpLoadComponent from '@/views/common/UpLoadComponent'
- export default {
- props: {
- businessId: {
- type: String,
- default: ''
- },
- formReadOnly: {
- type: Boolean,
- default: false
- },
- status: {
- type: String,
- default: ''
- }
- },
- data () {
- return {
- title: '',
- method: '',
- loading: false,
- visible: false,
- inputForm: {
- id: '',
- no: '',
- paymentUser: this.$store.state.user.id,
- paymentTime:this.moment(new Date()).format('YYYY-MM-DD'),
- reason: '',
- paymentLower:'', // 付款金额小写
- payment:'', //付款金额大写
- procInsId:'',
- status:'',
- projectDTOList:[],
- ourBank:'', //开户银行
- bankNumber:'', // 银行账号
- dutyNumber:'', //税号
- remarks:'',//摘要
- proceedOfficeId:'',//收款单位id
- proceedOfficeName:'',//收款单位名称
- amountPaid:'', //累计已支付金额
- proceedType:'', //收款类别
- paymentType:'', //付款方式
- files:[]
- },
- baseKey: '',
- keyWatch: '',
- dateList:[],
- programRow:'',
- bankList:[]
- }
- },
- PaymentService:null,
- CommonApi:null,
- workClientService: null,
- created () {
- console.log('jld ')
- this.paymentService=new PaymentService()
- this.commonApi = new CommonApi()
- this.workClientService = new WorkClientService()
- },
- mounted () {
- },
- activated () {
- },
- components: {
- ElDatePicker,
- ProjectForm,
- WorkClientChooseRadio,
- UserSelectSignatory,
- UserSelect,
- UpLoadComponent,
- },
- computed: {
- bus: {
- get () {
- this.$refs.uploadComponent.setDividerName('附件')
- return this.businessId
- },
- set (val) {
- this.businessId = val
- }
- }
- },
- watch: {
- 'keyWatch': {
- handler (newVal) {
- if (this.bus) {
- if (this.bus !== 'false') {
- this.init('', this.bus)
- }
- } else {
- this.$nextTick(() => {
- this.$refs.inputForm.resetFields()
- })
- }
- }
- },
- 'loading': {
- handler (newVal) {
- this.$emit('changeLoading', newVal)
- this.$refs.uploadComponent.changeLoading(newVal)
- }
- }
- },
- methods: {
- getKeyWatch(keyWatch) {
- this.keyWatch = keyWatch
- },
- init(method, id) {
- this.method = method
- this.inputForm={
- id: '',
- no: '',
- paymentUser: this.$store.state.user.id,
- paymentTime:'',
- reason: '',
- paymentLower:'', // 付款金额小写
- payment:'', //付款金额大写
- procInsId:'',
- status:'',
- projectDTOList:[],
- ourBank:'', //开户银行
- bankNumber:'', // 银行账号
- dutyNumber:'', //税号
- remarks:'',//摘要
- proceedOfficeId:'',//收款单位id
- proceedOfficeName:'',//收款单位名称
- amountPaid:'', //累计已支付金额
- proceedType:'', //收款类别
- paymentType:'', //付款方式
- files:[]
- }
- this.inputForm.id = id
- this.loading = false
- this.visible = true
- this.$nextTick(() => {
- this.$refs.inputForm.resetFields()
- this.loading = true
- if (this.commonJS.isNotEmpty(this.inputForm.id)) {
- console.log('this.inputForm.id', this.inputForm.id)
- this.paymentService.queryById(this.inputForm.id).then((data)=>{
- this.$refs.uploadComponent.clearUpload()
- this.inputForm = this.recover(this.inputForm, data)
- if (this.commonJS.isEmpty(data.projectDTOList)){
- this.inputForm.projectDTOList=[]
- }
- if (this.commonJS.isEmpty(this.inputForm.paymentUser)){
- this.inputForm.paymentUser== this.$store.state.user.id
- }
- if (this.commonJS.isNotEmpty(this.inputForm.proceedOfficeId)){
- this.workClientService.findById(this.inputForm.proceedOfficeId).then((da)=>{
- console.log('da',da)
- this.inputForm.proceedOfficeName=da.workClientInfo.name
- this.inputForm.proceedOfficeId=da.workClientInfo.Id
- if (this.commonJS.isNotEmpty(da.workClientBank)){
- da.workClientBank.forEach(item => {
- item.ourBank=item.ourBank
- this.bankList.push(item)
- this.inputForm.ourBank=item.id
- this.inputForm.bankNumber=item.bankNumber
- })
- }else {
- this.bankList = []
- }
- })
- }
- if (this.commonJS.isEmpty(this.inputForm.files)) {
- this.inputForm.files = []
- }
- this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'paymentMoney')
- })
- this.loading = false
- }
- })
- },
- saveForm(callback) {
- this.doSubmit('save', callback)
- },
- startForm(callback) {
- this.loading = true
- if (this.commonJS.isNotEmpty(this.inputForm.id)) {
- this.paymentService.queryById(this.inputForm.id).then((data) => {
- if (data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
- this.loading = false
- this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- throw new Error()
- } else {
- this.doSubmit('start', callback)
- }
- })
- } else {
- this.doSubmit('start', callback)
- }
- },
- async agreeForm(callback) {
- console.log('进入方法')
- this.loading = true
- await this.paymentService.queryById(this.inputForm.id).then((data) => {
- if (data.status !== '2' ) { // status的值不等于“审核中”,就弹出提示
- this.loading = false
- this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- throw new Error()
- } else {
- this.inputForm.status= '2'
- this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data)=>{
- if (this.commonJS.isNotEmpty(data)) {
- if (data === '总经理审核') {
- this.inputForm.status = '5'
- }
- }
- let param = {status: this.inputForm.status, id: this.inputForm.id}
- this.paymentService.updateStatusById(param).then(() => {
- callback(data.businessTable, data.businessId, this.inputForm)
- this.loading = false
- }).catch(() => {
- this.loading = false
- })
- })
- }
- })
- },
- reapplyForm(callback) {
- this.loading = true
- this.paymentService.queryById(this.inputForm.id).then((data) => {
- if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
- this.loading = false
- this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- } else {
- this.doSubmit('reapply', callback)
- }
- })
- },
- // 表单提交
- async doSubmit(status, callback) {
- this.loading = true
- if (this.commonJS.isEmpty(this.inputForm.paymentUser)){
- this.inputForm.paymentUser== this.$store.state.user.id
- }
- console.log('5',this.inputForm)
- if (status === 'save') {
- // 暂存
- this.loading = true
- this.inputForm.status = '1'
- this.paymentService.saveForm(this.inputForm).then((data) => {
- callback(data.businessTable, data.businessId, this.inputForm)
- this.loading = false
- }).catch(() => {
- this.loading = false
- })
- return
- } else if (status === 'start') {
- if (this.commonJS.isEmpty(this.inputForm.projectDTOList)) {
- this.$message.error('请选择项目')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.proceedOfficeName)) {
- this.$message.error('请选择收款单位')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.proceedType)) {
- this.$message.error('请选择收款类别')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.amountPaid)) {
- this.$message.error('请输入累计已支付金额')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.reason)) {
- this.$message.error('请输入付款用途')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.paymentLower)) {
- this.$message.error('请输入付款金额')
- this.loading = false
- }
- if (this.commonJS.isEmpty(this.inputForm.paymentType)) {
- this.$message.error('请选择付款方式')
- this.loading = false
- }
- // 送审 待审核
- this.inputForm.status = '2'
- } else if (status === 'agree') {
- this.inputForm.status= '5'
- } else if (status === 'reapply') {
- this.inputForm.status = '2'
- }
- this.$refs['inputForm'].validate((valid) => {
- if (valid) {
- this.loading = true
- console.log('form',this.inputForm)
- this.paymentService.adminEditForm(this.inputForm).then((data) => {
- this.visible=false
- this.$emit('refreshList')
- }).catch(() => {
- this.$refs.inputForm.resetFields()
- this.loading = false
- })
- } else {
- this.loading = false
- }
- })
- },
- close() {
- this.inputForm = {
- id: '',
- no: '',
- paymentUser: this.$store.state.user.id,
- paymentTime:'',
- reason: '',
- paymentLower:'', // 付款金额小写
- payment:'', //付款金额大写
- procInsId:'',
- status:'',
- projectDTOList:[],
- ourBank:'', //开户银行
- bankNumber:'', // 银行账号
- dutyNumber:'', //税号
- remarks:'',//摘要
- }
- this.visible = false
- },
- async updateStatusById(type, callback) {
- this.loading = true
- if (type === 'reject' || type === 'reback') {
- this.paymentService.queryById(this.inputForm.id).then((data) => {
- if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
- this.loading = false
- this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- throw new Error()
- } else {
- // if (type === 'agree') {
- // // 同意
- // this.inputForm.status = '5'
- // }
- 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.paymentService.updateStatusById(param).then(() => {
- this.loading = false
- callback()
- })
- }
- }
- })
- } else if (type === 'hold') {
- this.paymentService.queryById(this.inputForm.id).then((data) => {
- if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
- this.loading = false
- this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
- throw new Error()
- } else {
- // 终止
- let param = {status: '1', id: this.inputForm.id}
- this.paymentService.updateStatusById(param).then(() => {
- this.loading = false
- callback()
- })
- }
- })
- }
- },
- convert(money){
- if (!money) { return this.inputForm.payment='';}
- //数字的汉字数组
- let numberCNList = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
- //数字的基础单位汉字数组
- let numberBaseUnit = ['', '拾', '佰', '仟'];
- //数字的高级单位汉字数组
- let numberHighUnit = ['', '万', '亿', '兆'];// 一兆等于一万亿
- //小数部分单位汉字数组
- let floatUnit = ['角', '分', '毫', '厘'];
- //整数金额时后面跟的字符
- let integerLastCN = '整';
- //整数后的单位汉字
- let integerLastUnit = '元';
- //最大处理的数字
- let maxNum = 999999999999999.9999;
- //以小数点拆分金额产生的数组
- let decimalPointSplitList;
- //金额整数部分
- let integerNum;
- //金额小数部分
- let decimalNum;
- //返回的大写金额
- let moneyCNString = '';
- money = parseFloat(money);// 转为数字
- if(typeof money !== 'number' || isNaN(money)){this.$message('检测到非数字字符');return '';}
- //超出最大处理数字
- if (money >= maxNum) {this.$message('超出最大处理数字');return '';}
- // 等于0时 返回零元整
- if (money === 0) {
- moneyCNString = numberCNList[0] + integerLastUnit + integerLastCN;
- return moneyCNString;
- }
- //转换为字符串
- money = money.toString();
- /******金额数字的处理,转为字符串,判断有没有小数位,获取整数部分和小数部分*******/
- if (money.indexOf('.') === -1) {// 如果没有小数点
- integerNum = money;// money就都等于整数部分,小数部分为空
- decimalNum = '';
- } else {// 有小数点
- decimalPointSplitList = money.split('.');// 以小数点拆分数组
- if(decimalPointSplitList[1].length > 4)this.$message('金额精确仅支持到厘');
- integerNum = decimalPointSplitList[0];// 整数部分
- decimalNum = decimalPointSplitList[1].substr(0, 4);// 小数部分只支持4位
- }
- /******整数部分处理*******/
- if (parseInt(integerNum, 10) > 0) {// 以十进制转为int类型 大于零
- let zeroCount = 0;// 记录零的个数
- for (let i = 0; i < integerNum.length; i++) {
- let p = integerNum.length - 1 - i;// 当前数字的位数, 比如10000 ,1的位数是4 , 10001000,第一个1的位数是7,第二个1的位数是3
- console.log(p,integerNum[i]);
- let q = p / 4;// 当前数字位数 除以 4 商0余1,则值为0,控制其高级单位
- let m = p % 4;// 取余,比如1%4 商0余1 ,则值为1, 控制其基础单位
- // 如果当前数字等于零 则++
- if (integerNum[i] === '0') {zeroCount++;}
- // 否则当前数字不等于零时
- else {
- // 如果记录的零的个数大于0 返回结果中加一个汉字零
- if (zeroCount > 0) {moneyCNString += numberCNList[0];}
- //把零的个数归零,重新计算零的个数
- zeroCount = 0;
- // 然后把返回结果 加上 当前数字的汉字以及其基础单位
- moneyCNString += numberCNList[parseInt(integerNum[i])] + numberBaseUnit[m];
- }
- // 如果当前数字所在位数取余4等于0时,那么除以4一定是整数,并且记录的零的个数小于4个,则拼接当前位数对应的高级单位
- if (m === 0 && zeroCount < 4) {moneyCNString += numberHighUnit[q];}
- }
- moneyCNString += integerLastUnit;// 整数部分结束后 拼接上整数部分单位 元
- }
- /******小数部分处理 --- 小数部分只考虑是否有值,以及当前值所在单位,没有零的概念,所以只需拼接当前值对应的汉字,以及当前值的单位即可*******/
- if (decimalNum !== '') {
- for (let i = 0; i < decimalNum.length; i++) {
- if (decimalNum[i] !== '0') {// 如果当前数字不等于零 则加上当前数字的汉字 以及 其小数单位
- moneyCNString += numberCNList[Number(decimalNum[i])] + floatUnit[i];
- }
- }
- }else {// 如果没有小数部分则加上汉字 整
- moneyCNString += integerLastCN;
- }
- this.inputForm.payment= moneyCNString;
- },
- insertEvent(type) {
- if (type === 'base') {
- if (this.inputForm.projectDTOList.length>=1){
- if (this.commonJS.isEmpty(this.inputForm.projectDTOList[0].projectId)){
- this.$message.error('第一行不能为空')
- return
- }
- }
- this.$refs.baseTable.insertAt({})
- this.inputForm.projectDTOList.push({})
- this.baseKey = Math.random()
- }
- console.log('22',this.inputForm.projectDTOList)
- },
- // 删除
- removeEvent(row, rowIndex, type) {
- if (type === 'base') {
- this.$refs.baseTable.remove(row)
- this.inputForm.projectDTOList.splice(rowIndex, 1)
- }
- },
- openProgramPageForm(rowIndex) {
- this.$refs.projectForm.init()
- this.programRow = rowIndex
- console.log('11',this.programRow)
- },
- getProgram(rows) {
- console.log('1',rows)
- rows.forEach((item, index) => {
- this.inputForm.programId = item.id
- if (index === 0) {
- let r = this.inputForm.projectDTOList[this.programRow]
- r.projectId=item.id
- r.name = item.name
- r.contractNo = item.contractNo
- r.contractName = item.contractName
- console.log('2',this.inputForm.projectDTOList[this.programRow])
- } else {
- let r = {
- projectId: item.id,
- name: item.name,
- contractNo: item.contractNo,
- contractName: item.contractName,
- }
- this.$refs.baseTable.insertAt(r)
- this.inputForm.projectDTOList.push(r)
- this.baseKey = Math.random()
- }
- })
- this.$forceUpdate()
- this.programRow = ''
- // this.inputForm.reconciliationArea = this.inputForm.financeInvoiceBaseDTOList[0].location
- },
- openWorkClientForm() {
- this.$refs.workClientChooseRadio.init()
- },
- getWorkClientRadioChoose(row){
- console.log('row',row)
- console.log('row1',row.backs)
- this.bankList=[]
- this.inputForm.proceedOfficeId=row.id
- this.inputForm.proceedOfficeName=row.name
- row.backs.forEach(item => {
- item.ourBank=item.ourBank
- this.bankList.push(item)
- })
- },
- changeBank(value){
- this.bankList.forEach(item=>{
- console.log('item',item)
- if (item.id === value){
- this.inputForm.bankNumber=item.bankNumber
- }
- })
- console.log('this.inputForm.bankNumber',this.inputForm.bankNumber)
- }
- }
- }
- </script>
- <style scoped>
- /deep/ .el-input-number .el-input__inner {
- text-align: left;
- }
- /deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
- font-weight:700;
- }
- </style>
|