123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <div>
- <basic-container v-if="isShow" class="page-crad">
- <avue-crud
- ref="crud"
- :option="option"
- :data="dataList"
- :before-open="beforeOpen"
- :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"
- >
- <template slot-scope="{ row }" slot="updateUser">
- <span>{{ row.updateUserName }}</span>
- </template>
- <template slot-scope="{ row, index }" slot="menu">
- <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
- 查看
- </el-button>
- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
- 编辑
- </el-button>
- <el-button type="text" size="small" @click.stop="rowDel(row, index)">
- 删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <detailPage
- v-else
- ref="detail"
- @goBack="goBack"
- :detailData="detailData"
- ></detailPage>
- </div>
- </template>
- <script>
- import detailPage from "./detailsPage";
- import { getList, remove } from "@/api/salaryManagement/primarySchool";
- export default {
- name: "index",
- components: {
- detailPage
- },
- data() {
- return {
- form: {},
- dataList: [],
- loading: false,
- isShow: true,
- detailData: {},
- page: {
- pageSize: 10,
- currentPage: 1
- },
- option: {
- searchShow: true,
- searchMenuSpan: 16,
- align: "center",
- searchSpan: 8,
- border: true,
- index: true,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 120,
- searchIcon: true,
- searchIndex: 2,
- addBtnText: "新单",
- column: [
- {
- label: "年",
- prop: "annual",
- type: "year",
- valueFormat: "yyyy",
- overHidden: true,
- width: 100,
- search: true
- },
- {
- label: "月",
- prop: "moon",
- type: "select",
- filterable: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=month",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- overHidden: true,
- width: 100,
- search: true
- },
- {
- label: "制单人",
- prop: "createUser",
- type: "select",
- filterable: true,
- dicUrl: "/api/blade-user/client/gainUser",
- props: {
- label: "name",
- value: "id"
- },
- overHidden: true,
- width: 100,
- search: true
- },
- {
- label: "制单日期",
- prop: "createTime",
- type: "date",
- overHidden: true,
- width: 200
- },
- {
- label: "更新人",
- prop: "updateUser",
- overHidden: true,
- width: 100
- },
- {
- label: "更新日期",
- prop: "updateTime",
- type: "date",
- overHidden: true,
- width: 200
- },
- {
- label: "备注",
- prop: "remarks",
- overHidden: true,
- search: true
- }
- ]
- }
- };
- },
- methods: {
- 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);
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- onLoad(page, params) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, params)
- .then(res => {
- this.dataList = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- if (this.page.total) {
- this.option.height = window.innerHeight - 260;
- }
- })
- .finally(() => {
- this.loading = false;
- });
- },
- //新增跳转页面
- beforeOpen() {
- this.isShow = false;
- },
- editOpen(row, status) {
- this.detailData = {
- id: row.id,
- status: status
- };
- this.isShow = false;
- },
- 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);
- }
- });
- });
- },
- goBack() {
- this.detailData = this.$options.data().detailData;
- this.isShow = true;
- }
- }
- };
- </script>
- <style scoped>
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- </style>
|