123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <div>
- <basic-container v-show="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"
- @selection-change="selectionChange"
- :cell-style="cellStyle"
- @search-criteria-switch="searchCriteriaSwitch"
- >
- <template slot="menuLeft">
- <el-button
- type="success"
- size="small"
- @click.stop="copyDoc()"
- :disabled="selectionList.length != 1"
- >复制新单</el-button
- >
- </template>
- <template slot-scope="{ row }" slot="createUser">
- <span>{{ row.createUserName }}</span>
- </template>
- <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, 1)">
- 编辑
- </el-button> -->
- <el-button
- type="text"
- size="small"
- @click.stop="rowDel(row, index)"
- :disabled="row.status > 0"
- v-if="permission.kindergartenLogistics_edit"
- >
- 删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <detailPage
- v-if="!isShow"
- ref="detail"
- @goBack="goBack"
- @copyOrder="copyOrder"
- :detailData="detailData"
- ></detailPage>
- </div>
- </template>
- <script>
- import detailPage from "./detailsPage";
- import { option } from "./js/optionList";
- import {
- getList,
- remove,
- gainUser
- } from "@/api/salaryManagement/primarySchool";
- import { mapGetters } from "vuex";
- export default {
- name: "index",
- components: {
- detailPage
- },
- data() {
- return {
- selectionList: [],
- form: {},
- dataList: [],
- loading: false,
- isShow: true,
- detailData: {},
- page: {
- pageSize: 10,
- currentPage: 1
- },
- option: {}
- };
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(156), option);
- this.getWorkDicts("month").then(res => {
- this.findObject(this.option.column, "moon").dicData = res.data.data;
- this.$refs.crud.init();
- });
- gainUser().then(res => {
- this.findObject(this.option.column, "createUser").dicData = res.data.data;
- this.$refs.crud.init();
- });
- this.option.height = window.innerHeight - 210;
- },
- activated() {
- if (this.$route.query.check) {
- this.isShow = true;
- setTimeout(() => {
- this.editOpen({ id: this.$route.query.check.billId }, 1);
- }, 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;";
- },
- copyDoc() {
- this.selectionList.forEach(e => {
- this.detailData = {
- id: e.id,
- status: "copy"
- };
- this.isShow = false;
- });
- },
- copyOrder(id) {
- this.isShow = true;
- this.detailData = {
- id: id,
- status: "copy"
- };
- this.$nextTick(() => {
- this.isShow = false;
- });
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- //点击搜索按钮触发
- 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;
- params.salaryType = "幼儿园后勤";
- 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;
- });
- },
- //新增跳转页面
- 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);
- }
- });
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(156),
- 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(156), option);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- goBack() {
- if (this.$route.query.check) {
- this.$router.$avueRouter.closeTag(this.$route.fullPath);
- this.$router.push({
- path: "/salaryManagement/primarySchool/index"
- });
- }
- this.detailData = this.$options.data().detailData;
- this.onLoad(this.page, this.search);
- this.isShow = true;
- }
- },
- computed: {
- ...mapGetters(["permission"])
- }
- };
- </script>
- <style scoped>
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- </style>
|