| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146 |
- <template>
- <div>
- <!-- 搜索 -->
- <el-row class="top">
- <el-form
- v-model="queryFrom"
- size="small"
- label-width="95px"
- class="query-form"
- >
- <el-form-item label="转账状态" label-width="95px" prop="transferFlag">
- <el-select
- v-model="queryFrom.transferFlag"
- placeholder="请选择转账状态"
- clearable
- >
- <el-option label="已转账" value="0"></el-option>
- <el-option label="未转账" value="1"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="账户性质" label-width="95px" prop="accountQuality">
- <el-select
- v-model="queryFrom.accountQuality"
- placeholder="请选择账户性质"
- clearable
- >
- <el-option
- v-for="item in account_qualityData"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="申请人" label-width="95px" prop="applicant">
- <el-input
- v-model="queryFrom.applicant"
- placeholder="请输入申请人"
- class="widths"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item label="申请部门" label-width="95px" prop="applySector">
- <el-input
- v-model="queryFrom.applySector"
- placeholder="请输入申请部门"
- class="widths"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item label="申请日期" label-width="95px" prop="applyTime">
- <el-date-picker
- v-model="queryFrom.applyTime"
- type="date"
- placeholder="选择日期"
- >
- </el-date-picker>
- <!-- <el-input
- v-model="queryFrom.applyTime"
- placeholder="请输入申请部门"
- class="widths"
- clearable
- ></el-input> -->
- </el-form-item>
- <el-form-item>
- <el-button type="primary" size="small" @click="queryStaffInfo"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- </el-row>
- <!-- 申请按钮 -->
- <el-button
- class="operation"
- type="primary"
- plain
- size="medium"
- @click="showExpense"
- >资金使用申请单</el-button
- >
- <!-- 表格 -->
- <kt-common-table
- :operationWidth="operationWidth"
- class="ktTable"
- permsEdit="sys:agent:view"
- ref="dataTable"
- :data="pageResult"
- :columns="columns"
- editButtonName="编辑"
- button1Name="删除"
- :showBatchDelete="false"
- :showOperation="true"
- @findPage="findPage"
- :isshowpagination="true"
- @handleEdit="expendEdit"
- @handleButton1="expendDelete"
- ></kt-common-table>
- <!-- 申请资金弹框 -->
- <el-dialog
- class="dialog"
- :title="expendTitle"
- :close-on-click-modal="false"
- :before-close="resetForm"
- :visible.sync="expenseDialog"
- width="60%"
- >
- <div class="dialog-body">
- <el-form
- :model="tableForm"
- ref="tableForm"
- label-width="0px"
- class="demo-tableForm"
- >
- <el-row>
- <el-col :span="12">
- <el-form-item
- label="单位:"
- label-width="50px"
- prop="accountQuality"
- >
- <el-select
- v-model="tableForm.company"
- filterable
- placeholder="单位"
- >
- <el-option
- v-for="item in collectionData"
- :key="item.accountId"
- :label="item.name"
- :value="item.accountId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col style="display: flex; justify-content: end" :span="12">
- <el-button type="primary" @click="addUserFn" size="small"
- >新增账户信息</el-button
- >
- </el-col>
- </el-row>
- <table
- class="expense-table"
- width="100%"
- height="500"
- border="1"
- bordercolor="#71787f"
- align="center"
- cellspacing=""
- cellpadding="10"
- style="border-collapse: collapse"
- >
- <tr>
- <td class="td-title" colspan="1">申请人</td>
- <td class="td-content" colspan="1">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.applicant"
- ></el-input>
- </td>
- <td class="td-title" colspan="1">申请部门</td>
- <td class="td-content" colspan="1">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.applySector"
- ></el-input>
- </td>
- <td class="td-title" colspan="1">申请日期</td>
- <td class="td-content" colspan="1">
- <el-date-picker
- v-model="tableForm.applyTime"
- align="right"
- type="date"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptions"
- >
- </el-date-picker>
- </td>
- </tr>
- <tr>
- <td class="td-title" colspan="1">收款单位信息</td>
- <td class="td-content" colspan="5">
- <el-select
- v-model="tableForm.collectionMessage"
- filterable
- placeholder=""
- >
- <el-option
- v-for="item in collectionData"
- :key="item.accountId"
- :label="item.name"
- :value="item.accountId"
- >
- </el-option>
- </el-select>
- </td>
- </tr>
- <tr>
- <td class="td-title" colspan="1">资金流程</td>
- <td class="td-content" colspan="5">
- <div style="display: flex; align-items: center">
- <el-select
- v-model="tableForm.company"
- filterable
- disabled
- placeholder=""
- >
- <el-option
- v-for="item in collectionData"
- :key="item.accountId"
- :label="item.name"
- :value="item.accountId"
- >
- </el-option>
- </el-select>
- <i class="el-icon-right"></i>
- <el-select
- v-model="tableForm.collectionMessage"
- filterable
- disabled
- placeholder=""
- >
- <el-option
- v-for="item in collectionData"
- :key="item.accountId"
- :label="item.name"
- :value="item.accountId"
- >
- </el-option>
- </el-select>
- </div>
- </td>
- </tr>
- <tr>
- <td class="td-title" colspan="1">资金用途</td>
- <td class="td-content" colspan="3">
- <el-cascader
- v-model="tableForm.fundUse"
- :show-all-levels="false"
- :clearable="true"
- :checkStrictly="true"
- :emitPath="false"
- placeholder=""
- :options="fundFlowData"
- filterable
- :props="{
- children: 'child',
- label: 'category',
- value: 'category',
- }"
- ></el-cascader>
- </td>
- <td class="td-title" colspan="1">备注</td>
- <td class="td-content" colspan="1">
- <el-select v-model="tableForm.remark" placeholder="">
- <el-option
- v-for="item in use_fundsData"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </td>
- </tr>
- <tr>
- <td class="td-title" colspan="1">申请金额(元)</td>
- <td class="td-content" colspan="2">
- <el-input-number
- v-model="tableForm.applyAmount"
- :min="0"
- :precision="2"
- @blur="chageAppl"
- :max="99999999999999999"
- label=""
- ></el-input-number>
- </td>
- <td class="td-title" colspan="1">大写金额</td>
- <td class="td-content idea-box" colspan="2">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.bigApplyAmount"
- disabled
- ></el-input>
- </td>
- </tr>
- <tr>
- <td class="td-title" colspan="1">支付方式</td>
- <td class="td-content" colspan="5">
- <el-checkbox-group v-model="tableForm.payMethod">
- <el-checkbox
- v-for="payItem in payment_methodsData"
- :key="payItem.value"
- :label="payItem.label"
- :value="payItem.value"
- :disabled="payItem.value == 2"
- ></el-checkbox>
- </el-checkbox-group>
- </td>
- </tr>
- <tr>
- <td class="td-title" rowspan="2" colspan="1">审核意见</td>
- <td class="td-title" colspan="2">公司领导</td>
- <td class="td-title" colspan="1">财务部</td>
- <td class="td-title" colspan="2">部门领导</td>
- </tr>
- <tr class="idea-box">
- <td class="td-content" colspan="2">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.desc"
- disabled
- ></el-input>
- </td>
- <td class="td-content" colspan="1">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.desc"
- disabled
- ></el-input>
- </td>
- <td class="td-content" colspan="2">
- <el-input
- type="text"
- resize="none"
- v-model="tableForm.desc"
- disabled
- ></el-input>
- </td>
- </tr>
- </table>
- </el-form>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="resetForm" size="small">取 消</el-button>
- <el-button type="primary" @click="submitForm" size="small">{{
- buttonValue
- }}</el-button>
- </div>
- </el-dialog>
- <!-- 新增账户弹框 -->
- <expense-component
- ref="expenseComponent"
- :formData="formData"
- :title="title"
- :dialogFormVisible="dialogFormVisible"
- @resetForm="closeForm"
- @submitForm="submitUserForm"
- @setDateInterval="setDateInterval"
- @outChange="outChange"
- class="expense-component"
- ></expense-component>
- </div>
- </template>
- <script>
- import ExpenseComponent from "./ExpenseComponent.vue"; //新增账户信息弹框
- import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
- export default {
- name: "ExpenseApplyFor",
- components: { KtCommonTable, ExpenseComponent },
- data() {
- return {
- expendTitle: "新增资金使用申请单", //弹框标题
- operationWidth: 200, //操作单元格宽度
- queryFrom: {}, //查询form表单
- pageRequest: {
- // 列表查询条件
- pageNo: 1,
- pageSize: 10,
- },
- dialogFormVisible: false, //账户信息弹出框状态
- title: "新增账户信息", //账户信息弹框标题
- expenseDialog: false, //申请单显示状态
- pageResult: {
- pageNo: 1,
- pageSize: 10,
- content: [],
- }, //表格参数
- columns: [
- // 申请列表表格头部
- {
- prop: "transferFlagName",
- label: "转账状态",
- minWidth: 80,
- sortable: false,
- },
- {
- prop: "applicant",
- label: "申请人",
- minWidth: 80,
- sortable: false,
- },
- {
- prop: "applySector",
- label: "申请部门",
- minWidth: 100,
- sortable: false,
- },
- {
- prop: "applyTime",
- label: "申请日期",
- minWidth: 100,
- sortable: false,
- },
- {
- prop: "applyAmount",
- label: "申请金额(元)",
- minWidth: 120,
- sortable: false,
- },
- {
- prop: "bigApplyAmount",
- label: "大写金额",
- minWidth: 150,
- sortable: false,
- },
- {
- prop: "company",
- label: "单位",
- minWidth: 260,
- sortable: false,
- },
- {
- prop: "collectionMessage",
- label: "收款单位信息",
- minWidth: 260,
- sortable: false,
- },
- {
- prop: "fundFlow",
- label: "资金流程",
- minWidth: 460,
- sortable: false,
- },
- {
- prop: "fundUse",
- label: "资金用途",
- minWidth: 100,
- sortable: false,
- },
- {
- prop: "remark",
- label: "备注",
- minWidth: 100,
- sortable: false,
- },
- {
- prop: "payMethod",
- label: "支付方式",
- minWidth: 160,
- sortable: false,
- },
- ],
- formData: {
- outerFlag: "0", //账户类别
- accountName: "", //户名
- accountQuality: "", //账户性质
- bankCardNum: "", //银行卡号
- bank: "", //开户行
- bankName: "", //开户行名称
- bankNum: "", //开户行号
- certExpirationDate: "", //证书有效期
- clearingProfit: "", //结算卡
- dayStrokeNum: "", //单日转账笔数限制
- exteriorProfit: "", //外部过账金额
- fiscalProfit: "", //财税公司利润
- insuranceProfit: "", //保险公司回款
- otherProfit: "", //其他利润
- parkProfit: "", //园区利润
- priDayLines: "", //对私单日限额
- priSingleLines: "", //对私单笔限额
- priYearExcess: "", //对私年剩余额度
- priYearLines: "", //对私年额度
- pubDayLines: "", //对公单日限额
- pubSingleLines: "", //对公单笔限额
- pubYearExcess: "", //对公年剩余额度
- pubYearLines: "", //对公年额度
- tianqinProfit: "", //天勤利润
- },
- pickerOptions: {
- //日期快捷键
- disabledDate(time) {
- return time.getTime() > Date.now();
- },
- shortcuts: [
- {
- text: "今天",
- onClick(picker) {
- picker.$emit("pick", new Date());
- },
- },
- {
- text: "昨天",
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24);
- picker.$emit("pick", date);
- },
- },
- {
- text: "一周前",
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit("pick", date);
- },
- },
- ],
- },
- //新增申请表单form表单
- tableForm: {
- company: "", //单位
- applicant: "", //申请人
- applySector: "", //申请部门
- applyTime: "", //申请日期
- collectionMessage: "", //收款单位信息
- fundFlow: "", //资金流程
- fundUse: "", //资金用途
- remark: "", //备注
- applyAmount: "", //申请金额
- bigApplyAmount: "", //大写金额
- payMethod: [], //支付方式
- remark: "", //备注
- },
- payment_methodsData: [], //支付方式字典数据
- use_fundsData: [], //备注字典数据
- collectionData: [], //收款单位信息数据
- account_qualityData: [], //账户性质字典
- fundFlowData: [], //资金用途字典数据
- tableRules: {
- //资金申请单规则
- name: [
- { required: true, message: "请输入活动名称", trigger: "blur" },
- { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
- ],
- region: [
- { required: true, message: "请选择活动区域", trigger: "change" },
- ],
- date1: [
- {
- type: "date",
- required: true,
- message: "请选择日期",
- trigger: "change",
- },
- ],
- date2: [
- {
- type: "date",
- required: true,
- message: "请选择时间",
- trigger: "change",
- },
- ],
- type: [
- {
- type: "array",
- required: true,
- message: "请至少选择一个活动性质",
- trigger: "change",
- },
- ],
- resource: [
- { required: true, message: "请选择活动资源", trigger: "change" },
- ],
- desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
- },
- companyItem: {}, //选择单位整条数据
- collectionMessageItem: {}, //选择收款单位整条数据
- expendDataId: "", //修改时该条数据id
- buttonValue: "导 出", //弹框提交按钮内容
- };
- },
- watch: {
- expenseDialog(n) {
- if (!n) {
- this.tableForm = {
- company: "", //单位
- applicant: "", //申请人
- applySector: "", //申请部门
- applyTime: "", //申请日期
- collectionMessage: "", //收款单位信息
- fundFlow: "", //资金流程
- fundUse: "", //资金用途
- remark: "", //备注
- applyAmount: "", //申请金额
- bigApplyAmount: "", //大写金额
- payMethod: [], //支付方式
- remark: "", //备注
- };
- this.tableForm.payMethod = [
- this.payment_methodsData.find((item) => item.value == 2).label,
- ];
- this.expendDataId = "";
- }
- },
- },
- created() {
- this.business("use_funds"); //备注字典
- this.business("payment_methods"); //支付方式字典
- this.business("account_quality"); //账户性质字典
- this.getTreeList(); //获取资金用途树字典
- this.getAllUser(); //获取所有银行账户信息
- },
- mounted() {},
- methods: {
- //点击编辑按钮
- expendEdit(index) {
- let row = index.row;
- if (row.transferFlag == 0) {
- this.$message.error("已转账数据不能操作");
- return;
- }
- this.expendDataId = row.excelAccountOperateId;
- this.$api.expense
- .getAccountExcelById(row.excelAccountOperateId)
- .then((res) => {
- if (res.code == 200) {
- this.tableForm = JSON.parse(JSON.stringify(res.data));
- this.tableForm.payMethod = this.tableForm.payMethod.split(",");
- this.tableForm.collectionMessage = res.data.enterAccountId;
- this.tableForm.company = res.data.outAccountId;
- let obj = this.fundFlowData.find(item=>item.child.find(chidlItem=>chidlItem.category == this.tableForm.fundUse));
- this.tableForm.fundUse = [obj.category,obj.child.find(item=>item.category==this.tableForm.fundUse).category]
- let arr = [];
- this.tableForm.payMethod.forEach((items) => {
- arr.push(
- this.payment_methodsData.find((item) => item.value == items)
- .label
- );
- });
- this.tableForm.payMethod = arr;
- } else {
- this.$message.error(res.msg);
- }
- });
- this.expendTitle = "编辑资金使用申请单";
- this.buttonValue = "确认提交";
- this.expenseDialog = true;
- },
- //删除数据事件
- expendDelete(index) {
- let row = index.row;
- if (row.transferFlag == 0) {
- this.$message.error("已转账数据不能操作");
- return;
- }
- this.$confirm("确认删除该条数据吗?", "提示", {
- type: "warning",
- })
- .then(() => {
- this.$api.expense
- .deleteAccountExcel(index.row.excelAccountOperateId)
- .then((res) => {
- if (res.code == 200) {
- this.$message.success("删除成功");
- this.findPage();
- } else {
- this.$message.error(res.msg);
- }
- });
- })
- .catch(() => {});
- },
- //获取资金用途树数据
- getTreeList() {
- this.$api.expense.getAccountExpensesTreeList().then((res) => {
- let arr = res.data;
- res.data.forEach((item) => {
- item.child.forEach((childItem) => {
- delete childItem.child;
- });
- });
- this.fundFlowData = res.data;
- });
- },
- //搜索列表功能
- queryStaffInfo() {
- this.findPage();
- },
- //查询列表
- findPage(data) {
- if (data && data.pageRequest) {
- this.pageRequest.pageNo = data.pageRequest.pageNum;
- this.pageRequest.pageSize = data.pageRequest.pageSize;
- }
- let obj = { ...this.queryFrom, ...this.pageRequest };
- this.$api.expense
- .getAccountExcel(obj)
- .then((res) => {
- res.data.records.forEach((element) => {
- element.transferFlagName =
- element.transferFlag == 0 ? "已转账" : "未转账";
- this.use_fundsData.forEach((item) => {
- if (element.remark == item.value) {
- element.remarkName = item.label;
- }
- });
- });
- this.pageResult = {
- content: res.data.records,
- pageNum: res.data.current,
- pageSize: res.data.size,
- totalPages: res.data.pages,
- totalSize: res.data.total,
- };
- })
- .then(data != null ? data.callback : "");
- },
- //选择证书有效日期区间
- setDateInterval(e) {
- if (e != null && e != "") {
- this.formData.startCertExpirationDate = e[0];
- this.formData.endCertExpirationDate = e[1];
- } else {
- this.formData.startCertExpirationDate = "";
- this.formData.endCertExpirationDate = "";
- }
- },
- //新增用户信息提交
- submitUserForm() {
- let params = JSON.parse(JSON.stringify(this.formData));
- delete params.certExpirationDate;
- //新增
- this.$api.expense.insertAccount(params).then((res) => {
- if (res.code == 200) {
- this.$message({
- message: "添加成功",
- type: "success",
- });
- } else {
- this.$message({
- message: `添加失败, ${res.msg}`,
- type: "error",
- });
- }
- this.getAllUser();
- this.closeForm();
- });
- },
- //弹框重新赋值
- outChange(e) {
- if (e == 1) {
- this.formData = {
- outerFlag: e, //账户类别
- accountName: this.formData.accountName, //户名
- accountQuality: this.formData.accountQuality, //账户性质
- bankCardNum: this.formData.bankCardNum, //银行卡号
- bank: this.formData.bank, //开户行
- };
- } else {
- this.formData = {
- outerFlag: e, //账户类别
- accountName: this.formData.accountName, //户名
- accountQuality: this.formData.accountQuality, //账户性质
- bankCardNum: this.formData.bankCardNum, //银行卡号
- bank: this.formData.bank, //开户行
- bankName: "", //开户行名称
- bankNum: "", //开户行号
- certExpirationDate: "", //证书有效期
- clearingProfit: "", //结算卡
- dayStrokeNum: "", //单日转账笔数限制
- exteriorProfit: "", //外部过账金额
- fiscalProfit: "", //财税公司利润
- insuranceProfit: "", //保险公司回款
- otherProfit: "", //其他利润
- parkProfit: "", //园区利润
- priDayLines: "", //对私单日限额
- priSingleLines: "", //对私单笔限额
- priYearExcess: "", //对私年剩余额度
- priYearLines: "", //对私年额度
- pubDayLines: "", //对公单日限额
- pubSingleLines: "", //对公单笔限额
- pubYearExcess: "", //对公年剩余额度
- pubYearLines: "", //对公年额度
- tianqinProfit: "", //天勤利润
- };
- }
- },
- //弹框取消重置
- closeForm() {
- this.dialogFormVisible = false;
- this.formData = {
- outerFlag: "0", //账户类别
- accountName: "", //户名
- accountQuality: "", //账户性质
- bankCardNum: "", //银行卡号
- bank: "", //开户行
- bankName: "", //开户行名称
- bankNum: "", //开户行号
- certExpirationDate: "", //证书有效期
- clearingProfit: "", //结算卡
- dayStrokeNum: "", //单日转账笔数限制
- exteriorProfit: "", //外部过账金额
- fiscalProfit: "", //财税公司利润
- insuranceProfit: "", //保险公司回款
- otherProfit: "", //其他利润
- parkProfit: "", //园区利润
- priDayLines: "", //对私单日限额
- priSingleLines: "", //对私单笔限额
- priYearExcess: "", //对私年剩余额度
- priYearLines: "", //对私年额度
- pubDayLines: "", //对公单日限额
- pubSingleLines: "", //对公单笔限额
- pubYearExcess: "", //对公年剩余额度
- pubYearLines: "", //对公年额度
- tianqinProfit: "", //天勤利润
- };
- },
- //新增账户信息
- addUserFn() {
- this.dialogFormVisible = true;
- },
- //选择收款单位信息事件
- collectionChange(e) {
- if (e.length > 0) {
- let obj = this.collectionData
- .find((item) => item.accountId == e[0])
- .children.find((item) => item.accountId == e[1]);
- }
- },
- //获取所有账户信息
- getAllUser() {
- this.$api.expense.getAccountByAccountName().then((res) => {
- if (res.code == 200) {
- res.data.forEach((item, index) => {
- item.name =
- (item.outerFlag == 0 ? "内部用户" : "外部用户") +
- " " +
- (item.accountQuality == 0 ? "公户" : "私户") +
- " " +
- item.accountName +
- " " +
- item.bankCardNum +
- " " +
- item.bank;
- item.nameValue =
- item.accountName + " " + item.bankCardNum + " " + item.bank;
- });
- this.collectionData = res.data;
- }
- });
- },
- //申请金额填写完成后
- chageAppl(e) {
- this.tableForm.bigApplyAmount = this.toChies(this.tableForm.applyAmount);
- },
- //数据字典
- business(typeName) {
- this.$api.dict.findByLableName(typeName).then((res) => {
- this[typeName + "Data"] = res.data;
- if (typeName == "payment_methods") {
- this.tableForm.payMethod = [
- this[typeName + "Data"].find((item) => item.value == 2).label,
- ];
- }
- });
- },
- //费用申请弹框
- showExpense() {
- this.expendTitle = "新增资金使用申请单";
- this.buttonValue = "导 出";
- this.expenseDialog = true;
- },
- //取消隐藏弹框
- resetForm() {
- this.expenseDialog = false;
- },
- //导出事件
- submitForm() {
- let params = JSON.parse(JSON.stringify(this.tableForm));
- //校验
- if (!params.company) {
- this.$message.error("请选择单位");
- return;
- } else if (!params.applicant) {
- this.$message.error("申请人不能为空");
- return;
- } else if (!params.applySector) {
- this.$message.error("申请部门不能为空");
- return;
- } else if (!params.applyTime) {
- this.$message.error("请填写申请日期");
- return;
- } else if (!params.collectionMessage) {
- this.$message.error("请选择收款单位信息");
- return;
- } else if (!params.fundUse) {
- this.$message.error("请选择资金用途");
- return;
- } else if (params.applyAmount == 0) {
- this.$message.error("请填写金额");
- return;
- }
- params.payMethod = this.toPayment(params.payMethod); //支付方式转换
- let companyItem = this.collectionData.find(
- (item) => item.accountId === params.company
- );
- let collectionMessageItem = this.collectionData.find(
- (item) => item.accountId === params.collectionMessage
- );
- params.company = companyItem.nameValue; //单位
- params.outAccountId = companyItem.accountId; //支出账户id
- params.outFlag = collectionMessageItem.outerFlag; //支出账户性质
- params.collectionMessage = collectionMessageItem.nameValue; //收入账户信息
- params.enterAccountId = collectionMessageItem.accountId; //收入账户id
- params.fundUse = params.fundUse[params.fundUse.length - 1]; //资金用途
- params.fundFlow = params.company + "→" + params.collectionMessage; //资金流程
- if (this.expendDataId) {
- //修改
- params.expendDataId = this.expendDataId;
- this.$api.expense.update(params).then((res) => {
- if (res.code == 200) {
- this.resetForm();
- this.findPage();
- } else {
- this.$message.error(res.msg);
- }
- });
- } else {
- //新增+导出
- this.$api.expense.insert(params).then((res) => {
- if (res.code == 200) {
- this.$api.expense.excel([res.data]).then((response) => {
- if (response.code == 200) {
- response.data.forEach((data) => {
- this.resetForm();
- this.findPage();
- let url = process.env.BASE_URL + "/upload/" + data.uplodePath; // 3.创建一个临时的url指向blob对象
- // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
- let a = document.createElement("a");
- a.href = url;
- a.download = "资金使用申请单.xlsx";
- a.click();
- // 5.释放这个临时的对象url
- window.URL.revokeObjectURL(url);
- });
- } else {
- this.$message.error(res.msg);
- }
- });
- } else {
- this.$message.error(res.msg);
- }
- });
- }
- },
- //支付方式转换
- toPayment(list) {
- let newList = [];
- list.forEach((item) => {
- newList.push(
- this.payment_methodsData.find((payItem) => payItem.label == item)
- .value
- );
- });
- newList.sort();
- newList = newList.join(",");
- return newList;
- },
- //小写转大写金额
- toChies(amount) {
- // 汉字的数字
- const cnNums = [
- "零",
- "壹",
- "贰",
- "叁",
- "肆",
- "伍",
- "陆",
- "柒",
- "捌",
- "玖",
- ];
- // 基本单位
- const cnIntRadice = ["", "拾", "佰", "仟"];
- // 对应整数部分扩展单位
- const cnIntUnits = ["", "万", "亿", "兆"];
- // 对应小数部分单位
- const cnDecUnits = ["角", "分"];
- // 整数金额时后面跟的字符
- const cnInteger = "整";
- // 整型完以后的单位
- const cnIntLast = "元";
- // 最大处理的数字
- const maxNum = 9999999999999999.99;
- // 金额整数部分
- let integerNum;
- // 金额小数部分
- let decimalNum;
- // 输出的中文金额字符串
- let chineseStr = "";
- // 分离金额后用的数组,预定义
- let parts;
- if (amount === "") {
- return "";
- }
- amount = parseFloat(amount);
- if (amount >= maxNum) {
- // 超出最大处理数字
- return "";
- }
- if (amount === 0) {
- chineseStr = cnNums[0] + cnIntLast + cnInteger;
- return chineseStr;
- }
- // 转换为字符串
- amount = amount.toString();
- if (amount.indexOf(".") === -1) {
- integerNum = amount;
- decimalNum = "";
- } else {
- parts = amount.split(".");
- integerNum = parts[0];
- decimalNum = parts[1].substr(0, 4);
- }
- // 获取整型部分转换
- if (parseInt(integerNum, 10) > 0) {
- let zeroCount = 0;
- const IntLen = integerNum.length;
- for (let i = 0; i < IntLen; i++) {
- const n = integerNum.substr(i, 1);
- const p = IntLen - i - 1;
- const q = p / 4;
- const m = p % 4;
- if (n === "0") {
- zeroCount++;
- } else {
- if (zeroCount > 0) {
- chineseStr += cnNums[0];
- }
- // 归零
- zeroCount = 0;
- //alert(cnNums[parseInt(n)])
- chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
- }
- if (m === 0 && zeroCount < 4) {
- chineseStr += cnIntUnits[q];
- }
- }
- chineseStr += cnIntLast;
- }
- // 小数部分
- if (decimalNum !== "") {
- const decLen = decimalNum.length;
- for (let i = 0; i < decLen; i++) {
- const n = decimalNum.substr(i, 1);
- if (n !== "0") {
- chineseStr += cnNums[Number(n)] + cnDecUnits[i];
- }
- }
- }
- if (chineseStr === "") {
- chineseStr += cnNums[0] + cnIntLast + cnInteger;
- } else if (decimalNum === "") {
- chineseStr += cnInteger;
- }
- return chineseStr;
- },
- },
- };
- </script>
- <style scoped>
- .query-form {
- display: flex;
- align-items: center;
- margin-top: 14px;
- }
- .td-title,
- .demo-tableForm >>> .el-form-item__label {
- color: #323335;
- font-weight: bold;
- text-align: center;
- }
- .td-content,
- .demo-tableForm >>> .el-input.is-disabled .el-input__inner {
- color: #474545;
- }
- .expense-table >>> .el-textarea__inner,
- .expense-table >>> .el-input__inner {
- border: none;
- padding: 0;
- text-align: center;
- }
- .expense-table >>> .el-form-item {
- margin: 0;
- padding: 0;
- }
- .expense-table >>> .el-checkbox-group,
- .expense-table >>> .el-date-editor,
- .expense-table >>> .el-select,
- .expense-table >>> .el-input-number,
- .expense-table >>> .el-cascader,
- .demo-tableForm >>> .el-select {
- width: 100%;
- text-align: center;
- }
- .demo-tableForm >>> .el-input__inner {
- border: none;
- }
- .demo-tableForm >>> .el-input__prefix,
- .demo-tableForm >>> .el-select__caret {
- display: none;
- }
- .idea-box >>> .el-input.is-disabled .el-input__inner,
- .expense-table >>> .el-input.is-disabled .el-input__inner {
- background-color: #fff;
- }
- .demo-tableForm >>> .el-input-number__decrease,
- .demo-tableForm >>> .el-input-number__increase {
- display: none;
- }
- .demo-tableForm >>> .el-checkbox__input.is-disabled + span.el-checkbox__label {
- color: #409eff;
- }
- .demo-tableForm
- >>> .el-checkbox__input.is-disabled.is-checked
- .el-checkbox__inner {
- background-color: #409eff;
- border-color: #409eff;
- color: #fff;
- }
- .demo-tableForm
- >>> .el-checkbox__input.is-disabled.is-checked
- .el-checkbox__inner::after {
- border-color: #fff;
- }
- .demo-tableForm >>> .el-input__suffix {
- display: none;
- }
- .el-icon-right {
- font-size: 20px;
- }
- .operation {
- margin-bottom: 15px;
- }
- </style>
|