123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <div>
- <basic-container v-show="show" class="page-crad">
- <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
- @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
- @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
- <template slot="menuLeft">
- <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newAdd()">新增
- </el-button>
- </template>
- <template slot-scope="{ row,index}" slot="sysNo">
- <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.sysNo }}</span>
- </template>
- <template slot-scope="{ row,index}" slot="corpId">
- <span>{{ row.corpName }}</span>
- </template>
- <template slot="corpIdSearch">
- <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
- </template>
- <!-- <template slot="financingDateSearch">
- <el-date-picker v-model="search.financingDate" type="daterange" start-placeholder="开始日期"
- end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
- </el-date-picker>
- </template> -->
- <template slot-scope="{ row, index }" slot="menu">
- <el-button type="text" size="small" :disabled="row.status>0" @click.stop="rowDel(row, index)">
- 删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <details-page v-if="!show" @goBack="backToList" :detailData="detailData" />
- </div>
- </template>
- <script>
- import detailsPage from "./detailsPage";
- import { option } from "./js/optionList";
- import { getList, remove } from "@/api/basicData/financing";
- export default {
- name: "index",
- data() {
- return {
- show: true,
- loading: false,
- form: {},
- search: {},
- detailData: {},
- dataList: [],
- selectionList: [],
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 50, 100, 200, 300, 400, 500]
- },
- option: {},
- };
- },
- components: {
- detailsPage
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(198), option);
- this.getWorkDicts("approval_status").then(res => {
- this.findObject(this.option.column, "status").dicData =
- res.data.data;
- });
- this.getWorkDicts("financing_type").then(res => {
- this.findObject(this.option.column, "financingType").dicData =
- res.data.data;
- });
- this.option.height = window.innerHeight - 210;
- },
- activated() {
- setTimeout(() => {
- if (this.$route.query.check && this.show) {
- console.log(this.$route.query.check)
- // this.detailData = {
- // id: this.$route.query.check
- // }
- this.editOpen(this.$route.query.check.srcBillId,1)
- this.show = false;
- }
- }, 100);
- },
- methods: {
- searchCriteriaSwitch(type) {
- if (type) {
- this.option.height = this.option.height - 46;
- } else {
- this.option.height = this.option.height + 46;
- }
- this.$refs.crud.getTableHeight();
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- //点击搜索按钮触发
- searchChange(params, done) {
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- refreshChange() {
- this.onLoad(this.page, this.search);
- },
- newAdd() {
- this.show = false;
- },
- onLoad(page, params = {}) {
- this.loading = true;
- this.dataList.forEach(item => {
- this.$refs.crud.toggleRowExpansion(item, false);
- });
- getList(
- page.currentPage,
- page.pageSize,
- Object.assign(params, this.search)
- )
- .then(res => {
- this.dataList = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- editOpen(row, status) {
- this.detailData = {
- id: row.id,
- status: status
- };
- this.show = false;
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- rowDel(row, index, done) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- remove(row.id).then(res => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.onLoad(this.page, this.search);
- }
- });
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(198),
- this.option
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.option = option;
- const inSave = await this.delColumnData(this.getColumnName(198), option);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- //返回列表
- backToList() {
- this.detailData = this.$options.data().detailData;
- this.show = true;
- this.onLoad(this.page, this.search);
- }
- }
- };
- </script>
- <style scoped>
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- </style>
|