table.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :span="3">
  8. <a-form-item label="">
  9. <a-input
  10. placeholder="名称"
  11. v-model="queryParam.hourRoomName"
  12. style="width: 200px"
  13. ></a-input>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :md="6" :sm="8">
  17. <span
  18. style="float: left; overflow: hidden"
  19. class="table-page-search-submitButtons"
  20. >
  21. <a-button type="primary" @click="searchQuery" icon="search"
  22. >查询</a-button
  23. >
  24. <a-button
  25. type="primary"
  26. @click="searchReset"
  27. icon="reload"
  28. style="margin-left: 8px"
  29. >重置</a-button
  30. >
  31. </span>
  32. </a-col>
  33. </a-row>
  34. </a-form>
  35. </div>
  36. <!-- 查询区域-END -->
  37. <!-- 操作按钮区域 -->
  38. <div class="table-operator">
  39. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  40. <a-dropdown v-if="selectedRowKeys.length > 0">
  41. <a-button style="margin-left: 8px">
  42. 批量操作 <a-icon type="down"
  43. /></a-button>
  44. </a-dropdown>
  45. </div>
  46. <div>
  47. <a-table
  48. ref="table"
  49. size="middle"
  50. :scroll="{ x: true }"
  51. bordered
  52. rowKey="id"
  53. :columns="columns"
  54. :dataSource="dataSource"
  55. :pagination="ipagination"
  56. :loading="loading"
  57. :rowSelection="{
  58. selectedRowKeys: selectedRowKeys,
  59. onChange: onSelectChange,
  60. }"
  61. class="j-table-force-nowrap"
  62. @change="handleTableChange"
  63. >
  64. <template slot="idSlot" slot-scope="text, record">
  65. <div style="text-align:left;">1、开房后{{ record.afterOpenRoom?record.afterOpenRoom:0 }}分钟内按{{ record.afterOpenRoomPay?record.afterOpenRoomPay:0 }}元收取</div>
  66. <div style="text-align:left;">
  67. 2、超时之后每{{ record.exceedTime?record.exceedTime:0 }}分钟收取{{ record.exceedPay?record.exceedPay:0 }}元,
  68. 不足{{ record.exceedTime?record.exceedTime:0 }}分钟,超过{{ record.notReachExceedTime?record.notReachExceedTime:0 }}分钟加收{{ record.notReachExceedTimePay?record.notReachExceedTimePay:0 }}元
  69. </div>
  70. <div style="text-align:left;">
  71. 3、 {{ record.maxExtraPay?record.maxExtraPay:0 }}元封顶 注意:0元视为不封顶
  72. </div>
  73. <div style="text-align:left;">
  74. 4、消费超过{{ record.limitTimeTransferAllDay?record.limitTimeTransferAllDay:0 }}分钟,自动转为全天房 注意:0分钟视为不自动转全天房
  75. </div>
  76. </template>
  77. <span slot="action" slot-scope="text, record">
  78. <a @click="handleEdit(record)">编辑</a>
  79. <a-divider type="vertical" />
  80. <a @click="handleRelation(record)">关联</a>
  81. <a-divider type="vertical" />
  82. <a-popconfirm
  83. title="确定删除吗?"
  84. @confirm="() => handleDelete(record.id)"
  85. >
  86. <a>删除</a>
  87. </a-popconfirm>
  88. </span>
  89. </a-table>
  90. </div>
  91. <modal-form ref="modalForm" @ok="modalFormOk"></modal-form>
  92. <relation-form ref="relationForm" @ok="relationOk"></relation-form>
  93. </a-card>
  94. </template>
  95. <script>
  96. import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  97. import modalForm from "./hourRoomFormModal.vue"; // todo roomLayoutForm 需要替换成房型的表单弹窗
  98. import relationForm from "./hourLayoutRelation.vue"; // todo roomLayoutForm 需要替换成房型的表单弹窗
  99. // import RoomLayoutDetailModal from "./RoomLayoutFormDetailModal.vue";
  100. // import RoomLayoutPriceModal from "./RoomLayoutPriceModal.vue";
  101. import { modifyAppState } from "@/api/roomLayout";
  102. import { filterObj } from "@/utils/util";
  103. let hotelInfo = JSON.parse(localStorage.getItem("storeInfo"));
  104. export default {
  105. name: "roomLayoutList",
  106. mixins: [JeecgListMixin],
  107. components: {
  108. modalForm,
  109. relationForm
  110. // RoomLayoutPriceModal,
  111. // RoomLayoutDetailModal,
  112. },
  113. data() {
  114. return {
  115. queryParam: {
  116. hourRoomName:''
  117. },
  118. // 分页参数
  119. ipagination: {
  120. current: 1,
  121. pageSize: 10,
  122. pageSizeOptions: ["10", "20", "30"],
  123. showTotal: (total, range) => {
  124. return range[0] + "-" + range[1] + " 共" + total + "条";
  125. },
  126. showQuickJumper: true,
  127. showSizeChanger: true,
  128. total: 0,
  129. },
  130. // 表头
  131. columns: [
  132. {
  133. title: "商家",
  134. align: "center",
  135. dataIndex: "hotelName",
  136. },
  137. {
  138. title: "名称",
  139. align: "center",
  140. dataIndex: "hourRoomName",
  141. },
  142. {
  143. title: "规则",
  144. align: "center",
  145. dataIndex: "id",
  146. scopedSlots: { customRender: "idSlot" },
  147. },
  148. {
  149. title: "更新时间",
  150. align: "center",
  151. dataIndex: "updateAt",
  152. },
  153. {
  154. title: "操作",
  155. dataIndex: "action",
  156. align: "center",
  157. fixed: "right",
  158. width: 147,
  159. scopedSlots: { customRender: "action" },
  160. },
  161. ],
  162. url: {
  163. // list: 'org.jeecg.modules.business/busMarketMember/list',
  164. list: "/rooms/cesHourRoomRule/list",
  165. delete: "/rooms/cesHourRoomRule/delete",
  166. deleteBatch: "/rooms/cesHourRoomRule/batchDelete",
  167. exportXlsUrl: "/rooms/cesRoomLayout/exportXls",
  168. importExcelUrl: "rooms/cesRoomLayout/importExcel",
  169. },
  170. dictOptions: {},
  171. superFieldList: [],
  172. selectedRowKeys: [],
  173. isorter: {
  174. column: "createTime",
  175. order: "desc",
  176. },
  177. };
  178. },
  179. created() {
  180. // this.loadData()
  181. },
  182. methods: {
  183. handleRelation(data) {
  184. this.$refs.relationForm.setData(data);
  185. },
  186. relationOk() {
  187. this.$refs.relationForm.visible = false
  188. this.loadData()
  189. },
  190. onSaveOk() {
  191. this.loadData();
  192. },
  193. onPriceSave() {},
  194. handlePriceManager(record) {
  195. this.$refs.priceModal.setRaw(record.id, record.name);
  196. this.$refs.priceModal.visible = true;
  197. },
  198. handleDetailSetting(record) {
  199. this.$refs.detailModal.setRaw(record);
  200. this.$refs.detailModal.visible = true;
  201. },
  202. changeState(e) {
  203. console.log(e);
  204. },
  205. changeAppState(e, param) {
  206. modifyAppState(param).then((res) => {
  207. if (res.code == 200) {
  208. this.loadData();
  209. }
  210. });
  211. },
  212. getAvatarView: function (avatar) {
  213. return getFileAccessHttpUrl(avatar);
  214. },
  215. batchFrozen: function (status) {
  216. if (this.selectedRowKeys.length <= 0) {
  217. this.$message.warning("请选择一条记录!");
  218. return false;
  219. } else {
  220. let ids = "";
  221. let that = this;
  222. let isAdmin = false;
  223. that.selectionRows.forEach(function (row) {
  224. if (row.username == "admin") {
  225. isAdmin = true;
  226. }
  227. });
  228. if (isAdmin) {
  229. that.$message.warning("管理员账号不允许此操作,请重新选择!");
  230. return;
  231. }
  232. that.selectedRowKeys.forEach(function (val) {
  233. ids += val + ",";
  234. });
  235. that.$confirm({
  236. title: "确认操作",
  237. content: "是否" + (status == 1 ? "解冻" : "冻结") + "选中账号?",
  238. onOk: function () {
  239. frozenBatch({ ids: ids, status: status }).then((res) => {
  240. if (res.success) {
  241. that.$message.success(res.message);
  242. that.loadData();
  243. that.onClearSelected();
  244. } else {
  245. that.$message.warning(res.message);
  246. }
  247. });
  248. },
  249. });
  250. }
  251. },
  252. handleMenuClick(e) {
  253. if (e.key == 1) {
  254. this.batchDel();
  255. } else if (e.key == 2) {
  256. this.batchFrozen(2);
  257. } else if (e.key == 3) {
  258. this.batchFrozen(1);
  259. }
  260. },
  261. handleFrozen: function (id, status, username) {
  262. let that = this;
  263. //TODO 后台校验管理员角色
  264. if ("admin" == username) {
  265. that.$message.warning("管理员账号不允许此操作!");
  266. return;
  267. }
  268. frozenBatch({ ids: id, status: status }).then((res) => {
  269. if (res.success) {
  270. that.$message.success(res.message);
  271. that.loadData();
  272. } else {
  273. that.$message.warning(res.message);
  274. }
  275. });
  276. },
  277. handleChangePassword(username) {
  278. this.$refs.passwordmodal.show(username);
  279. },
  280. passwordModalOk() {
  281. //TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
  282. },
  283. onSyncFinally({ isToLocal }) {
  284. // 同步到本地时刷新下数据
  285. if (isToLocal) {
  286. this.loadData();
  287. }
  288. },
  289. },
  290. };
  291. </script>
  292. <style scoped>
  293. @import "~@assets/less/common.less";
  294. </style>