|
@@ -1,124 +1,130 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
<el-form
|
|
<el-form
|
|
- :model="queryParams"
|
|
|
|
- class="main-search"
|
|
|
|
- ref="queryForm"
|
|
|
|
- size="small"
|
|
|
|
- :inline="true"
|
|
|
|
- v-show="showSearch"
|
|
|
|
- label-width="68px"
|
|
|
|
|
|
+ :model="queryParams"
|
|
|
|
+ class="main-search"
|
|
|
|
+ ref="queryForm"
|
|
|
|
+ size="small"
|
|
|
|
+ :inline="true"
|
|
|
|
+ v-show="showSearch"
|
|
|
|
+ label-width="68px"
|
|
>
|
|
>
|
|
- <el-form-item label="桌码" prop="code">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.code"
|
|
|
|
- placeholder="请输入桌码"
|
|
|
|
- clearable
|
|
|
|
- style="width: 240px"
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="状态" prop="status">
|
|
|
|
- <el-select v-model="queryParams.status" placeholder="状态" clearable style="width: 240px">
|
|
|
|
- <el-option key="A" label="启用" value="A" />
|
|
|
|
- <el-option key="N" label="禁用" value="N" />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
|
|
|
|
- 搜索
|
|
|
|
- </el-button>
|
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- plain
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
- size="mini"
|
|
|
|
- @click="handleAdd"
|
|
|
|
- v-hasPermi="['table:index']"
|
|
|
|
- >
|
|
|
|
- 新增桌码
|
|
|
|
- </el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-form-item :label="$t('tableManagement.tableCode')" prop="code">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.code"
|
|
|
|
+ :placeholder="$t('tableManagement.pleaseEnterTableCode')"
|
|
|
|
+ clearable
|
|
|
|
+ style="width: 240px"
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item :label="$t('tableManagement.status')" prop="status">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="queryParams.status"
|
|
|
|
+ :placeholder="$t('tableManagement.status')"
|
|
|
|
+ clearable
|
|
|
|
+ style="width: 240px"
|
|
|
|
+ >
|
|
|
|
+ <el-option :key="$t('tableManagement.enabledKey')" :label="$t('tableManagement.enabled')" :value="A" />
|
|
|
|
+ <el-option :key="$t('tableManagement.disabledKey')" :label="$t('tableManagement.disabled')" :value="N" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="el-icon-search"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleQuery"
|
|
|
|
+ >
|
|
|
|
+ {{ $t('tableManagement.search') }}
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ icon="el-icon-refresh"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="resetQuery"
|
|
|
|
+ >
|
|
|
|
+ {{ $t('tableManagement.reset') }}
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleAdd"
|
|
|
|
+ v-hasPermi="['table:index']"
|
|
|
|
+ >
|
|
|
|
+ {{ $t('tableManagement.addNewTableCode') }}
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
<el-table
|
|
<el-table
|
|
- ref="tables"
|
|
|
|
- v-loading="loading"
|
|
|
|
- :data="list"
|
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
|
- :default-sort="defaultSort"
|
|
|
|
- @sort-change="handleSortChange"
|
|
|
|
|
|
+ ref="tables"
|
|
|
|
+ v-loading="loading"
|
|
|
|
+ :data="list"
|
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
|
+ :default-sort="defaultSort"
|
|
|
|
+ @sort-change="handleSortChange"
|
|
>
|
|
>
|
|
- <el-table-column label="ID" prop="id" width="60">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{ showIdLastFour(scope.row.id) }}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="桌子编码" align="center" prop="code" />
|
|
|
|
- <!-- <el-table-column label="人数限制" align="center" prop="maxPeople" /> -->
|
|
|
|
- <el-table-column label="所属店铺" align="center" prop="store">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span v-if="scope.row.storeId && scope.row.storeId > 0">
|
|
|
|
- <span>{{ getName(storeList, scope.row.storeId) }}</span>
|
|
|
|
- </span>
|
|
|
|
- <span v-else>公共所有</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
- label="创建时间"
|
|
|
|
- align="center"
|
|
|
|
- prop="createTime"
|
|
|
|
- sortable="custom"
|
|
|
|
- :sort-orders="['descending', 'ascending']"
|
|
|
|
- width="180"
|
|
|
|
- >
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="状态" align="center" prop="status">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="scope.row.status"
|
|
|
|
- active-value="A"
|
|
|
|
- inactive-value="N"
|
|
|
|
- v-hasPermi="['table:index']"
|
|
|
|
- @change="handleStatusChange(scope.row)"
|
|
|
|
- ></el-switch>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <!-- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-copy-document"
|
|
|
|
- v-hasPermi="['table:index']"
|
|
|
|
- @click="handleQrCode(scope.row)"
|
|
|
|
- >
|
|
|
|
- 二维码
|
|
|
|
- </el-button> -->
|
|
|
|
- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
- v-hasPermi="['table:index']"
|
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
|
- >
|
|
|
|
- 修改
|
|
|
|
- </el-button>
|
|
|
|
- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
- v-hasPermi="['table:index']"
|
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
|
- >
|
|
|
|
- 删除
|
|
|
|
- </el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
+ <el-table-column :label="$t('tableManagement.ID')" prop="id" width="60">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ showIdLastFour(scope.row.id) }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column :label="$t('tableManagement.tableEncoding')" align="center" prop="code" />
|
|
|
|
+ <el-table-column :label="$t('tableManagement.belongingStore')" align="center" prop="store">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span v-if="scope.row.storeId && scope.row.storeId > 0">
|
|
|
|
+ <span>{{ getName(storeList, scope.row.storeId) }}</span>
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else>{{ $t('tableManagement.publicOwnership') }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="$t('tableManagement.createTime')"
|
|
|
|
+ align="center"
|
|
|
|
+ prop="createTime"
|
|
|
|
+ sortable="custom"
|
|
|
|
+ :sort-orders="['descending', 'ascending']"
|
|
|
|
+ width="180"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column :label="$t('tableManagement.status')" align="center" prop="status">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-switch
|
|
|
|
+ v-model="scope.row.status"
|
|
|
|
+ active-value="A"
|
|
|
|
+ inactive-value="N"
|
|
|
|
+ v-hasPermi="['table:index']"
|
|
|
|
+ @change="handleStatusChange(scope.row)"
|
|
|
|
+ ></el-switch>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column :label="$t('tableManagement.operation')" align="center" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-edit"
|
|
|
|
+ v-hasPermi="['table:index']"
|
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
|
+ >
|
|
|
|
+ {{ $t('tableManagement.modify') }}
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ v-hasPermi="['table:index']"
|
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
|
+ >
|
|
|
|
+ {{ $t('tableManagement.delete') }}
|
|
|
|
+ </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
<pagination
|
|
@@ -129,79 +135,76 @@
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
/>
|
|
/>
|
|
|
|
|
|
- <!-- 添加或修改对话框 -->
|
|
|
|
- <el-dialog
|
|
|
|
- :title="title"
|
|
|
|
- :visible.sync="open"
|
|
|
|
- class="common-dialog"
|
|
|
|
- width="800px"
|
|
|
|
- append-to-body
|
|
|
|
|
|
+ <!-- 添加或修改对话框 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ :title="title"
|
|
|
|
+ :visible.sync="open"
|
|
|
|
+ class="common-dialog"
|
|
|
|
+ width="800px"
|
|
|
|
+ append-to-body
|
|
>
|
|
>
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="12">
|
|
|
|
- <el-form-item label="桌子编码" prop="code">
|
|
|
|
- <el-input v-model="form.code" placeholder="请输入桌子编码,如:A01" maxlength="30" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="所属店铺" prop="storeId">
|
|
|
|
- <el-select v-model="form.storeId" placeholder="请选择所属店铺">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in storeList"
|
|
|
|
- :key="item.id"
|
|
|
|
- :label="item.name"
|
|
|
|
- :value="item.id"
|
|
|
|
- :disabled="item.status !== 'A'"
|
|
|
|
- ></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <!-- <el-row>
|
|
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="人数上限" prop="maxPeople">
|
|
|
|
- <el-input-number v-model="form.maxPeople" :min="0"/>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row> -->
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="备注信息">
|
|
|
|
- <el-input
|
|
|
|
- v-model="form.description"
|
|
|
|
- type="textarea"
|
|
|
|
- rows="3"
|
|
|
|
- placeholder="请输入备注信息内容"
|
|
|
|
- ></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="排序" prop="sort">
|
|
|
|
- <el-input-number v-model="form.sort" :min="0" />
|
|
|
|
- <div class="form-tips">提示:数值越小,排行越靠前</div>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="24">
|
|
|
|
- <el-form-item label="状态">
|
|
|
|
- <el-radio-group v-model="form.status">
|
|
|
|
- <el-radio key="A" label="A" value="A">启用</el-radio>
|
|
|
|
- <el-radio key="N" label="N" value="N">禁用</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button type="primary" @click="submitForm">确定</el-button>
|
|
|
|
- <el-button @click="cancel">取消</el-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form-item :label="$t('tableManagement.tableEncoding')" prop="code">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.code"
|
|
|
|
+ :placeholder="$t('tableManagement.pleaseEnterTableEncoding')"
|
|
|
|
+ maxlength="30"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item :label="$t('tableManagement.belongingStore')" prop="storeId">
|
|
|
|
+ <el-select v-model="form.storeId" :placeholder="$t('tableManagement.pleaseSelectBelongingStore')">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in storeList"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ :disabled="item.status!== 'A'"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item :label="$t('tableManagement.remarkInfo')">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.description"
|
|
|
|
+ type="textarea"
|
|
|
|
+ rows="3"
|
|
|
|
+ :placeholder="$t('tableManagement.pleaseEnterRemarkInfo')"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item :label="$t('tableManagement.sort')" prop="sort">
|
|
|
|
+ <el-input-number v-model="form.sort" :min="0" />
|
|
|
|
+ <div class="form-tips">{{ $t('tableManagement.sortTip') }}</div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item :label="$t('tableManagement.status')">
|
|
|
|
+ <el-radio-group v-model="form.status">
|
|
|
|
+ <el-radio :key="$t('tableManagement.enabledKey')" :label="$t('tableManagement.enabledLabel')" value="A">{{ $t('tableManagement.enabled') }}</el-radio>
|
|
|
|
+ <el-radio :key="$t('tableManagement.disabledKey')" :label="$t('tableManagement.disabledLabel')" value="N">{{ $t('tableManagement.disabled') }}</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="submitForm">{{ $t('tableManagement.confirm') }}</el-button>
|
|
|
|
+ <el-button @click="cancel">{{ $t('tableManagement.cancel') }}</el-button>
|
|
|
|
+ </div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
<FuintQrCode :showDialog="openQrCode" :qr="qr" @closeDialog="closeDialog" />
|
|
<FuintQrCode :showDialog="openQrCode" :qr="qr" @closeDialog="closeDialog" />
|
|
@@ -255,10 +258,25 @@ export default {
|
|
// 表单校验
|
|
// 表单校验
|
|
rules: {
|
|
rules: {
|
|
code: [
|
|
code: [
|
|
- { required: true, message: '桌码不能为空', trigger: 'blur' },
|
|
|
|
- { min: 2, max: 30, message: '桌码长度必须介于 2 和 30 之间', trigger: 'blur' }
|
|
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: this.$t('tableManagement.tableCodeRequired'),
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ min: 2,
|
|
|
|
+ max: 30,
|
|
|
|
+ message: this.$t('tableManagement.tableCodeLengthRange'),
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ }
|
|
],
|
|
],
|
|
- storeId: [{ required: true, message: '所属店铺不能为空', trigger: 'blur' }]
|
|
|
|
|
|
+ storeId: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: this.$t('tableManagement.belongingStoreRequired'),
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -268,128 +286,131 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// 查询列表
|
|
// 查询列表
|
|
getList() {
|
|
getList() {
|
|
- this.loading = true
|
|
|
|
- getTableList(this.queryParams).then((response) => {
|
|
|
|
- this.list = response.data.paginationResponse.content
|
|
|
|
- this.total = response.data.paginationResponse.totalElements
|
|
|
|
- this.storeList = response.data.storeList
|
|
|
|
- this.imagePath = response.data.imagePath
|
|
|
|
- this.loading = false
|
|
|
|
- })
|
|
|
|
|
|
+ this.loading = true;
|
|
|
|
+ getTableList(this.queryParams).then((response) => {
|
|
|
|
+ this.list = response.data.paginationResponse.content;
|
|
|
|
+ this.total = response.data.paginationResponse.totalElements;
|
|
|
|
+ this.storeList = response.data.storeList;
|
|
|
|
+ this.imagePath = response.data.imagePath;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 搜索按钮操作
|
|
// 搜索按钮操作
|
|
handleQuery() {
|
|
handleQuery() {
|
|
- this.queryParams.page = 1
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ this.queryParams.page = 1;
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
// 重置按钮操作
|
|
// 重置按钮操作
|
|
resetQuery() {
|
|
resetQuery() {
|
|
- this.resetForm('queryForm')
|
|
|
|
- this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
|
|
|
- this.handleQuery()
|
|
|
|
|
|
+ this.resetForm('queryForm');
|
|
|
|
+ this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order);
|
|
|
|
+ this.handleQuery();
|
|
},
|
|
},
|
|
// 状态修改
|
|
// 状态修改
|
|
handleStatusChange(row) {
|
|
handleStatusChange(row) {
|
|
- let text = row.status == 'A' ? '启用' : '禁用'
|
|
|
|
- this.$modal
|
|
|
|
- .confirm('确认要' + text + '"' + row.code + '"桌码吗?')
|
|
|
|
- .then(function () {
|
|
|
|
- return updateTableStatus(row.id, row.status)
|
|
|
|
- })
|
|
|
|
- .then(() => {
|
|
|
|
- this.$modal.msgSuccess(text + '成功')
|
|
|
|
- })
|
|
|
|
- .catch(function () {
|
|
|
|
- row.status = row.status === 'N' ? 'A' : 'N'
|
|
|
|
- })
|
|
|
|
|
|
+ let text = row.status === 'A' ? this.$t('tableManagement.enable') : this.$t('tableManagement.disable');
|
|
|
|
+ const confirmMsg = this.$t('tableManagement.confirmChangeTableStatus', { action: text, tableCode: row.code });
|
|
|
|
+ this.$modal
|
|
|
|
+ .confirm(confirmMsg)
|
|
|
|
+ .then(() => {
|
|
|
|
+ return updateTableStatus(row.id, row.status);
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ const successMsg = this.$t('tableManagement.statusChangeSuccess', { action: text });
|
|
|
|
+ this.$modal.msgSuccess(successMsg);
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ row.status = row.status === 'N' ? 'A' : 'N';
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
handleSelectionChange(selection) {
|
|
- this.ids = selection.map((item) => item.operId)
|
|
|
|
- this.multiple = !selection.length
|
|
|
|
|
|
+ this.ids = selection.map((item) => item.operId);
|
|
|
|
+ this.multiple = !selection.length;
|
|
},
|
|
},
|
|
// 排序触发事件
|
|
// 排序触发事件
|
|
handleSortChange(column, prop, order) {
|
|
handleSortChange(column, prop, order) {
|
|
- this.queryParams.orderByColumn = column.prop
|
|
|
|
- this.queryParams.isAsc = column.order
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ this.queryParams.orderByColumn = column.prop;
|
|
|
|
+ this.queryParams.isAsc = column.order;
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
// 新增按钮操作
|
|
// 新增按钮操作
|
|
handleAdd() {
|
|
handleAdd() {
|
|
- this.reset()
|
|
|
|
- this.open = true
|
|
|
|
- this.title = '新增桌码'
|
|
|
|
|
|
+ this.reset();
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.title = this.$t('tableManagement.addNewTableCode');
|
|
},
|
|
},
|
|
// 表单重置
|
|
// 表单重置
|
|
reset() {
|
|
reset() {
|
|
- this.form = {
|
|
|
|
- id: '',
|
|
|
|
- code: '',
|
|
|
|
- description: '',
|
|
|
|
- storeId: '',
|
|
|
|
- maxPeople: 0,
|
|
|
|
- sort: 0,
|
|
|
|
- status: 'A'
|
|
|
|
- }
|
|
|
|
- this.resetForm('form')
|
|
|
|
|
|
+ this.form = {
|
|
|
|
+ id: '',
|
|
|
|
+ code: '',
|
|
|
|
+ description: '',
|
|
|
|
+ storeId: '',
|
|
|
|
+ maxPeople: 0,
|
|
|
|
+ sort: 0,
|
|
|
|
+ status: 'A'
|
|
|
|
+ };
|
|
|
|
+ this.resetForm('form');
|
|
},
|
|
},
|
|
// 取消按钮
|
|
// 取消按钮
|
|
cancel() {
|
|
cancel() {
|
|
- this.open = false
|
|
|
|
- this.reset()
|
|
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.reset();
|
|
},
|
|
},
|
|
// 提交按钮
|
|
// 提交按钮
|
|
submitForm: function () {
|
|
submitForm: function () {
|
|
- this.$refs['form'].validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- if (this.form.id) {
|
|
|
|
- saveTable(this.form).then((response) => {
|
|
|
|
- this.$modal.msgSuccess('修改成功')
|
|
|
|
- this.open = false
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- saveTable(this.form).then((response) => {
|
|
|
|
- this.$modal.msgSuccess('新增成功')
|
|
|
|
- this.open = false
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (this.form.id) {
|
|
|
|
+ saveTable(this.form).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess(this.$t('tableManagement.modifySuccess'));
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ saveTable(this.form).then((response) => {
|
|
|
|
+ this.$modal.msgSuccess(this.$t('tableManagement.addSuccess'));
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 二维码
|
|
// 二维码
|
|
handleQrCode(row) {
|
|
handleQrCode(row) {
|
|
- this.qr = { page: '/pages/category/index', type: 'table', id: row.id }
|
|
|
|
- this.openQrCode = true
|
|
|
|
|
|
+ this.qr = { page: '/pages/category/index', type: 'table', id: row.id };
|
|
|
|
+ this.openQrCode = true;
|
|
},
|
|
},
|
|
// 关闭二维码
|
|
// 关闭二维码
|
|
closeDialog() {
|
|
closeDialog() {
|
|
- this.openQrCode = false
|
|
|
|
|
|
+ this.openQrCode = false;
|
|
},
|
|
},
|
|
// 修改按钮操作
|
|
// 修改按钮操作
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
- this.reset()
|
|
|
|
- const id = row.id || this.ids
|
|
|
|
- getTableInfo(id).then((response) => {
|
|
|
|
- this.form = response.data.tableInfo
|
|
|
|
- this.open = true
|
|
|
|
- this.title = '编辑桌码'
|
|
|
|
- })
|
|
|
|
|
|
+ this.reset();
|
|
|
|
+ const id = row.id || this.ids;
|
|
|
|
+ getTableInfo(id).then((response) => {
|
|
|
|
+ this.form = response.data.tableInfo;
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.title = this.$t('tableManagement.editTableCode');
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 删除按钮操作
|
|
// 删除按钮操作
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
- const code = row.code || this.id
|
|
|
|
- this.$modal
|
|
|
|
- .confirm('是否确认删除"' + code + '"的数据项?')
|
|
|
|
- .then(function () {
|
|
|
|
- return updateTableStatus(row.id, 'D')
|
|
|
|
- })
|
|
|
|
- .then(() => {
|
|
|
|
- this.getList()
|
|
|
|
- this.$modal.msgSuccess('删除成功')
|
|
|
|
- })
|
|
|
|
- .catch(() => {})
|
|
|
|
|
|
+ const code = row.code || this.id;
|
|
|
|
+ const confirmMsg = this.$t('tableManagement.confirmDeleteTableCode', { tableCode: code });
|
|
|
|
+ this.$modal
|
|
|
|
+ .confirm(confirmMsg)
|
|
|
|
+ .then(() => {
|
|
|
|
+ return updateTableStatus(row.id, 'D');
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.getList();
|
|
|
|
+ this.$modal.msgSuccess(this.$t('tableManagement.deleteSuccess'));
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|