addAndEdit.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <!--
  2. * @Description: 新增/编辑弹框
  3. * @Author: Sugar.
  4. * @Date: 2023-11-24 13:55:00
  5. * @LastEditors: Sugar.
  6. * @LastEditTime: 22023-11-24 13:55:00
  7. * @FilePath: \cattle_webui\src\views\team\applicationMr\addAndEdit.vue
  8. * @Copyright: Copyright (c) 2016~2023 by Sugar., All Rights Reserved.
  9. -->
  10. <template>
  11. <el-dialog
  12. :title="title"
  13. :visible.sync="open"
  14. width="800px"
  15. append-to-body
  16. :close-on-click-modal="false"
  17. @close="cancel"
  18. >
  19. <div
  20. class="dialog"
  21. v-loading="loading1"
  22. element-loading-text="拼命加载中..."
  23. element-loading-spinner="el-icon-loading"
  24. element-loading-background="rgba(0, 0, 0, 0.8)"
  25. >
  26. <el-form :model="form" ref="form" size="mini" :rules="rules" label-width="200px">
  27. <el-form-item label="选择团队:" prop="teamId">
  28. <el-select
  29. v-model="form.teamId"
  30. placeholder="请点击输入框后输入关键词进行查询"
  31. clearable
  32. filterable
  33. remote
  34. reserve-keyword
  35. :remote-method="teamPageListApi"
  36. @change="teamChange"
  37. :loading="teamIdLoading"
  38. style="width: 100%;"
  39. >
  40. <el-option
  41. v-for="dict in teamList"
  42. :key="dict.id"
  43. :label="dict.name"
  44. :value="dict.id"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="带队负责人:" prop="linkName">
  49. <el-input
  50. v-model="form.linkName"
  51. placeholder="请输入带队负责人"
  52. clearable
  53. style="width: 260px;"
  54. >
  55. </el-input>
  56. </el-form-item>
  57. <el-form-item label="带队负责人联系电话:" prop="linkPhone">
  58. <el-input
  59. v-model="form.linkPhone"
  60. placeholder="请输入带队负责人联系电话"
  61. clearable
  62. style="width: 260px;"
  63. >
  64. </el-input>
  65. </el-form-item>
  66. <el-form-item label="选择场馆:" prop="theatreId">
  67. <el-select
  68. v-model="form.theatreId"
  69. placeholder="选择场馆"
  70. clearable
  71. @change="changeTheatre"
  72. style="width: 100%;"
  73. >
  74. <el-option
  75. v-for="dict in theatreList"
  76. :key="dict.id"
  77. :label="dict.name"
  78. :value="dict.id"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="选择演出厅:" prop="auditoriumId">
  83. <el-select
  84. v-model="form.auditoriumId"
  85. placeholder="选择演出厅"
  86. @change="auditoriumChange"
  87. clearable
  88. style="width: 100%;"
  89. >
  90. <el-option
  91. v-for="dict in merchantList"
  92. :key="dict.id"
  93. :label="dict.name"
  94. :value="dict.id"
  95. />
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="选择剧目:" prop="performId">
  99. <el-select
  100. v-model="form.performId"
  101. placeholder="选择剧目"
  102. clearable
  103. @change="performChangeEven"
  104. style="width: 100%;"
  105. >
  106. <el-option
  107. v-for="dict in goodsList"
  108. :key="dict.id"
  109. :label="dict.name"
  110. :value="dict.id"
  111. />
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item label="选择日期" prop="performDate">
  115. <el-date-picker
  116. v-model="form.performDate"
  117. type="date"
  118. @change="performDateEven"
  119. value-format="yyyy-MM-dd"
  120. placeholder="选择日期">
  121. </el-date-picker>
  122. </el-form-item>
  123. <el-form-item label="预约场次:" prop="performTimeId">
  124. <el-select
  125. v-model="form.performTimeId"
  126. placeholder="预约场次"
  127. clearable
  128. style="width: 100%;"
  129. @change="performTimeIdEven"
  130. >
  131. <el-option
  132. v-for="dict in performTimeList"
  133. :key="dict.id"
  134. :label="dict.timeSnapshot + '场次: ' + dict.performDate + ' 开始时间' + dict.performTimeStart + ', 结束时间' + dict.performTimeEnd"
  135. :value="dict.id"
  136. />
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="票务管理:" prop="goodsId">
  140. <el-select
  141. v-model="form.goodsId"
  142. placeholder="票务管理"
  143. clearable
  144. @change="goodsChangeEven"
  145. style="width: 100%;"
  146. >
  147. <el-option
  148. v-for="dict in ticketList"
  149. :key="dict.goodsId"
  150. :label="dict.goodsName"
  151. :value="dict.goodsId"
  152. />
  153. </el-select>
  154. </el-form-item>
  155. <el-form-item label="座位类型:" prop="seatTypeId">
  156. <el-select
  157. v-model="form.seatTypeId"
  158. placeholder="座位类型"
  159. clearable
  160. @change="seatChangeEven"
  161. style="width: 100%;"
  162. >
  163. <el-option
  164. v-for="dict in seatList"
  165. :key="dict.seatTypeId"
  166. :label="dict.seatTypeName"
  167. :value="dict.seatTypeId"
  168. />
  169. </el-select>
  170. </el-form-item>
  171. <el-form-item label="团购单价:" prop="price">
  172. <el-input
  173. type="number"
  174. disabled
  175. v-model="form.price"
  176. placeholder=""
  177. clearable
  178. @change="changePriceAmount('salePrice')"
  179. style="width: 260px;"
  180. >
  181. <template slot="append">元/人</template>
  182. </el-input>
  183. </el-form-item>
  184. <el-form-item label="观影人员:" prop="viewerList">
  185. <el-upload
  186. class="upload-demo"
  187. :action="uploadObj.url"
  188. :headers="uploadObj.headers"
  189. :auto-upload="false"
  190. :disabled="uploadLoading"
  191. :show-file-list="false"
  192. :on-change="beforeAvatarUpload"
  193. :file-list="form.fileList">
  194. <el-button size="small" type="primary" :loading="uploadLoading">{{form.viewerList && form.viewerList.length == 0 ? '导入excel' : '重新导入excel'}}</el-button>
  195. <div slot="tip" class="el-upload__tip">
  196. 上传excel文件,导入模板表头序号、姓名、身份证号码
  197. <i @click="handleExport" style="color: #1890ff;cursor: pointer;">下载模板</i>
  198. </div>
  199. </el-upload>
  200. <div v-if="form.viewerList && form.viewerList.length > 0">
  201. <el-table :data="form.viewerList" style="width: 100%" border>
  202. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  203. <el-table-column prop="name" label="姓名" align="center" ></el-table-column>
  204. <el-table-column prop="cardId" label="身份证号码" align="center"> </el-table-column>
  205. </el-table>
  206. </div>
  207. </el-form-item>
  208. </el-form>
  209. </div>
  210. <span slot="footer" class="dialog-footer">
  211. <el-button @click="cancel">取消</el-button>
  212. <el-button
  213. type="primary"
  214. @click="submitForm"
  215. v-loading="loading"
  216. element-loading-text="拼命加载中..."
  217. element-loading-spinner="el-icon-loading"
  218. element-loading-background="rgba(0, 0, 0, 0.8)"
  219. >
  220. <span v-if="loading">提交中...</span>
  221. <span v-else>保存</span>
  222. </el-button>
  223. </span>
  224. </el-dialog>
  225. </template>
  226. <script>
  227. import { saveAndEdit, getSelectById, uploadExcel, queryPrice,downloadModel,selectRegionApi,selectRegionNewApi } from "@/api/team/applicationMr";
  228. import { pagePerformTimeList } from '@/api/schedulingMr/schedulingMr'
  229. import Editor from "@/components/Editor";
  230. import { getToken } from "@/utils/auth";
  231. import { goodsPageList } from '@/api/programmeMr/programmeMr'
  232. import { seatPricePageList } from '@/api/distribution/ticketMr'
  233. import { merchantPageList } from '@/api/performanceHallMr/performanceHallMr'
  234. import { pageList } from "@/api/venueMr/venueMr";
  235. import { teamPageList } from '@/api/team/teamMr'
  236. export default {
  237. name: "addAndEdit",
  238. props: {
  239. dict: {
  240. type: Object,
  241. default: () => [],
  242. },
  243. },
  244. components: {
  245. Editor,
  246. },
  247. data() {
  248. return {
  249. title: "编辑",
  250. model: "EDIT",
  251. activeName: '01',
  252. open: false,
  253. loading: false,
  254. loading1: false,
  255. uploadLoading: false,
  256. form: {
  257. id: undefined,
  258. },
  259. rules: {
  260. teamId: [{ required: true, message: "请选择团队", trigger: ["change","blur"] }],
  261. linkName: [{ required: true, message: "请输入带队负责人", trigger: ["change","blur"] }],
  262. linkPhone: [{ required: true, message: "请输入带队负责人联系电话", trigger: ["change","blur"] }],
  263. theatreId: [{ required: true, message: "请选择场馆", trigger: ["change","blur"] }],
  264. auditoriumId: [{ required: true, message: "请选择演出厅", trigger: ["change","blur"] }],
  265. performId: [{ required: true, message: "请选择选择剧目", trigger: ["change","blur"] }],
  266. goodsId: [{ required: true, message: "请选择票务", trigger: ["change","blur"] }],
  267. seatTypeId: [{ required: true, message: "请选择座位类型", trigger: ["change","blur"] }],
  268. price: [{ required: true, message: "请输入团购单价", trigger: ["change","blur"] }],
  269. teamPersonNum: [{ required: true, message: "请输入人数", trigger: ["change","blur"] }],
  270. performTimeId: [{ required: true, message: "请选择预约场次", trigger: ["change","blur"] }],
  271. viewerList: [{ required: true, message: "请上传观影人员excel", trigger: ["change","blur"] }],
  272. performDate: [{ required: true, message: "请选择日期", trigger: ["change","blur"] }]
  273. },
  274. uploadObj: {
  275. url: process.env.VUE_APP_UPLOAD_FILE_API + "/upload/single/minio",
  276. Headers: { Authorization: "Bearer " + getToken() },
  277. },
  278. goodsList: [],
  279. ticketList: [],
  280. seatList: [],
  281. merchantList: [],
  282. theatreList: [],
  283. teamList: [],
  284. sessionList: [],
  285. performTimeList: [],
  286. teamIdLoading: false,
  287. };
  288. },
  289. methods: {
  290. /**
  291. * 打开弹框
  292. * @date 2023-11-22
  293. * @param {any} obj
  294. * @returns {any}
  295. */
  296. openDialog(title, obj) {
  297. this.open = true;
  298. this.teamPageListApi();
  299. this.getList();
  300. this.goodsPageList();
  301. this.reset();
  302. if (obj){
  303. this.title = "编辑报名";
  304. this.getSelectByIdApi(obj);
  305. }else{
  306. this.title = "添加报名";
  307. this.$nextTick(() => {
  308. this.$refs["form"].clearValidate();
  309. });
  310. }
  311. },
  312. /** 获取详情 */
  313. async getSelectByIdApi(row) {
  314. try {
  315. const id = row.id
  316. this.loading1 = true
  317. let response = await getSelectById(id)
  318. let obj = response.data;
  319. this.$set(this,'form',{
  320. ...obj,
  321. viewerList: obj.viewersList,
  322. applyId: obj.id?obj.id:null
  323. })
  324. //this.ticketListApi();
  325. //this.getSeatTypeList({goodsId: this.form.goodsId, performId: this.form.performId});
  326. await this.merchantPageList(this.form.theatreId) // 获取演出厅
  327. await this.selectRegionFun() // 获取票务管理
  328. await this.getPerformTimeList() // 预约场次列表
  329. this.setGoodsChangeEven(this.form.goodsId) // 座位类型
  330. this.loading1 = false
  331. } catch (error) {
  332. console.error("error====",error)
  333. this.loading1 = false
  334. this.open = false
  335. }
  336. },
  337. /** 团队列表查询 */
  338. teamPageListApi(key) {
  339. console.log("fadsfasdf====",key)
  340. this.teamIdLoading = true
  341. teamPageList(this.addDateRange({pageNum: 1, pageSize: 900,name:key}))
  342. .then(response => {
  343. // let teamArr = []
  344. // teamArr = response.data.rows || []
  345. // if(teamArr.length != 0) {
  346. // teamArr.forEach(ele => {
  347. // if(ele.remark) {
  348. // ele.name = ele.name + '(' + ele.remark +')'
  349. // }
  350. // })
  351. // }
  352. // this.teamList = teamArr
  353. this.teamList = response.data.rows
  354. this.teamIdLoading = false
  355. }).catch(()=>{
  356. this.teamIdLoading = true
  357. })
  358. },
  359. /** 场馆列表查询 */
  360. getList(name) {
  361. pageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  362. .then(response => {
  363. this.theatreList = response.data.rows;
  364. });
  365. },
  366. /** 团队选择 */
  367. teamChange(val) {
  368. if(!val) {
  369. this.teamPageListApi()
  370. }
  371. this.teamList.forEach(item => {
  372. if(val == item.id){
  373. this.$set(this.form, 'teamName', item.name)
  374. }
  375. })
  376. this.$set(this.form, 'goodsId', '')
  377. this.$set(this.form, 'goodsName', '')
  378. this.$set(this.form, 'seatTypeId', '')
  379. this.$set(this.form, 'price', '')
  380. this.selectRegionFun()
  381. },
  382. /** 场馆选择 */
  383. changeTheatre(id) {
  384. this.theatreList.forEach(item => {
  385. if(id == item.id){
  386. this.$set(this.form, 'theatreName', item.name)
  387. }
  388. })
  389. this.$set(this.form, 'auditoriumId', '')
  390. this.$set(this.form, 'performId', '')
  391. this.$set(this.form, 'goodsId', '')
  392. this.$set(this.form, 'goodsName', '')
  393. this.$set(this.form, 'seatTypeId', '')
  394. this.$set(this.form, 'price', '')
  395. this.$set(this.form, 'performDate', '');
  396. this.$set(this.form, 'performTimeId', '');
  397. this.merchantList = [] // 演出厅
  398. //this.goodsList = [] // 剧目
  399. this.performTimeList = [] // 场次
  400. this.ticketList = [] // 票务
  401. this.seatList = [] // 座位类型
  402. this.merchantPageList(id) // 获取演出厅
  403. },
  404. /** 演出厅选择 */
  405. auditoriumChange(id) {
  406. this.$set(this.form, 'performDate', '');
  407. this.$set(this.form, 'performTimeId', '');
  408. this.$set(this.form, 'performId', '');
  409. this.$set(this.form, 'goodsId', '')
  410. this.$set(this.form, 'seatTypeId', '')
  411. this.$set(this.form, 'price', '')
  412. this.merchantList.forEach(item => {
  413. if(id == item.id){
  414. this.$set(this.form, 'auditoriumName', item.name)
  415. }
  416. })
  417. // this.goodsList = [] // 剧目
  418. this.performTimeList = [] // 场次
  419. this.ticketList = [] // 票务
  420. this.seatList = [] // 座位类型
  421. //this.getPerformTimeList();
  422. },
  423. /** 演出厅列表查询 */
  424. merchantPageList(id) {
  425. merchantPageList(this.addDateRange({theatreId: id, pageNum: 1, pageSize: 100}))
  426. .then(response => {
  427. this.merchantList = response.data.rows;
  428. });
  429. },
  430. /** 剧目列表查询 */
  431. goodsPageList() {
  432. goodsPageList(this.addDateRange({pageNum: 1, pageSize: 100, status: 1}))
  433. .then(response => {
  434. this.goodsList = response.data.rows;
  435. });
  436. },
  437. /** 票务列表查询 */
  438. ticketListApi(performId) {
  439. this.ticketList = []
  440. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, performId: performId}))
  441. .then(response => {
  442. let ticketList = []
  443. response.data.rows.forEach(item => {
  444. if(ticketList.indexOf(item.goodsId) == -1){
  445. this.ticketList.push(item);
  446. ticketList.push(item.goodsId);
  447. }
  448. })
  449. });
  450. },
  451. /** 座位类型列表 */
  452. getSeatTypeList(obj) {
  453. seatPricePageList({pageNum: 1, pageSize: 100, goodsId: obj.goodsId, performId: obj.performId})
  454. .then(response => {
  455. let ticketList = []
  456. response.data.rows.forEach(item => {
  457. if(ticketList.indexOf(item.seatTypeId) == -1){
  458. this.seatList.push(item);
  459. ticketList.push(item.seatTypeId);
  460. }
  461. })
  462. });
  463. },
  464. /** 团购价格查询 */
  465. queryPriceApi() {
  466. let postMap = {
  467. teamId: this.form.teamId,
  468. goodsId: this.form.goodsId,
  469. performId: this.form.performId,
  470. seatTypeId: this.form.seatTypeId,
  471. }
  472. queryPrice(postMap)
  473. .then(response => {
  474. if(response.data){
  475. let data = response.data;
  476. this.$set(this.form, 'price', data.salePrice);
  477. }
  478. });
  479. },
  480. /** 预约场次列表 */
  481. getPerformTimeList() {
  482. if(this.form.performDate && this.form.performDate == '') {
  483. this.$message.error("请选择日期!");
  484. return false
  485. }
  486. pagePerformTimeList(this.addDateRange(
  487. {pageNum: 1, pageSize: 100, performDate: this.form.performDate, performId: this.form.performId, auditoriumId: this.form.auditoriumId, status: 1}
  488. ))
  489. .then(response => {
  490. this.performTimeList = response.data.rows;
  491. });
  492. },
  493. /** 价格输入事件 */
  494. changePriceAmount(key) {
  495. if(this.form[key] * 1 < 0){
  496. this.$message.error("输入需大于或等于0!");
  497. this.$set(this.form, key, '');
  498. return false
  499. }
  500. },
  501. /** 剧目改变事件 */
  502. performChangeEven(val) {
  503. this.seatList = [];
  504. this.ticketList = [];
  505. this.$set(this.form, 'performDate', '');
  506. this.$set(this.form, 'performTimeId', '');
  507. this.$set(this.form, 'goodsId', '');
  508. this.$set(this.form, 'seatTypeId', '');
  509. this.$set(this.form, 'price', '')
  510. this.goodsList.forEach(item => {
  511. if(item.id == val){
  512. this.$set(this.form, 'performName', item.name)
  513. }
  514. })
  515. // this.ticketListApi(val); // 获取票务
  516. // this.getPerformTimeList(); // 场次
  517. },
  518. // 预约时间
  519. performDateEven() {
  520. console.log("获取场次====")
  521. this.$set(this.form, 'performTimeId', '')
  522. this.$set(this.form, 'goodsId', '');
  523. this.$set(this.form, 'seatTypeId', '');
  524. this.$set(this.form, 'price', '')
  525. this.performTimeList = [] // 场次
  526. this.ticketList = [] // 票务
  527. this.seatList = [] // 座位类型
  528. this.getPerformTimeList(); // 获取场次
  529. },
  530. /** 选择场次 */
  531. performTimeIdEven(val){
  532. this.$set(this.form, 'goodsId', '');
  533. this.$set(this.form, 'goodsName', '')
  534. this.$set(this.form, 'seatTypeId', '');
  535. this.$set(this.form, 'price', '')
  536. this.ticketList = [] // 票务
  537. this.seatList = [] // 座位类型
  538. this.selectRegionFun() // 获取票务管理
  539. },
  540. // 票务改变事件
  541. goodsChangeEven(id) {
  542. let list = []
  543. this.ticketList.forEach(item => {
  544. if(item.goodsId == id){ // item.goodsId == id
  545. this.$set(this.form, 'goodsName', item.goodsName)
  546. list = item.seatList//item.regionList
  547. }
  548. })
  549. this.$set(this.form, 'price', '');
  550. this.$set(this.form, 'seatTypeId', '');
  551. this.seatList = [];
  552. console.log("ffffffffff=====",list)
  553. //let selectMap = {goodsId: this.form.goodsId, performId: this.form.performId}
  554. //this.getSeatTypeList(selectMap); 获取走位
  555. this.seatList = [].concat(list)
  556. },
  557. // 座位类型改变事件
  558. seatChangeEven(val) {
  559. this.seatList.forEach(item =>{
  560. if(item.seatTypeId == val){
  561. this.$set(this.form, 'seatTypeName', item.seatTypeName);
  562. this.$set(this.form, 'price', item.salePrice);
  563. }
  564. })
  565. //this.queryPriceApi();
  566. },
  567. setGoodsChangeEven(id) {
  568. let list = []
  569. this.ticketList.forEach(item => {
  570. if(item.id == id){
  571. list = item.regionList
  572. }
  573. })
  574. this.seatList = [];
  575. this.seatList = [].concat(list)
  576. },
  577. /**
  578. * 保存
  579. * @date 2023-11-22
  580. * @returns {any}
  581. */
  582. submitForm() {
  583. this.$refs["form"].validate(async (valid) => {
  584. if (valid) {
  585. try {
  586. this.loading = true;
  587. let params = JSON.parse(JSON.stringify(this.form))
  588. delete params.viewersList
  589. const { code } = await saveAndEdit({ ...params });
  590. if (code === 200) {
  591. this.$message.success("操作成功!");
  592. this.$emit("getList");
  593. this.cancel();
  594. }
  595. } catch (error) {
  596. } finally {
  597. this.loading = false;
  598. }
  599. }
  600. });
  601. },
  602. /**
  603. * 重置
  604. * @date 2023-11-22
  605. * @returns {any}
  606. */
  607. reset() {
  608. this.$set(this.form, 'id', '');
  609. this.$set(this.form, 'teamId', '');
  610. this.$set(this.form, 'linkName', '');
  611. this.$set(this.form, 'linkPhone', '');
  612. this.$set(this.form, 'teamName', '');
  613. this.$set(this.form, 'theatreId', '');
  614. this.$set(this.form, 'theatreName', '');
  615. this.$set(this.form, 'auditoriumId', '');
  616. this.$set(this.form, 'auditoriumName', '');
  617. this.$set(this.form, 'performId', '');
  618. this.$set(this.form, 'performName', '');
  619. this.$set(this.form, 'seatTypeId', '');
  620. this.$set(this.form, 'seatTypeName', '');
  621. this.$set(this.form, 'goodsId', '');
  622. this.$set(this.form, 'goodsName', '');
  623. this.$set(this.form, 'performTimeId', '');
  624. this.$set(this.form, 'performDate', '');
  625. this.$set(this.form, 'price', '');
  626. this.$set(this.form, 'viewerList', []);
  627. },
  628. /**
  629. * 关闭弹框
  630. * @date 2023-11-22
  631. * @returns {any}
  632. */
  633. cancel() {
  634. this.reset();
  635. this.open = false;
  636. },
  637. /**
  638. * 上传文件之前之前
  639. * @date 2023-11-22
  640. * @param {any} file
  641. * @returns {any}
  642. */
  643. beforeAvatarUpload(file) {
  644. this.uploadExcelApi(file.raw);
  645. },
  646. // 上传
  647. uploadExcelApi(file) {
  648. try {
  649. let formData = new FormData();
  650. formData.append("file", file);
  651. this.uploadLoading = true;
  652. uploadExcel(formData).then(response => {
  653. this.$message.success("上传成功!");
  654. this.$set(this.form, 'viewerList', response.data)
  655. });
  656. } catch (e) {
  657. } finally {
  658. this.uploadLoading = false;
  659. }
  660. },
  661. /** 导出按钮操作 */
  662. async handleExport() {
  663. //this.downloadGet('member/marketTeamApply/downTeamApplyTemplate', {}, `观影人员上传模板_${new Date().getTime()}.xlsx`)
  664. try {
  665. let res = await downloadModel()
  666. let fileName = `观影人员上传模板_${new Date().getTime()}.xlsx`
  667. let blob=new Blob([res])
  668. let href=window.URL.createObjectURL(blob)
  669. // 创建下载按钮a标签进行自动点击下载,下载完后移除按钮a标签
  670. let downloadDom=document.createElement('a')
  671. downloadDom.href=href
  672. downloadDom.download=fileName //--不是必须 若需要【前端重命名文件夹】的话这句代码就需要
  673. document.body.appendChild(downloadDom)
  674. downloadDom.click()
  675. document.body.removeChild(downloadDom)
  676. window.URL.revokeObjectURL(href)
  677. } catch (error) {
  678. }
  679. },
  680. // 获取票务管理
  681. async selectRegionFun(){
  682. try {
  683. if(!this.form.teamId||!this.form.auditoriumId||!this.form.performId||!this.form.performTimeId){
  684. return
  685. }
  686. let res = await selectRegionNewApi({
  687. "teamId": this.form.teamId,
  688. "auditoriumId": this.form.auditoriumId,
  689. "performId": this.form.performId,
  690. "performTimeId": this.form.performTimeId,
  691. "timeId": this.form.performTimeId,
  692. "channelType": "group"
  693. })
  694. if( res.code == 200 ) {
  695. this.ticketList = res.data.list
  696. }
  697. } catch (error) {
  698. console.error(error)
  699. }
  700. }
  701. },
  702. };
  703. </script>
  704. <style lang="scss" scoped>
  705. .dialog {
  706. padding: 0 30px;
  707. max-height: 65vh;
  708. overflow-y: auto;
  709. }
  710. .dialog {
  711. padding: 0 30px;
  712. .upload-btn {
  713. width: 100px;
  714. height: 100px;
  715. background-color: #fbfdff;
  716. border: dashed 1px #c0ccda;
  717. border-radius: 5px;
  718. i {
  719. font-size: 30px;
  720. margin-top: 20px;
  721. }
  722. &-text {
  723. margin-top: -10px;
  724. }
  725. }
  726. .avatar {
  727. cursor: pointer;
  728. }
  729. }
  730. </style>