123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <script>
- import { dicts } from "./dicts";
- import useColumns from "./columns";
- import { LIST } from "@/api/business/purchase/apply";
- export default {
- name: "PuchaseApply",
- dicts: dicts,
- components: {
- SeeButton: () => import("./see/index.vue"),
- AddButton: () => import("./add/index.vue"),
- CopyButton: () => import("./copy/index.vue"),
- EditButton: () => import("./edit/index.vue"),
- DeleButton: () => import("./delete/index.vue"),
- SubmButton: () => import("./submit/index.vue"),
- ElSuperTable: () => import("@/components/super-table/index.vue"),
- ElSuperSearch: () => import("@/components/super-search/index.vue"),
- },
- data() {
- const { TableColumns, SearchColumns } = useColumns();
- const page = this.$init.page();
- const params = this.$init.params(SearchColumns);
- return {
- size: "mini",
- loading: false,
- params: params,
- page: page,
- tableData: [],
- selectData: [],
- SearchColumns: SearchColumns,
- TableColumns: TableColumns,
- };
- },
- 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
- console.error(err);
- } finally {
- // finally
- this.loading = false;
- }
- },
- // 查 询
- useQuery(prop, page) {
- this.fetchList(prop, page);
- },
- // 重 置
- useReset() {
- this.page = this.$init.page();
- this.params = this.$init.params(this.SearchColumns);
- this.useQuery(this.params, this.page);
- },
- // 选 择
- useSelect(prop) {
- this.selectData = prop;
- },
- // 明 细
- async useSee(prop) {
- const { open } = this.$refs.SeeButton;
- await open([prop]);
- },
- },
- };
- </script>
- <template>
- <el-card
- v-loading="loading"
- :body-style="{
- height: '100%',
- padding: 0,
- display: 'flex',
- 'flex-direction': 'column',
- }"
- >
- <el-super-search
- v-model="params"
- :size="size"
- :dict="dict"
- :columns="SearchColumns"
- @reset="useReset"
- @submit="useQuery(params, page)"
- ></el-super-search>
- <el-row class="my-4" style="text-align: right">
- <el-button-group>
- <add-button
- :size="size"
- :dict="dict"
- @success="useQuery(params, page)"
- ></add-button>
- <copy-button
- :size="size"
- :dict="dict"
- :select-data="selectData"
- @success="useQuery(params, page)"
- >
- </copy-button>
- </el-button-group>
- <el-button-group>
- <see-button
- v-show="false"
- :size="size"
- :dict="dict"
- :model="params"
- :select-data="selectData"
- ref="SeeButton"
- @success="useQuery(params, page)"
- ></see-button>
- <edit-button
- :size="size"
- :dict="dict"
- :select-data="selectData"
- @success="useQuery(params, page)"
- ></edit-button>
- <dele-button
- :size="size"
- :select-data="selectData"
- @success="useQuery(params, page)"
- ></dele-button>
- </el-button-group>
- <el-button-group>
- <subm-button
- :size="size"
- :select-data="selectData"
- @success="useQuery(params, page)"
- ></subm-button>
- </el-button-group>
- </el-row>
- <el-super-table
- v-model="tableData"
- :size="size"
- :dict="dict"
- :page="page"
- :columns="TableColumns"
- index
- checkbox
- pagination
- convenitentOperation
- storage-key="PuchaseApplySuperTable1"
- @row-dblclick="useSee"
- @row-select="useSelect"
- @pagination="useQuery(params, page)"
- >
- </el-super-table>
- </el-card>
- </template>
- <style scoped lang="scss">
- .el-card {
- width: calc(100% - 32px);
- height: calc(100vh - 32px);
- margin: 16px;
- padding: 16px;
- border-radius: 8px;
- }
- .el-button-group + .el-button-group {
- margin: 0 0 0 8px;
- }
- </style>
|