index.vue 13 KB

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