|
@@ -0,0 +1,768 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ size="small"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
+ <el-form-item label="客户" prop="customerId">
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="queryParams.customerId"
|
|
|
+ placeholder="请客户编号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ /> -->
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.customerId"
|
|
|
+ placeholder="请选择客户"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="handleQuery"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in customSelectData"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.customName"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="付款方式" prop="paymentMethod">
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="queryParams.paymentMethod"
|
|
|
+ placeholder="请输入付款方式"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ /> -->
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.paymentMethod"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="handleQuery"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type.collection_registration_payment_method"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="金额" prop="amounts">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.amounts"
|
|
|
+ placeholder="请输入金额"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="收款日期" prop="collectionMoneyDate">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ v-model="queryParams.collectionMoneyDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择收款日期"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="结算单位" prop="settlementUnitId">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.settlementUnitId"
|
|
|
+ placeholder="请输入结算单位"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="记账标志" prop="bookkeepingFlag">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.bookkeepingFlag"
|
|
|
+ placeholder="请输入记账标志"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item>
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:add']"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:edit']"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:remove']"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:export']"
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar
|
|
|
+ :showSearch.sync="showSearch"
|
|
|
+ @queryTable="getList"
|
|
|
+ ></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="SaleRegistrationCollectionList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="编号" align="center" prop="id" />
|
|
|
+ <el-table-column label="客户编号" align="center" prop="customerId" />
|
|
|
+ <el-table-column label="付款方式" align="center" prop="paymentMethod" />
|
|
|
+ <el-table-column label="金额" align="center" prop="amounts" />
|
|
|
+ <el-table-column
|
|
|
+ label="收款类型"
|
|
|
+ align="center"
|
|
|
+ prop="collectionMoneyType"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="收款日期"
|
|
|
+ align="center"
|
|
|
+ prop="collectionMoneyDate"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{
|
|
|
+ parseTime(scope.row.collectionMoneyDate, "{y}-{m}-{d}")
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="结算单位"
|
|
|
+ align="center"
|
|
|
+ prop="settlementUnitId"
|
|
|
+ />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ <el-table-column label="记账标志" align="center" prop="bookkeepingFlag" />
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-dropdown>
|
|
|
+ <el-button type="warning" plain size="small">
|
|
|
+ 操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:edit']"
|
|
|
+ >修改</el-button
|
|
|
+ ></el-dropdown-item
|
|
|
+ >
|
|
|
+ <el-dropdown-item
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['system:SaleRegistrationCollection:remove']"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改收款登记对话框 -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="收款日期" prop="collectionMoneyDate">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ v-model="form.collectionMoneyDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择收款日期"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="客户名称" prop="customerId">
|
|
|
+ <!-- <el-input v-model="form.customerId" placeholder="请输入客户编号" /> -->
|
|
|
+ <el-select
|
|
|
+ v-model="form.customerId"
|
|
|
+ placeholder="请选择客户"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="getSettlementUnitList"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in customSelectData"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.customName"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="收款类型" prop="collectionMoneyType">
|
|
|
+ <el-input
|
|
|
+ v-model="form.collectionMoneyType"
|
|
|
+ placeholder="请输入收款类型"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="付款方式" prop="paymentMethod">
|
|
|
+ <!-- <el-input v-model="form.paymentMethod" placeholder="请输入付款方式" /> -->
|
|
|
+ <el-select v-model="form.paymentMethod" clearable filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type
|
|
|
+ .collection_registration_payment_method"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="金额" prop="amounts">
|
|
|
+ <el-input
|
|
|
+ v-model="form.amounts"
|
|
|
+ placeholder="请输入金额"
|
|
|
+ @blur="limitNumbersEvent"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="结算单位" prop="settlementUnitId">
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="form.settlementUnitId"
|
|
|
+ placeholder="请输入结算单位"
|
|
|
+ >
|
|
|
+
|
|
|
+ </el-input> -->
|
|
|
+ <el-select v-model="form.settlementUnitId" clearable filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in settlementUnitList"
|
|
|
+ :key="item.ids"
|
|
|
+ :label="item.customerName"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ class="ml10"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="editSettleUnit"
|
|
|
+ ></el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" placeholder="请输入备注" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <!-- <el-form-item label="记账标志" prop="bookkeepingFlag">
|
|
|
+ <el-input
|
|
|
+ v-model="form.bookkeepingFlag"
|
|
|
+ placeholder="请输入记账标志"
|
|
|
+ />
|
|
|
+ </el-form-item> -->
|
|
|
+ </el-form>
|
|
|
+ </el-row>
|
|
|
+ <el-dialog
|
|
|
+ width="600px"
|
|
|
+ :title="customName + '的结算单位'"
|
|
|
+ :visible.sync="innerVisible"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnit"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ :disabled="adding"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-table :data="settleTableData" border stripe>
|
|
|
+ <el-table-column type="index" width="50" />
|
|
|
+ <el-table-column prop="customerName" label="单位名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="!scope.row.isEdit">{{ scope.row.customerName }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.customerName"
|
|
|
+ size="mini"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="customerRegion" label="单位地区">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="!scope.row.isEdit">{{
|
|
|
+ scope.row.customerRegion
|
|
|
+ }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.customerRegion"
|
|
|
+ size="mini"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- 编辑 -->
|
|
|
+ <div class="btn-wrap" v-show="scope.row.isEdit && scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnitConfirm(scope.row)"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ <el-button type="info" size="small" @click="initSettleTableData"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <!-- 待编辑 -->
|
|
|
+ <div class="btn-wrap" v-show="!scope.row.isEdit && scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="scope.row.isEdit = true"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="deleteUnit(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <!-- 待新增 -->
|
|
|
+ <div class="btn-wrap" v-show="!scope.row.id">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="addSettleUnitConfirm(scope.row)"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="cancelAdd(scope.$index)"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="innerCancel">关 闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ listSaleRegistrationCollection,
|
|
|
+ getSaleRegistrationCollection,
|
|
|
+ delSaleRegistrationCollection,
|
|
|
+ addSaleRegistrationCollection,
|
|
|
+ updateSaleRegistrationCollection,
|
|
|
+ getCustomList,
|
|
|
+ customerSettlementUnit,
|
|
|
+ addSettlementUnit, //新增结算单位
|
|
|
+ updateSettlementUnit,
|
|
|
+ deleteSettlementUnit,
|
|
|
+} from "@/api/system/SaleRegistrationCollection";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "SaleRegistrationCollection",
|
|
|
+ dicts: ["collection_registration_payment_method"],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ customSelectData: [], //客户选择数据
|
|
|
+ settlementUnitList: [], // 结算单位数据
|
|
|
+ innerVisible: false, //内层弹窗
|
|
|
+ settleTableData: [], //结算单位表格数据
|
|
|
+ customName: "", //当前客户名称
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 收款登记表格数据
|
|
|
+ SaleRegistrationCollectionList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ customerId: null,
|
|
|
+ paymentMethod: null,
|
|
|
+ amounts: null,
|
|
|
+ collectionMoneyType: null,
|
|
|
+ collectionMoneyDate: null,
|
|
|
+ settlementUnitId: null,
|
|
|
+ bookkeepingFlag: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ adding() {
|
|
|
+ if (!this.settleTableData.length) return false;
|
|
|
+ return this.settleTableData.some((item) => !item.id);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // 初始化下拉框数据
|
|
|
+ this.initSelectData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 删除单位 */
|
|
|
+ async deleteUnit(row) {
|
|
|
+ this.$confirm("是否确认删除该单位?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ let res = await deleteSettlementUnit(row.id);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.initSettleTableData();
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 取消新增结算单位 */
|
|
|
+ cancelAdd(index) {
|
|
|
+ this.settleTableData.splice(index, 1);
|
|
|
+ },
|
|
|
+ /* 确认新增/修改一条结算单位 */
|
|
|
+ async addSettleUnitConfirm(row) {
|
|
|
+ let { customerName, customerRegion, id } = row;
|
|
|
+ if (!customerName || !customerRegion) {
|
|
|
+ this.$message.warning("请完善数据!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ let fun = id ? updateSettlementUnit : addSettlementUnit;
|
|
|
+ let payload = {
|
|
|
+ customerId,
|
|
|
+ customerRegion,
|
|
|
+ customerName,
|
|
|
+ };
|
|
|
+ if (id) {
|
|
|
+ payload.id = id;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await fun(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.initSettleTableData();
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 新增一条结算单位 */
|
|
|
+ addSettleUnit() {
|
|
|
+ this.settleTableData.unshift({
|
|
|
+ customerName: "",
|
|
|
+ customerRegion: "",
|
|
|
+ isEdit: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 内层弹窗关闭回调 */
|
|
|
+ innerCancel() {
|
|
|
+ this.innerVisible = false;
|
|
|
+ this.getSettlementUnitList();
|
|
|
+ },
|
|
|
+ /* 初始化结算单位表格数据 */
|
|
|
+ async initSettleTableData() {
|
|
|
+ await this.getSettlementUnitList();
|
|
|
+ this.settleTableData = this.settlementUnitList.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isEdit: false,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 开始编辑结算单位
|
|
|
+ async editSettleUnit() {
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ if (!customerId) {
|
|
|
+ this.$message.warning("请先选择客户名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.customName = this.customSelectData.find(
|
|
|
+ (item) => item.id == this.form.customerId
|
|
|
+ )?.customName;
|
|
|
+ await this.initSettleTableData();
|
|
|
+ this.innerVisible = true;
|
|
|
+ },
|
|
|
+ // 获取结算单位下拉框数据
|
|
|
+ async getSettlementUnitList() {
|
|
|
+ let customerId = this.form.customerId;
|
|
|
+ if (!customerId) {
|
|
|
+ this.$message.warning("请先选择客户名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let payload = {
|
|
|
+ customerId,
|
|
|
+ isEnablePaging: false,
|
|
|
+ };
|
|
|
+ let res = await customerSettlementUnit(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.settlementUnitList = res.rows;
|
|
|
+ } else {
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 正则校验 输入框只能输入两位小数
|
|
|
+ limitNumbersEvent(e) {
|
|
|
+ // 通过正则保留两位小数点
|
|
|
+ let val = e.target.value;
|
|
|
+ // if (val.length > 6) val = val.slice(0, 6)
|
|
|
+ this.form.amounts = val.match(/^\d*(\.?\d{0,2})/g)[0] || null;
|
|
|
+ },
|
|
|
+ // 初始化下拉框选择数据
|
|
|
+ async initSelectData() {
|
|
|
+ // 客户数据
|
|
|
+ try {
|
|
|
+ let res1 = await getCustomList({ isEnablePaging: false });
|
|
|
+ if (res1.code == 200) {
|
|
|
+ this.customSelectData = res1.rows;
|
|
|
+ } else {
|
|
|
+ throw new Error(res1.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 查询收款登记列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listSaleRegistrationCollection(this.queryParams).then((response) => {
|
|
|
+ this.SaleRegistrationCollectionList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ customerId: null,
|
|
|
+ paymentMethod: null,
|
|
|
+ amounts: null,
|
|
|
+ collectionMoneyType: "货款",
|
|
|
+ collectionMoneyDate: new Date(),
|
|
|
+ settlementUnitId: null,
|
|
|
+ remark: null,
|
|
|
+ bookkeepingFlag: null,
|
|
|
+ createBy: null,
|
|
|
+ createById: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateById: null,
|
|
|
+ updateTime: null,
|
|
|
+ delFlag: null,
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map((item) => item.id);
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加收款登记";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids;
|
|
|
+ getSaleRegistrationCollection(id).then((response) => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.getSettlementUnitList();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改收款登记";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.id != null) {
|
|
|
+ updateSaleRegistrationCollection(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addSaleRegistrationCollection(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除收款登记编号为"' + ids + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delSaleRegistrationCollection(ids);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download(
|
|
|
+ "system/SaleRegistrationCollection/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `SaleRegistrationCollection_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|