housePriceSchemeList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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="6">
  8. <a-form-item label="关键字">
  9. <a-input placeholder="关键字(方案、编号、简码)" v-model="queryParam.paramName" allowClear></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  14. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  15. <a-button type="primary" @click="searchReset" icon="reload"
  16. style="margin-left: 8px">重置</a-button>
  17. </span>
  18. </a-col>
  19. </a-row>
  20. </a-form>
  21. </div>
  22. <!-- 查询区域-END -->
  23. <!-- 操作按钮区域 -->
  24. <div class="table-operator">
  25. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  26. <a-dropdown v-if="selectedRowKeys.length > 0">
  27. <!-- <a-button style="margin-left: 8px">-->
  28. <!-- 批量操作 <a-icon type="down" /></a-button>-->
  29. <a-button @click="batchDel" type="danger" icon="delete">批量删除</a-button>
  30. </a-dropdown>
  31. </div>
  32. <!-- table区域-begin -->
  33. <div>
  34. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
  35. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
  36. <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
  37. >项
  38. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  39. </div> -->
  40. <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
  41. :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{
  42. selectedRowKeys: selectedRowKeys,
  43. onChange: onSelectChange,
  44. }" class="j-table-force-nowrap" @change="handleTableChange">
  45. <template slot="openSlot" slot-scope="text, record, index">
  46. <a-switch checked-children="开" un-checked-children="关" default-checked :checked="record.open == 1"
  47. @change="e=>changeOpenState(e,record)" />
  48. </template>
  49. <template slot="htmlSlot" slot-scope="text">
  50. <div v-html="text"></div>
  51. </template>
  52. <template slot="imgSlot" slot-scope="text, record">
  53. <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
  54. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
  55. style="max-width: 80px; font-size: 12px; font-style: italic" />
  56. </template>
  57. <template slot="fileSlot" slot-scope="text">
  58. <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
  59. <a-button v-else :ghost="true" type="primary" icon="download" size="small"
  60. @click="downloadFile(text)">
  61. 下载
  62. </a-button>
  63. </template>
  64. <span slot="action" slot-scope="text, record">
  65. <a @click="handleEdit(record)">编辑</a>
  66. <a-divider type="vertical" />
  67. <a-dropdown>
  68. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  69. <a-menu slot="overlay">
  70. <a-menu-item>
  71. <a @click="handleDetailSetting(record)">详情</a>
  72. </a-menu-item>
  73. <a-menu-item>
  74. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  75. <a>删除</a>
  76. </a-popconfirm>
  77. </a-menu-item>
  78. </a-menu>
  79. </a-dropdown>
  80. </span>
  81. </a-table>
  82. </div>
  83. <!-- <room-layout-form ref="modalForm" @ok="modalFormOk"></room-layout-form>-->
  84. <!-- <room-layout-price-modal ref="priceModal" @ok="onPriceSave"></room-layout-price-modal>-->
  85. <!-- <room-layout-detail-modal @saveOk="onSaveOk" ref="detailModal"></room-layout-detail-modal>-->
  86. <house-price-scheme-modal ref="modalForm" @ok="modalFormOk"></house-price-scheme-modal>
  87. <house-price-scheme-detail-modal ref="detailModal" @ok="modalFormOk"></house-price-scheme-detail-modal>
  88. </a-card>
  89. </template>
  90. <script>
  91. import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  92. import { modifyAppState } from '@/api/roomLayout'
  93. import { filterObj } from "@/utils/util";
  94. import HousePriceSchemeModal from "./modules/housePriceSchemeModal";
  95. let hotelInfo = JSON.parse(localStorage.getItem('storeInfo'))
  96. import { httpAction, getAction } from '@/api/manage'
  97. import HousePriceSchemeDetailModal from "./modules/housePriceSchemeDetailModal";
  98. export default {
  99. name: "housePriceSchemeList",
  100. mixins: [JeecgListMixin],
  101. components: {
  102. HousePriceSchemeDetailModal,
  103. HousePriceSchemeModal
  104. },
  105. data() {
  106. return {
  107. queryParam: {},
  108. // 分页参数
  109. ipagination: {
  110. current: 1,
  111. pageSize: 10,
  112. pageSizeOptions: ["10", "20", "30"],
  113. showTotal: (total, range) => {
  114. return range[0] + "-" + range[1] + " 共" + total + "条";
  115. },
  116. showQuickJumper: true,
  117. showSizeChanger: true,
  118. total: 0,
  119. },
  120. // 表头
  121. columns: [
  122. {
  123. title: "简码",
  124. align: "center",
  125. dataIndex: "simpleCode",
  126. },
  127. {
  128. title: "编号",
  129. align: "center",
  130. dataIndex: "number",
  131. },
  132. {
  133. title: "房价方案",
  134. align: "center",
  135. dataIndex: "priceScheme",
  136. },
  137. {
  138. title: "客人类型",
  139. align: "center",
  140. dataIndex: "guestTypeName",
  141. },
  142. {
  143. title: "入住时间",
  144. align: "center",
  145. dataIndex: "checkInTimeText",
  146. },
  147. {
  148. title: "有效期",
  149. align: "center",
  150. dataIndex: "validTimeText",
  151. },
  152. {
  153. title: "状态",
  154. align: "center",
  155. dataIndex: "open",
  156. scopedSlots: {customRender: "openSlot"},
  157. },
  158. {
  159. title: "排序",
  160. align: "center",
  161. dataIndex: "sort",
  162. },
  163. {
  164. title: "操作时间",
  165. align: "center",
  166. dataIndex: "createAt",
  167. },
  168. {
  169. title: "操作",
  170. dataIndex: "action",
  171. align: "center",
  172. fixed: "right",
  173. width: 147,
  174. scopedSlots: {customRender: "action"},
  175. },
  176. ],
  177. url: {
  178. // list: 'org.jeecg.modules.business/busMarketMember/list',
  179. list: "/rooms/cesHousePriceScheme/list?hotelId=" + hotelInfo.id,
  180. delete: "/rooms/cesHousePriceScheme/remove",
  181. deleteBatch: "/rooms/cesHousePriceScheme/deleteBatch",
  182. exportXlsUrl: "/rooms/cesHousePriceScheme/exportXls",
  183. importExcelUrl:
  184. "rooms/cesHousePriceScheme/importExcel",
  185. modifyOpen: "/rooms/cesHousePriceScheme/modifyOpen",
  186. },
  187. dictOptions: {},
  188. superFieldList: [],
  189. selectedRowKeys: [],
  190. isorter: {
  191. column: "createTime",
  192. order: "desc",
  193. },
  194. };
  195. },
  196. created() {
  197. // this.loadData()
  198. },
  199. methods: {
  200. onSaveOk() {
  201. this.loadData()
  202. },
  203. onPriceSave() {
  204. },
  205. handleDetailSetting(record) {
  206. this.$refs.detailModal.title="详情"
  207. this.$refs.detailModal.visible = true
  208. this.$refs.detailModal.schemeId=record.id
  209. },
  210. changeOpenState(e, record) {
  211. console.log(e)
  212. var that = this;
  213. this.confirmLoading = true
  214. httpAction(this.url.modifyOpen +'/'+ record.id + "?open=" + (e ? 1 : 0), {}, 'put').then((res) => {
  215. if (res.success) {
  216. that.$message.success('操作成功')
  217. that.$emit('ok')
  218. that.loadData(1);
  219. } else {
  220. that.$message.warning(res.message)
  221. }
  222. }).finally(() => {
  223. that.confirmLoading = false
  224. })
  225. },
  226. changeAppState(e, param) {
  227. modifyAppState(param).then(res => {
  228. if (res.code == 200) {
  229. this.loadData();
  230. }
  231. })
  232. },
  233. getAvatarView: function (avatar) {
  234. return getFileAccessHttpUrl(avatar);
  235. },
  236. batchFrozen: function (status) {
  237. if (this.selectedRowKeys.length <= 0) {
  238. this.$message.warning("请选择一条记录!");
  239. return false;
  240. } else {
  241. let ids = "";
  242. let that = this;
  243. let isAdmin = false;
  244. that.selectionRows.forEach(function (row) {
  245. if (row.username == "admin") {
  246. isAdmin = true;
  247. }
  248. });
  249. if (isAdmin) {
  250. that.$message.warning("管理员账号不允许此操作,请重新选择!");
  251. return;
  252. }
  253. that.selectedRowKeys.forEach(function (val) {
  254. ids += val + ",";
  255. });
  256. that.$confirm({
  257. title: "确认操作",
  258. content: "是否" + (status == 1 ? "解冻" : "冻结") + "选中账号?",
  259. onOk: function () {
  260. frozenBatch({ids: ids, status: status}).then((res) => {
  261. if (res.success) {
  262. that.$message.success(res.message);
  263. that.loadData();
  264. that.onClearSelected();
  265. } else {
  266. that.$message.warning(res.message);
  267. }
  268. });
  269. },
  270. });
  271. }
  272. },
  273. handleMenuClick(e) {
  274. if (e.key == 1) {
  275. this.batchDel();
  276. } else if (e.key == 2) {
  277. this.batchFrozen(2);
  278. } else if (e.key == 3) {
  279. this.batchFrozen(1);
  280. }
  281. },
  282. handleFrozen: function (id, status, username) {
  283. let that = this;
  284. //TODO 后台校验管理员角色
  285. if ("admin" == username) {
  286. that.$message.warning("管理员账号不允许此操作!");
  287. return;
  288. }
  289. frozenBatch({ids: id, status: status}).then((res) => {
  290. if (res.success) {
  291. that.$message.success(res.message);
  292. that.loadData();
  293. } else {
  294. that.$message.warning(res.message);
  295. }
  296. });
  297. },
  298. handleChangePassword(username) {
  299. this.$refs.passwordmodal.show(username);
  300. },
  301. passwordModalOk() {
  302. //TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
  303. },
  304. onSyncFinally({isToLocal}) {
  305. // 同步到本地时刷新下数据
  306. if (isToLocal) {
  307. this.loadData();
  308. }
  309. },
  310. },
  311. };
  312. </script>
  313. <style scoped>
  314. @import "~@assets/less/common.less";
  315. </style>