index.vue 15 KB

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