scenicAreaTickets.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--用户数据-->
  5. <el-col :span="24" :xs="24">
  6. <el-row :gutter="10" class="mb8">
  7. <el-col :span="1.5">
  8. <el-button
  9. type="primary"
  10. plain
  11. icon="el-icon-plus"
  12. size="mini"
  13. @click="handleAdd"
  14. v-hasPermi="configPermi.add"
  15. >添加门票</el-button>
  16. </el-col>
  17. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  18. </el-row>
  19. <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
  20. <el-table-column type="index" label="序号" align="center" />
  21. <el-table-column label="票务名称" align="center" key="name" prop="name" v-if="columns[0].visible" :show-overflow-tooltip="true" />
  22. <el-table-column label="票务规格" align="center" key="goodsName" prop="goodsName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  23. <el-table-column label="可用状态" align="center" key="status" prop="status" v-if="columns[2].visible">
  24. <template slot-scope="scope">
  25. <switchBox
  26. :defaultChecked="true"
  27. v-model="scope.row.status"
  28. @changeFun="openAttraction(scope.row)"
  29. :disabled="false"
  30. :active-value="1"
  31. :inactive-value="0"
  32. />
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="发布时间" align="center" key="goodsName1" prop="goodsName1" v-if="columns[3].visible" :show-overflow-tooltip="true" />
  36. <el-table-column
  37. label="操作"
  38. align="center"
  39. class-name="small-padding fixed-width"
  40. >
  41. <template slot-scope="scope" >
  42. <el-button
  43. size="mini"
  44. type="text"
  45. icon="el-icon-edit"
  46. @click="handleUpdate(scope.row)"
  47. v-hasPermi="configPermi.edit"
  48. >修改基本信息</el-button>
  49. <el-button
  50. size="mini"
  51. type="text"
  52. icon="el-icon-edit"
  53. @click="handleUpdateSpecs(scope.row)"
  54. v-hasPermi="configPermi.edit"
  55. >规格信息</el-button>
  56. <el-button
  57. size="mini"
  58. type="text"
  59. icon="el-icon-delete"
  60. @click="handleDelete(scope.row)"
  61. v-hasPermi="configPermi.delect"
  62. >删除</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <pagination
  67. v-show="total>0"
  68. :total="total"
  69. :page.sync="queryParams.pageNum"
  70. :limit.sync="queryParams.pageSize"
  71. @pagination="getList"
  72. />
  73. </el-col>
  74. </el-row>
  75. <!-- 新增或修改 -->
  76. <addAndEdit ref="addAndEdit" @refresh="getList" />
  77. <addAndEditSpecs ref="addAndEditSpecs" @refresh="getList" />
  78. </div>
  79. </template>
  80. <script>
  81. import {
  82. listTableApi,
  83. delTableParamsApi,
  84. publicByPutApi as releaseApi
  85. } from "@/api/CURD";
  86. import addAndEdit from "./formBox/scenicAreaTicketsForm.vue"
  87. import addAndEditSpecs from "./formBox/scenicAreaTicketsSpecsForm.vue"
  88. export default {
  89. name: "User",
  90. dicts: [],
  91. components: {addAndEdit,addAndEditSpecs},
  92. data() {
  93. return {
  94. title: "景区门票",// 通用标题
  95. configPermi: {
  96. add: ['system:user:edit'], // 新增权限
  97. details: ['system:user:details'], // 详情权限
  98. delect: ['system:user:remove'], // 删除权限
  99. edit: ['system:user:edit'], // 编辑权限
  100. upload: ['system:user:upload'],// 导入权限
  101. export: ['system:user:export'],// 导出权限
  102. release: ['system:user:release']
  103. },
  104. configUrl: {
  105. list: '/merchant/merchantPerformAuditorium/merchantPerformList', // 列表地址
  106. delect: '/merchant/merchantPerformAuditorium/deleteMerchantPerform', // 删除地址
  107. upload: '',// 导入地址
  108. download:'', // 下载模板地址
  109. export: '',// 导出地址
  110. updateStatusById: '/goods/performInfo/updateStatusById',
  111. },
  112. // 遮罩层
  113. loading: true,
  114. // 选中数组
  115. ids: [],
  116. // 非单个禁用
  117. single: true,
  118. // 非多个禁用
  119. multiple: true,
  120. // 显示搜索条件
  121. showSearch: true,
  122. // 总条数
  123. total: 0,
  124. // 用户表格数据
  125. tableList: null,
  126. // 查询参数
  127. queryParams: {
  128. pageNum: 1,
  129. pageSize: 10,
  130. },
  131. dateRange: [],
  132. // 控制列表是否显示
  133. columns: [
  134. { key: 0, label: `票务名称`, visible: true },
  135. { key: 2, label: `票务规格`, visible: true },
  136. { key: 3, label: `可用状态`, visible: true },
  137. { key: 4, label: `发布时间`, visible: true },
  138. ],
  139. };
  140. },
  141. created() {
  142. this.getList();
  143. },
  144. methods: {
  145. /** 查询用户列表 */
  146. getList() {
  147. this.loading = true;
  148. listTableApi(
  149. this.configUrl.list,
  150. this.addDateRange(
  151. this.queryParams,
  152. this.dateRange)).then(response => {
  153. this.tableList = response.data.rows;
  154. this.total = response.data.total;
  155. this.loading = false;
  156. }
  157. ).catch (error=>{
  158. console.error('获取列表失败!!!!',error)
  159. this.tableList = [];
  160. this.total = 0;
  161. this.loading = false
  162. })
  163. },
  164. /** 搜索按钮操作 */
  165. handleQuery() {
  166. this.queryParams.pageNum = 1;
  167. this.getList();
  168. },
  169. /** 重置按钮操作 */
  170. resetQuery() {
  171. this.dateRange = [];
  172. this.queryParams = {
  173. pageNum: 1,
  174. pageSize: 10,
  175. }
  176. this.handleQuery();
  177. },
  178. // 多选框选中数据
  179. handleSelectionChange(selection) {
  180. this.ids = selection.map(item => item.id);
  181. this.single = selection.length != 1;
  182. this.multiple = !selection.length;
  183. },
  184. /** 新增按钮操作 */
  185. handleAdd() {
  186. if(this.$refs.addAndEdit) {
  187. this.$refs.addAndEdit.initData(this.title + '新增', "ADD",{})
  188. }
  189. },
  190. /** 修改按钮操作 */
  191. handleUpdate(row) {
  192. if(this.$refs.addAndEdit) {
  193. this.$refs.addAndEdit.initData(this.title + '基本信息编辑', "EDIT",{...row})
  194. }
  195. },
  196. handleUpdateSpecs(row) {
  197. if(this.$refs.addAndEditSpecs) {
  198. this.$refs.addAndEditSpecs.initData(this.title + '规格信息编辑', "EDITInit",{...row})
  199. }
  200. },
  201. handleDetails(row){
  202. if(this.$refs.detailsBox) {
  203. this.$refs.detailsBox.initData(this.title + '详情',"DEATILSInit", row)
  204. }
  205. },
  206. /** 删除按钮操作 */
  207. handleDelete(row) {
  208. const ids = row.id || this.ids;
  209. this.$modal.confirm('是否确认删除数据项?').then( () => {
  210. return delTableParamsApi(this.configUrl.delect,{
  211. id: ids
  212. });
  213. }).then(() => {
  214. this.getList();
  215. this.$modal.msgSuccess("删除成功");
  216. }).catch((e) => {
  217. console.error("删除失败====",e)
  218. });
  219. },
  220. /** 导出按钮操作 */
  221. handleExport() {
  222. this.download(this.configUrl.export, {
  223. ...this.queryParams
  224. }, `${this.title }_${new Date().getTime()}.xlsx`)
  225. },
  226. /** 导入按钮操作 */
  227. handleImport() {
  228. if(this.$refs.upload) {
  229. this.$refs.upload.initData({
  230. width: '400px',
  231. // 弹出层标题(用户导入)
  232. title: this.title + "导入",
  233. // 下载模板地址
  234. importTemplate: this.configUrl.download,
  235. // 上传的地址
  236. url: this.configUrl.upload
  237. })
  238. }
  239. },
  240. /**
  241. * 修改状态
  242. * @date 2023-11-22
  243. * @returns {any}
  244. */
  245. openAttraction(row) {
  246. this.$modal.confirm(`是否确认${row.status == 0 ? '上架' : '下架'} ${row.name}点位吗?`).then( () => {
  247. return listTableApi(this.configUrl.updateStatusById,{
  248. id: row.performId,
  249. status: row.status == 1 ? 0 : 1
  250. });
  251. }).then(() => {
  252. this.getList()
  253. this.$modal.msgSuccess(`${row.status == 0 ? '上架' : '下架'}成功`);
  254. }).catch((e) => {
  255. console.error("失败====",e)
  256. });
  257. },
  258. }
  259. };
  260. </script>