Commit 836b1fa9 authored by 耿迪迪's avatar 耿迪迪
parents 6a992956 e038652e
...@@ -16,6 +16,7 @@ import com.zehong.system.service.ITTransactionProjectService; ...@@ -16,6 +16,7 @@ import com.zehong.system.service.ITTransactionProjectService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
...@@ -82,6 +83,23 @@ public class TTransactionProjectController extends BaseController ...@@ -82,6 +83,23 @@ public class TTransactionProjectController extends BaseController
return util.exportExcel(list, "交易项目数据"); return util.exportExcel(list, "交易项目数据");
} }
@Log(title = "交易项目维护", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<TTransactionProject> util = new ExcelUtil<TTransactionProject>(TTransactionProject.class);
List<TTransactionProject> transactionList = util.importExcel(file.getInputStream());
String message = tTransactionProjectService.importTransaction(transactionList, updateSupport);
return AjaxResult.success(message);
}
@GetMapping("/importTemplate")
public AjaxResult importTemplate()
{
ExcelUtil<TTransactionProject> util = new ExcelUtil<TTransactionProject>(TTransactionProject.class);
return util.importTemplateExcel("交易项目数据");
}
/** /**
* 获取交易项目详细信息 * 获取交易项目详细信息
*/ */
......
...@@ -32,7 +32,7 @@ public class TTransactionProject extends BaseEntity ...@@ -32,7 +32,7 @@ public class TTransactionProject extends BaseEntity
private String context; private String context;
/** 定价类型:1.单价 2.议价 */ /** 定价类型:1.单价 2.议价 */
@Excel(name = "定价类型:1.单价 2.议价") @Excel(name = "定价类型:1定价 2议价")
private String priceType; private String priceType;
/** 单价 */ /** 单价 */
...@@ -40,14 +40,13 @@ public class TTransactionProject extends BaseEntity ...@@ -40,14 +40,13 @@ public class TTransactionProject extends BaseEntity
private BigDecimal price; private BigDecimal price;
/** 部门 */ /** 部门 */
@Excel(name = "部门") @Excel(name = "部门:103泽宏云研发部,104泽宏云技术部,105泽宏云销售部,200核算部,201综合管理部,202销售服务部")
private Long deptId; private Long deptId;
/**部门名称*/ /**部门名称*/
private String deptName; private String deptName;
/** 是否删除:0否,1是 */ /** 是否删除:0否,1是 */
@Excel(name = "是否删除:0否,1是")
private String isDel; private String isDel;
public void setTransactionProjectId(Long transactionProjectId) public void setTransactionProjectId(Long transactionProjectId)
......
...@@ -19,6 +19,14 @@ public interface TTransactionProjectMapper ...@@ -19,6 +19,14 @@ public interface TTransactionProjectMapper
*/ */
public TTransactionProject selectTTransactionProjectById(Long transactionProjectId); public TTransactionProject selectTTransactionProjectById(Long transactionProjectId);
/**
* 查询交易项目
*
* @param transactionProjectName 交易项目名称
* @return 交易项目
*/
public TTransactionProject selectTransactionProjectByName(String transactionProjectName);
/** /**
* 查询交易项目列表 * 查询交易项目列表
* *
......
...@@ -58,4 +58,14 @@ public interface ITTransactionProjectService ...@@ -58,4 +58,14 @@ public interface ITTransactionProjectService
* @return 结果 * @return 结果
*/ */
public int deleteTTransactionProjectById(Long transactionProjectId); public int deleteTTransactionProjectById(Long transactionProjectId);
/**
* 导入数据
*
* @param transactionList 数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @return 结果
*/
public String importTransaction(List<TTransactionProject> transactionList, Boolean isUpdateSupport);
} }
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.service.ISysConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TTransactionProjectMapper; import com.zehong.system.mapper.TTransactionProjectMapper;
...@@ -17,9 +25,13 @@ import com.zehong.system.service.ITTransactionProjectService; ...@@ -17,9 +25,13 @@ import com.zehong.system.service.ITTransactionProjectService;
@Service @Service
public class TTransactionProjectServiceImpl implements ITTransactionProjectService public class TTransactionProjectServiceImpl implements ITTransactionProjectService
{ {
private static final Logger log = LoggerFactory.getLogger(TTransactionProjectServiceImpl.class);
@Autowired @Autowired
private TTransactionProjectMapper tTransactionProjectMapper; private TTransactionProjectMapper tTransactionProjectMapper;
@Autowired
private ISysConfigService configService;
/** /**
* 查询交易项目 * 查询交易项目
* *
...@@ -93,4 +105,67 @@ public class TTransactionProjectServiceImpl implements ITTransactionProjectServi ...@@ -93,4 +105,67 @@ public class TTransactionProjectServiceImpl implements ITTransactionProjectServi
{ {
return tTransactionProjectMapper.deleteTTransactionProjectById(transactionProjectId); return tTransactionProjectMapper.deleteTTransactionProjectById(transactionProjectId);
} }
/**
* 导入数据
*
* @param transactionList 数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @return 结果
*/
@Override
public String importTransaction(List<TTransactionProject> transactionList, Boolean isUpdateSupport)
{
if (StringUtils.isNull(transactionList) || transactionList.size() == 0)
{
throw new CustomException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (TTransactionProject transaction : transactionList)
{
try
{
// 验证是否存在这个用户
TTransactionProject project = tTransactionProjectMapper.selectTransactionProjectByName(transaction.getTransactionProjectName());
if (StringUtils.isNull(project))
{
this.insertTTransactionProject(transaction);
successNum++;
successMsg.append("<br/>" + successNum + "、交易项目 " + transaction.getTransactionProjectName() + " 导入成功");
}
else if (isUpdateSupport)
{
transaction.setTransactionProjectId(project.getTransactionProjectId());
this.updateTTransactionProject(transaction);
successNum++;
successMsg.append("<br/>" + successNum + "、交易项目 " + transaction.getTransactionProjectName() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、交易项目 " + transaction.getTransactionProjectName() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、交易项目 " + transaction.getTransactionProjectName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new CustomException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
} }
...@@ -40,6 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,6 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTTransactionProjectVo"/> <include refid="selectTTransactionProjectVo"/>
where transaction_project_id = #{transactionProjectId} where transaction_project_id = #{transactionProjectId}
</select> </select>
<select id="selectTransactionProjectByName" parameterType="String" resultMap="TTransactionProjectResult">
<include refid="selectTTransactionProjectVo"/>
where transaction_project_name = #{transactionProjectName}
</select>
<insert id="insertTTransactionProject" parameterType="TTransactionProject" useGeneratedKeys="true" keyProperty="transactionProjectId"> <insert id="insertTTransactionProject" parameterType="TTransactionProject" useGeneratedKeys="true" keyProperty="transactionProjectId">
insert into t_transaction_project insert into t_transaction_project
...@@ -76,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -76,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transactionItemName != null">transaction_item_name = #{transactionItemName},</if> <if test="transactionItemName != null">transaction_item_name = #{transactionItemName},</if>
<if test="context != null">context = #{context},</if> <if test="context != null">context = #{context},</if>
<if test="priceType != null">price_type = #{priceType},</if> <if test="priceType != null">price_type = #{priceType},</if>
<if test="price != null">price = #{price},</if> price = #{price},
<if test="deptId != null">dept_id = #{deptId},</if> <if test="deptId != null">dept_id = #{deptId},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
......
/*
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2023-06-12 10:49:16
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-06-13 16:19:48
* @FilePath: /precision-effect-web/src/api/account/account.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import request from '@/utils/request' import request from '@/utils/request'
// 查询账户列表 // 查询账户列表
...@@ -9,6 +17,15 @@ export function listAccount(query) { ...@@ -9,6 +17,15 @@ export function listAccount(query) {
}) })
} }
// 应收应付金额列表
export function getIncomeOrPayableList (query) {
return request({
url: '/trade/project/getIncomeOrPayableList',
method: 'get',
params: query
})
}
// 查询账户详细 // 查询账户详细
export function getAccount(accountId) { export function getAccount(accountId) {
return request({ return request({
......
...@@ -60,3 +60,11 @@ export function exportProject(query) { ...@@ -60,3 +60,11 @@ export function exportProject(query) {
params: query params: query
}) })
} }
// 下载导入模板
export function importTemplate() {
return request({
url: '/transaction/project/importTemplate',
method: 'get'
})
}
...@@ -324,3 +324,6 @@ ...@@ -324,3 +324,6 @@
.flex{ .flex{
display: flex; display: flex;
} }
.cup{
cursor: pointer;
}
\ No newline at end of file
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2023-06-13 15:40:04
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-06-13 17:37:46
* @FilePath: /precision-effect-web/src/views/account/component/table.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<!-- 交易项目、卖方、申请人、买方、买方经办人、应付/应收金额 -->
<el-table :data="tableData" v-loading="moneyLoading">
<el-table-column
label="交易项目"
align="center"
prop="a"
:formatter="formatter"
/>
<el-table-column label="卖方" align="center" prop="tradeTransactorName" />
<el-table-column label="申请人" align="center" prop="applyName" />
<el-table-column label="买方" align="center" prop="applyDeptName" />
<el-table-column label="买方经办人" align="center" prop="tradeDeptName" />
<template v-if="or === 'income'">
<el-table-column
label="应收金额"
align="center"
prop="pendingPayment"
/>
</template>
<template v-else>
<el-table-column
label="应付金额"
align="center"
prop="pendingPayment"
/>
</template>
</el-table>
<pagination
v-show="tableData.length > 0"
:total="total"
:page.sync="queryAccountDetailParams.pageNum"
:limit.sync="queryAccountDetailParams.pageSize"
@pagination="getOperateList"
/>
</div>
</template>
<script>
export default {
name: "",
props: {
moneyLoading: {
type: Boolean,
},
tableData: {
type: Array,
default: () => {
return [];
},
},
or: {
type: String,
default: "tableOr",
},
total: {
tyle: Number,
},
deptId: {
tyle: Number,
},
},
data() {
return {
queryAccountDetailParams: {
pageNum: 1,
pageSize: 10,
},
};
},
methods: {
getOperateList() {
this.$parent.$parent.getIncomeOrPayableList(
{
...this.queryAccountDetailParams,
deptId: this.deptId,
},
this.or
);
},
formatter(row, column, cellValue, index) {
return cellValue ? cellValue : "-";
},
},
};
</script>
<style lang="scss" scoped></style>
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="部门" prop="deptId"> <el-form-item label="部门" prop="deptId">
<div style="width: 200px"> <div style="width: 200px">
<treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" :disabled="disabled"/> <treeselect
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
:disabled="disabled"
/>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -60,12 +80,49 @@ ...@@ -60,12 +80,49 @@
</el-row>--> </el-row>-->
<el-table v-loading="loading" :data="accountList"> <el-table v-loading="loading" :data="accountList">
<el-table-column label="部门" align="center" prop="deptName" :show-overflow-tooltip="true"/> <el-table-column
<el-table-column label="账户总额" align="center" prop="totalAmount"/> label="部门"
align="center"
prop="deptName"
:show-overflow-tooltip="true"
/>
<el-table-column label="账户总额" align="center" prop="totalAmount" />
<el-table-column label="可用金额" align="center" prop="ableAmount" /> <el-table-column label="可用金额" align="center" prop="ableAmount" />
<el-table-column label="应收总额" align="center" prop="incomeAbleTotalAmount"/> <el-table-column
<el-table-column label="应付总额" align="center" prop="payableTotalAmount"/> label="应收总额"
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> align="center"
prop="incomeAbleTotalAmount"
>
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="moneyDialog(scope.row, 'income')"
>
{{ scope.row.incomeAbleTotalAmount }}
</el-button>
</template>
</el-table-column>
<el-table-column
label="应付总额"
align="center"
prop="payableTotalAmount"
>
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="moneyDialog(scope.row, 'pay')"
>
{{ scope.row.payableTotalAmount }}
</el-button>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<!--<el-button <!--<el-button
size="mini" size="mini"
...@@ -81,13 +138,15 @@ ...@@ -81,13 +138,15 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:account:remove']" v-hasPermi="['system:account:remove']"
>删除</el-button>--> >删除</el-button>-->
<el-button size="mini" type="text" @click="accountDetail(scope.row)">账户详情</el-button> <el-button size="mini" type="text" @click="accountDetail(scope.row)"
>账户详情</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -110,16 +169,39 @@ ...@@ -110,16 +169,39 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 应收应付弹框 -->
<el-dialog
:title="tableOr === 'pay' ? '应付金额' : '应收金额'"
:visible.sync="moneyOpen"
append-to-body
destroy-on-close
>
<MoneyTable
:tableData="ableTotalAmountData"
:or="tableOr"
:deptId="deptId"
:total="ableTotalAmounTotal"
:moneyLoading="moneyLoading"
/>
</el-dialog>
<!-- 账户详情 --> <!-- 账户详情 -->
<el-dialog title="账户详情" :visible.sync="operateOpen" width="800px" append-to-body> <el-dialog
title="账户详情"
:visible.sync="operateOpen"
width="800px"
append-to-body
>
<el-table :data="cashOperateList"> <el-table :data="cashOperateList">
<el-table-column label="序号" width="50px" align="center"> <el-table-column label="序号" width="50px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作部门" align="center" prop="operateDeptName"/> <el-table-column
label="操作部门"
align="center"
prop="operateDeptName"
/>
<el-table-column label="操作类型" align="center" prop="operateType"> <el-table-column label="操作类型" align="center" prop="operateType">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.operateType == '1'">收入</span> <span v-if="scope.row.operateType == '1'">收入</span>
...@@ -127,11 +209,11 @@ ...@@ -127,11 +209,11 @@
<span v-if="scope.row.operateType == '3'">尾款扣除</span> <span v-if="scope.row.operateType == '3'">尾款扣除</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" align="center" prop="operateAmount"/> <el-table-column label="金额" align="center" prop="operateAmount" />
<el-table-column label="操作时间" align="center" prop="operateTime"/> <el-table-column label="操作时间" align="center" prop="operateTime" />
</el-table> </el-table>
<pagination <pagination
v-show="operateListTotal>0" v-show="operateListTotal > 0"
:total="operateListTotal" :total="operateListTotal"
:page.sync="queryAccountDetailParams.pageNum" :page.sync="queryAccountDetailParams.pageNum"
:limit.sync="queryAccountDetailParams.pageSize" :limit.sync="queryAccountDetailParams.pageSize"
...@@ -142,15 +224,26 @@ ...@@ -142,15 +224,26 @@
</template> </template>
<script> <script>
import { listAccount, getAccount, delAccount, addAccount, updateAccount, exportAccount } from "@/api/account/account"; import {
listAccount,
getIncomeOrPayableList,
getAccount,
delAccount,
addAccount,
updateAccount,
exportAccount,
} from "@/api/account/account";
import { treeselect } from "@/api/system/dept"; import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { listOperate } from "@/api/account/operate"; import { listOperate } from "@/api/account/operate";
import MoneyTable from "./component/MoneyTable";
export default { export default {
name: "Account", name: "Account",
components: { components: {
Treeselect Treeselect,
MoneyTable,
}, },
data() { data() {
return { return {
...@@ -172,14 +265,24 @@ export default { ...@@ -172,14 +265,24 @@ export default {
accountList: [], accountList: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 总额弹框
moneyOpen: false,
moneyLoading:true,
// 应收还是应付 income / pay
tableOr: "income",
ableTotalAmountData: [],
ableTotalAmounTotal: 0,
deptId: null,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
deptId: null, deptId: null,
ableAmount: null ableAmount: null,
}, },
queryAccountDetailParams: { queryAccountDetailParams: {
pageNum: 1, pageNum: 1,
...@@ -189,20 +292,19 @@ export default { ...@@ -189,20 +292,19 @@ export default {
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {},
},
// 部门树选项 // 部门树选项
deptOptions: [], deptOptions: [],
disabled: false, disabled: false,
operateOpen: false, operateOpen: false,
cashOperateList: [], cashOperateList: [],
operateListTotal: 0 operateListTotal: 0,
}; };
}, },
created() { created() {
console.log("userId===",this.$store.state.user.userId); console.log("userId===", this.$store.state.user.userId);
console.log("deptId===",this.$store.state.user.deptId); console.log("deptId===", this.$store.state.user.deptId);
if(this.$store.state.user.userId != 1){ if (this.$store.state.user.userId != 1) {
this.queryParams.deptId = this.$store.state.user.deptId; this.queryParams.deptId = this.$store.state.user.deptId;
this.disabled = true; this.disabled = true;
} }
...@@ -213,12 +315,26 @@ export default { ...@@ -213,12 +315,26 @@ export default {
/** 查询账户列表 */ /** 查询账户列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listAccount(this.queryParams).then(response => { listAccount(this.queryParams).then((response) => {
console.log(response);
this.accountList = response.rows; this.accountList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
getIncomeOrPayableList(queryParams, or) {
if (or === "pay") {
return getIncomeOrPayableList({
...queryParams,
tradeDeptId: queryParams.deptId,
});
} else {
return getIncomeOrPayableList({
...queryParams,
applyDeptId: queryParams.deptId,
});
}
},
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
...@@ -229,7 +345,7 @@ export default { ...@@ -229,7 +345,7 @@ export default {
this.form = { this.form = {
accountId: null, accountId: null,
deptId: null, deptId: null,
ableAmount: null ableAmount: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -245,9 +361,9 @@ export default { ...@@ -245,9 +361,9 @@ export default {
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.accountId) this.ids = selection.map((item) => item.accountId);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
...@@ -258,8 +374,8 @@ export default { ...@@ -258,8 +374,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const accountId = row.accountId || this.ids const accountId = row.accountId || this.ids;
getAccount(accountId).then(response => { getAccount(accountId).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改账户"; this.title = "修改账户";
...@@ -267,16 +383,16 @@ export default { ...@@ -267,16 +383,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.accountId != null) { if (this.form.accountId != null) {
updateAccount(this.form).then(response => { updateAccount(this.form).then((response) => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addAccount(this.form).then(response => { addAccount(this.form).then((response) => {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
...@@ -288,53 +404,88 @@ export default { ...@@ -288,53 +404,88 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const accountIds = row.accountId || this.ids; const accountIds = row.accountId || this.ids;
this.$confirm('是否确认删除账户编号为"' + accountIds + '"的数据项?', "警告", { this.$confirm(
'是否确认删除账户编号为"' + accountIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delAccount(accountIds); return delAccount(accountIds);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
this.$confirm('是否确认导出所有账户数据项?', "警告", { this.$confirm("是否确认导出所有账户数据项?", "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(() => { })
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportAccount(queryParams); return exportAccount(queryParams);
}).then(response => { })
.then((response) => {
this.download(response.msg); this.download(response.msg);
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
.catch(() => {});
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getTreeselect() { getTreeselect() {
treeselect().then(response => { treeselect().then((response) => {
this.deptOptions = response.data; this.deptOptions = response.data;
}); });
}, },
// 应收音符金额点击弹框 data是table传进来的数据,or是印绶还是应付
moneyDialog(data, or, pageNum, pageSize) {
this.tableOr = or;
this.moneyOpen = true;
this.ableTotalAmountData=[];
this.moneyLoading=true;
// 储存一下,好传参,点击进来的要
this.deptId = data.deptId;
const queryParams = {
pageNum: pageNum ? pageNum : 1,
pageSize: pageSize ? pageSize : 10,
deptId: this.deptId,
};
this.getIncomeOrPayableList(queryParams, or).then((res) => {
// console.log(res)
this.ableTotalAmountData = res.rows;
this.ableTotalAmounTotal=res.total;
this.moneyLoading=false;
});
// // 应收还是应付
// this.tableOr = or;
// this.moneyOpen = true;
// this.ableTotalAmountData = [];
},
//账户详情 //账户详情
accountDetail(row){ accountDetail(row) {
this.operateOpen = true; this.operateOpen = true;
this.queryAccountDetailParams.operateDeptId = row.deptId; this.queryAccountDetailParams.operateDeptId = row.deptId;
this.getOperateList(); this.getOperateList();
}, },
//账户操作记录查询 //账户操作记录查询
getOperateList(){ getOperateList() {
listOperate(this.queryAccountDetailParams).then(res =>{ listOperate(this.queryAccountDetailParams).then((res) => {
if(res.code == 200){ if (res.code == 200) {
this.cashOperateList = res.rows; this.cashOperateList = res.rows;
this.operateListTotal = res.total; this.operateListTotal = res.total;
} }
}) });
} },
} },
}; };
</script> </script>
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
<el-form-item label="买方" prop="tradeDeptId"> <el-form-item label="买方" prop="tradeDeptId">
<treeselect <treeselect
v-model="form.tradeDeptId" v-model="form.tradeDeptId"
:options="deptOptions" :options="formDeptOptions"
:show-count="true" :show-count="true"
placeholder="请选择部门" placeholder="请选择部门"
/> />
...@@ -396,6 +396,7 @@ export default { ...@@ -396,6 +396,7 @@ export default {
transactionProjects: [], transactionProjects: [],
deptOptions: [], deptOptions: [],
formDeptOptions: [],
priceType: "1", priceType: "1",
fileList: [], fileList: [],
transactionProjectStatus: [], transactionProjectStatus: [],
...@@ -574,6 +575,20 @@ export default { ...@@ -574,6 +575,20 @@ export default {
getTreeselect() { getTreeselect() {
treeselect().then((response) => { treeselect().then((response) => {
this.deptOptions = response.data; this.deptOptions = response.data;
this.formDeptOptions = response.data;
// 申请服务时买方不能选自己部门
var items = this.formDeptOptions[0].children;
var result = [];
var j=0;
for(var i=0; i<items.length; i++){
if(items[i].id != this.$store.state.user.deptId){
result[j] = items[i];
j++;
}
}
this.formDeptOptions[0].children = result;
console.log("formDeptOptions===",this.formDeptOptions);
}); });
}, },
changeTransactionProject(val) { changeTransactionProject(val) {
......
...@@ -56,6 +56,16 @@ ...@@ -56,6 +56,16 @@
v-hasPermi="['system:project:remove']" v-hasPermi="['system:project:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['system:user:import']"
>导入</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
...@@ -77,7 +87,7 @@ ...@@ -77,7 +87,7 @@
<el-table-column label="交易类型" align="center" prop="priceType"> <el-table-column label="交易类型" align="center" prop="priceType">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.priceType == '1'">定价</span> <span v-if="scope.row.priceType == '1'">定价</span>
<span v-if="scope.row.priceType == '2'"></span> <span v-if="scope.row.priceType == '2'"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价" align="center" prop="price"> <el-table-column label="单价" align="center" prop="price">
...@@ -154,11 +164,43 @@ ...@@ -154,11 +164,43 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listProject, getProject, delProject, addProject, updateProject, exportProject } from "@/api/transaction/project"; import { listProject, getProject, delProject, addProject, updateProject, exportProject, importTemplate } from "@/api/transaction/project";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept"; import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
...@@ -189,6 +231,21 @@ export default { ...@@ -189,6 +231,21 @@ export default {
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 导入参数
upload: {
// 是否显示弹出层(导入)
open: false,
// 弹出层标题(导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/transaction/project/importData"
},
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
...@@ -299,6 +356,33 @@ export default { ...@@ -299,6 +356,33 @@ export default {
this.open = true; this.open = true;
this.title = "添加交易项目"; this.title = "添加交易项目";
}, },
/** 导入按钮操作 */
handleImport() {
this.upload.title = "交易项目导入";
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.download(response.msg);
});
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment