index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="场馆名称" label-width="70px">
  5. <el-input
  6. v-model="queryParams.theatreName"
  7. placeholder="请输入场馆名称"
  8. clearable
  9. style="width: 240px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="剧目名称">
  14. <el-input
  15. v-model="queryParams.performName"
  16. placeholder="请输入剧目名称"
  17. clearable
  18. style="width: 240px;"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="选择日期">
  23. <el-date-picker
  24. v-model="queryParams.performDate"
  25. type="date"
  26. value-format="yyyy-MM-dd"
  27. placeholder="选择日期">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  32. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-row :gutter="10" class="mb8">
  36. <el-col :span="1.5">
  37. <el-button
  38. type="success"
  39. plain
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd(null)"
  43. v-hasPermi="['schedulingMr:schedulingMr:add']"
  44. >添加</el-button>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-button
  48. type="primary"
  49. plain
  50. icon="el-icon-plus"
  51. size="mini"
  52. @click="handleAdd('batch')"
  53. v-hasPermi="['schedulingMr:schedulingMr:batch']"
  54. >批量添加</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. plain
  60. icon="el-icon-delete"
  61. size="mini"
  62. @click="handleBatchDelete"
  63. v-hasPermi="['schedulingMr:schedulingMr:batchDelete']"
  64. >批量删除</el-button>
  65. </el-col>
  66. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  67. </el-row>
  68. <el-table ref="tables" v-loading="loading" :data="dataList" border @selection-change="handleSelectionChange">
  69. <el-table-column type="selection" width="50" align="center" />
  70. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  71. <el-table-column label="场馆名称" align="center" prop="theatreName" />
  72. <el-table-column label="演出厅" align="center" prop="auditoriumName" />
  73. <el-table-column label="剧目名称" align="center" prop="performName" />
  74. <el-table-column label="票务名称" align="center">
  75. <template slot-scope="scope">
  76. <span>
  77. {{ scope.row.goodsNames }}
  78. </span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="日期" align="center" prop="performDate" />
  82. <el-table-column label="开始时间" align="center" prop="performTimeStart" width="160">
  83. <template slot-scope="scope">
  84. <span>{{ scope.row.performTimeStart }}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="结束时间" align="center" prop="performTimeEnd" width="160">
  88. <template slot-scope="scope">
  89. <span>{{ scope.row.performTimeEnd }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  93. <template slot-scope="scope">
  94. <el-button
  95. size="mini"
  96. type="text"
  97. @click="handleUpdate(scope.row)"
  98. v-hasPermi="['schedulingMr:schedulingMr:edit']"
  99. >修改</el-button>
  100. <el-button
  101. size="mini"
  102. type="text"
  103. @click="handleDelete(scope.row,scope.index)"
  104. v-hasPermi="['schedulingMr:schedulingMr:delete']"
  105. >删除</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. <!-- 新增/编辑弹框 -->
  117. <add-and-edit
  118. ref="addAndEdit"
  119. :dict="dict"
  120. @getList="getList"
  121. />
  122. <el-dialog
  123. title="查看"
  124. :visible.sync="visibleStatus"
  125. width="600px"
  126. :destroy-on-close="true"
  127. :close-on-click-modal="false"
  128. >
  129. <div v-if="visibleType == 'img'">
  130. <el-image
  131. style="width: 400px; height: 100%"
  132. :src="newObj.mainImg"
  133. fit="cover"
  134. />
  135. </div>
  136. <div v-if="visibleType == 'html'">
  137. <div v-html="newObj.centent"></div>
  138. </div>
  139. <div slot="footer" class="dialog-footer">
  140. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  141. </div>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import { pageList, deleteById, deleteBatchById } from '@/api/schedulingMr/schedulingMr'
  147. import addAndEdit from "./dialog/addAndEdit";
  148. export default {
  149. name: "SchedulingMr1",
  150. dicts: ['agreement_type'],
  151. components: { addAndEdit },
  152. data() {
  153. return {
  154. // 遮罩层
  155. loading: true,
  156. // 选中数组
  157. ids: [],
  158. // 非单个禁用
  159. single: true,
  160. // 非多个禁用
  161. multiple: true,
  162. // 显示搜索条件
  163. showSearch: true,
  164. // 总条数
  165. total: 0,
  166. // 用户表格数据
  167. dataList: null,
  168. // 弹出层标题
  169. title: "",
  170. // 是否显示弹出层
  171. open: false,
  172. // 日期范围
  173. dateRange: [],
  174. // 查询参数
  175. queryParams: {
  176. pageNum: 1,
  177. pageSize: 10,
  178. type: undefined
  179. },
  180. statusList: [
  181. {id: 1, name: '未发布', value: 0},
  182. {id: 2, name: '发布', value: 1},
  183. {id: 3, name: '下架', value: 2},
  184. ],
  185. visibleStatus: false,
  186. newObj: {},
  187. visibleType: '',
  188. };
  189. },
  190. created() {
  191. this.getList();
  192. },
  193. // activated(){
  194. // this.getList();
  195. // },
  196. methods: {
  197. /** 查询列表 */
  198. getList() {
  199. this.loading = true;
  200. pageList(this.addDateRange(this.queryParams, this.dateRange))
  201. .then(response => {
  202. this.dataList = response.data.rows;
  203. this.total = response.data.total;
  204. this.loading = false;
  205. }
  206. ).catch(() => {
  207. this.loading = false;
  208. });
  209. },
  210. // 取消按钮
  211. cancel() {
  212. this.open = false;
  213. },
  214. /** 搜索按钮操作 */
  215. handleQuery() {
  216. this.queryParams.pageNum = 1;
  217. this.getList();
  218. },
  219. /** 重置按钮操作 */
  220. resetQuery() {
  221. this.dateRange = [];
  222. this.$set(this.queryParams, 'theatreName', '');
  223. this.$set(this.queryParams, 'performDate', '');
  224. this.$set(this.queryParams, 'performName', '');
  225. this.queryParams.pageNum = 1;
  226. this.handleQuery();
  227. },
  228. // 多选框选中数据
  229. handleSelectionChange(selection) {
  230. this.ids = selection.map(item => item.id);
  231. },
  232. /** 新增按钮操作 */
  233. handleAdd(type) {
  234. this.$refs["addAndEdit"].openDialog("新增数据", null, type);
  235. },
  236. /** 修改按钮操作 */
  237. handleUpdate(row) {
  238. this.$refs["addAndEdit"].openDialog("修改数据", row);
  239. },
  240. /** 删除按钮操作 */
  241. handleDelete(row) {
  242. this.$modal.confirm('是否确认删除该数据?').then(function() {
  243. return deleteById(row.id);
  244. }).then(() => {
  245. this.getList();
  246. this.$modal.msgSuccess("删除成功");
  247. }).catch(() => {});
  248. },
  249. /** 批量删除按钮操作 */
  250. handleBatchDelete() {
  251. if(!this.ids || this.ids.length == 0){
  252. this.$modal.msgWarning("请选择需要删除的数据!");
  253. return false
  254. }
  255. this.$confirm('是否确认删除选中的数据?', '提示', {
  256. confirmButtonText: '确定',
  257. cancelButtonText: '取消',
  258. type: 'warning'
  259. }).then(() => {
  260. deleteBatchById(this.ids.toString())
  261. .then(response => {
  262. this.getList();
  263. this.$modal.msgSuccess("删除成功");
  264. }).catch(() => {
  265. });
  266. }).catch(() => {});
  267. },
  268. /** 查看按钮操作 */
  269. seeCenter(obj, type) {
  270. this.visibleStatus = true
  271. this.visibleType = type;
  272. this.newObj = obj;
  273. }
  274. }
  275. };
  276. </script>