index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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" prop="performDate" />
  75. <el-table-column label="开始时间" align="center" prop="performTimeStart" width="160">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.performTimeStart }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="结束时间" align="center" prop="performTimeEnd" width="160">
  81. <template slot-scope="scope">
  82. <span>{{ scope.row.performTimeEnd }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  86. <template slot-scope="scope">
  87. <el-button
  88. size="mini"
  89. type="text"
  90. @click="handleUpdate(scope.row)"
  91. v-hasPermi="['schedulingMr:schedulingMr:edit']"
  92. >修改</el-button>
  93. <el-button
  94. size="mini"
  95. type="text"
  96. @click="handleDelete(scope.row,scope.index)"
  97. v-hasPermi="['schedulingMr:schedulingMr:delete']"
  98. >删除</el-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <pagination
  103. v-show="total>0"
  104. :total="total"
  105. :page.sync="queryParams.pageNum"
  106. :limit.sync="queryParams.pageSize"
  107. @pagination="getList"
  108. />
  109. <!-- 新增/编辑弹框 -->
  110. <add-and-edit
  111. ref="addAndEdit"
  112. :dict="dict"
  113. @getList="getList"
  114. />
  115. <el-dialog
  116. title="查看"
  117. :visible.sync="visibleStatus"
  118. width="600px"
  119. :destroy-on-close="true"
  120. :close-on-click-modal="false"
  121. >
  122. <div v-if="visibleType == 'img'">
  123. <el-image
  124. style="width: 400px; height: 100%"
  125. :src="newObj.mainImg"
  126. fit="cover"
  127. />
  128. </div>
  129. <div v-if="visibleType == 'html'">
  130. <div v-html="newObj.centent"></div>
  131. </div>
  132. <div slot="footer" class="dialog-footer">
  133. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  134. </div>
  135. </el-dialog>
  136. </div>
  137. </template>
  138. <script>
  139. import { pageList, deleteById, deleteBatchById } from '@/api/schedulingMr/schedulingMr'
  140. import addAndEdit from "./dialog/addAndEdit.vue";
  141. export default {
  142. name: "agreement",
  143. dicts: ['agreement_type'],
  144. components: { addAndEdit },
  145. data() {
  146. return {
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个禁用
  152. single: true,
  153. // 非多个禁用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. // 用户表格数据
  160. dataList: null,
  161. // 弹出层标题
  162. title: "",
  163. // 是否显示弹出层
  164. open: false,
  165. // 日期范围
  166. dateRange: [],
  167. // 查询参数
  168. queryParams: {
  169. pageNum: 1,
  170. pageSize: 10,
  171. type: undefined
  172. },
  173. statusList: [
  174. {id: 1, name: '未发布', value: 0},
  175. {id: 2, name: '发布', value: 1},
  176. {id: 3, name: '下架', value: 2},
  177. ],
  178. visibleStatus: false,
  179. newObj: {},
  180. visibleType: '',
  181. };
  182. },
  183. created() {
  184. this.getList();
  185. },
  186. methods: {
  187. /** 查询列表 */
  188. getList() {
  189. this.loading = true;
  190. pageList(this.addDateRange(this.queryParams, this.dateRange))
  191. .then(response => {
  192. this.dataList = response.data.rows;
  193. this.total = response.data.total;
  194. this.loading = false;
  195. }
  196. ).catch(() => {
  197. this.loading = false;
  198. });
  199. },
  200. // 取消按钮
  201. cancel() {
  202. this.open = false;
  203. },
  204. /** 搜索按钮操作 */
  205. handleQuery() {
  206. this.queryParams.pageNum = 1;
  207. this.getList();
  208. },
  209. /** 重置按钮操作 */
  210. resetQuery() {
  211. this.dateRange = [];
  212. this.$set(this.queryParams, 'theatreName', '');
  213. this.$set(this.queryParams, 'performDate', '');
  214. this.$set(this.queryParams, 'performName', '');
  215. this.queryParams.pageNum = 1;
  216. this.handleQuery();
  217. },
  218. // 多选框选中数据
  219. handleSelectionChange(selection) {
  220. this.ids = selection.map(item => item.id);
  221. },
  222. /** 新增按钮操作 */
  223. handleAdd(type) {
  224. this.$refs["addAndEdit"].openDialog("新增数据", null, type);
  225. },
  226. /** 修改按钮操作 */
  227. handleUpdate(row) {
  228. this.$refs["addAndEdit"].openDialog("修改数据", row);
  229. },
  230. /** 删除按钮操作 */
  231. handleDelete(row) {
  232. this.$modal.confirm('是否确认删除该数据?').then(function() {
  233. return deleteById(row.id);
  234. }).then(() => {
  235. this.getList();
  236. this.$modal.msgSuccess("删除成功");
  237. }).catch(() => {});
  238. },
  239. /** 批量删除按钮操作 */
  240. handleBatchDelete() {
  241. if(!this.ids || this.ids.length == 0){
  242. this.$modal.msgWarning("请选择需要删除的数据!");
  243. return false
  244. }
  245. this.$confirm('是否确认删除选中的数据?', '提示', {
  246. confirmButtonText: '确定',
  247. cancelButtonText: '取消',
  248. type: 'warning'
  249. }).then(() => {
  250. deleteBatchById(this.ids.toString())
  251. .then(response => {
  252. this.getList();
  253. this.$modal.msgSuccess("删除成功");
  254. }).catch(() => {
  255. });
  256. }).catch(() => {});
  257. },
  258. /** 查看按钮操作 */
  259. seeCenter(obj, type) {
  260. this.visibleStatus = true
  261. this.visibleType = type;
  262. this.newObj = obj;
  263. }
  264. }
  265. };
  266. </script>