|
@@ -0,0 +1,356 @@
|
|
|
+<template>
|
|
|
+ <basic-container v-if="show">
|
|
|
+ <avue-crud :option="option"
|
|
|
+ :data="dataList"
|
|
|
+ ref="crud"
|
|
|
+ v-model="form"
|
|
|
+ :page.sync="page"
|
|
|
+ :search.sync="search"
|
|
|
+ :table-loading="loading"
|
|
|
+ :cell-style="cellStyle"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @saveColumn="saveColumn"
|
|
|
+ @resetColumn="resetColumn"
|
|
|
+ @on-load="onLoad"
|
|
|
+ @search-criteria-switch="searchCriteriaSwitch"
|
|
|
+ @row-save="rowSave" @row-update="rowUpdate">
|
|
|
+ <template slot-scope="{type,size,row,$index}" slot="menuLeft">
|
|
|
+ <el-button class="el-icon-document-copy" type="danger" size="small"
|
|
|
+ :disabled="!(SelectedData.length>0 && !Selectedtype)" @click="BatchDeletefun">
|
|
|
+ 批量删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="menu">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ :disabled="scope.row.synchronous == 1"
|
|
|
+ @click.stop="editBtnfun(scope.row,scope.index)"
|
|
|
+ >编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.synchronous != 1"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click.stop="corpscechargerecordSynchronousfun(scope.row,1)"
|
|
|
+ >提交
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-else
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ style="color: #f6760a"
|
|
|
+ @click.stop="corpscechargerecordSynchronousfun(scope.row,2)"
|
|
|
+ >撤销
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ :disabled="scope.row.synchronous == 1"
|
|
|
+ @click.stop="rowDel(scope.row.id, scope.index)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ </basic-container>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import option from "./configuration/mainList.json";
|
|
|
+import {
|
|
|
+ corpscechargerecordList,
|
|
|
+ corpscechargerecordSubmit,
|
|
|
+ corpscechargerecordRemove, corpscechargerecordSynchronous
|
|
|
+} from "@/api/financialManagement/financialManagement"
|
|
|
+
|
|
|
+
|
|
|
+import {getToken} from "@/util/auth";
|
|
|
+import {allCropList} from "@/api/basicData/customerInformation";
|
|
|
+import fa from "element-ui/src/locale/lang/fa";
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 客户的数据
|
|
|
+ corpData:[],
|
|
|
+ // 转圈加载动画
|
|
|
+ loading : false,
|
|
|
+ // 双向绑定的值
|
|
|
+ form: {},
|
|
|
+ // 表单搜索的变量对象
|
|
|
+ search:{},
|
|
|
+ // 表格的配置
|
|
|
+ option: option,
|
|
|
+ // 详情组件的隐藏和显示
|
|
|
+ show:true,
|
|
|
+ // 表格的数据
|
|
|
+ dataList: [{
|
|
|
+ canem:""
|
|
|
+ }],
|
|
|
+ // 页码
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ pagerCount: 5,
|
|
|
+ total: 0,
|
|
|
+ },
|
|
|
+ // 当前登陆用户信息
|
|
|
+ content:{},
|
|
|
+ // 当前选中的id
|
|
|
+ SelectedData:[],
|
|
|
+ // 判断当前选中的是不是可用点击的
|
|
|
+ Selectedtype:false,
|
|
|
+
|
|
|
+ query:{},
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components:{
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.allCropListfun()
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // 获取当前操作人的信息
|
|
|
+ this.content = JSON.parse(localStorage.getItem('saber-userInfo')).content
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取客户的数据
|
|
|
+ allCropListfun(){
|
|
|
+ allCropList({corpType:"KH"}).then(res=>{
|
|
|
+ this.corpData = res.data.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 当前内容发生变化时触发
|
|
|
+ rowUpdate(row,index,done,loading){
|
|
|
+ row.totalAmount = Number(row.realityAmount) + Number(row.giveAmount)
|
|
|
+ console.log(row,index,done,loading,163)
|
|
|
+ corpscechargerecordSubmit(row).then(res=>{
|
|
|
+ this.$message.success('编辑成功');
|
|
|
+ done()
|
|
|
+ this.onLoad(this.page)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 编辑事件
|
|
|
+ editBtnfun(row,index){
|
|
|
+ this.$refs.crud.rowEdit(row,index)
|
|
|
+ },
|
|
|
+ // 提交和撤销接口
|
|
|
+ corpscechargerecordSynchronousfun(row,i){
|
|
|
+ if (row.totalAmount <= 0) return this.$message.success('充值金额为零不能进行撤销');
|
|
|
+ row.synchronous = i
|
|
|
+ corpscechargerecordSynchronous(row).then(res=>{
|
|
|
+ if (i == 1) {
|
|
|
+ this.$message.success('提交成功');
|
|
|
+ }else if (i == 2) {
|
|
|
+ this.$message.success('撤销成功');
|
|
|
+ }
|
|
|
+ this.onLoad(this.page)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 弹窗保存
|
|
|
+ rowSave(form,done,loading){
|
|
|
+ console.log(form,120)
|
|
|
+ let obj = {}
|
|
|
+ for(let item of this.corpData) {
|
|
|
+ if (item.id == form.corpId) {
|
|
|
+ obj.corpName = item.cname
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ obj.time = this.timeDetafun()
|
|
|
+ obj.operatorId = this.content.dept_id
|
|
|
+ obj.operatorName = this.content.account
|
|
|
+ obj.totalAmount = Number(form.realityAmount) + Number(form.giveAmount)
|
|
|
+ console.log({...form, ...obj},'143')
|
|
|
+ obj.synchronous = 0
|
|
|
+ corpscechargerecordSubmit({
|
|
|
+ ...form,
|
|
|
+ ...obj,
|
|
|
+ }).then(res=>{
|
|
|
+ console.log(res,127)
|
|
|
+ this.$message.success('添加成功');
|
|
|
+ done()
|
|
|
+ this.onLoad(this.page)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 初始化页面
|
|
|
+ onLoad(page, params) {
|
|
|
+ corpscechargerecordList({
|
|
|
+ currentPage:page.currentPage,
|
|
|
+ pageSize:page.pageSize,
|
|
|
+ ...params
|
|
|
+ }).then(res =>{
|
|
|
+ this.dataList = res.data.data.records
|
|
|
+ this.page.total = res.data.data.total
|
|
|
+ if (this.page.total) {
|
|
|
+ this.option.height = window.innerHeight - 240;
|
|
|
+ }
|
|
|
+ }).finally(()=>{
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ searchCriteriaSwitch(type){
|
|
|
+ if (type){
|
|
|
+ this.option.height = this.option.height - 90
|
|
|
+ }else {
|
|
|
+ this.option.height = this.option.height + 90
|
|
|
+ }
|
|
|
+ this.$refs.crud.getTableHeight()
|
|
|
+ },
|
|
|
+ // 批量删除
|
|
|
+ BatchDeletefun(){
|
|
|
+ let arrid = []
|
|
|
+ for(let item of this.SelectedData) {
|
|
|
+ if (item.synchronous != 1) {
|
|
|
+ arrid.push(item.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.rowDel(arrid.join())
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ rowDel(ids, index, done) {
|
|
|
+ if(ids){
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ corpscechargerecordRemove({ids:ids}).then(res =>{
|
|
|
+ if(res.data.success){
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.onLoad(this.page);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //点击搜索按钮触发
|
|
|
+ searchChange(params, done) {
|
|
|
+ this.query = params;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page, params);
|
|
|
+ done()
|
|
|
+ },
|
|
|
+ // 清空搜索回调方法
|
|
|
+ searchReset() {
|
|
|
+ console.log('清空搜索回调方法')
|
|
|
+ },
|
|
|
+ // 当选择项发生变化时会触发该事件
|
|
|
+ selectionChange(selection) {
|
|
|
+ console.log('当选择项发生变化时会触发该事件')
|
|
|
+ console.log(selection)
|
|
|
+ this.SelectedData = selection
|
|
|
+ this.Selectedtype = this.Selectedtypefun()
|
|
|
+ },
|
|
|
+ // 判断选中的状态能不能删除
|
|
|
+ Selectedtypefun(){
|
|
|
+ let type = false
|
|
|
+ for(let item of this.SelectedData) {
|
|
|
+ if (item.synchronous == 1) {
|
|
|
+ type = true
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return type
|
|
|
+ },
|
|
|
+ currentChange(val) {
|
|
|
+ this.page.currentPage = val
|
|
|
+ },
|
|
|
+ // 点击每页多少条
|
|
|
+ sizeChange() {
|
|
|
+ console.log('点击每页多少条')
|
|
|
+ },
|
|
|
+ // 点击刷新
|
|
|
+ refreshChange(params) {
|
|
|
+ this.onLoad(this.page,params)
|
|
|
+ },
|
|
|
+ // 获取当前的时间
|
|
|
+ timeDetafun(){
|
|
|
+ var today = new Date()
|
|
|
+ var year = today.getFullYear();
|
|
|
+ var month = String(today.getMonth() + 1).padStart(2, '0');
|
|
|
+ var day = String(today.getDate()).padStart(2, '0');
|
|
|
+ var hours = String(today.getHours()).padStart(2, '0');
|
|
|
+ var minutes = String(today.getMinutes()).padStart(2, '0');
|
|
|
+ var seconds = String(today.getSeconds()).padStart(2, '0');
|
|
|
+ // 构建今天的日期时间字符串
|
|
|
+ var todayDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
|
|
+ return todayDateTime
|
|
|
+ },
|
|
|
+
|
|
|
+ goBack() {
|
|
|
+ this.detailData=this.$options.data().detailData
|
|
|
+ this.show = true;
|
|
|
+ this.onLoad(this.page,this.search)
|
|
|
+ },
|
|
|
+ // 条纹样式
|
|
|
+ cellStyle() {
|
|
|
+ return "padding:0;height:40px;";
|
|
|
+ },
|
|
|
+ //列保存触发
|
|
|
+ async saveColumn() {
|
|
|
+ const inSave = await this.saveColumnData(
|
|
|
+ this.getColumnName(64),
|
|
|
+ this.option
|
|
|
+ );
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs.crud.$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重置列
|
|
|
+ async resetColumn() {
|
|
|
+ const inSave = await this.delColumnData(
|
|
|
+ this.getColumnName(64),
|
|
|
+ option
|
|
|
+ );
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("重置成功");
|
|
|
+ this.option = option;
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs.crud.$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 导出
|
|
|
+ openExport() {
|
|
|
+ let params = JSON.parse(JSON.stringify(this.search))
|
|
|
+ if (params.settlementDate && params.settlementDate.length !==0 ) { //合同
|
|
|
+ params.settlementStartDate = params.settlementDate[0]+ " " + "00:00:00";
|
|
|
+ params.settlementEndDate = params.settlementDate[1] + " " + "23:59:59";
|
|
|
+ this.$delete(params,'settlementDate')
|
|
|
+ }
|
|
|
+ if (params.completionTime && params.completionTime.length !==0 ) {
|
|
|
+ params.completionTimeStart = params.completionTime[0]+ " " + "00:00:00";
|
|
|
+ params.completionTimeEnd = params.completionTime[1] + " " + "23:59:59";
|
|
|
+ this.$delete(params,'completionTime')
|
|
|
+ }
|
|
|
+ params.billType = "收费"
|
|
|
+ params.settlementType = 1
|
|
|
+ const routeData = this.$router.resolve({
|
|
|
+ path: '/api/trade-finance/settlement/expenseExport', //跳转目标窗口的地址
|
|
|
+ query: {
|
|
|
+ ...params //括号内是要传递给新窗口的参数
|
|
|
+ }
|
|
|
+ })
|
|
|
+ window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|