shuishen
2021-08-13 e8a728024b32be3d227e406c13aee47bb254d10f
src/views/qualificationExamination/paymentInquiry.vue
@@ -2,32 +2,56 @@
 * @Author: Morpheus
 * @Date: 2021-07-07 17:30:05
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-10 16:06:14
 * @Last Modified time: 2021-08-12 19:32:05
 * menu-name 缴费查询
 */
<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      :permission="permissionList"
      v-model="form"
      ref="crud"
      @row-update="rowUpdates"
      @row-save="rowSave"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option"
                   :table-loading="loading"
                   :data="data"
                   :page.sync="page"
                   :permission="permissionList"
                   v-model="form"
                   ref="crud"
                   @row-update="rowUpdates"
                   @row-save="rowSave"
                   @row-del="rowDel"
                   @search-change="searchChange"
                   @search-reset="searchReset"
                   @selection-change="selectionChange"
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   @refresh-change="refreshChange"
                   @on-load="onLoad">
            <template slot-scope="{ type, size, row }"
                      slot="menu">
                <el-button icon="el-icon-edit"
                           :size="size"
                           :type="type"
                           @click.stop="payTheFees(row)">缴费确认
                </el-button>
            </template>
            <template class="tdtype"
                      slot-scope="{ row }"
                      slot="paymentStatus">
                <el-tag class="dtype">
                    {{ row.paymentStatus == "1" ? "已缴费" : row.paymentStatus == "2" ? "未缴费" : "部分缴费" }}
                    <i class="gz"
                       v-if="row.paymentStatus == '1'"></i>
                    <i class="yj"
                       v-if="row.paymentStatus == '2'"></i>
                    <i class="zc"
                       v-if="row.paymentStatus == '3'"></i>
                </el-tag>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
