| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <search @search="reload" />
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :page-size="pageSize"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit('add')"
- v-if="$hasPermission('main:teamtime:save')"
- >
- 新建
- </el-button>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit('edit', row)"
- v-if="$hasPermission('main:teamtime:update')"
- >
- 修改
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此班次吗?"
- @confirm="remove(row)"
- v-if="$hasPermission('main:teamtime:delete')"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <edit ref="edit" @done="done"></edit>
- </div>
- </template>
- <script>
- import tabMixins from '@/mixins/tableColumnsMixin';
- import edit from './components/edit.vue';
- import {
- getteamtime,
- deleteteamtime
- } from '@/api/workforceManagement/classes';
- import search from './components/search.vue';
- export default {
- mixins: [tabMixins],
- components: {
- edit,
- search
- },
- data () {
- return {
- columns: [
- {
- width: 45,
- type: 'index',
- columnKey: 'index',
- align: 'center',
- fixed:'left'
- },
- {
- prop: 'code',
- label: '班次编号'
- },
- {
- label: '班次名称',
- prop: 'name'
- },
- {
- label: '所属工厂',
- prop: 'factoryName'
- },
- {
- label: '创建人',
- prop: 'createUserName'
- },
- {
- label: '创建时间',
- prop: 'createTime'
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 220,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true,
- fixed:'right'
- }
- ],
- dict: {
- enabled: {
- 1: '生效',
- 0: '未生效'
- },
- groupId: []
- },
- pageSize: this.$store.state.tablePageSize,
- cacheKeyUrl: 'bd54dd9f-workforceManagement-classes'
- };
- },
- methods: {
- datasource ({ page, where, limit }) {
- let data = getteamtime({
- ...where,
- pageNum: page,
- size: limit
- });
- console.log(data);
- return data;
- },
- openEdit (type, row) {
- this.$refs.edit.open(type, row);
- },
- remove (row) {
- let par = [row.id];
- deleteteamtime(par)
- .then((message) => {
- this.$message.success(message);
- this.done();
- })
- .catch((e) => {
- this.$message.error(e.message);
- });
- },
- done () {
- this.$refs.table.reload({
- page: 1
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- },
- openclass () {
- this.$refs.setclasses.open();
- }
- }
- };
- </script>
|