| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="goBack(0)">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button v-if="editButton" class="el-button--small-yh" style="margin-left: 6px;" type="primary"
- size="small" @click="editButton = false">编 辑
- </el-button>
- <el-button v-if="!editButton" style="margin-left: 6px;" type="primary" size="small" @click="submit">保 存
- </el-button>
- <el-button v-if="!editButton" type="success" size="small" @click="importData">导入明细科目名称</el-button>
- </div>
- </div>
- <div style="margin-top: 50px">
- <trade-card title="基础信息">
- <avue-form :option="optionForm" v-model="form" ref="form">
- </avue-form>
- </trade-card>
- <trade-card title="明细信息">
- <avue-crud ref="crud" :option="option" :data="form.accItems"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 368)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 368)"
- @selection-change="selectionChange"></avue-crud>
- </trade-card>
- </div>
- </div>
- </template>
- <script>
- import {
- getDetails, submit, getAccountsItemsList
- } from "@/api/iosBasicData/periodManagement";
- import reportDialog from "@/components/report-dialog/main";
- import { dateFormat } from "@/util/date";
- import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
- import _ from "lodash";
- export default {
- name: "detailsPage",
- data() {
- return {
- editButton: true,
- selectionList: [],
- bigObj: {},
- form: {},
- optionForm: {
- menuBtn: false,
- span: 6,
- labelWidth: 90,
- disabled: false,
- column: [
- {
- label: '凭证类型',
- prop: "vkno",
- disabled: false,
- },
- {
- label: '汇兑损益科目',
- prop: "plAccFnm",
- disabled: false,
- },
- {
- label: '摘要',
- prop: "descr",
- disabled: false,
- }
- ]
- },
- option: {},
- optionList: {
- disabled: false,
- border: true,
- align: 'center',
- // index: true,
- refreshBtn: false,
- addBtn: false,
- cellBtn: true,
- addRowBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 120,
- menu: false,
- tip: false,
- selection: true,
- column: [{
- label: '科目代码',
- prop: 'accNo',
- overHidden: true,
- display: false
- }, {
- label: '科目名称',
- prop: 'cnm',
- overHidden: true,
- display: false
- }, {
- label: '方向',
- prop: 'dc',
- overHidden: true,
- display: false
- }, {
- label: '币种',
- prop: 'fcyNo',
- overHidden: true,
- display: false
- }]
- }
- }
- },
- components: { SearchQuery, reportDialog },
- props: {
- onLoad: Object,
- detailData: Object
- },
- async created() {
- if (this.detailData.id) {
- this.editButton = true
- this.optionForm.disabled = true
- this.getDetail(this.detailData.id, this.detailData.type)
- }
- this.option = await this.getColumnData(this.getColumnName(368), this.optionList);
- },
- methods: {
- selectionChange(list) {
- this.selectionList = list
- },
- //修改提交触发
- submit() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- this.form.accItems.forEach(item => {
- item.selected = 'false'
- })
- this.selectionList.forEach(e => {
- this.form.accItems.forEach(item => {
- if (item.id == e.id) {
- item.selected = 'true'
- }
- })
- })
- let obj = {
- ...this.bigObj,
- periodVouchersTemplate: this.form
- }
- submit(obj).then(res => {
- this.form = res.data.data
- this.$message.success("保存成功");
- this.editButton = true;
- this.getDetail(this.form.periodVouchersTemplate.id, this.form.periodVouchersTemplate.bsType)
- }).finally(() => {
- loading.close();
- });
- } else {
- return false;
- }
- });
- },
- getDetail(id, type) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- })
- getDetails({ id: id, type: type }).then(res => {
- this.bigObj = res.data.data
- this.form = res.data.data.periodVouchersTemplate
- }).catch(() => {
- }).finally(() => {
- loading.close();
- this.form.accItems.forEach((e, index) => {
- if (e.selected == 'true') {
- this.$refs.crud.toggleRowSelection(e);
- }
- })
- });
- },
- importData() {
- this.$confirm('是否导入科目明细总账?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- getAccountsItemsList({ type: this.form.bsType == 'FM-CURRENCY-PL-TRANSFER' ? 1 : 2 }).then(res => {
- this.form.accItems = res.data.data
- this.$message.success("导入成功");
- }).finally(() => {
- this.form.accItems.forEach((e, index) => {
- if (e.selected == 'true') {
- this.$refs.crud.toggleRowSelection(e);
- }
- })
- });
- })
- },
- //自定义列保存
- 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;
- }
- },
- goBack(type) {
- this.$emit("goBack", type);
- },
- // 弹框的重置
- resetCrud() {
- this.$message.success("重置成功");
- },
- // 弹窗的保存
- saveCrud() {
- this.$message.success("保存成功");
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- </style>
|