| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585 |
- <template>
- <div>
- <el-row>
- <el-col :span="5">
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOption" :data="feesTypeData" @node-click="nodeClick">
- <template slot="addBtn">
- <el-tooltip class="item" effect="dark" content="新建分类" placement="top">
- <i
- class="el-icon-setting"
- style="font-size:18px;line-height: 30px;width: 20px;padding: 0 10px;"
- @click="corpTypeVisible = true"
- ></i>
- </el-tooltip>
- </template>
- </avue-tree>
- </basic-container>
- </el-scrollbar>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :search="search"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- id="out-table"
- :header-cell-class-name="headerClassName"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 328)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 328)"
- >
- <template slot="menuLeft">
- <el-button type="primary" size="small" @click="initializationfun">初始化 </el-button>
- <!--<el-button type="danger"-->
- <!-- size="small"-->
- <!-- icon="el-icon-delete"-->
- <!-- plain-->
- <!-- @click="handleDelete">删 除-->
- <!--</el-button>-->
- </template>
- <!--<template slot-scope="{ row }" slot="currencyCodeForm" >-->
- <!-- <search-query :datalist="currencyData"-->
- <!-- :selectValue="form.currencyCode"-->
- <!-- :clearable="true"-->
- <!-- :buttonIf="false"-->
- <!-- placeholder="请选择币种"-->
- <!-- :forParameter="{key:'id',label:'code',value:'code'}"-->
- <!-- @remoteMethod="bcurrencyGetExratefun"-->
- <!-- @corpChange="corpChange($event,'currencyCode')"-->
- <!-- @corpFocus="bcurrencyGetExratefun" >-->
- <!-- </search-query>-->
- <!--</template>-->
- <template slot="subjectCodeForm" slot-scope="{ row }">
- <search-query
- :datalist="subjectData"
- :selectValue="form.subjectCode"
- :filterable="true"
- :clearable="true"
- :remote="true"
- :buttonIf="false"
- :desc="true"
- :forParameter="{ key: 'id', label: 'code', value: 'code', desc: 'fullName' }"
- @corpFocus="accountsListfun"
- @remoteMethod="accountsListfun"
- @corpChange="corpChange($event, 'subjectCode')"
- >
- </search-query>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <!--类别弹窗-->
- <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="70%" :before-close="corpTypeClose">
- <div>
- <bbusinesstype></bbusinesstype>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="corpTypeVisible = false">取 消</el-button>
- <el-button type="primary" @click="corpTypeVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import bvouchertype from "@/views/iosBasicData/bvouchertype/index.vue";
- import { bvouchertypelist } from "@/api/bvouchertype/index";
- import { mapGetters } from "vuex";
- import {
- vouchertemplatelist,
- vouchertemplateDetail,
- vouchertemplateSubmit,
- vouchertemplateRemove,
- initialization
- } from "@/api/vouchertemplate/index";
- import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
- import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
- import { getCurrentDate } from "@/util/date";
- import { accountsList } from "@/api/iosBasicData/accounts";
- import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
- import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
- export default {
- name: "凭证模板(F)",
- components: { SearchQuery, bvouchertype, bbusinesstype },
- data() {
- return {
- treeOption: {
- nodeKey: "id",
- // lazy: true,
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "cnName",
- value: "value",
- children: "children"
- }
- },
- feesTypeData: [],
- corpTypeVisible: false,
- form: {
- // currencyCode:'RMB', // 币种代码
- },
- currencyData: [], // 币种数据
- subjectData: [], // 科目数据
- query: {},
- loading: true,
- page: {
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- search: {},
- data: [],
- option: {},
- optionBack: {
- height: "auto",
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- menuWidth: "100",
- column: [
- {
- label: "币别代码",
- prop: "currencyCode",
- // formslot:true,
- overHidden: true,
- display: false,
- disabled: true
- },
- {
- label: "币别名称",
- prop: "currencyName",
- overHidden: true,
- display: false,
- disabled: true
- },
- {
- label: "凭证类型",
- prop: "voucherType",
- overHidden: true,
- display: false,
- disabled: true
- },
- {
- label: "凭证名称",
- prop: "voucherName",
- overHidden: true
- },
- {
- label: "类型",
- prop: "dcType",
- overHidden: true,
- display: false,
- disabled: true
- },
- {
- label: "科目代码",
- prop: "subjectCode",
- formslot: true,
- overHidden: true
- },
- {
- label: "科目名称",
- prop: "subjectName",
- overHidden: true,
- disabled: true
- },
- {
- label: "金额方向",
- prop: "amountDirection",
- type: "select",
- dicData: [
- {
- label: "借",
- value: "D"
- },
- {
- label: "贷",
- value: "C"
- }
- ],
- overHidden: true
- },
- {
- label: "静态值",
- prop: "staticValue",
- overHidden: true
- },
- {
- label: "状态",
- prop: "status",
- type: "select",
- overHidden: true,
- dicData: [
- {
- label: "启用",
- value: 0
- },
- {
- label: "停用",
- value: 1
- }
- ],
- value: 0
- },
- {
- label: "附加公式",
- prop: "additionalFormulas",
- type: "textarea",
- minRows: 2,
- span: 12,
- overHidden: true
- },
- {
- label: "业务类型",
- prop: "businessType",
- overHidden: true,
- display: false
- },
- {
- label: "创建人",
- prop: "createUserName",
- overHidden: true,
- display: false
- },
- {
- label: "创建部门",
- prop: "createDeptName",
- overHidden: true,
- display: false
- },
- {
- label: "创建时间",
- prop: "createTime",
- overHidden: true,
- display: false
- },
- {
- label: "修改人",
- prop: "updateUserName",
- overHidden: true,
- display: false
- },
- {
- label: "修改时间",
- prop: "updateTime",
- overHidden: true,
- display: false
- },
- {
- label: "备注",
- prop: "remarks",
- overHidden: true,
- type: "textarea",
- minRows: 2,
- span: 12
- }
- ]
- }
- };
- },
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.bvouchertype_add, false),
- viewBtn: this.vaildData(this.permission.bvouchertype_view, false),
- delBtn: this.vaildData(this.permission.bvouchertype_delete, false)
- // editBtn: this.vaildData(this.permission.bvouchertype_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(328), this.optionBack);
- this.bbusinesstypeListfun();
- this.accountsListfun(); // 科目
- },
- methods: {
- // 所属币别
- corpChange(value, name) {
- if (name == "currencyCode") {
- for (let item of this.currencyData) {
- if (item.code == value) {
- this.$set(this.form, "currencyCode", item.code);
- this.$set(this.form, "currencyName", item.cnName);
- }
- }
- }
- if (name == "subjectCode") {
- for (let item of this.subjectData) {
- if (item.code == value) {
- this.$set(this.form, "subjectCode", item.code);
- this.$set(this.form, "subjectName", item.fullName);
- }
- }
- }
- },
- // 获取币别数据
- bcurrencyGetExratefun() {
- bcurrencyGetExrate({
- date: getCurrentDate(), // 当前日期
- dc: "C"
- }).then(res => {
- this.currencyData = res.data.data;
- });
- },
- // 获取科目类型数据
- accountsListfun(code) {
- accountsList(1, 10, { code, isDetail: 1 }).then(res => {
- this.subjectData = res.data.data.records;
- });
- },
- rowSave(row, done, loading) {
- console.log(row, "添加");
- vouchertemplateSubmit(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- },
- error => {
- loading();
- window.console.log(error);
- }
- );
- },
- rowUpdate(row, index, done, loading) {
- console.log(row, "编辑");
- vouchertemplateSubmit(row).then(
- () => {
- this.onLoad(this.page, this.search);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- },
- error => {
- loading();
- console.log(error);
- }
- );
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return vouchertemplateRemove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return vouchertemplateRemove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- console.log(type, 324);
- // 如果是添加判断是否选择了左侧类型
- if (type == "add") {
- if (!this.search.businessTypeId) {
- return this.$message.warning("请选择左侧的类型");
- }
- }
- if (["edit", "view"].includes(type)) {
- vouchertemplateDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- // this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- vouchertemplatelist(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- },
- // 初始化
- initializationfun() {
- if (!this.search.businessTypeId) {
- return this.$message.warning("请选择左侧的类型");
- }
- this.$confirm("初始化会清空数据", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- initialization({
- businessTypeId: this.search.businessTypeId,
- businessType: this.search.businessType
- }).then(res => {
- this.page.currentPage = 1;
- this.onLoad(this.page, this.search);
- });
- });
- },
- // 左侧筛选
- nodeClick(data) {
- this.search.businessTypeId = data.id;
- this.search.businessType = data.code;
- this.form.businessTypeId = data.id;
- this.form.businessType = data.code;
- // this.detailData.businessTypeId = data.id
- // this.detailData.businessTypeCnName = data.cnName
- // this.detailData.businessTypeEnName = data.enName
- // this.detailData.businessTypeCode = data.code
- this.onLoad(this.page, this.search);
- },
- // 获取左侧业务类别数据
- bbusinesstypeListfun() {
- bbusinesstypeList(1, 100, { enableVoucher: "1" }).then(res => {
- this.feesTypeData = res.data.data.records;
- });
- },
- // 类别弹窗关闭
- corpTypeClose(done) {
- done();
- // this.$confirm('确认关闭?')
- // .then(_ => {
- // done();
- // })
- // .catch(_ => { });
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行编码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- // 更改表格颜色
- headerClassName(tab) {
- //颜色间隔
- let back = "";
- if (tab.columnIndex >= 0 && tab.column.level === 1) {
- if (tab.columnIndex % 2 === 0) {
- back = "back-one";
- } else if (tab.columnIndex % 2 === 1) {
- back = "back-two";
- }
- }
- return back;
- }
- }
- };
- </script>
- <style scoped>
- ::v-deep#out-table .back-one {
- background: #ecf5ff !important;
- }
- ::v-deep#out-table .back-two {
- background: #ecf5ff !important;
- }
- </style>
|