| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786 |
- <template>
- <div>
- <el-row>
- <el-col :span="4">
- <div class="box">
- <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>
- </div>
- </el-col>
- <el-col :span="20">
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
- id="out-table" :header-cell-class-name="headerClassName" :before-open="beforeOpen" :search.sync="search"
- v-model="form" ref="crud" @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"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 302)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 302)" @on-load="onLoad">
- <template slot="menuLeft">
- <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除
- </el-button>
- <el-button type="warning" size="small" icon="el-icon-printer" @click="excelBox = true">导入
- </el-button>
- <el-button type="success" size="small" @click="handleExport" icon="el-icon-printer">导出</el-button>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button v-if="scope.row.status == 1" type="text" icon="el-icon-turn-off" style="color: #85e967" size="small"
- @click.stop="statusfun(scope.row.id,0)">
- 启用
- </el-button>
- <el-button v-if="scope.row.status == 0" type="text" icon="el-icon-turn-off" style="color: #e83c3a" size="small"
- @click.stop="statusfun(scope.row.id,1)">
- 停用
- </el-button>
- </template>
- <template slot="unitNoForm">
- <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.unitNo" :datalist="unitNoData" title="计量单位" :filterable="true" :clearable="true"
- :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
- @remoteMethod="getBunitsListfun" @corpChange="unitNoCorpChange">
- <bunits></bunits>
- </search-query>
- </template>
- <template slot="curNoForm">
- <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.curNo" :datalist="curNoData" title="币别" :filterable="true" :clearable="true"
- :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
- @remoteMethod="getRateListfun" @corpChange="curNoCorpChange">
- <rateManagement></rateManagement>
- </search-query>
- </template>
- <template slot="feesTypeNameForm">
- <search-query ref="SearchQuery" :disabled="searchDisabled" :selectValue="form.feesTypeName" :datalist="feesTypeData" title="费用类别"
- :filterable="true" :clearable="true"
- :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
- @remoteMethod="bfeesdefineListfun" @corpChange="feesTypeCorpChange">
- <bfeesdetype></bfeesdetype>
- </search-query>
- </template>
- <template slot="code" slot-scope="scope">
- <avue-text-ellipsis :text="scope.row.code" :height="30" use-tooltip placement="top">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
- <template slot="cnName" slot-scope="scope">
- <avue-text-ellipsis :text="scope.row.cnName" :height="30" use-tooltip placement="top">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
- <template slot="enName" slot-scope="scope">
- <avue-text-ellipsis :text="scope.row.enName" :height="30" use-tooltip placement="top">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
- <template slot="remarks" slot-scope="scope">
- <avue-text-ellipsis :text="scope.row.remarks" :height="30" use-tooltip placement="top">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <!--类别弹窗-->
- <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="60%" :before-close="corpTypeClose">
- <div>
- <bfeesdetype></bfeesdetype>
- </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>
- <el-dialog title="导入往来单位" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
- v-dialog-drag>
- <avue-form :option="excelOption" v-model="excelForm" :table-loading="excelLoading" :upload-before="uploadBefore"
- :upload-after="onSuccess">
- <template slot="excelTemplate">
- <el-button type="primary" @click="handleGet">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- </div>
- </template>
- <script>
- import { bfeesList, bfeesDetail, bfeesSubmit, bfeesRemove } from "@/api/iosBasicData/bfees";
- import { mapGetters } from "vuex";
- import { bfeesdefineList } from "@/api/iosBasicData/bfeesdefine";
- import { getBunitsList } from "@/api/iosBasicData/bunits";
- import { getRateList } from "@/api/iosBasicData/rateManagement";
- import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
- import bunits from "@/views/iosBasicData/bunits/index.vue";
- import bfeesdetype from "@/views/iosBasicData/bfeesdefine/bfeesdetype.vue";
- import rateManagement from '@/views/iosBasicData/rateManagement/index.vue'
- import { getToken } from "@/util/auth";
- export default {
- components: { bunits, bfeesdetype, rateManagement, SearchQuery },
- data() {
- return {
- // 是否禁用
- searchDisabled:false,
- // 类别弹窗的开启
- corpTypeVisible: false,
- // 费用类别数据
- feesTypeData: [],
- // 计量单位数据
- unitNoData: [],
- // 币别数据
- curNoData: [],
- treeOption: {
- nodeKey: "id",
- // lazy: true,
- // treeLoad: function(node, resolve) {
- // const parentId = node.level === 0 ? 0 : node.data.id;
- // },
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "cnName",
- value: "value",
- children: "children"
- }
- },
- form: {},
- query: {},
- loading: true,
- excelBox: false,
- search: {},
- excelForm: {},
- excelLoading: false,
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24
- },
- {
- label: "模板上传",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "模板上传中,请稍等",
- span: 24,
- propsHttp: {
- res: "data"
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/blade-los/bfees/importBFees"
- }
- ]
- },
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- ageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- selectionList: [],
- option: {
- dialogDrag: true,
- },
- optionBack: {
- dialogDrag: true,
- addBtnText: '新建费用信息',
- addTitle: '新建费用信息',
- editBtnText: '编辑',
- editTitle: '编辑费用信息',
- viewBtnText: '查看',
- viewTitle: '查看费用信息',
- height: 'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- menuWidth:260,
- column: [
- // {
- // label: "凭证",
- // prop: "code",
- // search: true,
- // rules: [{
- // required: true,
- // message: "请输入费用编码",
- // trigger: "blur"
- // }]
- // },
- {
- label: "编码",
- prop: "code",
- width: "180",
- search: true,
- rules: [{
- required: true,
- message: "请输入费用编码",
- trigger: "blur"
- }]
- },
- {
- label: "中文名称",
- prop: "cnName",
- width: "180",
- search: true,
- rules: [{
- required: true,
- message: "请输入中文名称",
- trigger: "blur"
- }]
- },
- {
- label: "英文名称",
- prop: "enName",
- width: "180",
- search: true,
- rules: [{
- required: true,
- message: "请输入英文名称",
- trigger: "blur"
- }]
- },
- {
- label: "费用类别",
- prop: "feesTypeName",
- formslot: true,
- // rules: [{
- // required: true,
- // message: "请选择费用类别",
- // trigger: "blur"
- // }]
- },
- {
- label: "计量单位",
- prop: "unitNo",
- formslot: true,
- // rules: [{
- // required: true,
- // message: "请输入计量单位",
- // trigger: "blur"
- // }]
- },
- {
- label: "币别",
- prop: "curNo",
- formslot: true,
- // rules: [{
- // required: true,
- // message: "请输入币别",
- // trigger: "blur"
- // }]
- },
- {
- label: "核算ID",
- prop: "accElementId",
- // rules: [{
- // required: true,
- // message: "请输入核算要素ID",
- // trigger: "blur"
- // }]
- },
- {
- label: "核算名称",
- prop: "accElementName",
- // rules: [{
- // required: true,
- // message: "请输入财务核算要素名称",
- // trigger: "blur"
- // }]
- },
- {
- label: "科目 Id",
- prop: "accId",
- // rules: [{
- // required: true,
- // message: "请输入科目 Id",
- // trigger: "blur"
- // }]
- },
- {
- label: "科目编号",
- prop: "accNo",
- // rules: [{
- // required: true,
- // message: "请输入科目编号",
- // trigger: "blur"
- // }]
- },
- {
- label: "科目全称",
- prop: "accFullName",
- // rules: [{
- // required: true,
- // message: "请输入科目全称",
- // trigger: "blur"
- // }]
- },
- {
- label: "版本",
- prop: "version",
- hide: true,
- display: false,
- },
- {
- label: "收付",
- prop: "dc",
- type: 'select',
- dicData: [{
- label: '收',
- value: 'D'
- }, {
- label: '付',
- value: 'C'
- }],
- },
- {
- label: "状态",
- prop: "status",
- type: 'select',
- dicData: [{
- label: '启用',
- value: 0
- }, {
- label: '停用',
- value: 1
- }],
- value: 0
- // rules: [{
- // required: true,
- // message: "请输入状态",
- // trigger: "blur"
- // }]
- },
- {
- label: "主键",
- prop: "id",
- hide: true,
- display: false,
- },
- {
- label: "创建人 Id",
- prop: "createUser",
- hide: true,
- display: false,
- },
- {
- label: "创建人",
- prop: "createUserName",
- display: false,
- },
- {
- label: "创建部门 Id",
- prop: "createDept",
- hide: true,
- display: false,
- },
- {
- label: "创建部门",
- prop: "createDeptName",
- display: false,
- },
- {
- label: "创建时间",
- prop: "createTime",
- width: 160,
- display: false,
- },
- {
- label: "修改人 Id",
- prop: "updateUser",
- hide: true,
- display: false,
- },
- {
- label: "修改人",
- prop: "updateUserName",
- display: false,
- },
- {
- label: "修改时间",
- prop: "updateTime",
- width: 160,
- display: false,
- },
- {
- label: "是否已删除(0 否 1是)",
- prop: "isDeleted",
- hide: true,
- display: false,
- },
- {
- label: "备注",
- prop: "remarks",
- span: 24,
- type: 'textarea',
- width: "180",
- slot: true,
- minRows: 3,
- },
- ]
- },
- data: []
- };
- },
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- // addBtn: this.vaildData(this.permission.bfees_add, false),
- // viewBtn: this.vaildData(this.permission.bfees_view, false),
- // delBtn: this.vaildData(this.permission.bfees_delete, false),
- // editBtn: this.vaildData(this.permission.bfees_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(302), this.optionBack);
- this.bfeesdefineListfun()
- this.getBunitsListfun()
- this.getRateListfun()
- },
- methods: {
- // 禁用启用按钮
- statusfun(id,status){
- this.$confirm("确定将选择数据更改状态?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(()=>{
- bfeesDetail(id).then(res=>{
- let obj = res.data.data;
- obj.status = status
- bfeesSubmit(obj).then(()=>{
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- })
- })
- })
- },
- // 导出
- handleExport() {
- var condition = ''
- for (const key in this.search) {
- var value = this.search[key]
- if (value) {
- condition += `&${key}=${this.search[key]}`
- }
- }
- this.$confirm('是否导出费用信息?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- window.open(
- `/api/blade-los/bfees/exportBFees?${this.website.tokenHeader
- }=${getToken()}${condition}`
- );
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消' //
- });
- })
- },
- uploadBefore(file, done, loading) {
- done();
- loading = true;
- },
- // 上传成功
- onSuccess(res, done, loading, column) {
- this.excelBox = false;
- this.$message.success("导入成功!");
- loading = false;
- this.onLoad(this.page);
- done();
- },
- // 下载模板
- handleGet() {
- window.open(
- `/api/blade-los/bfees/exportBFees/template?${this.website.tokenHeader
- }=${getToken()}`
- );
- },
- // 获取费用类别数据
- bfeesdefineListfun() {
- bfeesdefineList(1, 10).then(res => {
- this.feesTypeData = res.data.data.records
- })
- },
- // 获取计算单位数据
- getBunitsListfun(cnName) {
- getBunitsList(1, 10, { cnName }).then(res => {
- this.unitNoData = res.data.data.records
- })
- },
- // 获取币别数据
- getRateListfun(cnName) {
- getRateList({
- current: 1,
- size: 10,
- cnName
- }).then(res => {
- this.curNoData = res.data.data.records
- })
- },
- // 费用信息选中回调
- feesTypeCorpChange(value) {
- this.feesTypeData.map(item => {
- if (item.cnName == value) {
- this.form.feesTypeId = item.id
- this.form.feesTypeName = item.cnName
- }
- })
- },
- // 计量单位选中的回调
- unitNoCorpChange(value) {
- this.form.unitNo = value
- },
- // 币别选中回调
- curNoCorpChange(value) {
- this.form.curNo = value
- },
- nodeClick(data) {
- console.log(data, 331)
- // this.feesTypeId = data.id;
- // this.page.currentPage = 1;
- // this.onLoad(this.page);
- },
- rowSave(row, done, loading) {
- row.accElementId = Number(row.accElementId)
- row.accId = Number(row.accId)
- bfeesSubmit(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- row.accElementId = Number(row.accElementId)
- row.accId = Number(row.accId)
- bfeesSubmit(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- rowDel(row) {
- if (row.status === 1) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return bfeesRemove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- } else {
- this.$message({
- message: '非禁用状态无法删除',
- type: 'warning'
- });
- }
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- for (const selection of this.selectionList) {
- if (selection.status == 0) {
- this.$message.warning("选中的数据中有启用数据,启用数据不可删除!");
- return;
- }
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return bfeesRemove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "add"].includes(type)) {
- this.searchDisabled = false
- } else {
- this.searchDisabled = true
- }
- if (["edit", "view"].includes(type)) {
- bfeesDetail(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;
- bfeesList(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();
- });
- },
- // 类别弹窗关闭
- corpTypeClose(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;
- }
- ::v-deep .el-input-group__append {
- padding: 0 0px !important;
- }
- </style>
|