@@ -41,339 +65,404 @@
import { mapGetters } from "vuex";
import { datasing } from "./dataqualificationExamination";
// import { getList } from "@/api/qualificationExamination/qualificationExamination";
import { getLispereexamPayment } from "@/api/qualificationExamination/scoreInquiry";
import { getLispereexamPayment, update } from "@/api/qualificationExamination/scoreInquiry";
export default {
  data() {
    var dic1 = [
      {
        label: "公司缴费",
        value: 1,
      },
      {
        label: "个人缴费",
        value: 2,
      },
    ];
    var dic2 = [
      {
        label: "已缴费",
        value: 1,
      },
      {
        label: "未缴费",
        value: 2,
      },
      {
        label: "部分缴费",
        value: 3,
      },
    ];
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        addBtn: false,
        selection: true,
        menu: false,
    data () {
        var dic1 = [
            {
                label: "公司缴费",
                value: 1,
            },
            {
                label: "个人缴费",
                value: 2,
            },
        ];
        var dic2 = [
            {
                label: "已缴费",
                value: 1,
            },
            {
                label: "未缴费",
                value: 2,
            },
            {
                label: "部分缴费",
                value: 3,
            },
        ];
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            selectionList: [],
            option: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: false,
                addBtn: false,
                selection: true,
                menu: true,
        searchShowBtn: false,
                searchShowBtn: false,
        align: "center",
        height: "auto",
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        index: true,
        viewBtn: true,
        dialogClickModal: false,
                align: "center",
                height: "auto",
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                index: true,
                viewBtn: true,
                dialogClickModal: false,
        column: [
          // {
          //   label: "姓名",
          //   prop: "securityName",
          //   // slot: true,
          //   // display: false,
          // },
          {
            label: "缴费类型",
            prop: "type",
            dicData: dic1,
            searchSpan: 4,
            search: true,
            type: "select",
            // slot: true,
            // display: false,
          },
          {
            // label: "考试开始时间",
            label: "缴费时间",
            prop: "paymentTime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            labelWidth: 120,
            searchSpan: 4,
            // search: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: "请输入时间",
                trigger: "click",
              },
                column: [
                    // {
                    //   label: "姓名",
                    //   prop: "securityName",
                    //   // slot: true,
                    //   // display: false,
                    // },
                    {
                        label: "缴费类型",
                        prop: "type",
                        dicData: dic1,
                        searchSpan: 4,
                        search: true,
                        type: "select",
                        // slot: true,
                        // display: false,
                    },
                    {
                        // label: "考试开始时间",
                        label: "缴费时间",
                        prop: "paymentTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        labelWidth: 120,
                        searchSpan: 4,
                        // search: true,
                        overHidden: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入时间",
                                trigger: "click",
                            },
                        ],
                        // slot: true,
                        // display: false,
                        // formatter: function (row, value) {
                        //   return (value = value + "%");
                        // },
                    },
                    // {
                    //   label: "考试结束时间",
                    //   prop: "examEndTime",
                    //   type: "date",
                    //   format: "yyyy-MM-dd",
                    //   valueFormat: "yyyy-MM-dd",
                    //   labelWidth: 120,
                    //   searchSpan: 4,
                    //   search: true,
                    //   overHidden: true,
                    //   rules: [
                    //     {
                    //       required: true,
                    //       message: "请输入时间",
                    //       trigger: "click",
                    //     },
                    //   ],
                    //   // slot: true,
                    //   // display: false,
                    //   // formatter: function (row, value) {
                    //   //   return (value = value + "万元");
                    //   // },
                    // },
                    // {
                    //   label: "考试类型",
                    //   prop: "examinationaddress",
                    //   // slot: true,
                    //   // display: false,
                    // },
                    {
                        label: "缴费人",
                        prop: "deptName",
                        searchSpan: 4,
                        search: true,
                        // slot: true,
                        // display: false,
                    },
                    {
                        label: "缴费状态",
                        prop: "paymentStatus",
                        searchSpan: 4,
                        search: true,
                        dicData: dic2,
                        type: "select",
                        // slot: true,
                        // display: false,
                    },
                    {
                        label: "报名编号",
                        prop: "applyCode",
                        overHidden: true,
                        // slot: true,
                        // display: false,
                    },
                ],
            },
            data: [
                // {
                //   deptid: "江西众泰保安公司",
                //   punishtype: 2,
                //   punishreason: "非法施工",
                //   punishresult: "没收全部非法所得财产,并罚款3W元",
                //   punishtime: "2021-01-01",
                //   punisnum: 110110110120,
                // },
            ],
            // slot: true,
            // display: false,
            // formatter: function (row, value) {
            //   return (value = value + "%");
            // },
          },
          // {
          //   label: "考试结束时间",
          //   prop: "examEndTime",
          //   type: "date",
          //   format: "yyyy-MM-dd",
          //   valueFormat: "yyyy-MM-dd",
          //   labelWidth: 120,
          //   searchSpan: 4,
          //   search: true,
          //   overHidden: true,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入时间",
          //       trigger: "click",
          //     },
          //   ],
          //   // slot: true,
          //   // display: false,
          //   // formatter: function (row, value) {
          //   //   return (value = value + "万元");
          //   // },
          // },
          // {
          //   label: "考试类型",
          //   prop: "examinationaddress",
          //   // slot: true,
          //   // display: false,
          // },
          {
            label: "缴费人",
            prop: "deptName",
            searchSpan: 4,
            search: true,
            // slot: true,
            // display: false,
          },
          {
            label: "缴费状态",
            prop: "paymentStatus",
            searchSpan: 4,
            search: true,
            dicData: dic2,
            type: "select",
            // slot: true,
            // display: false,
          },
          {
            label: "报名编号",
            prop: "applyCode",
            overHidden: true,
            // slot: true,
            // display: false,
          },
        ],
      },
      data: [
        // {
        //   deptid: "江西众泰保安公司",
        //   punishtype: 2,
        //   punishreason: "非法施工",
        //   punishresult: "没收全部非法所得财产,并罚款3W元",
        //   punishtime: "2021-01-01",
        //   punisnum: 110110110120,
        // },
      ],
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.post_add, false),
        viewBtn: this.vaildData(this.permission.post_view, false),
        delBtn: this.vaildData(this.permission.post_delete, false),
        editBtn: this.vaildData(this.permission.post_edit, false),
      };
        };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      adddata(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    computed: {
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.post_add, false),
                viewBtn: this.vaildData(this.permission.post_view, false),
                delBtn: this.vaildData(this.permission.post_delete, false),
                editBtn: this.vaildData(this.permission.post_edit, false),
            };
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdates(row, index, done, loading) {
      // console.log(42342);
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        ids () {
            let ids = [];
            this.selectionList.forEach((ele) => {
                ids.push(ele.id);
            });
            return ids.join(",");
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    // beforeOpen(done, type) {
    //   if (["edit", "view"].includes(type)) {
    //     getDetail(this.form.id).then((res) => {
    //       this.form = res.data.data;
    //     });
    //   }
    //   done();
    // },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      // this.loading = false;
      this.loading = true;
      getLispereexamPayment(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        console.log(this.data, "getLispereexamPayment");
        this.loading = false;
        // this.selectionClear();
      });
    },
    // onLoad(page, params = {}) {
    //   // this.loading = false;
    //   this.loading = true;
    //   //   getListJSON().then((res) => {
    //   //   axios
    //   //     .get(
    //   //       "../../api/qualificationExamination/signQualificationExamination.json"
    //   //     )
    //   //     .then((res) => {
    //   // page.currentPage,
    //   // page.pageSize,
    //   // Object.assign(params, this.query)
    //   if (datasing) {
    //     var res = datasing;
    //     console.log(res, "signQualificationExamination");
    //     const data = res.data;
    //     // this.page.total = data.total;
    //     var d = data.records;
    //     for (var k in d) {
    //       d[k].examination_mx = "正常";
    //       d[k].examination_type = "正常";
    //       d[k]["carid"] = "370111198807051124";
    //       d[k]["certificate"] = "拥有";
    //       d[k]["reviewTime"] = "2021-02-21";
    //       d[k]["results"] = "通过";
    //       d[k]["onjob"] = "是";
    //     }
    //     this.data = d;
    //     this.loading = false;
    //   }
    //   // this.selectionClear();
    //   // });
    // },
    methods: {
        rowSave (row, done, loading) {
            adddata(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        rowUpdates (row, index, done, loading) {
            // console.log(42342);
            update(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
    // 行单击
    // handleRowClick(row) {
    //   // delete (row["name"]);
    //   var obj = row;
    //   obj["name"] = "保安公司详细资料";
    //   this.$router.push({
    //     path: `/securityCompany/index`,
    //     query: obj,
    //   });
    // },
  },
        payTheFees (row) {
            console.log(row)
            this.$confirm("请确认是否缴费?", {
                confirmButtonText: "已缴费",
                cancelButtonText: "未缴费",
                type: "warning",
            })
                .then(() => {
                    row.paymentStatus = "1";
                    return update(row).then(() => {
                        this.onLoad(this.page);
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                    });
                })
                .catch(() => {
                    row.paymentStatus = "2";
                    return update(row).then(() => {
                        this.onLoad(this.page);
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                    });
                });
        },
        // beforeOpen(done, type) {
        //   if (["edit", "view"].includes(type)) {
        //     getDetail(this.form.id).then((res) => {
        //       this.form = res.data.data;
        //     });
        //   }
        //   done();
        // },
        searchReset () {
            this.query = {};
            this.onLoad(this.page);
        },
        searchChange (params, done) {
            this.query = params;
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        selectionChange (list) {
            this.selectionList = list;
        },
        selectionClear () {
            this.selectionList = [];
            this.$refs.crud.toggleSelection();
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange () {
            this.onLoad(this.page, this.query);
        },
        onLoad (page, params = {}) {
            // this.loading = false;
            this.loading = true;
            getLispereexamPayment(
                page.currentPage,
                page.pageSize,
                Object.assign(params, this.query)
            ).then((res) => {
                const data = res.data.data;
                this.page.total = data.total;
                this.data = data.records;
                console.log(this.data, "getLispereexamPayment");
                this.loading = false;
                // this.selectionClear();
            });
        },
        // onLoad(page, params = {}) {
        //   // this.loading = false;
        //   this.loading = true;
        //   //   getListJSON().then((res) => {
        //   //   axios
        //   //     .get(
        //   //       "../../api/qualificationExamination/signQualificationExamination.json"
        //   //     )
        //   //     .then((res) => {
        //   // page.currentPage,
        //   // page.pageSize,
        //   // Object.assign(params, this.query)
        //   if (datasing) {
        //     var res = datasing;
        //     console.log(res, "signQualificationExamination");
        //     const data = res.data;
        //     // this.page.total = data.total;
        //     var d = data.records;
        //     for (var k in d) {
        //       d[k].examination_mx = "正常";
        //       d[k].examination_type = "正常";
        //       d[k]["carid"] = "370111198807051124";
        //       d[k]["certificate"] = "拥有";
        //       d[k]["reviewTime"] = "2021-02-21";
        //       d[k]["results"] = "通过";
        //       d[k]["onjob"] = "是";
        //     }
        //     this.data = d;
        //     this.loading = false;
        //   }
        //   // this.selectionClear();
        //   // });
        // },
        // 行单击
        // handleRowClick(row) {
        //   // delete (row["name"]);
        //   var obj = row;
        //   obj["name"] = "保安公司详细资料";
        //   this.$router.push({
        //     path: `/securityCompany/index`,
        //     query: obj,
        //   });
        // },
    },
};
</script>
<style>
<style scoped>
.dtype {
    width: 80px;
}
.zc {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #29c093;
}
.yj {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #f34a4a;
}
.gz {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #f48f57;
}
</style>