123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781 |
- <template>
- <div class="app-container zap-main">
- <search-bar
- :checkList="checkList"
- :tableList="tableList"
- :selfDom="selfDom"
- :companyType="companyType"
- :tableId="tableId"
- @query="handleQuery"
- @reset="resetQuery">
- <el-form :model="queryParams" ref="queryForm" v-show="showSearch" label-width="80px">
- <el-row type="flex" style="flex-wrap:wrap;">
- <el-form-item class="zap-flex-1 mr24" label="授信类型" prop="zfpType" v-if="companyType != '02'" size="medium">
- <el-select class="zap-form-input--small" v-model="queryParams.zfpType" placeholder="请选择类型" clearable>
- <el-option v-for="dict in queryTypeOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
- </el-select>
- </el-form-item>
- <el-form-item class="zap-flex-1" label="类型" prop="zfpcrQuery" size="medium">
- <el-select class="zap-form-input--medium" v-model="queryParams.zfpcrQuery" clearable>
- <el-option v-for="dict in queryTypesOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" v-if="dict.dictValue == '02' && companyType == '00'" />
- <el-option v-for="dict in queryTypesOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" v-if="dict.dictValue != '02'" />
- </el-select>
- </el-form-item>
- <el-form-item class="zap-flex-1 ml24" prop="zfpcrValue" v-if="this.queryParams.zfpcrQuery" size="medium" label-width="0">
- <el-input class="zap-form-input--default" v-model="queryParams.zfpcrValue" placeholder="请输入关键字模糊查询" clearable maxlength="25" />
- </el-form-item>
- </el-row>
- <el-row type="flex" style="flex-wrap:wrap;">
- <el-form-item class="zap-flex-1 mr24" label="授信状态" prop="zfpcrStatus" size="medium">
- <el-select class="zap-form-input--small" v-model="queryParams.zfpcrStatus" placeholder="请选择状态" clearable>
- <el-option v-for="dict in queryStatusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
- </el-select>
- </el-form-item>
- <!-- <el-form-item class="zap-flex-1" label="生效日期" prop="startTime" size="medium">
- <el-date-picker
- v-model="queryParams.startTime"
- unlink-panels
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item> -->
- <el-form-item class="zap-flex-1" label="到期日期" prop="endTime" size="medium">
- <el-date-picker
- class="zap-form-input--medium"
- v-model="queryParams.endTime"
- unlink-panels
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- </el-row>
- </el-form>
- </search-bar>
- <div class="zap-content zap-margin-top">
- <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['credit:line:add']">新增</el-button>
- </div>
- <!-- 供应商查看列表 -->
- <el-table class="zap-table" v-loading="loading" :data="creditLineList" @selection-change="handleSelectionChange" :row-key="rowKey" stripe :cell-style="changeCellStyle" v-if="companyType == '02'" border>
- <!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> -->
- <el-table-column label="序号" type="index" width="50" align="center">
- <template slot-scope="scope">
- <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
- </template>
- </el-table-column>
- <el-table-column label="核心企业" align="center" prop="scyName" show-overflow-tooltip />
- <el-table-column label="融资产品" align="center" prop="zfpName" show-overflow-tooltip />
- <el-table-column
- label="授信额度"
- :formatter="moneyFormat"
- align="center"
- prop="zfsqAmount"
- show-overflow-tooltip
- />
- <el-table-column label="利率(%)" align="center" prop="zfpcrRate" width="120" />
- <el-table-column label="已使用额度" :formatter="moneyFormat" align="center" prop="zfiAmount" width="120" />
- <el-table-column label="可用额度" :formatter="moneyFormat" align="center" prop="usableAmount" width="120" />
- <el-table-column label="生效日期" align="center" prop="zfpcrStartDate" show-overflow-tooltip />
- <el-table-column label="到期日期" align="center" prop="zfpcrEndDate" show-overflow-tooltip />
- <el-table-column label="授信状态" :formatter="statuFormat" align="center" prop="zfsqStatus" show-overflow-tooltip />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250" fixed="right">
- <template slot-scope="scope">
- <plain-button size="mini" type="text" @click="handleRows(scope.row)" v-hasPermi="['credit:line:query']">详情</plain-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- -->
- <el-table class="zap-table" v-loading="loading" :data="creditLineList" @selection-change="handleSelectionChange" :row-key="rowKey" stripe :cell-style="changeCellStyle" v-if="companyType != '02'" border>
- <!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> -->
- <el-table-column label="序号" type="index" width="50" align="center">
- <template slot-scope="scope">
- <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
- </template>
- </el-table-column>
- <el-table-column label="资金方" align="center" prop="rzScyName" show-overflow-tooltip v-if="uncheckList.rzScyName && companyType != '03'" />
- <el-table-column
- label="授信类型"
- :formatter="typeFormat"
- align="center"
- prop="zfpType"
- show-overflow-tooltip
- v-if="uncheckList.zfpType" />
- <el-table-column label="融资产品" align="center" prop="zfpName" v-if="uncheckList.zfpName" show-overflow-tooltip />
- <el-table-column label="企业名称" align="center" prop="scyName" v-if="uncheckList.scyName && companyType != '01'" show-overflow-tooltip />
- <el-table-column label="企业代码" align="center" prop="scySocialCode" v-if="uncheckList.scySocialCode && companyType == '00'" show-overflow-tooltip />
- <el-table-column
- label="授信额度"
- :formatter="moneyFormat"
- align="center"
- prop="zfpcrAmount"
- show-overflow-tooltip
- v-if="uncheckList.zfpcrAmount"
- width="120" />
- <el-table-column label="利率(%)" align="center" prop="zfpcrRate" v-if="uncheckList.zfpcrRate" width="120" />
- <!-- <el-table-column label="已分割额度" :formatter="moneyFormat" align="center" prop="zfpcrDivisionAmount" v-if="uncheckList.zfpcrDivisionAmount" width="120"/> -->
- <el-table-column
- label="已使用额度"
- :formatter="moneyFormat"
- align="center"
- prop="zfiAmount"
- v-if="uncheckList.zfiAmount"
- width="120" />
- <el-table-column
- label="已分配额度"
- :formatter="moneyFormat"
- align="center"
- prop="supplierAmount"
- v-if="uncheckList.supplierAmount"
- width="120" />
- <el-table-column
- label="可用额度"
- :formatter="moneyFormat"
- align="center"
- prop="usableAmount"
- v-if="uncheckList.usableAmount && (companyType != '02')"
- width="120" />
- <el-table-column label="生效日期" align="center" prop="zfpcrStartDate" v-if="uncheckList.zfpcrStartDate && (companyType != '01'|| companyType != '03')" show-overflow-tooltip />
- <el-table-column label="到期日期" align="center" prop="zfpcrEndDate" v-if="uncheckList.zfpcrEndDate" show-overflow-tooltip />
- <el-table-column
- label="授信状态"
- :formatter="statusFormat"
- align="center"
- prop="zfpcrStatus"
- v-if="uncheckList.zfpcrStatus"
- show-overflow-tooltip />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250" fixed="right">
- <template slot-scope="scope">
- <el-button
- class="zap-button-primary"
- size="mini"
- type="text"
- @click="handleEdit(scope.row)"
- v-if="scope.row.zfpcrStatus == '01'"
- v-hasPermi="['credit:line:edit']">修改</el-button>
- <el-button class="zap-button-plain" size="mini" type="text" @click="handleRows(scope.row)" v-hasPermi="['credit:line:query']">详情</el-button>
- <el-button
- class="zap-button-primary"
- type="text"
- size="mini"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['credit:line:update']"
- v-if="scope.row.zfpcrStatus == '00'">冻结</el-button>
- <el-button
- class="zap-button-primary"
- size="mini"
- type="text"
- @click="handleUpdate(scope.row)"
- v-if="scope.row.zfpcrStatus == '01'"
- v-hasPermi="['credit:line:update']">解冻</el-button>
- <el-button
- class="zap-button-primary"
- size="mini"
- type="text"
- @click="handleSupplier(scope.row)"
- v-hasPermi="['supplierCredit:line:list']"
- v-if="scope.row.zfpType == '0'">融资方列表</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
- </div>
- </template>
- <script>
- import {
- listCreditLine,
- getCreditLine,
- delCreditLine,
- addCreditLine,
- updateCreditLine,
- changeStatus
- } from "@/api/service/creditLine/creditLine";
- import Cookies from 'js-cookie'
- import {
- columnQuery,
- columnfilter
- } from "@/api/common/columnSetting";
- import ColumnSetting from "../../../components/Table/columnSetting.vue";
- import {
- getPreMonthDay,
- getCurrentDateStr
- } from "@/api/common/getDateUtils";
- import {
- getUserProfile
- } from "@/api/system/user";
- import SearchBar from '@/components/SearchBar/index.vue'
- import PlainButton from '@/components/PlainButton/index.vue'
- export default {
- name: "CreditLine",
- components: {
- ColumnSetting,
- SearchBar,
- PlainButton
- },
- data() {
- return {
- //企业类型
- companyType: null,
- // 遮罩层
- loading: true,
- //弹窗是否禁用
- isShow: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 授信信息表格数据
- creditLineList: [],
- //合同列表
- contractList: [],
- //授信状态数据字典
- statusOptions: [],
- //供应商授信状态数据字典
- statuOptions: [],
- //授信类型(融资产品类型)
- typeOptions: [],
- //筛选条件字典
- //授信类型
- queryTypeOptions: [],
- //授信状态
- queryStatusOptions: [],
- //类型
- queryTypesOptions: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- zfpcrProductId: null,
- zfpcrCompanyId: null,
- zfpcrType: null,
- zfpcrAmount: null,
- zfpcrRate: null,
- zfpcrDivisionAmount: null,
- zfpcrDateType: null,
- zfpcrStartDate: null,
- zfpcrEndDate: null,
- zfpcrAddress: null,
- zfpcrCharge: null,
- zfpcrChargeRate: null,
- zfpcrAccount: null,
- zfpcrLoanType: null,
- zfpcrBookkeepingType: null,
- zfpcrStatus: '02',
- zfpcrProfitSpare1: null,
- zfpcrProfitSpare2: null,
- zfpcrProfitSpare3: null,
- zfpcrProfitSpare4: null,
- zfpcrProfitSpare5: null,
- zfpcrProfitSpare6: null,
- zfpcrProfitSpare7: null,
- zfpcrProfitSpare8: null,
- zfpcrProfitSpare9: null,
- rzScyName: null,
- AmountA: null,
- AmountB: null,
- startTime: [],
- endTime: [],
- zfpType: '2',
- zfpName: null,
- zfpcrQuery: null,
- zfpcrValue: null,
- },
- options: [],
- // 表单参数
- form: {},
- //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
- tableList: [{
- label: "rzScyName",
- value: "资金方"
- },
- {
- label: "zfpType",
- value: "授信类型"
- },
- {
- label: "zfpName",
- value: "融资产品"
- },
- {
- label: 'scyName',
- value: '企业名称'
- },
- {
- label: 'scySocialCode',
- value: '企业代码'
- },
- {
- label: "zfpcrAmount",
- value: "授信额度"
- },
- {
- label: "zfpcrRate",
- value: "利率"
- },
- // {
- // label: "zfpcrDivisionAmount",
- // value: "已分割额度"
- // },
- {
- label: "zfiAmount",
- value: "已使用额度"
- },
- {
- label: "supplierAmount",
- value: "已分配额度"
- },
- {
- label: "usableAmount",
- value: "可用额度"
- },
- {
- label: "zfpcrStartDate",
- value: "生效日期"
- },
- {
- label: "zfpcrEndDate",
- value: "到期日期"
- },
- {
- label: "zfpcrStatus",
- value: "授信状态"
- }
- ],
- checkList: [], //筛选列选中的数据列表--显示隐藏列用
- uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
- selfDom: this,
- tableId: "/sc-service/creditLine/list",
- // 表单校验
- rules: {
- zfpcrProductId: [{
- required: true,
- message: "融资产品不能为空",
- trigger: "blur"
- }],
- zfpcrCompanyId: [{
- required: true,
- message: "关联企业不能为空",
- trigger: "blur"
- }],
- zfpcrAmount: [{
- required: true,
- message: "授信额度不能为空",
- trigger: "blur"
- }],
- zfpcrRate: [{
- required: true,
- message: "利率不能为空",
- trigger: "blur"
- }],
- zfpcrCharge: [{
- required: true,
- message: "是否收取手续费不能为空",
- trigger: "blur"
- }],
- zfpcrChargeRate: [{
- required: true,
- message: "平台服务费收取费率不能为空",
- trigger: "blur"
- }],
- zfpcrLoanType: [{
- required: true,
- message: "融资放款方式不能为空",
- trigger: "change"
- }],
- zfpcrBookkeepingType: [{
- required: true,
- message: "记账簿托管方式不能为空",
- trigger: "change"
- }],
- }
- };
- },
- created() {
- // this.$set(this.queryParams, 'startTime',[this.parseTime(getPreMonthDay(getCurrentDateStr(),3), '{y}-{m}-{d}'), this.parseTime(getCurrentDateStr(), '{y}-{m}-{d}')]);
- // this.$set(this.queryParams, 'endTime',[this.parseTime(getPreMonthDay(getCurrentDateStr(),3), '{y}-{m}-{d}'), this.parseTime(getCurrentDateStr(), '{y}-{m}-{d}')]);
- // this.getContractList();
- this.getDicts("zc_zfpcr_status").then(response => {
- this.statusOptions = response.data;
- });
- this.getDicts("zc_zfp_type").then(response => {
- this.typeOptions = response.data;
- });
- this.getDicts("zc_zfp_queryType").then(response => {
- this.queryTypeOptions = response.data;
- });
- this.getDicts("zc_zfpcr_queryStatus").then(response => {
- this.queryStatusOptions = response.data;
- });
- this.getList().then(() => {
- this.queryParams.zfpcrQuery = "00";
- });
- },
- activated() {
- // this.getContractList();
- this.getDicts("zc_zfpcr_status").then(response => {
- this.statusOptions = response.data;
- });
- this.getDicts("zc_zfsq_status").then(response => {
- this.statuOptions = response.data;
- });
- this.getDicts("zc_zfp_type").then(response => {
- this.typeOptions = response.data;
- });
- this.getDicts("zc_zfp_queryType").then(response => {
- this.queryTypeOptions = response.data;
- });
- this.getDicts("zc_zfpcr_queryStatus").then(response => {
- this.queryStatusOptions = response.data;
- });
- this.getDicts("zc_zfpcr_queryType").then(response => {
- this.queryTypesOptions = response.data;
- });
- this.getList().then(() => {
- this.queryParams.zfpcrQuery = "00";
- });
- },
- mounted() {
- this.columnQuery();
- },
- methods: {
- /** 查询授信信息列表 */
- getList() {
- this.loading = true;
- return listCreditLine(this.queryParams).then(response => {
- debugger
- this.creditLineList = response.data.records;
- if (response.data.records[0]) {
- this.companyType = response.data.records[0].companyType
- console.log(this.companyType, "企业类型")
- }
- this.total = response.data.total;
- this.loading = false;
- return Promise.resolve(response);
- }).catch(response => {
- this.loading = false;
- return Promise.reject("error");
- });
- },
- rowKey(row) {
- return row.zfpcrId;
- },
- //获取当前客户是否之前设置过列展示隐藏
- columnQuery() {
- //获取页面路径
- var psfPagePath = window.location.pathname;
- //用请求后台的url作为唯一标识
- var psfTableName = this.tableId;
- var columnForm = {};
- columnForm.psfPagePath = psfPagePath;
- columnForm.psfTableName = psfTableName;
- columnQuery(columnForm).then(response => {
- if (response.data && response.data.psfShowData) {
- this.checkList = response.data.psfShowData;
- }
- this.filter();
- });
- },
- //控制隐藏显示的函数
- filter(checkList) {
- if (!!checkList) {
- this.checkList = checkList;
- }
- columnfilter(this.selfDom);
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.custId = "";
- this.ctmId = "";
- this.customerList = [];
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- zfpcrId: null,
- zfpcrProductId: null,
- zfpcrCompanyId: null,
- zfpcrType: null,
- zfpcrAmount: null,
- zfpcrRate: null,
- zfpcrDivisionAmount: null,
- zfpcrDateType: null,
- zfpcrStartDate: null,
- zfpcrEndDate: null,
- zfpcrAddress: null,
- zfpcrCharge: null,
- zfpcrChargeRate: null,
- zfpcrAccount: null,
- zfpcrLoanType: null,
- zfpcrBookkeepingType: null,
- zfpcrStatus: "0",
- zfpcrProfitSpare1: null,
- zfpcrProfitSpare2: null,
- zfpcrProfitSpare3: null,
- zfpcrProfitSpare4: null,
- zfpcrProfitSpare5: null,
- zfpcrProfitSpare6: null,
- zfpcrProfitSpare7: null,
- zfpcrProfitSpare8: null,
- zfpcrProfitSpare9: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.pafId);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 字典翻译 */
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.zfpcrStatus);
- },
- statuFormat(row, column) {
- return this.selectDictLabel(this.statuOptions, row.zfsqStatus);
- },
- typeFormat(row, column) {
- return this.selectDictLabel(this.typeOptions, row.zfpType);
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.resetForm("queryForm");
- Cookies.set("/creditLine/addCreditLine/", this.$route.fullPath)
- this.$router.push("/creditLine/addCreditLine/");
- },
- /** 修改按钮操作 */
- handleEdit(row) {
- const zfpcrId = row.zfpcrId || this.ids;
- const zfiAmount = row.zfiAmount;
- const usableAmount = row.usableAmount;
- this.resetForm("queryForm");
- Cookies.set("/creditLine/editCreditLine/" + zfpcrId + '/' + zfiAmount + '/' + usableAmount + '/', this.$route.fullPath)
- this.$router.push("/creditLine/editCreditLine/" + zfpcrId + '/' + zfiAmount + '/' + usableAmount + '/');
- },
- // /** 详情按钮操作 */
- handleRows(row) {
- const zfpcrId = row.zfpcrId || this.ids;
- console.log(zfpcrId, "授信id")
- const zfiAmount = row.zfiAmount;
- const usableAmount = row.usableAmount;
- const companyType = this.companyType;
- this.resetForm("queryForm");
- Cookies.set("/creditLine/detailCreditLine/" + zfpcrId + '/' + zfiAmount + '/' + usableAmount + '/' + companyType + '/', this.$route.fullPath)
- this.$router.push("/creditLine/detailCreditLine/" + zfpcrId + '/' + zfiAmount + '/' + usableAmount + '/' + companyType + '/', );
- },
- /** 冻结/解冻按钮操作 */
- handleUpdate(row) {
- let text = row.zfpcrStatus === "01" ? "解冻" : "冻结";
- this.$confirm(
- "确认要" + text + '此数据项吗?',
- "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(function () {
- return changeStatus(row.zfpcrId, row.zfiAmount, row.zfpcrStatus);
- })
- .then(() => {
- this.getList();
- this.msgSuccess(text + "成功");
- })
- },
- /* 融资方列表 */
- handleSupplier(row) {
- const zfpcrId = row.zfpcrId || this.ids;
- const zfpcrCompanyId = row.zfpcrCompanyId;
- this.resetForm("queryForm");
- Cookies.set("/creditLine/supplierCreditLine/" + zfpcrId + '/' + zfpcrCompanyId, this.$route.fullPath)
- this.$router.push("/creditLine/supplierCreditLine/" + zfpcrId + '/' + zfpcrCompanyId);
- },
- /** 提交按钮 */
- submitForm(state) {
- this.$refs["form"].validate(valid => {
- if (state) {
- this.form.pafState = state;
- }
- console.log(this.form, "提交form")
- debugger
- if (valid) {
- if (this.form.pafId != null) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- updateFlow(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.reset();
- this.getList();
- });
- loading.close();
- } else {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- addFlow(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.reset();
- this.getList();
- });
- loading.close();
- }
- }
- });
- },
- /* 金额格式化 */
- moneyFormat(row, column, cellValue) {
- if (cellValue == null || cellValue == undefined || cellValue == '') {
- cellValue = '0.00'
- }
- cellValue += '';
- if (!cellValue.includes('.')) {
- cellValue += '.00';
- }
- return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
- return $1 + ',';
- }).replace(/\.$/, '');
- },
- /* 修改表格样式 */
- changeCellStyle(row, column, rowIndex, columnIndex) {
- if (row.column.label === "授信额度" || row.column.label === "已分割额度" || row.column.label === "已使用额度" ||
- row.column.label === "可用额度") {
- return "font-weight: 700;"; // 修改的样式
- } else {
- return "";
- }
- },
- /* // 将数字金额转换为大写金额 */
- smallToBig(money) {
- // 将数字金额转换为大写金额
- var cnNums = new Array(
- "零",
- "壹",
- "贰",
- "叁",
- "肆",
- "伍",
- "陆",
- "柒",
- "捌",
- "玖"
- ); //汉字的数字
- var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
- var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
- var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
- var cnInteger = "整"; //整数金额时后面跟的字符
- var cnIntLast = "元"; //整数完以后的单位
- //最大处理的数字
- var maxNum = 999999999999999.9999;
- var integerNum; //金额整数部分
- var decimalNum; //金额小数部分
- //输出的中文金额字符串
- var chineseStr = "";
- var parts; //分离金额后用的数组,预定义
- if (money == "" || money == null || money == undefined) {
- return "零元零角零分";
- }
- money = parseFloat(money);
- if (money >= maxNum) {
- //超出最大处理数字
- return "超出最大处理数字";
- }
- if (money == 0) {
- chineseStr = cnNums[0] + cnIntLast + cnInteger;
- return chineseStr;
- }
- //四舍五入保留两位小数,转换为字符串
- money = Math.round(money * 100).toString();
- integerNum = money.substr(0, money.length - 2);
- decimalNum = money.substr(money.length - 2);
- //获取整型部分转换
- if (parseInt(integerNum, 10) > 0) {
- var zeroCount = 0;
- var IntLen = integerNum.length;
- for (var i = 0; i < IntLen; i++) {
- var n = integerNum.substr(i, 1);
- var p = IntLen - i - 1;
- var q = p / 4;
- var m = p % 4;
- if (n == "0") {
- zeroCount++;
- } else {
- if (zeroCount > 0) {
- chineseStr += cnNums[0];
- }
- //归零
- zeroCount = 0;
- chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
- }
- if (m == 0 && zeroCount < 4) {
- chineseStr += cnIntUnits[q];
- }
- }
- chineseStr += cnIntLast;
- }
- //小数部分
- if (decimalNum != "") {
- var decLen = decimalNum.length;
- for (var i = 0; i < decLen; i++) {
- var n = decimalNum.substr(i, 1);
- if (n != "0") {
- chineseStr += cnNums[Number(n)] + cnDecUnits[i];
- }
- }
- }
- if (chineseStr == "") {
- chineseStr += cnNums[0] + cnIntLast + cnInteger;
- } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
- chineseStr += cnInteger;
- }
- return chineseStr;
- }
- }
- };
- </script>
|