hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
  <div class="custom-box">
    <v-header
      title="服务类型管理"
    ></v-header>
    <div class="serachContent">
      <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="关键词">
          <el-input v-model="search.keyWord" style="width:350px" size="small" placeholder="请输入 请输入类型名称进行查找"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" @click="onSearch()">查询</el-button>
          <el-button size="small" @click="Reset()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="addBtn">
      <el-button size="small" type="primary" @click="add">新增</el-button>
    </div>
    <div class="tableBox">
      <my-eltable
        id="printTable"
        ref="mt"
        :paginationDataSource="tableData"
        :tabheight="tabheight"
        :tableHeader="tableHeader"
        :loading="loading"
        :checkbox="checkboxTable"
        :isIndex="isIndex"
        @onPageSizeChange="onPageSizeChange"
        @onPaginationChange="onPaginationChange"
      >
        <template v-slot:btn="{ scope }">
          <el-button type="text" @click="edit(scope)">编辑</el-button>
          <el-button type="text" @click="deletes(scope)">删除</el-button>
        </template>
      </my-eltable>
    </div>
    <!-- 弹框模板 -->
    <AddServer v-model="isShow" :serverData="serverData" @change="isShow = false" @success="onAddSuccess"></AddServer>
  </div>
</template>
<script>
 
// import * as organizationServicer from '@/services/organizationServicer';
import MyEltable from '@/components/table/table2';
import AddServer from './com/AddServer'
export default {
  components: { MyEltable, AddServer },
  props: [],
  data() {
    return {
      isShow: false,
      tableData: {},
      loading: false,
      checkboxTable: false,
      isIndex: true,
      tabheight: '100%',
      tableHeader: [
        { label: '类型名称', prop: 'name' },
        { label: '备注', prop: 'remark' },
        { label: '创建人', prop: 'createByName' },
        { label: '创建时间', prop: 'createAt' },
        { label: '操作', slot: 'btn' }
      ],
      search: {
        keyWord: ''
      },
      /** 分页参数 */
      paginationParams: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      serverData: {}
    };
  },
 
  mounted() {
    this.init();
  },
  methods: {
    add() {
      this.isShow = true;
    },
    edit(d) {
      this.serverData = d;
      this.isShow = true;
    },
    onAddSuccess() {
      this.isShow = false;
      this.init()
    },
    deletes(d) {
      this.$confirm('确定要删除该服务类型吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        this.$api.get('volunteer/service/type/delete',d,res=>{
          this.$message('删除成功');
          this.init();
        })
        // return
        // await organizationServicer.deleteservice(d)
 
      }).catch((res) => {
        this.$message(res.message)
      });
    },
    /** pageSize 改变时会触发 */
    onPageSizeChange (pageSize) {
      this.paginationParams.pageSize = pageSize;
      this.init();
    },
    /** 分页 */
    onPaginationChange (page) {
      this.paginationParams.currentPage = page;
      this.init();
    },
 
    onSearch() {
      this.init();
    },
    Reset() {
      this.search = {
        status: '',
        keyword: ''
      };
      this.init();
    },
 
    async init() {
      const params = {
        pageNum: this.paginationParams.currentPage,
        pageSize: this.paginationParams.pageSize,
        ...this.search
      }
      this.$api.post('volunteer/service/type/page',params,res=>{
        this.tableData = res;
      })
      // return
      // const res = await organizationServicer.servicepage(params)
      // this.tableData = res;
    }
  }
};
</script>
<style lang="less" scoped>
  /*@import '../../../styles/table.less';*/
 
</style>