index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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 label="状态">
  31. <el-select
  32. v-model="queryParams.status"
  33. placeholder="状态"
  34. clearable
  35. style="width: 100%"
  36. @change="handleQuery"
  37. >
  38. <el-option
  39. v-for="dict in statusList"
  40. :key="dict.id"
  41. :label="dict.name"
  42. :value="dict.value"
  43. />
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. plain
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd(null)"
  59. v-hasPermi="['schedulingMr:schedulingMr:add']"
  60. >添加</el-button>
  61. </el-col>
  62. <el-col :span="1.5">
  63. <el-button
  64. type="primary"
  65. plain
  66. icon="el-icon-plus"
  67. size="mini"
  68. @click="handleAdd('batch')"
  69. v-hasPermi="['schedulingMr:schedulingMr:batch']"
  70. >批量添加</el-button>
  71. </el-col>
  72. <el-col :span="1.5">
  73. <el-button
  74. type="danger"
  75. plain
  76. icon="el-icon-delete"
  77. size="mini"
  78. @click="handleBatchDelete"
  79. v-hasPermi="['schedulingMr:schedulingMr:batchDelete']"
  80. >批量删除</el-button>
  81. </el-col>
  82. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  83. </el-row>
  84. <el-table ref="tables" v-loading="loading" :data="dataList" border @selection-change="handleSelectionChange">
  85. <el-table-column type="selection" width="50" align="center" />
  86. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  87. <el-table-column label="场馆名称" align="center" prop="theatreName" />
  88. <el-table-column label="演出厅" align="center" prop="auditoriumName" />
  89. <el-table-column label="剧目名称" align="center" prop="performName" />
  90. <el-table-column label="票务名称" align="center">
  91. <template slot-scope="scope">
  92. <span>
  93. {{ scope.row.goodsNames }}
  94. </span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="日期" align="center" prop="performDate" />
  98. <el-table-column label="开始时间" align="center" prop="performTimeStart" width="160">
  99. <template slot-scope="scope">
  100. <span>{{ scope.row.performTimeStart }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="结束时间" align="center" prop="performTimeEnd" width="160">
  104. <template slot-scope="scope">
  105. <span>{{ scope.row.performTimeEnd }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="状态" align="center" prop="status">
  109. <template slot-scope="scope">
  110. <el-tag type="success" v-if="scope.row.status == '1'">启用</el-tag>
  111. <el-tag type="danger" v-else-if="scope.row.status == '2'">禁用</el-tag>
  112. <!-- <el-tag type="info" v-else>待发布</el-tag> -->
  113. <!-- <span>{{ scope.row.status }}</span> -->
  114. <!-- <dict-tag :options="statusList" :value="String( scope.row.status)"/> -->
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  118. <template slot-scope="scope">
  119. <el-button
  120. size="mini"
  121. type="text"
  122. @click="ionlineApi(scope.row)"
  123. v-hasPermi="['schedulingMr:schedulingMr:edit']"
  124. >{{scope.row.status == '1' ? '禁用' : '启用'}}</el-button>
  125. <el-button
  126. size="mini"
  127. type="text"
  128. @click="handleUpdate(scope.row)"
  129. v-hasPermi="['schedulingMr:schedulingMr:edit']"
  130. >修改</el-button>
  131. <el-button
  132. size="mini"
  133. type="text"
  134. @click="handleDelete(scope.row,scope.index)"
  135. v-hasPermi="['schedulingMr:schedulingMr:delete']"
  136. >删除</el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <pagination
  141. v-show="total>0"
  142. :total="total"
  143. :page.sync="queryParams.pageNum"
  144. :limit.sync="queryParams.pageSize"
  145. @pagination="getList"
  146. />
  147. <!-- 新增/编辑弹框 -->
  148. <add-and-edit
  149. ref="addAndEdit"
  150. :dict="dict"
  151. @getList="getList"
  152. />
  153. <el-dialog
  154. title="查看"
  155. :visible.sync="visibleStatus"
  156. width="600px"
  157. :destroy-on-close="true"
  158. :close-on-click-modal="false"
  159. >
  160. <div v-if="visibleType == 'img'">
  161. <el-image
  162. style="width: 400px; height: 100%"
  163. :src="newObj.mainImg"
  164. fit="cover"
  165. />
  166. </div>
  167. <div v-if="visibleType == 'html'">
  168. <div v-html="newObj.centent"></div>
  169. </div>
  170. <div slot="footer" class="dialog-footer">
  171. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  172. </div>
  173. </el-dialog>
  174. </div>
  175. </template>
  176. <script>
  177. import { pageList, deleteById, deleteBatchById,ionline } from '@/api/schedulingMr/schedulingMr'
  178. import addAndEdit from "./dialog/addAndEdit";
  179. export default {
  180. name: "SchedulingMr1",
  181. dicts: ['agreement_type'],
  182. components: { addAndEdit },
  183. data() {
  184. return {
  185. // 遮罩层
  186. loading: true,
  187. // 选中数组
  188. ids: [],
  189. // 非单个禁用
  190. single: true,
  191. // 非多个禁用
  192. multiple: true,
  193. // 显示搜索条件
  194. showSearch: true,
  195. // 总条数
  196. total: 0,
  197. // 用户表格数据
  198. dataList: null,
  199. // 弹出层标题
  200. title: "",
  201. // 是否显示弹出层
  202. open: false,
  203. // 日期范围
  204. dateRange: [],
  205. // 查询参数
  206. queryParams: {
  207. pageNum: 1,
  208. pageSize: 10,
  209. type: undefined,
  210. },
  211. statusList: [
  212. // {id: 1, name: '未发布', value: 0},
  213. {id: 1, name: '启用', value: 1},
  214. {id: 2, name: '禁用', value: 2},
  215. ],
  216. visibleStatus: false,
  217. newObj: {},
  218. visibleType: '',
  219. };
  220. },
  221. created() {
  222. this.getList();
  223. },
  224. // activated(){
  225. // this.getList();
  226. // },
  227. methods: {
  228. /** 查询列表 */
  229. getList() {
  230. this.loading = true;
  231. pageList(this.addDateRange(this.queryParams, this.dateRange))
  232. .then(response => {
  233. this.dataList = response.data.rows;
  234. this.total = response.data.total;
  235. this.loading = false;
  236. }
  237. ).catch(() => {
  238. this.loading = false;
  239. });
  240. },
  241. // 取消按钮
  242. cancel() {
  243. this.open = false;
  244. },
  245. /** 搜索按钮操作 */
  246. handleQuery() {
  247. this.queryParams.pageNum = 1;
  248. this.getList();
  249. },
  250. /** 重置按钮操作 */
  251. resetQuery() {
  252. this.dateRange = [];
  253. this.$set(this.queryParams, 'theatreName', '');
  254. this.$set(this.queryParams, 'performDate', '');
  255. this.$set(this.queryParams, 'performName', '');
  256. this.$set(this.queryParams, 'status', '');
  257. this.queryParams.pageNum = 1;
  258. this.handleQuery();
  259. },
  260. // 多选框选中数据
  261. handleSelectionChange(selection) {
  262. this.ids = selection.map(item => item.id);
  263. },
  264. /** 新增按钮操作 */
  265. handleAdd(type) {
  266. this.$refs["addAndEdit"].openDialog("新增数据", null, type);
  267. },
  268. /** 修改按钮操作 */
  269. handleUpdate(row) {
  270. this.$refs["addAndEdit"].openDialog("修改数据", row);
  271. },
  272. /** 发布或者取消发布按钮操作 */
  273. ionlineApi(row) {
  274. this.$confirm("是否对:" + row.performName + row.goodsNames + "的数据进行" + (row.status == 1 ? '禁用?' : '启用?'), '提示', {
  275. confirmButtonText: '确定',
  276. cancelButtonText: '取消',
  277. type: 'warning'
  278. }).then(() => {
  279. this.loading = true;
  280. ionline({ id: row.id, status: row.status == 1 ? 2 : 1 }).then((res) => {
  281. if (res.code == 200) {
  282. this.$message({
  283. type: 'success',
  284. message: '操作成功!'
  285. });
  286. this.getList();
  287. }
  288. });
  289. }).catch((error) => {
  290. this.$message({
  291. type: 'error',
  292. message: error.msg
  293. });
  294. }).finally(() => {
  295. this.loading = false;
  296. });
  297. },
  298. /** 删除按钮操作 */
  299. handleDelete(row) {
  300. this.$modal.confirm('是否确认删除该数据?').then(function() {
  301. return deleteById(row.id);
  302. }).then(() => {
  303. this.getList();
  304. this.$modal.msgSuccess("删除成功");
  305. }).catch(() => {});
  306. },
  307. /** 批量删除按钮操作 */
  308. handleBatchDelete() {
  309. if(!this.ids || this.ids.length == 0){
  310. this.$modal.msgWarning("请选择需要删除的数据!");
  311. return false
  312. }
  313. this.$confirm('是否确认删除选中的数据?', '提示', {
  314. confirmButtonText: '确定',
  315. cancelButtonText: '取消',
  316. type: 'warning'
  317. }).then(() => {
  318. deleteBatchById(this.ids.toString())
  319. .then(response => {
  320. this.getList();
  321. this.$modal.msgSuccess("删除成功");
  322. }).catch(() => {
  323. });
  324. }).catch(() => {});
  325. },
  326. /** 查看按钮操作 */
  327. seeCenter(obj, type) {
  328. this.visibleStatus = true
  329. this.visibleType = type;
  330. this.newObj = obj;
  331. }
  332. }
  333. };
  334. </script>