123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <script>
- import { dicts } from "./dicts";
- import { TableColumns, SearchColumns } from "./columns";
- import { LIST } from "@/api/business/purchase/catalogue";
- export default {
- name: "PuchaseCatalogue",
- dicts: dicts,
- components: {
- SeeButton: () => import("./see/index.vue"),
- InvButton: () => import("./invalid/index.vue"),
- EnaButton: () => import("./enable/index.vue"),
- ExpButton: () => import("./export/index.vue"),
- ElSuperTable: () => import("@/components/super-table/index.vue"),
- ElSuperSearch: () => import("@/components/super-search/index.vue"),
- },
- data() {
- const params = this.$init.params(SearchColumns);
- return {
- size: "mini",
- loading: false,
- params: params,
- tableData: [],
- selectData: [],
- SearchColumns: SearchColumns,
- TableColumns: TableColumns,
- page: { pageNum: 1, pageSize: 10, total: 0 },
- };
- },
- computed: {},
- created() {
- this.useQuery(this.params, this.page);
- },
- methods: {
- //
- async fetchList(prop, page) {
- try {
- this.loading = true;
- const { pageNum, pageSize } = page;
- const { code, rows, total } = await LIST(
- { ...prop },
- { pageNum, pageSize }
- );
- if (code === 200) {
- this.tableData = rows.map((item, index) => ({
- ...item,
- $index: (pageNum - 1) * pageSize + index + 1,
- }));
- this.page.total = total;
- }
- } catch (err) {
- // catch
- } finally {
- // finally
- this.loading = false;
- }
- },
- // 查 询
- useQuery(prop, page) {
- this.selectData = [];
- this.fetchList(prop, page);
- },
- // 重 置
- useReset() {
- this.page.pageNum = 1;
- this.page.pageSize = 10;
- this.params = this.$init.params(SearchColumns);
- this.useQuery(this.params, this.page);
- },
- // 选 择
- useSelect(prop) {
- this.selectData = prop;
- },
- // 明 细
- async useSee(prop) {
- const { $index } = prop;
- const { open } = this.$refs.SeeButton;
- await open($index);
- },
- },
- };
- </script>
- <template>
- <el-card v-loading="loading" :body-style="{ padding: 0 }">
- <el-super-search
- v-model="params"
- :size="size"
- :dict="dict"
- :columns="SearchColumns"
- @reset="useReset"
- @submit="useQuery(params, page)"
- ></el-super-search>
- <div style="padding: 0 20px; text-align: right">
- <el-button-group>
- <ena-button
- :size="size"
- :select-data="selectData"
- status="Y"
- @success="useQuery(params, page)"
- ></ena-button>
- <ena-button
- :size="size"
- :select-data="selectData"
- status="N"
- @success="useQuery(params, page)"
- ></ena-button>
- </el-button-group>
- <el-button-group>
- <inv-button
- :size="size"
- :select-data="selectData"
- @success="useQuery(params, page)"
- ></inv-button>
- <see-button
- v-show="false"
- ref="SeeButton"
- :size="size"
- :dict="dict"
- :select-data="selectData"
- @success="useQuery(params, page)"
- ></see-button
- ></el-button-group>
- <el-button-group>
- <exp-button
- :size="size"
- :page="page"
- :data="params"
- @success="useQuery(params, page)"
- ></exp-button>
- </el-button-group>
- </div>
- <el-super-table
- v-model="tableData"
- :size="size"
- :dict="dict"
- :columns="TableColumns"
- stroage
- hideOperationColumns
- @row-dblclick="useSee"
- @selection-change="useSelect"
- >
- <el-table-column fixed width="55" align="center" type="selection">
- </el-table-column>
- </el-super-table>
- <pagination
- :total="page.total"
- :page.sync="page.pageNum"
- :limit.sync="page.pageSize"
- @pagination="useQuery(params, page)"
- style="margin: 20px"
- />
- </el-card>
- </template>
- <style scoped lang="scss">
- .el-card {
- width: calc(100% - 20px);
- height: 100%;
- margin: 10px;
- padding: 0 0 20px 0;
- }
- .el-button-group + .el-button-group {
- margin: 0 0 0 10px;
- }
- </style>
|