liuyg
2021-07-07 81cc3cda3533bd0b8ec7f52d38709bcaa322258f
增删改查
3 files modified
317 ■■■■ changed files
src/api/recruitmentManagement/recruitmentManagement.js 32 ●●●●● patch | view | raw | blame | history
src/views/recruitmentManagement/data.js 131 ●●●●● patch | view | raw | blame | history
src/views/recruitmentManagement/index.vue 154 ●●●●● patch | view | raw | blame | history
src/api/recruitmentManagement/recruitmentManagement.js
@@ -1,11 +1,39 @@
import request from '@/router/axios';
export const getdata = (params) => {
export const getdata = (current, size, params) => {
  return request({
    url: '/api/recruitment/page',
    method: 'get',
    params: {
      ...params
      ...params,
      current,
      size,
    }
  })
}
export const adddata = (row) => {
  return request({
    url: '/api/recruitment/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/recruitment/submit',
    method: 'post',
    data: row
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/recruitment/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
src/views/recruitmentManagement/data.js
@@ -1,9 +1,68 @@
var DIC = [
    {
        label: '招聘中',
        value: 1,
    }, {
        label: '停止招聘',
        value: 2,
    }
]
var educationS = [
    {
        label: '高中及以上',
        value: "高中及以上"
    }, {
        label: '大专及以上',
        value: "大专及以上"
    }
    // {
    //     label: '初中及以下',
    //     value: "初中及以下",
    // }, {
    //     label: '高中/中技/中专',
    //     value: '高中/中技/中专',
    // },
    //  {
    //     label: '大专',
    //     value: '大专',
    // }, {
    //     label: '本科',
    //     value: '本科',
    // }, {
    //     label: '硕士',
    //     value: '硕士',
    // }, {
    //     label: '博士',
    //     value: '博士',
    // }, {
    //     label: '不限',
    //     value: '不限',
    // }
]
export var column = [
    {
        label: "id",
        prop: "id",
        hide: true,
        editDisplay: false,
        addDisplay: false
    },
    {
        label: "保安单位",
        prop: "tenantName",
        // search: true,
        hide: true,
        editDisplay: false,
        addDisplay: false
    },
    {
        label: "保安id",
        prop: "tenantId",
        hide: true,
        editDisplay: false,
        addDisplay: false
    },//上面不显示
    {
        label: "招聘岗位",
        prop: "name",
@@ -17,14 +76,61 @@
    },
    {
        label: "学历要求",
        prop: "education",
        prop: 'education',
        filter: false,
        type: 'tree',
        search: true,
        searchSpan: 4,
        searchSpan: 5,
        dicData: educationS
        // prop: "education",
        // // search: true,
        // // searchSpan: 4,
        // props: {
        //     label: 'educationType',
        //     value: 1
        // }
        // prop: "education",
        // addDisplay: true,
        // editDisplay: true,
        // viewDisplay: true,
        // searchSpan: 3,
        // dicUrl: "/api/blade-system/dict-biz/dictionary?code=education",
        // props: {
        //     label: "dictValue",
        //     value: "dictKey"
        // },
        // search: true,
        // type: "select",
        // rules: [{
        //     required: true,
        //     message: "请选择学历",
        //     trigger: "blur"
        // }],
    },
    {
        label: "工作经验",
        prop: "experience",
        search: true,
        searchSpan: 4,
    },
    {
        label: "工作任务",
        prop: "workDesc",
        // search: true,
        width: 110,
        overHidden: true
    },
    {
        label: "福利",
        prop: "welfare",
        // search: true,
        searchSpan: 4,
        overHidden: true
    },
    {
        label: "最低薪资",
        prop: "minSalary",
        // search: true,
        searchSpan: 4,
    },
    {
@@ -47,28 +153,37 @@
        label: "联系人电话",
        prop: "phone",
        // search: true,
        width: 110,
    },
    {
        label: "详细地址",
        prop: "address",
        width: 160,
        width: 110,
        // search: true,
        overHidden: true
    },
    {
        label: "开始时间",
        prop: "startTime",
        // search: true,
        width: 88,
    },
    {
        label: "结束时间",
        prop: "end_time",
        prop: "endTime",
        // search: true,
        width: 88,
    },
    {
        label: "招聘状态",
        prop: "status",
        search: true,
        searchSpan: 4,
        // prop: "status",
        // search: true,
        // searchSpan: 4,
        prop: 'status',
        filter: false,
        type: 'tree',
        dicData: DIC
    },
]
src/views/recruitmentManagement/index.vue
@@ -3,32 +3,37 @@
    <avue-crud
      :option="option"
      :data="data"
      :page.sync="page1"
      @size-change="sizeChange"
      @current-change="currentChange"
      :page.sync="page"
      :table-loading="loading"
      @row-save="rowSave"
      @search-change="searchChange"
      @search-reset="searchReset"
      @row-update="rowUpdate"
      @row-del="rowDel"
      @refresh-change="refresh"
    ></avue-crud>
  </div>
</template>
<script>
import { data, column } from "./data";
import { getdata } from "@/api/recruitmentManagement/recruitmentManagement";
import {
  getdata,
  adddata,
  update,
  remove,
} from "@/api/recruitmentManagement/recruitmentManagement";
export default {
  data() {
    return {
      loading: true,
      Ourdata: "",
      page1: {
        currentPage: 1,
        total: 20,
        layout: "total,pager,prev, next",
        background: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      query: {},
      data: [],
      option: {
        card: true,
@@ -41,33 +46,6 @@
    };
  },
  methods: {
    getData(dat) {
      var that = this,
        datas = dat || {},
        pro = {
          page: that.currentPage,
          size: that.pageSize,
          ...datas,
        };
      getdata(pro).then((res) => {
        that.data = res.data.data.records;
        console.log(res);
      });
      //   this.page1.total = this.Ourdata.length;
      //   var maxi = +this.Ourdata.length / +this.page1.pageSize;
      //   var y = String(maxi).indexOf(".") + 1; //判断小数
      //   if (y != 0) {
      //     maxi++;
      //   }
      //   for (var i = 1; i <= maxi; i++) {
      //     if (this.page1.currentPage === i) {
      //       this.data = this.Ourdata.slice(
      //         (i - 1) * this.page1.pageSize,
      //         i * this.page1.pageSize
      //       );
      //     }
      //   }
    },
    sizeChange(val) {
      this.page1.currentPage = 1;
      this.page1.pageSize = val;
@@ -81,41 +59,85 @@
    },
    rowSave(form, done, loading) {
      var that = this;
      this.$message.success("模拟网络请求");
      setTimeout(() => {
        this.$message.success("关闭按钮等待");
        loading();
      }, 1000);
      setTimeout(() => {
        this.$message.success("新增数据" + JSON.stringify(form));
        done();
        that.Ourdata.push(form);
        this.getData();
      }, 2000);
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    refresh(val) {
      this.$message.success("刷新回调,当前分页对象" + JSON.stringify(val));
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    rowDel(form, index) {
      this.$message.success("删除数据" + JSON.stringify(form));
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    rowUpdate(form, index, done, loading) {
      this.$message.success("模拟网络请求");
      setTimeout(() => {
        this.$message.success("关闭按钮等待");
        loading();
      }, 1000);
      setTimeout(() => {
        this.$message.success(
          "编辑数据" + JSON.stringify(form) + "数据序号" + index
        );
        done(form);
      }, 2000);
    rowUpdate(row, index, done, loading) {
      console.log(row);
      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: "操作成功!",
          });
        });
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getdata(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        console.log(this.data);
        this.loading = false;
      });
    },
  },
  mounted() {
    this.Ourdata = data;
    this.getData();
    // this.Ourdata = data;
    // this.getData();
    this.onLoad(this.page);
  },
};
</script>