123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <div>
- <basic-container v-show="show">
- <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
- :table-loading="loading" :cell-style="cellStyle" @search-change="searchChange" @search-reset="searchReset"
- @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @saveColumn="saveColumn" @resetColumn="resetColumn" @on-load="onLoad"
- @search-criteria-switch="searchCriteriaSwitch">
- <template slot="corpIdSearch">
- <select-component v-model="search.corpId" :configuration="configuration"></select-component>
- </template>
- <template slot="menuLeft">
- <el-button type="primary" size="small" icon="el-icon-plus" @click="addReceipt">创建单据
- </el-button>
- <el-button type="warning" size="small" icon="el-icon-top" @click.stop="openExport()">导出</el-button>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button type="text" size="small" icon="el-icon-delete" @click.stop="rowDel(scope.row, scope.index)">删除
- </el-button>
- </template>
- <template slot-scope="scope" slot="srcOrderno">
- <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row)">{{ scope.row.srcOrderno
- }}</span>
- </template>
- <template slot-scope="scope" slot="corpId">
- <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row)">{{ scope.row.corpName }}</span>
- </template>
- </avue-crud>
- </basic-container>
- <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-if="!show"></detail-page>
- </div>
- </template>
- <script>
- import option from "./configuration/mainList.json";
- import { getList, remove } from "@/api/financialManagement/financialManagement"
- import detailPage from "./receiptSettleDetailsPage.vue";
- import { getToken } from "@/util/auth";
- export default {
- data() {
- return {
- loading: false,
- form: {},
- search: {},
- option: {},
- parentId: 0,
- show: true,
- detailData: {},
- dataList: [{
- canem: ""
- }],
- page: {
- pageSize: 10,
- pagerCount: 5,
- total: 0,
- },
- query: {},
- configuration: {
- multipleChoices: false,
- multiple: false,
- disabled: false,
- searchShow: true,
- collapseTags: false,
- clearable: true,
- placeholder: '请点击右边按钮选择',
- dicData: []
- },
- }
- },
- components: {
- detailPage
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(64), option);
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- },
- activated() {
- if (this.$route.query.id) {
- this.show = true;
- this.$store.commit("COLL_OPEN_EXPORT_DETAIL");
- this.editOpen({ id: this.$route.query.id });
- }
- },
- mounted() {
- // this.option.height = window.innerHeight - 200;
- },
- methods: {
- searchCriteriaSwitch(type) {
- if (type) {
- this.option.height = this.option.height - 90
- } else {
- this.option.height = this.option.height + 90
- }
- this.$refs.crud.getTableHeight()
- },
- //新单打开
- addReceipt(row) {
- this.detailData = {
- id: row.id,
- status: 1,
- corpId: row.corpId,
- };
- this.show = false;
- },
- //编辑打开
- editOpen(row) {
- const data = {
- moduleName: 'sf',
- tableName: 'finance_settlement',
- billId: row.id,
- no: localStorage.getItem('browserID')
- }
- this.checkLock(data).then(res => {
- if (res.data.code == 200) {
- this.detailData = {
- disabled: true,
- id: row.id,
- corpId: row.corpId,
- };
- this.show = false;
- }
- }).catch(error => {
- this.detailData = {
- disabled: true,
- id: row.id,
- corpId: row.corpId,
- };
- this.show = false;
- })
- },
- rowDel(row, index, done) {
- if (row.id) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- remove(row.id).then(res => {
- if (res.data.success) {
- this.$message.success("操作成功!");
- this.onLoad(this.page);
- }
- })
- });
- }
- },
- //点击搜索按钮触发
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done()
- },
- searchReset() {
- console.log('1')
- },
- selectionChange() {
- console.log('1')
- },
- currentChange(val) {
- this.page.currentPage = val
- },
- sizeChange() {
- console.log('1')
- },
- refreshChange(params) {
- this.onLoad(this.page, params)
- },
- paramsAdjustment(params) {
- params = Object.assign({}, this.search);
- if (params.settlementDate && params.settlementDate.length !== 0) { //合同
- params.settlementStartDate = params.settlementDate[0] + " " + "00:00:00";
- params.settlementEndDate = params.settlementDate[1] + " " + "23:59:59";
- this.$delete(params, 'settlementDate')
- }
- if (params.completionTime && params.completionTime.length !== 0) {
- params.completionTimeStart = params.completionTime[0] + " " + "00:00:00";
- params.completionTimeEnd = params.completionTime[1] + " " + "23:59:59";
- this.$delete(params, 'completionTime')
- }
- return params
- },
- onLoad(page, params) {
- this.loading = true
- params = this.paramsAdjustment(params)
- params.billType = "收费"
- params.settlementType = 1
- getList(page.currentPage, page.pageSize, params).then(res => {
- this.dataList = res.data.data.records
- this.page.total = res.data.data.total
- if (this.page.total) {
- this.option.height = window.innerHeight - 240;
- }
- }).finally(() => {
- this.loading = false
- })
- },
- goBack() {
- this.detailData = this.$options.data().detailData
- this.show = true;
- this.onLoad(this.page, this.search)
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- //列保存触发
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(64),
- this.option
- );
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- const inSave = await this.delColumnData(
- this.getColumnName(64),
- option
- );
- if (inSave) {
- this.$message.success("重置成功");
- this.option = option;
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- openExport() {
- let params = JSON.parse(JSON.stringify(this.search))
- if (params.settlementDate && params.settlementDate.length !== 0) { //合同
- params.settlementStartDate = params.settlementDate[0] + " " + "00:00:00";
- params.settlementEndDate = params.settlementDate[1] + " " + "23:59:59";
- this.$delete(params, 'settlementDate')
- }
- if (params.completionTime && params.completionTime.length !== 0) {
- params.completionTimeStart = params.completionTime[0] + " " + "00:00:00";
- params.completionTimeEnd = params.completionTime[1] + " " + "23:59:59";
- this.$delete(params, 'completionTime')
- }
- params.billType = "收费"
- params.settlementType = 1
- const routeData = this.$router.resolve({
- path: '/api/trade-finance/settlement/expenseExport', //跳转目标窗口的地址
- query: {
- ...params //括号内是要传递给新窗口的参数
- }
- })
- window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
- },
- }
- }
- </script>
- <style scoped></style>
|