xnzt/xnzt-h5/pages/accounts/index.vue
2024-11-11 10:27:27 +08:00

2230 lines
65 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- <div class="accounts">accounts</div> -->
<view class="page accounts">
<component :is="'style'">
:root { --select-collect:
{{ selectCollect && isPieShow ? "block" : "none" }};
--select-collect_view-height:
{{ selectCollect ? "min-height" : "height" }}; collect_view-height:
{{ selectCollect }}; }
</component>
<view class="page-head">
<!-- 主体信息组件 -->
<view class="infoBody">
<view class="wxInfoRow">
<view class="entityInfo">
<view class="via">
<view
style="
position: absolute;
width: 100%;
height: 100%;
opacity: 20%;
"
>
<image
:src="entityInfo.round"
style="
left: 0px;
position: absolute;
width: 100%;
height: 100%;
"
/>
<view
style="
width: 80%;
height: 80%;
background-color: #2c2c2c;
align-self: center;
border-radius: 50%;
display: inline-block;
transform: translate(0.5%, 13%);
"
/>
</view>
<image
:src="entityInfo.img"
style="width: 70%; height: 70%; transform: translate(23%, 15%)"
/>
</view>
<view v-if="!haveEnterprise">
<navigator
:url="
!checkRole(['admin']) && checkRole(['enterprise'])
? '/pages/formPages/enterprise/baseInfo/index'
: '#'
"
class="navigator-text create-entity baseInfo-text"
@click="navigator()"
>
<view>创建主体</view>
</navigator>
<navigator
:url="
!checkRole(['admin']) && checkRole(['enterprise'])
? '/pages/formPages/enterprise/baseInfo/index'
: '#'
"
class="navigator-arrow"
@click="navigator()"
></navigator>
</view>
<view class="baseInfo-text" v-else>{{ baseInfo.fullName }}</view>
</view>
<view v-if="false" class="spotting">
<!-- <navigator
url="/packageInfo/pages/integral.page/integral.page/integral.page"
class="integral"
> -->
<navigator url="#" class="integral">
<image :src="integral.img" />
<view class="navigator-text">积分</view>
</navigator>
</view>
</view>
</view>
</view>
<view class="page-body">
<view v-if="true" class="direct-reporting-information card">
<view class="card-title">
<navigator url="/pages/accounts/dirRepInfo/index" class="title-text">
<view class="navigator-text">
<view class="icon dir-rep-info">
<image src="@/static/images/accounts/z9SJyt.png" />
</view>
<text>直报信息</text>
</view>
<view class="navigator-arrow"></view>
</navigator>
</view>
<view class="card-body" style="min-height: 100px">
<!-- <view
v-if="false"
> -->
<view
v-if="
isManagement ||
isLandManagement ||
isBusinessItems ||
isMainProductsSales ||
isSubsidy
"
>
<uni-row class="dir_rep_info">
<uni-col :push="1" :span="22">
<uni-section title="经营现状">
<template v-slot:right>
<view v-if="isManagement" class="is_filled">
<!-- <span>{{ isManagement ? "已填写" : "未填写" }}</span> -->
<span>{{ "已填写" }}</span>
</view>
<view v-else>
<span>{{ "未填写" }}</span>
</view>
</template>
</uni-section>
<uni-section title="土地经营情况">
<template v-slot:right>
<view v-if="isLandManagement" class="is_filled">
<!-- <span>{{ isLandManagement ? "已填写" : "未填写" }} </span> -->
<span>{{ "已填写" }}</span>
</view>
<view v-else>
<span>{{ "未填写" }}</span>
</view>
</template>
</uni-section>
<uni-section title="经营项目记录">
<template v-slot:right>
<view v-if="isBusinessItems" class="is_filled">
<!-- <span>{{ isBusinessItems ? "已填写" : "未填写" }}</span> -->
<span>{{ "已填写" }}</span>
</view>
<view v-else>
<span>{{ "未填写" }}</span>
</view>
</template>
</uni-section>
<uni-section title="主要产品销售记录">
<template v-slot:right>
<view v-if="isMainProductsSales" class="is_filled">
<!-- <span>{{ isMainProductsSales ? "已填写" : "未填写" }}</span> -->
<span>{{ "已填写" }}</span>
</view>
<view v-else>
<span>{{ "未填写" }}</span>
</view>
</template>
</uni-section>
<uni-section title="政府补贴">
<template v-slot:right>
<view v-if="isSubsidy" class="is_filled">
<!-- <span>{{ isSubsidy ? "已填写" : "未填写" }} </span> -->
<span>{{ "已填写" }}</span>
</view>
<view v-else>
<span>{{ "未填写" }}</span>
</view>
</template>
</uni-section>
</uni-col>
</uni-row>
</view>
<view class="floater" v-else>
<navigator
url="/pages/accounts/dirRepInfo/index"
class="improve-info"
>
<text>请完善上一年度直报必填信息!</text>
</navigator>
</view>
</view>
</view>
<!-- 记账信息卡片 -->
<view class="account-list card">
<view class="card-title">
<navigator
url="/packageAccounts/pages/account-list/account-list/account-list"
class="title-text"
>
<view class="navigator-text">
<view class="icon account-list-icon">
<image src="@/static/images/accounts/z9SYOP.png" />
<text>账</text>
</view>
<text>记账列表</text>
</view>
</navigator>
<view class="add-account-view">
<view
@click="isAccountPopupShow = !isAccountPopupShow"
class="add-account"
>
{{ "记一笔" }}
</view>
</view>
</view>
<view class="card-body">
<view class="date">
<view class="soFar">
<button
type="primary"
size="mini"
@click="soFarTap"
hover-class="defaultTap"
>
{{ "至今" }}
</button>
</view>
<uni-datetime-picker
type="daterange"
@change="dateChange"
:value="datetimePickerType === 'date' ? nowDate : nowDaterange"
class="drow-pie-rely_on-view"
>
<view class="year">
<view v-if="datetimePickerType === 'date'">
<text>{{ !isSoFar ? date.year + "年" : "--年" }}</text>
</view>
<view v-else>
<text>{{
!isSoFar
? nowDaterange[0].substr(0, 4) ===
nowDaterange[1].substr(0, 4)
? nowDaterange[0].substr(0, 4) + "年"
: nowDaterange[0].substr(0, 4) +
"&nbsp;&nbsp; &nbsp;&nbsp;" +
nowDaterange[1].substr(0, 4) +
"年"
: "--年"
}}</text>
</view>
</view>
<view class="month">
<view v-if="datetimePickerType === 'date'">
<text>{{ !isSoFar ? date.month + 1 : "--" }}</text>
<text class="yue" style="font-size: 11px">月</text>
</view>
<view v-else>
<text>{{
!isSoFar
? nowDaterange[0].substr(0, 4) ===
nowDaterange[1].substr(0, 4) &&
nowDaterange[0].substr(5, 2) ===
nowDaterange[1].substr(5, 2)
? nowDaterange[0].substr(5, 2)
: nowDaterange[0].substr(5, 2) +
" 至 " +
nowDaterange[1].substr(5, 2)
: "--"
}}</text>
<text class="yue" style="font-size: 11px">月</text>
</view>
<view class="down-arrow"></view>
</view>
<view class="day">
<view v-if="datetimePickerType === 'date'">
<text>{{ !isSoFar ? date.day : "--" }}</text>
<text class="yue" style="font-size: 11px">日</text>
</view>
<view v-else>
<text>{{
!isSoFar
? nowDaterange[0].substr(0, 4) ===
nowDaterange[1].substr(0, 4) &&
nowDaterange[0].substr(5, 2) ===
nowDaterange[1].substr(5, 2) &&
nowDaterange[0].substr(8, 2) ===
nowDaterange[1].substr(8, 2)
? nowDaterange[0].substr(8, 2)
: nowDaterange[0].substr(5, 2) !==
nowDaterange[1].substr(5, 2)
? nowDaterange[0].substr(8, 2) +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
nowDaterange[1].substr(8, 2)
: nowDaterange[0].substr(0, 4) ===
nowDaterange[1].substr(0, 4) &&
nowDaterange[0].substr(5, 2) ===
nowDaterange[1].substr(5, 2)
? nowDaterange[0].substr(8, 2) +
" 至 " +
nowDaterange[1].substr(8, 2)
: nowDaterange[0].substr(8, 2) +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
nowDaterange[1].substr(8, 2)
: "--"
}}</text>
<text class="yue" style="font-size: 11px">日</text>
</view>
</view>
</uni-datetime-picker>
</view>
<view class="Income_and_expenditure">
<view
:class="
'collect_view' +
' ' +
'collect_view' +
(selectCollect ? '_NH' : '_H')
"
>
<view class="collect_frame">
<view :class="'collect'">
<view
v-for="(typeItem, typeIndex) in definedPieData"
:key="'type ' + typeIndex"
>
<view>
<text>{{ typeItem }}</text>
</view>
<view
v-if="
selectCollect &&
pieData[1] !== undefined &&
pieData[0] !== undefined
"
>
<template v-for="(dataItem, dataIndex) in pieData">
<view
:key="'type ' + typeIndex + 'data ' + dataIndex"
v-if="typeItem === dataItem.name"
>
<text>{{
(dataItem !== null && dataItem !== undefined
? dataItem.value
: "0.00") + "¥"
}}</text>
</view>
</template>
</view>
<view v-else>{{ "0.00" + "¥" }}</view>
</view>
</view>
</view>
<view class="pie" v-if="isPieShow">
<view class="echart" id="mychart" :style="myChartStyle" />
</view>
</view>
</view>
</view>
</view>
<!-- 记账列表数据 -->
<view class="list-data card renderjs" id="accountsListRj">
<view v-if="ALRjStatus">
<view class="income_table-view">
<view class="title"
><text>{{ "收入列表" }}</text></view
>
<uni-table :loading="loading" :stripe="true" class="income_table">
<uni-tr>
<uni-th rowspan="1" align="center">记账分类</uni-th>
<uni-th rowspan="1" align="center">记账时间</uni-th>
<uni-th rowspan="1" align="center">金额(元)</uni-th>
</uni-tr>
<template v-for="(income, incomeIndex) in incomeList">
<uni-tr
:key="'tr' + incomeIndex"
@click.native="accountsRj.showIncDetailList"
:data-indexx="incomeIndex"
:data-valuex="income.firstId"
:class="
incomeIndex % 2 === 0 ? 'tr-stripe-even' : 'tr-stripe-odd'
"
:id="'tr_' + incomeIndex"
>
<uni-td rowspan="1" align="center">{{
income.secondId !== undefined && income.secondId !== null
? dictDatas["incCaDetailList"][income.secondId].name
: dictDatas["incCaDetailList"][income.firstId].name
}}</uni-td>
<uni-td rowspan="1" align="center">{{
income.billingTime
}}</uni-td>
<uni-td rowspan="1" align="center">{{
income.amount
}}</uni-td>
</uni-tr>
<view
@click="accountsRj.showIncDetailList"
:data-indexx="incomeIndex"
:data-valuex="income.firstId"
:class="
'detail-tr' +
(!(
incomeDetShow[incomeIndex] === null ||
incomeDetShow[incomeIndex] === undefined ||
incomeDetShow[incomeIndex].isShow === false
)
? ''
: ' unShow')
"
:key="'detail' + incomeIndex"
>
<view>
<uni-list :border="false" class="detail-list">
<template
v-for="(incomeField, PFIndex) in incomeItemFields"
>
<uni-list-item
:border="false"
:key="'fieldIndex' + PFIndex"
:title="incomeField.label"
:rightText="
incomeField.isDict !== undefined &&
incomeField.isDict !== null
? dictDatas[incomeField.dictName][
income.secondId !== undefined &&
income.secondId !== null
? income.secondId
: income.firstId
].name
: income[incomeField.name] !== null
? income[incomeField.name].toString()
: ''
"
v-if="
(incomeField.isRenderFieName !== undefined &&
incomeField.isRenderFieName !== null &&
incomeField.isRenderFieName === true) ||
incomeFieIsShow[incomeField.isRenderFieName] ===
true
"
/>
</template>
</uni-list>
</view>
</view>
</template>
</uni-table>
<uni-pagination
:current="IncomeFormData.pageNum"
:total="IncomeTotal"
title="标题文字"
:show-icon="true"
@change="incomePageinationChange"
:pageSize="IncomeFormData.pageSize"
v-if="!loading"
/>
</view>
<view class="expend_table-view">
<view class="title"
><text>{{ "支出列表" }}</text></view
>
<uni-table :loading="loading" :stripe="true" class="expend_table">
<uni-tr>
<uni-th rowspan="1" align="center">记账分类</uni-th>
<uni-th rowspan="1" align="center">记账时间</uni-th>
<uni-th rowspan="1" align="center">金额(元)</uni-th>
</uni-tr>
<template v-for="(expend, expendIndex) in expendList">
<uni-tr
:key="'tr' + expendIndex"
@click.native="accountsRj.showExpDetailList"
:data-indexx="expendIndex"
:data-valuex="expend.firstId"
:class="
expendIndex % 2 === 0 ? 'tr-stripe-even' : 'tr-stripe-odd'
"
:id="'tr_' + expendIndex"
>
<uni-td rowspan="1" align="center">{{
expend.secondId !== undefined && expend.secondId !== null
? dictDatas["expCaDetailList"][expend.secondId].name
: dictDatas["expCaDetailList"][expend.firstId].name
}}</uni-td>
<uni-td rowspan="1" align="center">{{
expend.billingTime
}}</uni-td>
<uni-td rowspan="1" align="center">{{
expend.amount
}}</uni-td>
</uni-tr>
<view
@click="accountsRj.showExpDetailList"
:data-indexx="expendIndex"
:data-valuex="expend.firstId"
:class="
'detail-tr' +
(!(
expendDetShow[expendIndex] === null ||
expendDetShow[expendIndex] === undefined ||
expendDetShow[expendIndex].isShow === false
)
? ''
: ' unShow')
"
:key="'detail' + expendIndex"
>
<view>
<uni-list :border="false" class="detail-list">
<template
v-for="(expendField, PFIndex) in expendItemFields"
>
<uni-list-item
:border="false"
:key="'fieldIndex' + PFIndex"
:title="expendField.label"
:rightText="
expendField.isDict !== undefined &&
expendField.isDict !== null
? dictDatas[expendField.dictName][
expend.secondId !== undefined &&
expend.secondId !== null
? expend.secondId
: expend.firstId
].name
: expend[expendField.name] !== null
? expend[expendField.name].toString()
: ''
"
v-if="
(expendField.isRenderFieName !== undefined &&
expendField.isRenderFieName !== null &&
expendField.isRenderFieName === true) ||
expendFieIsShow[expendField.isRenderFieName] ===
true
"
/>
</template>
</uni-list>
</view>
</view>
</template>
</uni-table>
<uni-pagination
:current="ExpendFormData.pageNum"
:total="ExpendTotal"
title="标题文字"
:show-icon="true"
@change="expendPageinationChange"
:pageSize="ExpendFormData.pageSize"
v-if="!loading"
/>
</view>
</view>
<view v-else class="empty">
<text>暂无记账信息</text>
</view>
</view>
</view>
<view v-if="true" class="summary-of-week card">
<view class="card-title">
<navigator
url="/packageInfo/pages/my-stats/my-stats/my-stats"
class="title-text"
>
<view class="navigator-text">
<view class="icon my-stats-icon">
<image src="@/static/images/accounts/z9SNef.png" />
<view class="yuan">
<view></view>
<text>¥</text>
</view>
</view>
<text>本周收支汇总</text>
</view>
<view class="navigator-arrow"></view>
</navigator>
</view>
<view class="card-body my-stats-body">
<view v-if="false"></view>
<view v-else class="empty">
<image
style="opacity: myStaBodyImage.opacity"
:src="myStaBodyImage.src"
/>
<text>暂无数据,快去记账吧</text>
</view>
</view>
</view>
<!-- 绝对定位组件 -->
<view
class="add-account-view add-account_fixed"
@click="isAccountPopupShow = !isAccountPopupShow"
/>
<view class="suspended-solids" v-if="false">
<button class="scan"></button>
<button class="account"></button>
</view>
<uni-popup
ref="accountPopup"
background-color="#fff"
@change="accountPopupShowChange"
>
<view class="account-popup-view">
<view v-for="(bottomItem, bottomIndex) in groups" :key="bottomIndex">
<button
:plain="true"
:data-value="bottomItem.value"
@click="btnClick"
style="border: 0px"
>
<text>{{ bottomItem.text }}</text>
</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { selectBaseInfo } from "@/api/enterprise/baseInfo";
import { selectUserEntity } from "@/api/enterprise/userEntity";
import { checkPermi, checkRole } from "@/utils/permission";
import * as echarts from "@/static/echarts/echarts.min.js";
import { getListIncome, listIncome, getIncome } from "@/api/income/income";
import {
queryIncomeCategory,
getIncomeCategory,
} from "@/api/income/incomeCategory";
import { getListExpend, listExpend, getExpend } from "@/api/expend/expend";
import {
queryExpendCategory,
getExpendCategory,
} from "@/api/expend/expendCategory";
import { listManagement, delManagement } from "@/api/enterprise/management";
import {
listLandManagement,
delLandManagement,
} from "@/api/enterprise/landManagement";
import {
listBusinessItems,
delBusinessItems,
} from "@/api/enterprise/businessItems";
import {
listMainProductsSales,
delMainProductsSales,
} from "@/api/enterprise/mainProductsSales";
import { listSubsidy, delSubsidy } from "@/api/lef/subsidy";
export default {
name: "accounts",
components: {},
props: {},
data() {
const date = new Date();
const years = [];
const months = [];
const days = [];
const nowDate = new Date();
const year = nowDate.getFullYear();
const month = nowDate.getMonth();
const day = nowDate.getDate();
for (let i = 1990; i <= date.getFullYear(); i++) {
years.push(i);
}
for (let i = 1; i <= 12; i++) {
months.push(i);
}
for (let i = 1; i <= 31; i++) {
days.push(i);
}
return {
haveEnterprise: false,
queryParams: { createTime: 11 },
myStaBodyImage: {
src: "../../static/images/accounts/z9LGTJ.png",
// 透明度
opacity: "50%",
},
baseInfo: {
baseId: "???",
fullName: "长阳观坪家庭农场有限公司",
page: "",
},
entityInfo: {
img: "../../static/images/mine/xxlAuF.png",
round: "../../static/images/mine/xxWhzq.png",
},
integral: {
id: "integral",
name: "积分",
page: "integral",
img: "../../static/images/mine/xxlC90.png",
},
list: [],
showActionsheet: false,
groups: [
{ text: "记一笔收入", value: 1 },
{ text: "记一笔支出", value: 2 },
],
showPicker: false,
nowDate: nowDate,
selectDate: nowDate,
nowMonth: nowDate.getMonth(),
date: {
years,
year,
months,
month,
days,
day,
value: [9999, 1, 1],
isDaytime: true,
},
nowDaterange: [
year + "-" + (month + 1 < 10 ? "0" : "") + (month + 1) + "-" + "01",
year +
"-" +
(month + 1 < 10 ? "0" : "") +
(month + 1) +
"-" +
(day < 10 ? "0" : "") +
day,
],
datetimePickerType: "daterange",
selectDaterange: [
year + "-" + (month + 1 < 10 ? "0" : "") + (month + 1) + "-" + "01",
year +
"-" +
(month + 1 < 10 ? "0" : "") +
(month + 1) +
"-" +
(day < 10 ? "0" : "") +
day,
],
isSoFar: false,
accountsForm: {
time: 5,
date: [],
},
IncomeFormData: {
pageNum: 1,
pageSize: 10,
// time: 5,
// date: [],
},
ExpendFormData: {
pageNum: 1,
pageSize: 10,
// time: 5,
// date: [],
},
pieName: [],
pieData: [],
definedPieData: ["支出", "收入"],
myChart: {},
// 支出记录表格数据
incomeList: [],
// 收入记录表格数据
expendList: [],
// 饼图支出数据
incomePieData: [],
// 饼图收入数据
expendPieData: [],
// 总条数
IncomeTotal: 0,
ExpendTotal: 0,
//图表样式
myChartStyle: {
float: "left",
// width: "calc(100% + 14px)",
width: "100%",
height: "200%",
},
drawTimeout: {},
isPieShow: false,
drawASelectNeedImportFunctions: {
getListExpend: {
formName: "ExpendFormData",
importFuntcion: function (val) {
return getListExpend(val);
},
rowsData: { fieldName: "expendPieData", needResFie: "rows" },
totalData: { fieldName: "ExpendTotal", needResFie: "total" },
_thisMetFunName: "expendCalculate",
},
getListIncome: {
formName: "IncomeFormData",
importFuntcion: function (val) {
return getListIncome(val);
},
rowsData: { fieldName: "incomePieData", needResFie: "rows" },
totalData: { fieldName: "IncomeTotal", needResFie: "total" },
_thisMetFunName: "incomeCalculate",
},
},
pieColor: ["rgb(145,204,117)", "rgb(203, 71, 71)"],
selectCollect: false,
// 绘饼图数据遍历接口等待分页列表请求接口计数器
selListCount: 0,
// 绘饼图函数等待绘饼图数据请求遍历接口计数器
drawSelCount: 0,
// 绘饼图所需所有条目查询对象
drawNeedForms: {
IncomeFormData: {
pageNum: 1,
pageSize: 10,
// time: 5,
// date: [],
},
ExpendFormData: {
pageNum: 1,
pageSize: 10,
// time: 5,
// date: [],
},
},
isAccountPopupShow: false,
incomeFieIsShow: {
//贷款
loansState: false,
//借款
borrowState: false,
//保险
insuranceState: false,
//其他
elseState: true,
},
expendFieIsShow: {
//流转
areaState: false,
//还款
repaymentState: false,
//借款
borrowState: false,
//保险
insuranceState: false,
},
ALRjStatus: false,
loading: false,
incomeItemFields: [],
expendItemFields: [],
testText: "未改变初始值",
detailsShow: [],
isInAccounts: false,
incomeDetShow: [],
expendDetShow: [],
dictDatas: {},
isManagement: false,
isLandManagement: false,
isBusinessItems: false,
isMainProductsSales: false,
isSubsidy: false,
queryParams: {
year: new Date().getFullYear(),
state: "0",
},
};
},
computed: {},
methods: {
checkRole,
getMsg(yes_no) {
if (yes_no === true) {
this.$modal.msgSuccess("新增成功");
} else if (yes_no === false) {
this.$modal.msgSuccess("修改成功");
}
},
dateChange(e) {
const _this = this;
_this.accountsForm.time = 5;
_this.isSoFar = false;
if (_this.datetimePickerType === "date") {
_this.nowDate = e;
_this.selectDate = e;
} else {
_this.nowDaterange = e;
_this.selectDaterange = e;
}
_this.fillForm().then(_this.selectLists());
},
getEnterprise() {
selectUserEntity().then((response) => {
if (response.data.length !== 0) {
this.haveEnterprise = false;
this.haveEnterprise = true;
} else {
this.haveEnterprise = false;
}
});
},
getBaseInfo() {
selectBaseInfo().then((response) => {
this.baseInfo = response.data;
});
},
btnClick(e) {
const value = e.currentTarget.dataset.value;
this.isAccountPopupShow = !this.isAccountPopupShow;
if (value === 1) {
wx.navigateTo({
url: "/pages/accounts/incomeSort/index",
});
} else {
wx.navigateTo({
url: "/pages/accounts/expendSort/index",
});
}
},
soFarTap() {
const _this = this;
_this.accountsForm.time = 1;
_this.isSoFar = true;
_this.selectDaterange = ["0001-01-01", _this.nowDateParse()];
_this.fillForm().then(_this.selectLists());
},
async selectLists() {
this.$modal.loading("加载中,请耐心等待...");
const that = this;
this.fillForm().then((filFormRes) => {
getListIncome(that.IncomeFormData)
.then((res) => {
that.incomePieData = res.rows;
that.incomeList = res.rows;
that.IncomeTotal = res.total;
that.pieDataInit();
})
.catch((err) => {
that.$modal.closeLoading();
that.pieDataInit();
return new Promise((resolve, reject) => {
reject(err);
});
})
.then((response) => {
that.$modal.closeLoading();
that.selListCount++;
});
getListExpend(that.ExpendFormData)
.then((res) => {
that.expendPieData = res.rows;
that.expendList = res.rows;
that.ExpendTotal = res.total;
that.pieDataInit();
})
.catch((err) => {
that.$modal.closeLoading();
that.pieDataInit();
return new Promise((resolve, reject) => {
reject(err);
});
})
.then((response) => {
that.$modal.closeLoading();
that.selListCount++;
});
});
},
reset() {
Object.assign(this.accountsForm, {
id: null,
baseId: null,
firstId: null,
secondId: null,
billingTime: null,
amount: null,
area: null,
repayment: null,
repaymentDate: null,
borrow: null,
insurance: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
});
},
async fillForm(expression) {
const _this = this;
Object.assign(_this.IncomeFormData, _this.accountsForm);
Object.assign(_this.ExpendFormData, _this.accountsForm);
let startTime = _this.selectDaterange[0];
let endTime = _this.selectDaterange[1];
if (_this.datetimePickerType === "date") {
_this.IncomeFormData.billingTime = _this.selectDate;
_this.ExpendFormData.billingTime = _this.selectDate;
} else if (_this.selectDaterange.length !== 0) {
_this.IncomeFormData["startTime"] = startTime;
_this.IncomeFormData["endTime"] = endTime;
_this.ExpendFormData["startTime"] = startTime;
_this.ExpendFormData["endTime"] = endTime;
}
Object.assign(_this.drawNeedForms.ExpendFormData, _this.ExpendFormData);
Object.assign(_this.drawNeedForms.IncomeFormData, _this.IncomeFormData);
return new Promise((resolve, reject) => {
if (expression) {
resolve("true");
} else if (
expression !== undefined &&
expression !== null &&
expression === false
) {
reject(892);
} else {
resolve("true");
}
});
},
/** 计算收入与支出 */
expendCalculate() {
const _this = this;
var expend = 0;
for (let e = 0; e < _this.expendPieData.length; e++) {
expend += _this.expendPieData[e].amount;
}
var exp = {};
exp["name"] = "支出";
exp["value"] = expend;
_this.$set(_this.pieData, [0], exp);
_this.initDate(); //数据初始化
},
incomeCalculate() {
const _this = this;
var income = 0;
for (let i = 0; i < _this.incomePieData.length; i++) {
income += _this.incomePieData[i].amount;
}
var inc = {};
inc["name"] = "收入";
inc["value"] = income === undefined || income === null ? 0.0 : income;
_this.$set(_this.pieData, [1], inc);
_this.initDate(); //数据初始化
},
initDate() {
const _this = this;
for (let i = 0; i < _this.pieData.length; i++) {
if (
_this.pieData[i] !== undefined &&
_this.pieData[i] !== null &&
_this.pieData[i] !== ""
) {
_this.pieName[i] = _this.pieData[i].name;
}
}
},
initEcharts() {
const _this = this;
// 饼图
const option = {
color: _this.pieColor,
legend: {
// 图例
data: _this.pieName,
left: "left",
bottom: "0%",
orient: "horizontal",
},
title: {
// 设置饼图标题,位置设为顶部居中
text: "比例图表",
top: "0%",
left: "center",
textStyle: {
fontSize: 13,
fontWeight: "normal",
},
},
series: [
{
type: "pie",
label: {
show: true,
fontSize: "10",
formatter: "{d}% ({c}¥)", // b代表名称c代表对应值d代表百分比
},
radius: "45%", //饼图半径
data: _this.pieData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
const optionFree = {
xAxis: {},
yAxis: {},
series: [
{
data: _this.seriesData,
type: "line",
smooth: true,
},
],
};
_this.myChart = echarts.init(document.getElementById("mychart"));
_this.myChart.setOption(option);
//随着屏幕大小调节图表
window.addEventListener("resize", () => {
_this.myChart.resize();
});
},
resetPieData() {
const _this = this;
_this.pieData.forEach((element, index) => {
_this.pieData[index].value = 0;
});
},
drawASelect() {
this.$modal.loading("加载中,请耐心等待...");
const that = this;
const _this = this;
clearTimeout(that.drawTimeout);
that
.fillForm()
.then(() => {
_this.setSelAllTotal();
})
.catch((err) => {
// console.error(err);
})
.then((res) => {
for (let importFunctionObj in that.drawASelectNeedImportFunctions) {
that.$modal.loading("加载中,请耐心等待...");
const _thisDAS = _this.drawASelectNeedImportFunctions;
_thisDAS[importFunctionObj]
.importFuntcion(
that.drawNeedForms[_thisDAS[importFunctionObj].formName]
)
.then((response) => {
_this[_thisDAS[importFunctionObj].rowsData.fieldName] =
response[_thisDAS[importFunctionObj].rowsData.needResFie];
_this[_thisDAS[importFunctionObj].totalData.fieldName] =
response[_thisDAS[importFunctionObj].totalData.needResFie];
if (
_this[_thisDAS[importFunctionObj].rowsData.fieldName].length <
_this[_thisDAS[importFunctionObj].totalData.fieldName] &&
_this.isInAccounts === true
) {
clearTimeout(that.drawTimeout);
that.drawTimeout = setTimeout(function () {
that.drawASelect();
}, 20);
return new Promise((resolve, reject) => {
reject("绘图条目与查询条目不符,重载中...");
});
}
})
.catch((err) => {
_this.$modal.closeLoading();
_this.estimateIsPieShow();
_this[_thisDAS[importFunctionObj]._thisMetFunName]();
return new Promise((resolve, reject) => {
reject(err);
});
})
.then((response) => {
_this.$modal.closeLoading();
if (
document.readyState === "complete" &&
document.getElementById("mychart") !== null
) {
_this[_thisDAS[importFunctionObj]._thisMetFunName]();
} else if (
_this[_thisDAS[importFunctionObj].rowsData.fieldName]
.length !== undefined &&
_this[_thisDAS[importFunctionObj].rowsData.fieldName].length >
0 &&
_this.isInAccounts === true
) {
clearTimeout(that.drawTimeout);
that.drawTimeout = setTimeout(function () {
that.drawASelect();
}, 100);
}
_this.drawSelCount++;
});
}
});
},
estimateIsPieShow() {
const _this = this;
_this.selectCollect = false;
if (
_this.incomePieData.length === 0 &&
_this.expendPieData.length === 0
) {
_this.isPieShow = false;
} else {
if (
_this.isPieShow === true &&
document.getElementById("mychart") &&
_this.pieData.length === 2 &&
_this.incomePieData.length !== undefined &&
_this.expendPieData.length !== undefined &&
(_this.incomePieData.length !== 0 || _this.expendPieData.length !== 0)
) {
_this.initEcharts();
_this.selectCollect = true;
} else if (
_this.isPieShow === true &&
document.getElementById("mychart") &&
_this.pieData.length === 2
// &&
) {
_this.selectCollect = false;
} else {
_this.selectCollect = false;
}
_this.isPieShow = true;
}
},
async setSelAllTotal() {
const that = this;
this.drawNeedForms.IncomeFormData.pageSize = that.IncomeTotal;
this.drawNeedForms.ExpendFormData.pageSize = that.ExpendTotal;
},
pieDataInit() {
if (this.pieData.length === 0) {
this.incomeCalculate();
this.expendCalculate();
}
},
nowDateParse() {
const year = this.date.year;
const month = this.date.month;
const day = this.date.day;
return (
year +
"-" +
(month + 1 < 10 ? "0" : "") +
(month + 1) +
"-" +
(day < 10 ? "0" : "") +
day
);
},
accountPopupShowChange(e) {
this.isAccountPopupShow = e.show;
},
receiveRenderData(fieVal) {
const _this = this;
for (let name in fieVal) {
this[name] = fieVal[name];
}
},
incomePageinationChange(e) {
this.IncomeFormData = e;
this.fillForm().then(this.selectLists());
},
expendPageinationChange(e) {
this.ExpendFormData = e;
this.fillForm().then(this.selectLists());
},
recRenIncDetShow(e) {
this.incomeDetShow = e;
},
recRenExpDetShow(e) {
this.expendDetShow = e;
},
recRenIncFieShow(e) {
this.incomeFieIsShow = e;
},
recRenExpFieShow(e) {
this.expendFieIsShow = e;
},
recRenDictIncCate(e) {
this.dictDatas["incCaDetailList"] = e;
},
recRenDictExpCate(e) {
this.dictDatas["expCaDetailList"] = e;
},
async getDatas() {
this.loading = true;
listManagement(this.queryParams)
.then((response) => {
let list = response.rows;
this.isManagement = list && list.length > 0;
})
.catch((err) => {
// console.error(err);
})
.then(() => {
// this.setIsLoadRecord();
this.loading = false;
});
listLandManagement(this.queryParams)
.then((response) => {
let list = response.rows;
this.isLandManagement = list && list.length > 0;
})
.catch((err) => {
// console.error(err);
})
.then(() => {
// this.setIsLoadRecord();
this.loading = false;
});
listBusinessItems(this.queryParams)
.then((response) => {
let list = response.rows;
this.isBusinessItems = list && list.length > 0;
})
.catch((err) => {
// console.error(err);
})
.then(() => {
// this.setIsLoadRecord();
this.loading = false;
});
listMainProductsSales(this.queryParams)
.then((response) => {
let list = response.rows;
this.isMainProductsSales = list && list.length > 0;
})
.catch((err) => {
// console.error(err);
})
.then(() => {
// this.setIsLoadRecord();
this.loading = false;
});
listSubsidy(this.queryParams)
.then((response) => {
const resRows = response.rows;
let list = resRows[0].rows.rows;
this.isSubsidy = list && list.length > 0;
})
.then(() => {
// this.setIsLoadRecord();
this.loading = false;
});
},
},
watch: {
selectDate: {
handler: function (val, oldVal) {
const _this = this;
const selectTime = new Date(val);
_this.date.year = selectTime.getFullYear();
_this.date.month = selectTime.getMonth();
_this.date.day = selectTime.getDay();
_this.nowMonth = selectTime.getMonth();
},
deep: true,
},
haveEnterprise: {
handler: function (val, oldVal) {
if (this.haveEnterprise === true) {
this.getBaseInfo();
}
},
deep: true,
},
isPieShow: {
handler: function (val, oldVal) {
if (val === false) {
this.drawASelect();
}
},
deep: true,
},
selectCollect: {
handler: function (val, oldVal) {
const _this = this;
if (val === false) {
_this.isPieShow = true;
}
},
deep: true,
},
drawSelCount: {
handler: function (val, oldVal) {
const _this = this;
if (val >= 2 && _this.isInAccounts === true) {
_this.estimateIsPieShow();
if (_this.isPieShow && !_this.selectCollect) {
_this.drawTimeout = setTimeout(function () {
_this.drawASelect();
}, 100);
}
_this.drawSelCount = 0;
}
},
deep: true,
},
selListCount: {
handler: function (val, oldVal) {
const _this = this;
if (val >= 2) {
_this.ALRjStatus =
_this.incomeList.length > 0 || _this.expendList.length > 0
? true
: false;
_this.estimateIsPieShow();
if (_this.isPieShow && !_this.selectCollect) {
_this.drawTimeout = setTimeout(function () {
_this.selectLists();
}, 20);
}
_this.drawASelect();
_this.selListCount = 0;
}
},
deep: true,
},
isAccountPopupShow: {
handler: function (val, oldVal) {
const _this = this;
if (val === true) {
_this.$refs.accountPopup.open("bottom");
} else {
_this.$refs.accountPopup.close();
}
},
deep: true,
},
},
mounted() {
var that = this;
that.$nextTick(function () {
let pageHead = uni.createSelectorQuery().select(".page-head");
pageHead.fields({ size: true }, (data) => {}).exec();
});
},
// 页面周期函数--监听页面加载
onLoad() {
this.reset();
this.getEnterprise();
},
// 页面周期函数--监听页面初次渲染完成
onReady() {},
// 页面周期函数--监听页面显示(not-nvue)
onShow() {
this.isInAccounts = true;
this.getEnterprise();
this.selectLists();
if (!checkRole(["admin", "agriculture"]) && checkRole(["enterprise"])) {
this.getDatas();
}
},
// 页面周期函数--监听页面隐藏
onHide() {
this.isInAccounts = false;
clearTimeout(this.drawTimeout);
const _this = this;
clearTimeout(_this.drawTimeout);
this.isAccountPopupShow = false;
},
// 页面周期函数--监听页面卸载
onUnload() {},
// 页面处理函数--监听用户下拉动作
// onPullDownRefresh() { uni.stopPullDownRefresh(); },
// 页面处理函数--监听用户上拉触底
// onReachBottom() {},
// 页面处理函数--监听页面滚动(not-nvue)
// onPageScroll(event) {},
// 页面处理函数--用户点击右上角分享
// onShareAppMessage(options) {},
};
</script>
<style scoped lang="scss">
@import url("@/static/scss/infoBody.scss");
$collect_view_height: --select-collect_view-height;
.page-head {
background: #39b673;
width: 100%;
height: 8%;
padding: 10% 0px 10% 0px;
position: relative;
}
.page-body {
min-height: 50%;
position: relative;
}
.entityInfo .navigator-text {
height: auto;
}
.entityInfo .baseInfo-text {
line-height: unset;
}
.navigator-text {
display: flex;
margin-left: 10px;
height: 35px;
line-height: 35px;
}
.icon {
width: 35px;
height: 35px;
line-height: 35px;
display: inline-block;
}
.icon image {
position: absolute;
margin: 5px;
width: 25px;
height: 25px;
align-self: center;
}
.dir-rep-info image {
width: 22px;
}
.my-stats-icon image {
margin-left: 3px;
width: 27px;
height: 27px;
}
.my-stats-icon .yuan {
position: absolute;
padding-left: 13px;
width: 35px;
height: 35px;
}
.my-stats-icon .yuan view {
position: absolute;
margin-top: 13px;
margin-left: -3.5px;
height: 9.8px;
width: 9.8px;
border: #fff 1px solid;
border-radius: 50%;
background-color: #3ab674;
}
.my-stats-icon .yuan text {
transform: rotate(-25deg) translate(-37%, -1%) scale(0.7);
position: absolute;
font-size: 7px;
color: white;
// font-family: SimSun;
font-family: math;
}
.account-list-icon text {
position: absolute;
color: white;
line-height: 30px;
font-size: 12px;
padding-left: 10px;
}
.card-body {
display: flex;
// justify-content: center;
justify-content: space-evenly;
}
/deep/ .dir_rep_info {
width: 100vw;
color: #999;
.uni-section-header__content .distraction {
color: #666 !important;
}
.is_filled {
color: #6bcf9a;
}
}
.floater {
width: 100%;
height: 100px;
position: relative;
bottom: 0px;
}
.improve-info {
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
clear: both;
position: absolute;
width: 220px;
height: 40px;
border: #3ab674 1px solid;
border-radius: 5px;
text-align: center;
}
.improve-info text {
color: #027e3c;
font-size: 12px;
line-height: 40px;
}
.entityInfo > view > .navigator-arrow:after {
margin-top: auto;
left: 0px;
}
/* 页面卡片 */
.card {
width: 100%;
background-color: #fff;
}
/* 直报信息 */
.direct-reporting-information {
margin-top: 10px;
min-height: 120px;
}
/* 卡片标题 */
.card-title {
width: 100%;
border-bottom: solid #efefef 1px;
}
/* 卡片标题文字 */
.title-text {
padding: 5px;
}
/* 标题尾部箭头 */
.navigator-arrow:after {
margin-top: -16px;
border-width: 2px 2px 0 0;
}
/* 本周收支汇总 */
.summary-of-week {
margin-top: 10px;
min-height: 180px;
}
.my-stats-body .empty {
transform: translateY(50%);
display: flex;
justify-content: center;
}
.my-stats-body .empty image {
width: 50px;
height: 50px;
}
.my-stats-body .empty text {
margin-bottom: 0px;
margin-top: auto;
color: #999;
}
/* 记账列表 */
.account-list {
margin-top: 10px;
// height: 120px;
}
.account-list .card-title {
display: flex;
justify-content: space-between;
}
.account-list .card-title {
.add-account-view {
display: flex;
align-items: center;
.add-account {
border: #3ab674 1px solid;
margin-right: 10px;
line-height: 14px;
padding: 3px 5px 3px 5px;
// transform: translateY(70%);
border-radius: 3px;
color: #027e3c;
font-size: 12px;
text {
color: #027e3c;
font-size: 12px;
}
}
}
}
.account-list .card-body {
height: calc(100% - 46px);
position: relative;
}
.year {
font-size: 10px;
color: #999;
line-height: 10px;
white-space: nowrap;
// word-wrap: break-word;
// flex-wrap: nowrap;
text-align: right;
}
.month {
display: flex;
justify-content: flex-end;
font-size: 18px;
white-space: nowrap;
}
.day {
// display: flex;
// justify-content: flex-end;
font-size: 16px;
color: #666;
white-space: nowrap;
}
.year,
.day {
padding-right: 15px;
}
.date {
position: relative;
// height: 100%;
height: auto;
display: flex;
vertical-align: middle;
text-align: center;
padding: 10px 3% 10px 10px;
flex-direction: column;
.soFar {
padding: 5px;
min-width: 72.484px;
button {
background-color: #39b673;
}
}
/deep/.drow-pie-rely_on-view {
height: 100%;
.uni-date-editor {
display: flex;
flex-direction: column;
justify-content: space-evenly;
height: 80%;
}
}
}
.date .down-arrow {
margin: 3px 5px auto 2px;
border: black 10px solid;
border-left: white 5px solid;
border-right: white 5px solid;
border-bottom: 0px;
}
.date::after {
top: 20%;
right: 0px;
content: "";
position: absolute;
height: 50%;
float: right;
border-right: 1px black solid;
}
.Income_and_expenditure {
width: 80%;
padding-bottom: 10px;
position: relative;
.collect_view {
#{collect_view_height}: 100%;
.collect_frame {
height: 100%;
position: relative;
.collect {
position: relative;
padding: 10px 0px;
display: flex;
justify-content: space-evenly;
align-items: center;
text-align: center;
font-weight: 800;
height: 100%;
}
}
.pie {
height: 100%;
display: flex;
#mychart > {
/deep/div,
:not(not) > :not(not) {
display: var(--select-collect);
}
}
}
}
.collect_view_H {
height: 100%;
}
.collect_view_NH {
min-height: 100%;
}
}
/* 列表数据 */
.list-data {
position: relative;
margin-top: 5px;
min-height: 180px;
display: flex;
justify-content: center;
.title {
margin: 1em 1.6em;
color: #999;
font-weight: 700;
font-size: 1.2em;
}
.income_table-view {
width: 100vw;
.title {
color: rgb(203, 71, 71);
}
.income_table {
/deep/.uni-table {
min-width: 100vw !important;
.detail-tr {
// position: relative;
margin-right: -100vw;
width: 100vw;
// margin-right: -115%;
padding: 0 15%;
.detail-abs-tr {
position: absolute;
width: 100%;
height: 100%;
.detail-list {
position: relative;
width: 100%;
}
}
}
.tr-stripe-odd {
background: #fafafa;
}
}
}
/deep/.uni-pagination {
justify-content: end;
margin: 0em 2em;
}
}
.expend_table-view {
width: 100vw;
padding: 1em 0em;
.title {
color: rgb(145, 204, 117);
}
.expend_table {
/deep/.uni-table {
min-width: 100vw !important;
.detail-tr {
// position: relative;
margin-right: -100vw;
width: 100vw;
// margin-right: -115%;
padding: 0 15%;
.detail-abs-tr {
position: absolute;
width: 100%;
height: 100%;
.detail-list {
position: relative;
width: 100%;
}
}
}
.tr-stripe-odd {
background: #fafafa;
}
}
}
/deep/.uni-pagination {
justify-content: end;
margin: 0em 2em;
}
}
.expend_table-view::before {
content: "";
display: block;
position: absolute;
height: 1px;
width: 100vw;
background-color: #efefef;
margin-top: -0.6em;
}
}
.list-data .empty {
color: #999;
font-size: 12px;
position: absolute;
top: 40%;
}
.add-account_fixed {
position: fixed;
bottom: 0px;
height: var(--window-bottom);
width: 25%;
margin-left: 25vw;
z-index: 999;
}
/* 页面悬浮组件 */
.suspended-solids {
width: 15%;
height: 18%;
right: 5%;
bottom: 15%;
position: fixed;
}
/* 悬浮组件内的按钮 */
.suspended-solids button {
width: 0;
height: 47px;
border-radius: 100%;
}
// 记一笔弹出层
.account-popup,
.account-popup-view {
margin-bottom: var(--window-bottom);
}
/* 扫票按钮 */
.scan {
background-color: orange;
}
/* 记账按钮 */
.account {
background-color: rgb(50, 205, 109);
}
.styleFalse {
display: none;
}
.unShow {
display: none;
}
</style>
<script module="accountsRj" lang="renderjs">
import {
listExpendCategory,
} from "@/api/expend/expendCategory";
import {
listIncomeCategory,
} from "@/api/income/incomeCategory";
export default {
data() {
return {
renderIncomeItemFields: [
{
label: "记账分类",
name: "secondId",
secondName: "firstId",
isRenderFieName: true,
isDict: true,
dictName:"incCaDetailList"
},
{ label: "记账时间", name: "billingTime", isRenderFieName: true, },
{ label: "金额(元)", name: "amount", isRenderFieName: true, },
{ label: "贷款时间", name: "loanDate", isRenderFieName: "loansState" },
{ label: "贷款银行", name: "bank", isRenderFieName: "loansState" },
{ label: "贷款期限", name: "loanLimit", isRenderFieName: "loansState" },
{ label: "贷款月息", name: "loanInterest", isRenderFieName: "loansState" },
{ label: "借款来源", name: "borrowOrigin", isRenderFieName: "borrowState" },
{ label: "借款时间", name: "borrowDate", isRenderFieName: "borrowState" },
{ label: "借款用途", name: "borrowUse", isRenderFieName: "borrowState" },
{ label: "借款时长", name: "borrowLimit", isRenderFieName: "borrowState" },
{ label: "借款月息", name: "borrowInterest", isRenderFieName: "borrowState" },
{ label: "还款来源", name: "repaymentOrigin", isRenderFieName: "borrowState" },
{ label: "保险公司", name: "insuranceCompany", isRenderFieName: "insuranceState" },
{ label: "保险品种", name: "insuranceItem", isRenderFieName: "insuranceState" },
{ label: "灾害原因", name: "disaster", isRenderFieName: "insuranceState" },
{ label: "其他收入", name: "otherIncome", isRenderFieName: "elseState" },
],
renderExpendItemFields: [
{
label: "记账分类",
name: "secondId",
secondName: "firstId",
isRenderFieName: true,
isDict: true,
dictName:"expCaDetailList"
},
{ label: "记账时间", name: "billingTime", isRenderFieName: true },
{ label: "金额(元)", name: "amount", isRenderFieName: true },
{ label: "流转面积", name: "area", isRenderFieName: "areaState" },
{ label: "借给谁", name: "borrow", isRenderFieName: "repaymentState" },
{
label: "还款对象",
name: "repayment",
isRenderFieName: "borrowState",
},
{
label: "还款时间",
name: "billingTime",
isRenderFieName: "borrowState",
},
{
label: "投保险种",
name: "insurance",
isRenderFieName: "insuranceState",
},
],
renderIncomeDetShow: [],
renderExpendDetShow: [],
expCaDetailList: [],
incCaDetailList: [],
}
},
methods: {
emitData(e, ownerVm){
this.$ownerInstance.callMethod('receiveRenderData',{
incomeItemFields: this.renderIncomeItemFields,
expendItemFields: this.renderExpendItemFields
})
},
showIncDetailList(e, ownerVm) {
const index = e.currentTarget.dataset.indexx;
const value = e.currentTarget.dataset.valuex;
this.incomeFieShowBySelId(value);
let detailsShow = [];
this.renderIncomeDetShow[index] = {
isShow:
this.renderIncomeDetShow[index] !== undefined &&
this.renderIncomeDetShow[index] !== null &&
this.renderIncomeDetShow[index].isShow !== undefined &&
this.renderIncomeDetShow[index].isShow !== null
? this.renderIncomeDetShow[index].isShow
: false
}
this.renderIncomeDetShow.forEach((renDlement,renIndex) => {
this.$set(this.renderIncomeDetShow, [renIndex], {
isShow:
this.renderIncomeDetShow[renIndex] === null ||
this.renderIncomeDetShow[renIndex] === undefined
? true
: this.renderIncomeDetShow[renIndex] ===this.renderIncomeDetShow[index] ? !this.renderIncomeDetShow[index].isShow :false,
});
});
detailsShow[index] = this.renderIncomeDetShow[index]
ownerVm.callMethod('recRenIncDetShow',detailsShow);
},
showExpDetailList(e, ownerVm) {
const index = e.currentTarget.dataset.indexx;
const value = e.currentTarget.dataset.valuex;
this.expendFieShowBySelId(value);
let detailsShow = []
this.renderExpendDetShow[index] = {
isShow:
this.renderExpendDetShow[index] !== undefined &&
this.renderExpendDetShow[index] !== null &&
this.renderExpendDetShow[index].isShow !== undefined &&
this.renderExpendDetShow[index].isShow !== null
? this.renderExpendDetShow[index].isShow
: false
}
this.renderExpendDetShow.forEach((renDlement,renIndex) => {
this.$set(this.renderExpendDetShow, [renIndex], {
isShow:
this.renderExpendDetShow[renIndex] === null ||
this.renderExpendDetShow[renIndex] === undefined
? true
: this.renderExpendDetShow[renIndex] ===this.renderExpendDetShow[index] ? !this.renderExpendDetShow[index].isShow :false,
});
});
detailsShow[index] = this.renderExpendDetShow[index]
ownerVm.callMethod('recRenExpDetShow',detailsShow);
},
incomeFieShowBySelId(value) {
const that = this;
var loans = /贷款/;
var borrow = /借款/;
var insurance = /保险/;
if (loans.test(that.incCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenIncFieShow', {
loansState: true,
borrowState: false,
insuranceState: false,
elseState: false,
})
} else if (borrow.test(that.incCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenIncFieShow', {
loansState: false,
borrowState: true,
insuranceState: false,
elseState: false,
})
} else if (insurance.test(that.incCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenIncFieShow', {
loansState: false,
borrowState: false,
insuranceState: true,
elseState: false,
})
} else {
this.$ownerInstance.callMethod('recRenIncFieShow', {
loansState: false,
borrowState: false,
insuranceState: false,
elseState: true,
})
}
},
expendFieShowBySelId(value) {
const that = this;
var area = /银行/;
var repayment = /还款/;
var borrow = /借/;
var insurance = /保险/;
if (area.test(that.expCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenExpFieShow', {
areaState: true,
repaymentState: false,
borrowState: false,
insuranceState: false,
})
} else if (repayment.test(that.expCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenExpFieShow', {
areaState: false,
repaymentState: true,
borrowState: false,
insuranceState: false,
})
} else if (borrow.test(that.expCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenExpFieShow', {
areaState: false,
repaymentState: false,
borrowState: true,
insuranceState: false,
})
} else if (insurance.test(that.expCaDetailList[value].name)) {
this.$ownerInstance.callMethod('recRenExpFieShow', {
areaState: false,
repaymentState: false,
borrowState: false,
insuranceState: true,
})
} else {
this.$ownerInstance.callMethod('recRenExpFieShow', {
areaState: false,
repaymentState: false,
borrowState: false,
insuranceState: false,
})
}
},
getExpCateLists() {
let emitTLogic = [];
listExpendCategory({ status: 0 }).then((res) => {
res.data.forEach((element) => {
this.$set(this.expCaDetailList, [element.id], element);
emitTLogic.push({
text: element.name,
value: element.id
})
});
this.$ownerInstance.callMethod('recRenDictExpCate', this.expCaDetailList)
});
},
getIncCateLists() {
listIncomeCategory({ status: 0 }).then((res) => {
res.data.forEach((element) => {
this.$set(this.incCaDetailList, [element.id], element);
});
this.$ownerInstance.callMethod('recRenDictIncCate', this.incCaDetailList)
});
},
},
mounted() {
},
// 页面周期函数--监听页面显示(not-nvue)
onShow() {
this.emitData()
this.getExpCateLists()
this.getIncCateLists()
},
}
</script>