| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <template>
- <a-card :bordered="false">
- <!-- 查询区域 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="searchQuery">
- <a-row :gutter="24">
- <a-col :span="3">
- <a-form-item label="">
- <j-input
- placeholder="餐桌名称"
- v-model="queryParam.name"
- ></j-input>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <span
- style="float: left; overflow: hidden"
- class="table-page-search-submitButtons"
- >
- <a-button type="primary" @click="searchQuery" icon="search"
- >查询</a-button
- >
- <a-button
- type="primary"
- @click="searchReset"
- icon="reload"
- style="margin-left: 8px"
- >重置</a-button
- >
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 查询区域-END -->
- <!-- 操作按钮区域 -->
- <div class="table-operator">
- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
- <a-button :disabled="selectedRowKeys.length == 0" @click="downloadQRcode" type="primary">下载二维码</a-button>
- <a-button @click="batchDel" :disabled="selectedRowKeys.length == 0" icon="stop" type="danger" >批量删除</a-button>
- </div>
- <!-- table区域-begin -->
- <div>
- <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
- <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
- >项
- <a style="margin-left: 24px" @click="onClearSelected">清空</a>
- </div> -->
- <a-table
- ref="table"
- size="middle"
- :scroll="{ x: true }"
- bordered
- rowKey="id"
- :columns="columns"
- :dataSource="dataSource"
- :pagination="ipagination"
- :loading="loading"
- :rowSelection="{
- selectedRowKeys: selectedRowKeys,
- onChange: onSelectChange,
- }"
- class="j-table-force-nowrap"
- @change="handleTableChange"
- >
- <template slot="payFlagslot" slot-scope="text, record, index">
- {{ record.payFlag == 1 ? "是" : "否" }}
- </template>
- <template slot="iconslot" slot-scope="text, record, index">
- <a-icon :type="record.icon" theme="filled" />
- </template>
- <template slot="htmlSlot" slot-scope="text">
- <div v-html="text"></div>
- </template>
- <template slot="imgSlot" slot-scope="text, record">
- <span v-if="!text" style="font-size: 12px; font-style: italic"
- >无图片</span
- >
- <img
- v-else
- :src="getImgView(text)"
- :preview="record.id"
- height="25px"
- alt=""
- style="max-width: 80px; font-size: 12px; font-style: italic"
- />
- </template>
- <template slot="fileSlot" slot-scope="text">
- <span v-if="!text" style="font-size: 12px; font-style: italic"
- >无文件</span
- >
- <a-button
- v-else
- :ghost="true"
- type="primary"
- icon="download"
- size="small"
- @click="downloadFile(text)"
- >
- 下载
- </a-button>
- </template>
- <span slot="action" slot-scope="text, record">
- <a @click="QRcode(record)">二维码</a>
- <a-divider type="vertical" />
- <a @click="handleEdit(record)">编辑</a>
- <a-divider type="vertical" />
- <a-popconfirm
- title="确定删除吗?"
- @confirm="() => handleDelete(record.id)"
- >
- <a>删除</a>
- </a-popconfirm>
- </span>
- </a-table>
- </div>
- <a-modal title="二维码" :visible="QRcodeVisible" @cancel="QRcodeVisible = false" @ok="QRcodeVisible = false">
- <div style="text-align:center;">
- <a-avatar :size="264" shape="square" :src="selectQRcode" alt="暂无二维码" />
- </div>
- </a-modal>
- <pos-table-modal ref="modalForm" @ok="modalFormOk"></pos-table-modal>
- </a-card>
- </template>
-
- <script>
- import { JeecgListMixin } from "@/mixins/JeecgListMixin";
- import PosTableModal from "./modules/PosTableModal";
- import { filterObj } from "@/utils/util";
- import { getAction, downloadFileZIP } from "@/api/manage";
- export default {
- name: "memberList",
- mixins: [JeecgListMixin],
- components: {
- PosTableModal,
- },
- data() {
- return {
- QRcodeVisible: false,
- selectQRcode: "",
- queryParam: {},
- // 分页参数
- ipagination: {
- current: 1,
- pageSize: 10,
- pageSizeOptions: ["10", "20", "30"],
- showTotal: (total, range) => {
- return range[0] + "-" + range[1] + " 共" + total + "条";
- },
- showQuickJumper: true,
- showSizeChanger: true,
- total: 0,
- },
- // 表头
- columns: [
- {
- title: "pos类型",
- align: "center",
- dataIndex: "typeName",
- },
- {
- title: "餐桌区域",
- align: "center",
- dataIndex: "regionName",
- },
- {
- title: "餐桌名称",
- align: "center",
- dataIndex: "name",
- },
- {
- title: "桌型",
- align: "center",
- dataIndex: "tableTypeName",
- },
- {
- title: "座位数",
- align: "center",
- dataIndex: "num",
- },
- {
- title: "餐桌序号",
- align: "center",
- dataIndex: "tableNo",
- },
- {
- title: "状态",
- align: "center",
- dataIndex: "state",
- customRender: function (text) {
- return text == 0 ? "空桌台" : "用餐中";
- },
- },
- {
- title: "操作",
- dataIndex: "action",
- align: "center",
- fixed: "right",
- width: 147,
- scopedSlots: { customRender: "action" },
- },
- ],
- url: {
- list: "/pos/posTable/list",
- delete: "/pos/posTable/delete",
- deleteBatch: "/pos/posTable/deleteBatch",
- exportXlsUrl: "/pos/posTable/exportXls",
- importExcelUrl: "pos/posTable/importExcel",
- },
- dictOptions: {},
- superFieldList: [],
- selectedRowKeys: [],
- isorter: {
- column: "createTime",
- order: "desc",
- },
- };
- },
- created() {
- },
- methods: {
- QRcode(record){
- console.log(record.qrCode);
- this.selectQRcode = record.qrCode;
- this.QRcodeVisible = true;
- },
- downloadQRcode(){
- if (this.selectedRowKeys.length <= 0) {
- this.$message.warning('请选择一条记录!');
- return;
- } else {
- var ids = "";
- for (var a = 0; a < this.selectedRowKeys.length; a++) {
- ids += this.selectedRowKeys[a] + ",";
- }
- var that = this;
- console.log(ids);
- downloadFileZIP('/pos/posTable/makeQRCode?ids=' + ids, '二维码', {}).then((res) => {
- console.log(res);
- that.onClearSelected();
- });
- }
- },
- getAvatarView: function (avatar) {
- return getFileAccessHttpUrl(avatar);
- },
- batchFrozen: function (status) {
- if (this.selectedRowKeys.length <= 0) {
- this.$message.warning("请选择一条记录!");
- return false;
- } else {
- let ids = "";
- let that = this;
- let isAdmin = false;
- that.selectionRows.forEach(function (row) {
- if (row.username == "admin") {
- isAdmin = true;
- }
- });
- if (isAdmin) {
- that.$message.warning("管理员账号不允许此操作,请重新选择!");
- return;
- }
- that.selectedRowKeys.forEach(function (val) {
- ids += val + ",";
- });
- that.$confirm({
- title: "确认操作",
- content: "是否" + (status == 1 ? "解冻" : "冻结") + "选中账号?",
- onOk: function () {
- frozenBatch({ ids: ids, status: status }).then((res) => {
- if (res.success) {
- that.$message.success(res.message);
- that.loadData();
- that.onClearSelected();
- } else {
- that.$message.warning(res.message);
- }
- });
- },
- });
- }
- },
- handleMenuClick(e) {
- if (e.key == 1) {
- this.batchDel();
- } else if (e.key == 2) {
- this.batchFrozen(2);
- } else if (e.key == 3) {
- this.batchFrozen(1);
- }
- },
- handleFrozen: function (id, status, username) {
- let that = this;
- //TODO 后台校验管理员角色
- if ("admin" == username) {
- that.$message.warning("管理员账号不允许此操作!");
- return;
- }
- frozenBatch({ ids: id, status: status }).then((res) => {
- if (res.success) {
- that.$message.success(res.message);
- that.loadData();
- } else {
- that.$message.warning(res.message);
- }
- });
- },
- handleChangePassword(username) {
- this.$refs.passwordmodal.show(username);
- },
- passwordModalOk() {
- //TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
- },
- onSyncFinally({ isToLocal }) {
- // 同步到本地时刷新下数据
- if (isToLocal) {
- this.loadData();
- }
- },
- },
- };
- </script>
- <style scoped>
- @import "~@assets/less/common.less";
- </style>
|