seatManagementTable.vue 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786
  1. <template>
  2. <div class="sm">
  3. <div class="sm-box-top-tool">
  4. <div style="display: flex;align-items: center;">
  5. <span style="margin-right: 5px;font-size: 14px;">放大/缩小:</span>
  6. <div style="width: 100px;">
  7. <el-slider input-size="mini" v-model="whNum" :min="16" :max="100"></el-slider>
  8. </div>
  9. </div>
  10. <div class="sm-box-top-tool-legend">
  11. <div
  12. :key="item.id"
  13. v-for="(item,index) in seatTypeList"
  14. >
  15. <span :style="{backgroundColor: item.color,border: '1px solid #000'}"></span>
  16. <span :style="{color: item.color}">{{ item.name }}</span>
  17. </div>
  18. <div>
  19. <span :style="{backgroundColor: '#ccc',border: '1px solid #000'}"></span>
  20. <span :style="{color: '#ccc'}">{{ "不可用" }}</span>
  21. </div>
  22. <div>
  23. <span :style="{backgroundColor: '#fff',border: '1px solid #000',color: '#000'}"></span>
  24. <span :style="{color: '#ccc'}">{{ "未设置座位类型" }}</span>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="sm-box">
  29. <div class="sm-scroll-box">
  30. <el-table
  31. v-dragSelect="{
  32. selectClass: ['.row-item'],
  33. change: dragSelectChange,
  34. lostItem: dragLostItemChange,
  35. reSelect: reSelect
  36. }"
  37. :data="tableData"
  38. width="100%"
  39. height="100%"
  40. ref="table"
  41. row-key="id"
  42. class="exchange_table"
  43. :style="{
  44. '--row-scale': whNum/100,
  45. '--row-w': (width*(whNum/100))+'px',
  46. '--row-h': (width*(whNum/100))+'px',
  47. '--row-w-i': width+'px',
  48. '--row-h-i': height+'px',
  49. }"
  50. :data-source="ranking_goods"
  51. :cell-class-name="tableCellClassName"
  52. @cell-dblclick="cellDblclick"
  53. >
  54. <el-table-column
  55. type="index"
  56. fixed=left
  57. label="#"
  58. align="center"
  59. v-if="tableHeader.length!=0"
  60. :width="50">
  61. <template slot-scope="scope">
  62. <span>{{ scope.$index + 1 }}#</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. v-for="(item,index) in tableHeader"
  67. :prop="item.key"
  68. :label="item.title"
  69. :width="((width*(whNum/100)+7.5)*item.length)+'px'"
  70. align="center"
  71. >
  72. <!-- 自定义头部 -->
  73. <template slot="header" slot-scope="scope">
  74. <div
  75. class="table-header"
  76. :width="((width*(whNum/100)+7.5)*item.length)+'px'"
  77. >
  78. <div
  79. class="table-header-item"
  80. :key="index"
  81. v-for="(item,index) in colsAll"
  82. >{{ index + 1 }}</div>
  83. </div>
  84. </template>
  85. <template slot-scope="scope">
  86. <div class="row-item-box" :style='{display: "flex",flexWrap: "nowrap",justifyContent: item.align}'>
  87. <div
  88. :class="['row-item',selectList.includes(item1.styleCss.id) ? 'row-item-select': '']"
  89. v-for="(item1,index1) in scope.row[item.key]"
  90. :key="item1.styleCss.id"
  91. dragSelectType="div"
  92. :dragSelectId="item1.styleCss.id"
  93. :style="{
  94. backgroundColor: item1.status == 1 ? item1.color?item1.color: '#fff': '#ccc',
  95. }"
  96. @contextmenu="(e)=>{e.preventDefault();openFormDialogVisible('singleEdit',item1)}"
  97. >
  98. <div>
  99. <i style="line-height: 15px;"></i>
  100. <i style="line-height: 15px;">{{ item1.name ? item1.name : '未命名' }}</i>
  101. <i style="line-height: 15px;white-space: nowrap;">{{ item1.rowNo+ '-' +item1.columnNo }} ({{ item1.priority ? item1.priority : '-' }})</i>
  102. </div>
  103. </div>
  104. </div>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </div>
  109. <!-- 编辑页 -->
  110. <div class="table-tool">
  111. <div class="table-tool-tab">
  112. <el-tabs
  113. v-model="activeName"
  114. @tab-click="handleClickTab">
  115. <!-- <el-tab-pane label="创建区域" name="first"></el-tab-pane> -->
  116. <el-tab-pane label="座位管理" name="second">
  117. <!-- 座位管理 -->
  118. <div class="qu-second-box">
  119. <div class="qu-second-form">
  120. <el-form :model="ruleForm1" size="mini" :rules="rules1" ref="ruleForm1" label-width="80px" class="demo-ruleForm">
  121. <div v-if="!rowAll" style="display: flex;">
  122. <el-form-item label-width="0px" label=" ">
  123. <el-input placeholder="行数" v-model="ruleForm1.rowAll"></el-input>
  124. </el-form-item>
  125. <span style="margin-top: 10px;">—</span>
  126. <el-form-item label-width="0px" label=" ">
  127. <el-input placeholder="列数" v-model="ruleForm1.colsAll"></el-input>
  128. </el-form-item>
  129. <el-button style="height: 28px;margin-top: 7px;margin-left: 5px;" size="mini" type="primary" @click="createTemplate('ruleForm1')">创建模板</el-button>
  130. </div>
  131. <div v-else style="display: flex;">
  132. <el-button style="height: 28px;margin-top: 7px;" size="mini" type="primary" @click="addRanks('row')">增加一排</el-button>
  133. <el-button style="height: 28px;margin-top: 7px;margin-left: 5px;" size="mini" type="primary" @click="addRanks('cols')">增加一列</el-button>
  134. <el-button v-if="modeEdit == 'add'" style="height: 28px;margin-top: 7px;margin-left: 5px;" size="mini" type="primary" @click="initData">清除模板</el-button>
  135. </div>
  136. </el-form>
  137. </div>
  138. <div class="qu-second-info">
  139. <div class="qu-second-select">
  140. <span>当前选择的是:</span>
  141. <span v-if="currentRow">{{ currentRow }}排</span>
  142. <span v-if="currentRow">(注:从左至右排序如下)</span>
  143. </div>
  144. <div class="qu-second-info-tool">
  145. <span>快速排序:</span>
  146. <i @click="seatSortingFun('rise')">升序</i>
  147. <i @click="seatSortingFun('fall')">降序</i>
  148. <i @click="seatSortingFun('symmetry')">奇偶对称</i>
  149. <i @click="seatSortingFun('reversal')">反转</i>
  150. </div>
  151. <!-- <div class="qu-second-info-tool">
  152. <span>批量操作:</span>
  153. <i @click="seatSortingFun('rise')">修改名称</i>
  154. </div> -->
  155. <div class="qu-second-info-list">
  156. <transition-group>
  157. <div
  158. class="qu-second-info-item"
  159. :key="index"
  160. v-for="(item,index) in currentTabelList"
  161. v-dragging="{item: item, list:currentTabelList}"
  162. >
  163. <div >
  164. <span>名称:{{ item.name ? item.name :'未命名' }}</span>
  165. <span>优先级:{{ item.priority ? item.priority : '-' }}</span>
  166. </div>
  167. <el-button type="primary" size="mini" @click="openFormDialogVisible('singleEdit',item)">编辑</el-button>
  168. </div>
  169. </transition-group>
  170. </div>
  171. </div>
  172. </div>
  173. </el-tab-pane>
  174. <el-tab-pane label="批量处理" name="batch">
  175. <!-- 批量操作 -->
  176. <div class="qu-batch-box">
  177. <div class="qu-batch-form">
  178. <el-form :model="queryParams" ref="queryForm" size="mini" label-width="40px">
  179. <el-form-item style="margin-bottom: 5px;" label="坐标" >
  180. <div style="display: flex;">
  181. <el-input
  182. v-model="queryParams.row"
  183. placeholder="行数"
  184. clearable
  185. @keyup.enter.native="handleQuery"
  186. />
  187. <span>—</span>
  188. <el-input
  189. v-model="queryParams.cols"
  190. placeholder="列数"
  191. clearable
  192. @keyup.enter.native="handleQuery"
  193. />
  194. </div>
  195. </el-form-item>
  196. <el-form-item style="margin-bottom: 5px;" label="类型">
  197. <el-select v-model="queryParams.seatTypeId" placeholder="座位类型" clearable>
  198. <el-option
  199. v-for="(item,index) in seatTypeList"
  200. :key="item.id"
  201. :label="item.name"
  202. :value="item.id">
  203. </el-option>
  204. <el-option
  205. label="未绑定"
  206. :value="-1"
  207. />
  208. </el-select>
  209. </el-form-item>
  210. <el-form-item style="margin-bottom: 5px;" label="名称" >
  211. <div style="display: flex;">
  212. <el-input
  213. v-model="queryParams.name"
  214. placeholder="座位名称"
  215. clearable
  216. @keyup.enter.native="handleQuery"
  217. />
  218. <el-button style="margin-left: 5px;" type="primary" size="mini" @click="handleQuery">搜索</el-button>
  219. <el-button size="mini" @click="resetQuery">重置</el-button>
  220. </div>
  221. </el-form-item>
  222. </el-form>
  223. </div>
  224. <div class="qu-batch-tool">
  225. <div>
  226. <el-button type="primary" :disabled="multipleSelection.length==0" size="mini" @click="openFormDialogVisible('batchSetaName')">座位名称</el-button>
  227. <el-button type="primary" :disabled="multipleSelection.length==0" size="mini" @click="openFormDialogVisible('batchSetaType')">座位类型</el-button>
  228. </div>
  229. <div>
  230. <el-button type="primary" :disabled="multipleSelection.length==0" size="mini" @click="openFormDialogVisible('batchSetaPriority')">优先级</el-button>
  231. <el-button type="danger" :disabled="multipleSelection.length==0" size="mini" @click="openFormDialogVisible('batchSetaDisable')">座位状态</el-button>
  232. </div>
  233. </div>
  234. <div class="qu-batch-table">
  235. <el-table
  236. size="mini"
  237. :data="batchTableList"
  238. @selection-change="handleSelectionChange"
  239. style="width: 100%"
  240. height="100%"
  241. row-key="styleCss.id"
  242. >
  243. <el-table-column
  244. type="selection"
  245. align="center"
  246. width="40">
  247. </el-table-column>
  248. <el-table-column
  249. prop="name"
  250. align="center"
  251. label="名称">
  252. <template slot-scope="scope">
  253. <div>
  254. <span>{{ scope.row.name ? scope.row.name : '暂未命名' }}</span>
  255. <span>({{ scope.row.rowNo}}-{{ scope.row.columnNo}})</span>
  256. </div>
  257. </template>
  258. </el-table-column>
  259. <el-table-column
  260. align="center"
  261. label="优先级">
  262. <template slot-scope="scope">
  263. <span>{{ scope.row.priority }}</span>
  264. </template>
  265. </el-table-column>
  266. </el-table>
  267. </div>
  268. </div>
  269. </el-tab-pane>
  270. <el-tab-pane label="当前选择" name="select">
  271. <!-- 当前选择 -->
  272. <div class="qu-select-box">
  273. <div class="qu-select-select">
  274. <span>提示:</span>
  275. <span>鼠标左右键按下拖动可进行多选</span>
  276. </div>
  277. <div class="qu-select-tool">
  278. <div>
  279. <el-button type="primary" :disabled="selectTabelList.length==0" size="mini" @click="openFormDialogVisible('selectBatchSetaName')">座位名称</el-button>
  280. <el-button type="primary" :disabled="selectTabelList.length==0" size="mini" @click="openFormDialogVisible('selectBatchSetaType')">座位类型</el-button>
  281. <el-button type="primary" :disabled="selectTabelList.length==0" size="mini" @click="openFormDialogVisible('selectBatchSetaPriority')">优先级</el-button>
  282. </div>
  283. <div>
  284. <el-button type="danger" :disabled="selectTabelList.length==0" size="mini" @click="openFormDialogVisible('selectBatchSetaDisable')">座位状态</el-button>
  285. <el-button type="info" :disabled="selectTabelList.length==0" size="mini" @click="delSelectTabelList">清除选择</el-button>
  286. </div>
  287. </div>
  288. <div class="qu-select-table">
  289. <el-table
  290. size="mini"
  291. :data="selectTabelList"
  292. style="width: 100%"
  293. height="100%"
  294. row-key="styleCss.id"
  295. >
  296. <el-table-column
  297. prop="name"
  298. align="center"
  299. label="名称">
  300. <template slot-scope="scope">
  301. <div>
  302. <span>{{ scope.row.name ? scope.row.name : '暂未命名' }}</span>
  303. <span>({{ scope.row.rowNo}}-{{ scope.row.columnNo}})</span>
  304. </div>
  305. </template>
  306. </el-table-column>
  307. <el-table-column
  308. align="center"
  309. label="优先级">
  310. <template slot-scope="scope">
  311. <span>{{ scope.row.priority }}</span>
  312. </template>
  313. </el-table-column>
  314. </el-table>
  315. </div>
  316. </div>
  317. </el-tab-pane>
  318. </el-tabs>
  319. </div>
  320. </div>
  321. </div>
  322. <!-- 批量操作 -->
  323. <el-dialog
  324. :title="formDialogVisibleTitle"
  325. :visible.sync="formDialogVisible"
  326. width="30%"
  327. append-to-body
  328. >
  329. <el-form
  330. :model="formAll"
  331. :rules="formRules"
  332. ref="formAll"
  333. label-width="120px" >
  334. <div v-if="['batchSetaName','selectBatchSetaName'].indexOf(formAllType) !=-1">
  335. <el-form-item label="创建方式" prop="seatWay">
  336. <el-radio-group v-model="formAll.seatWay">
  337. <el-radio :label="1">相同</el-radio>
  338. <el-radio :label="2">使用行列号</el-radio>
  339. </el-radio-group>
  340. </el-form-item>
  341. <el-form-item v-if="formAll.seatWay == 2" label="座位名称" prop="name">
  342. <div style="display: flex;">
  343. <el-input v-model="formAll.name1"></el-input>
  344. <span style="white-space: nowrap;">+行号+</span>
  345. <el-input v-model="formAll.name"></el-input>
  346. <span style="white-space: nowrap;">+列号+</span>
  347. <el-input v-model="formAll.name2"></el-input>
  348. </div>
  349. </el-form-item>
  350. <el-form-item v-else label="座位名称" prop="name">
  351. <el-input v-model="formAll.name"></el-input>
  352. </el-form-item>
  353. </div>
  354. <div v-if="['batchSetaType','selectBatchSetaType'].indexOf(formAllType) !=-1">
  355. <el-form-item label="座位类型" prop="seatTypeId">
  356. <el-select
  357. v-model="formAll.seatTypeId"
  358. placeholder="请选择座位类型">
  359. <el-option
  360. v-for="(item,index) in seatTypeList"
  361. :key="item.id"
  362. :label="item.name"
  363. :value="item.id"></el-option>
  364. </el-select>
  365. </el-form-item>
  366. </div>
  367. <div v-if="['batchSetaPriority','selectBatchSetaPriority'].indexOf(formAllType) !=-1">
  368. <el-form-item label="设置方式" prop="seatPriorityWay">
  369. <el-radio-group v-model="formAll.seatPriorityWay">
  370. <el-radio :label="1">同一级</el-radio>
  371. <el-radio :label="2">递增</el-radio>
  372. <el-radio :label="3">递减</el-radio>
  373. </el-radio-group>
  374. </el-form-item>
  375. <el-form-item label="开始位置" prop="seatPriorityPosition">
  376. <el-radio-group v-model="formAll.seatPriorityPosition">
  377. <el-radio :label="1">列表上到下</el-radio>
  378. <el-radio :label="2">列表下到上</el-radio>
  379. </el-radio-group>
  380. </el-form-item>
  381. <el-form-item label="等级数" prop="setaPriorityNum">
  382. <el-input v-model="formAll.setaPriorityNum" placeholder="等级数"></el-input>
  383. </el-form-item>
  384. </div>
  385. <div v-if="['batchSetaDisable','selectBatchSetaDisable'].indexOf(formAllType) !=-1">
  386. <el-form-item label="座位状态" prop="status">
  387. <el-radio-group v-model="formAll.status">
  388. <!-- <el-radio :label="0">初始(该状态下不C端显示)</el-radio> -->
  389. <el-radio :label="1">可用</el-radio>
  390. <el-radio :label="2">不可用</el-radio>
  391. </el-radio-group>
  392. </el-form-item>
  393. </div>
  394. <!-- 单个编辑 -->
  395. <div v-if="['singleEdit'].indexOf(formAllType) !=-1">
  396. <el-form-item label="座位名称" prop="name">
  397. <el-input v-model="formAll.name" placeholder="座位名称"></el-input>
  398. </el-form-item>
  399. <el-form-item label="优先级" prop="priority">
  400. <el-input v-model="formAll.priority" placeholder="优先级"></el-input>
  401. </el-form-item>
  402. <el-form-item label="座位类型" prop="seatTypeId">
  403. <el-select
  404. v-model="formAll.seatTypeId"
  405. placeholder="请选择座位类型">
  406. <el-option
  407. v-for="(item,index) in seatTypeList"
  408. :key="item.id"
  409. :label="item.name"
  410. :value="item.id"></el-option>
  411. </el-select>
  412. </el-form-item>
  413. <el-form-item label="座位状态" prop="status">
  414. <el-radio-group v-model="formAll.status">
  415. <!-- <el-radio :label="0">初始(该状态下不C端显示)</el-radio> -->
  416. <el-radio :label="1">可用</el-radio>
  417. <el-radio :label="2">不可用</el-radio>
  418. </el-radio-group>
  419. </el-form-item>
  420. <!-- <el-form-item label="是否禁用" prop="delFlag">
  421. <el-radio-group v-model="formAll.delFlag">
  422. <el-radio :label="0">禁用</el-radio>
  423. <el-radio :label="1">启用</el-radio>
  424. </el-radio-group>
  425. </el-form-item> -->
  426. </div>
  427. </el-form>
  428. <span slot="footer" class="dialog-footer">
  429. <el-button @click="formDialogVisible = false">取 消</el-button>
  430. <el-button type="primary" @click="chekeFormAll('formAll')">确 定</el-button>
  431. </span>
  432. </el-dialog>
  433. </div>
  434. </template>
  435. <script>
  436. import Sortable from "sortablejs";
  437. import dragSelect from 'ty-drag-select';
  438. import { pageList as getSeatTypeList } from '@/api/seatTypeMr/seatTypeMr'
  439. import selectListMixin from "../mixins/selectList"
  440. export default {
  441. name: 'sysIndex',
  442. mixins: [selectListMixin],
  443. components: {},
  444. data() {
  445. return {
  446. modeEdit: '',
  447. // 页面渲染的数据
  448. seatList: [],
  449. seatTypeList: [],
  450. tableHeader: [{key: 'A',title: '舞台',length: 0,align: 'center'}],
  451. tableData: [], // 全部的座位 表格形式
  452. tableDataAll: [], // 全部的座位
  453. widthAll: '100%',
  454. heightAll: '100%',
  455. width: 65,
  456. height: 65,
  457. spacing: 10,
  458. whNum: 43,
  459. sortable: null,
  460. ranking_goods: [],
  461. // tool
  462. rowAll: null,
  463. colsAll: null,
  464. activeName: 'second',
  465. // 创建区域
  466. ruleForm: {},
  467. rules: {
  468. name: [
  469. { required: true, message: '请输入活动名称', trigger: ['blur','change'] }
  470. ],
  471. region: [
  472. { required: true, message: '请选择活动区域', trigger: ['blur','change'] }
  473. ],
  474. },
  475. /** 创建座位 开始 */
  476. // 创建座位
  477. ruleForm1: {
  478. name: '${row}排${col}座'
  479. },
  480. rules1: {
  481. resource: [
  482. { required: true, message: '请选择创建方式', trigger: ['blur','change'] }
  483. ],
  484. name: [
  485. { required: true, message: '请选择座位名称', trigger: ['blur','change'] }
  486. ],
  487. seatParity: [
  488. { required: true, message: '请选择座位号', trigger: ['blur','change'] }
  489. ],
  490. seatTypeId: [
  491. { required: true, message: '请选择座位类型', trigger: ['blur','change'] }
  492. ],
  493. },
  494. currentRow: null, // 当前选择的单元格行
  495. currentRegion: null, // 当前选择的单元格列
  496. currentLabel: null, // 当前选择的单元格列 名称
  497. currentProperty: null, // 当前选择的key
  498. currentTabelList: [], // 当前单元格的座位列表
  499. /** 创建座位 结束 */
  500. /** 批量操作 */
  501. batchTableList: [],
  502. multipleSelection: [], // 批量操作选中的
  503. queryParams: {},
  504. /** 编辑区域 开始 */
  505. formDialogVisibleTitle: '',
  506. formDialogVisible: false, // 弹窗
  507. formAll: {},
  508. formRules: {
  509. /** 修改名称 开始 */
  510. seatWay: [
  511. { required: true, message: '请选择创建方式', trigger: ['blur','change'] }
  512. ],
  513. seatParity: [
  514. { required: true, message: '请选择座号规律', trigger: ['blur','change'] }
  515. ],
  516. seatWell: [
  517. { required: true, message: '请选择座号顺序', trigger: ['blur','change'] }
  518. ],
  519. colMin: [
  520. { required: true, message: '请输入最小座位号', trigger: ['blur','change'] }
  521. ],
  522. colMax: [
  523. { required: true, message: '请输入最大座位号', trigger: ['blur','change'] }
  524. ],
  525. name: [
  526. { required: true, message: '请输入座位名称', trigger: ['blur','change'] }
  527. ],
  528. seatTypeId: [
  529. { required: true, message: '请输入座位类型', trigger: ['blur','change'] }
  530. ],
  531. seatPriorityWay: [
  532. { required: true, message: '请输入创建方式', trigger: ['blur','change'] }
  533. ],
  534. seatPriorityPosition: [
  535. { required: true, message: '请输入开始位置', trigger: ['blur','change'] }
  536. ],
  537. setaPriorityNum: [
  538. { required: true, message: '请输入等级数', trigger: ['blur','change'] }
  539. ]
  540. /** 修改名称 结束 */
  541. },
  542. formAllType: '', // region 区域
  543. /** 编辑区域 结束 */
  544. };
  545. },
  546. mounted() {
  547. //this.initData()
  548. // this.initDataCopy()
  549. // setTimeout(() => {
  550. // let tbody = document.getElementsByClassName('exchange_table')[0].getElementsByTagName('tbody');
  551. // tbody[0] && (tbody[0].className += ' box-table');
  552. // this.initSortTable();
  553. // }, 1000)
  554. // 拖拽事件
  555. this.columnDrop()
  556. this.$dragging.$on("dragged", (result) => {
  557. // 将排序后的结果重新赋值
  558. //this.tableHeader = [].concat(JSON.parse(JSON.stringify(result.value.list)))
  559. this.draggingSeatSort()
  560. });
  561. },
  562. methods: {
  563. /** 获取座位类型 */
  564. async getSeatTypeListFun(){
  565. try {
  566. let res = await getSeatTypeList({
  567. pageNum: 1, pageSize: 999
  568. })
  569. this.seatTypeList = res.data.rows
  570. } catch (error) {
  571. }
  572. },
  573. /** 重置所有的数据 */
  574. resetDataAll(){
  575. this.modeEdit = null
  576. this.tableData = []
  577. this.tableDataAll = []
  578. this.rowAll = null
  579. this.colsAll = null
  580. this.selectList = []
  581. this.selectTabelList = []
  582. this.activeName = "second"
  583. this.currentRow = null // 当前选择的单元格行
  584. this.currentRegion = null // 当前选择的单元格列
  585. this.currentLabel = null // 当前选择的单元格列 名称
  586. this.currentProperty = null // 当前选择的key
  587. this.currentTabelList = [] // 当前单元格的座位列表
  588. this.batchTableList = []
  589. this.multipleSelection = [] // 批量操作选中的
  590. this.queryParams = {}
  591. this.selectList = []
  592. this.selectTabelList = []
  593. this.multipleSelection_1 = []
  594. },
  595. /** 初始化数据 */
  596. async initData(row,list,type){
  597. this.resetDataAll()
  598. await this.getSeatTypeListFun()
  599. if(row.rows) {
  600. this.modeEdit = 'edit'
  601. this.rowAll = row.rows
  602. this.colsAll = row.cols
  603. let listCopy = []
  604. list.forEach((item,index) => {
  605. listCopy.push({
  606. ...item,
  607. styleCss: item.styleCss ? {
  608. ...JSON.parse(JSON.parse(item.styleCss)),
  609. id: this.tableHeader[0].key + "_"+item.rowNo+"_"+item.columnNo,
  610. }: {
  611. key: 'A',
  612. keyLabel: '舞台',
  613. id: this.tableHeader[0].key + "_"+item.rowNo+"_"+item.columnNo,
  614. }
  615. })
  616. })
  617. this.tableDataAll = JSON.parse(JSON.stringify(listCopy))
  618. console.log("sfasdfasdfasd111====",list)
  619. console.log("sfasdfasdfasd====",this.tableDataAll)
  620. this.dataProcess() // 数据整理
  621. }else {
  622. this.modeEdit = 'add'
  623. }
  624. },
  625. /** 数组组装 */
  626. dataProcess(){
  627. let list = JSON.parse(JSON.stringify(this.tableDataAll))
  628. let list1 = JSON.parse(JSON.stringify(this.tableData))
  629. for(let i = 0;i<this.rowAll;i++) {
  630. list1[i] = {
  631. tableId: 'A_'+ i,
  632. A: []
  633. }
  634. for(let j = 0; j<list.length;j++) {
  635. if(i == (list[j].rowNo - 1) ) {
  636. list1[i].A.push({
  637. ...list[j],
  638. styleCss: {
  639. key: 'A',
  640. keyLabel: '舞台',
  641. id: this.tableHeader[0].key + "_"+list[j].rowNo+"_"+list[j].columnNo,
  642. }
  643. })
  644. }
  645. }
  646. }
  647. // 排序
  648. for(let j = 0; j < list1.length ; j++) {
  649. for(let i = 0;i<this.tableHeader.length;i++) {
  650. list1[j][this.tableHeader[i].key].sort(this.sortFun)
  651. }
  652. }
  653. this.tableData = JSON.parse(JSON.stringify(list1))
  654. console.log("this.tableData===",this.tableData)
  655. this.countRegionW()
  656. },
  657. /** sort 排序函数 */
  658. sortFun(a,b){
  659. return a.sortId - b.sortId;
  660. },
  661. /** tab 切换 右侧工具 */
  662. handleClickTab(item){
  663. console.log("item====",item,this.activeName)
  664. if(this.activeName == 'batch') { // 批量操作
  665. // this.batchTableList = this.tableDataAll
  666. this.resetQuery()
  667. }else if(this.activeName=='select'){
  668. this.addSelectTabelList()
  669. }else if(this.activeName=='second'){
  670. if(this.currentRow){
  671. let list = this.tableData[this.currentRow-1][this.currentProperty]
  672. this.currentTabelList = list && list.length>0 ? JSON.parse(JSON.stringify(list)) : []
  673. }else {
  674. this.currentTabelList = []
  675. }
  676. }
  677. },
  678. /** 创建区域 结束 */
  679. // 创建模板
  680. createTemplate(formName){
  681. this.$refs[formName].validate((valid) => {
  682. if (valid) {
  683. let list = []
  684. for(let i = 1; i <= this.ruleForm1.rowAll;i++){
  685. for(let j = 1; j <= this.ruleForm1.colsAll;j++){
  686. list.push({
  687. tableId: this.tableHeader[0].key + "_"+i+"_"+j,
  688. name: i + '排' + j + '座',
  689. styleCss: {
  690. key: this.tableHeader[0].key, // 所属区域的key
  691. keyLabel: this.tableHeader[0].title, // 所属区域的名称
  692. sort: j,
  693. id: this.tableHeader[0].key + "_"+i+"_"+j,
  694. },
  695. rowNo: i,
  696. columnNo: j,
  697. seatTypeId: null,
  698. seatLabel: null,
  699. sortId: j, // 排序号码
  700. color: '#E6E6FA',// 座位类型对应的颜色
  701. //delFlag: 0, // 座位是否可用
  702. priority: '', // 座位出票顺序 数字越小越优先
  703. status: 2, //0-初始(该状态下不C端显示) 1-可用 2-不可用
  704. })
  705. }
  706. }
  707. this.tableDataAll = JSON.parse(JSON.stringify(list))
  708. this.rowAll = this.ruleForm1.rowAll
  709. this.colsAll = this.ruleForm1.colsAll
  710. this.dataProcess() // 数据整理
  711. }else {
  712. console.log('error submit!!');
  713. return false;
  714. }
  715. })
  716. },
  717. // 增加行/列
  718. addRanks(type){
  719. if(type == 'row'){
  720. this.rowAll = Number(this.rowAll) + 1
  721. this.rowAll = this.rowAll
  722. let list = []
  723. for(let j = 1; j <= this.colsAll;j++){
  724. list.push({
  725. tableId: this.tableHeader[0].key + "_"+this.rowAll+"_"+j,
  726. name: this.rowAll + '排' + j + '座',
  727. styleCss: {
  728. key: this.tableHeader[0].key, // 所属区域的key
  729. keyLabel: this.tableHeader[0].title, // 所属区域的名称
  730. sort: j,
  731. id: this.tableHeader[0].key + "_"+this.rowAll+"_"+j,
  732. },
  733. rowNo: this.rowAll,
  734. columnNo: j,
  735. seatTypeId: null,
  736. seatLabel: null,
  737. sortId: j, // 排序号码
  738. color: '#E6E6FA',// 座位类型对应的颜色
  739. //delFlag: 0, // 座位是否可用
  740. priority: '', // 座位出票顺序 数字越小越优先
  741. status: 2, //0-初始(该状态下不C端显示) 1-可用 2-不可用
  742. })
  743. }
  744. this.tableDataAll = this.tableDataAll.concat(list)
  745. console.log("list======",list)
  746. }else if(type == 'cols') {
  747. this.colsAll = Number(this.colsAll) + 1
  748. let list = []
  749. for(let i = 1; i <= this.rowAll;i++){
  750. list.push({
  751. tableId: this.tableHeader[0].key + "_"+i+"_"+ this.colsAll,
  752. name: i + '排' + this.colsAll + '座',
  753. styleCss: {
  754. key: this.tableHeader[0].key, // 所属区域的key
  755. keyLabel: this.tableHeader[0].title, // 所属区域的名称
  756. sort: this.colsAll,
  757. id: this.tableHeader[0].key + "_"+i+"_"+this.colsAll,
  758. },
  759. rowNo: i,
  760. columnNo: this.colsAll,
  761. seatTypeId: null,
  762. seatLabel: null,
  763. sortId: this.colsAll, // 排序号码
  764. color: '#E6E6FA',// 座位类型对应的颜色
  765. //delFlag: 0, // 座位是否可用
  766. priority: '', // 座位出票顺序 数字越小越优先
  767. status: 2, //0-初始(该状态下不C端显示) 1-可用 2-不可用
  768. })
  769. }
  770. this.tableDataAll = this.tableDataAll.concat(list)
  771. }
  772. this.dataProcess() // 数据整理
  773. },
  774. /**
  775. * 创建排数
  776. */
  777. createTableList(){
  778. let list = JSON.parse(JSON.stringify(this.tableData))
  779. for(let i = 0;i<this.rowAll;i++) {
  780. if(this.tableHeader && this.tableHeader.length){
  781. let obj = {
  782. id: "row_"+i
  783. }
  784. this.tableHeader.forEach((item,index)=>{
  785. obj[item.key] = []
  786. })
  787. if(list[i] && JSON.stringify(list[i]) != '{}') {
  788. list[i] = Object.assign(obj,list[i])
  789. }else {
  790. list.push(obj)
  791. }
  792. }else if(!list[i]){
  793. list.push({})
  794. }
  795. }
  796. this.tableData = JSON.parse(JSON.stringify(list))
  797. console.log("this.tableData===",this.tableData)
  798. },
  799. /** 创建区域 结束 */
  800. /** 创建座位 开始 */
  801. tableCellClassName({row, column, rowIndex, columnIndex}){
  802. //注意这里是解构
  803. //利用单元格的 className 的回调方法,给行列索引赋值
  804. row.index=rowIndex;
  805. column.index=columnIndex;
  806. },
  807. /** 点击某个单元格 */
  808. cellDblclick(row, column, cell, event){
  809. this.currentRow = row.index + 1
  810. this.currentRegion = column.index
  811. this.currentLabel = column.label
  812. this.currentProperty = column.property
  813. console.log('this.tableData===', this.tableData)
  814. console.log("this.tableData111=====",this.currentRow,this.currentProperty,this.tableData[this.currentRow-1][this.currentProperty])
  815. let list = this.tableData[this.currentRow-1][this.currentProperty]
  816. this.currentTabelList = list && list.length>0 ? JSON.parse(JSON.stringify(list)) : []
  817. console.log("row, column, cell, event===",row, column, cell, event)
  818. },
  819. // 计算区域的宽度
  820. countRegionW(){
  821. let list = JSON.parse(JSON.stringify(this.tableHeader))
  822. for(let i = 0; i < list.length; i++) {
  823. list[i].length = 0
  824. for(let j = 0;j < this.tableData.length; j++) {
  825. if(this.tableData[j][list[i].key] && this.tableData[j][list[i].key].length){
  826. if(list[i].length<this.tableData[j][list[i].key].length){
  827. list[i].length = this.tableData[j][list[i].key].length
  828. }
  829. }
  830. }
  831. }
  832. console.log("list=====111",list)
  833. this.tableHeader = [].concat(list)
  834. let colsAll = 0
  835. this.tableHeader.forEach((item,index) => {
  836. if(item.length) {
  837. colsAll = colsAll + item.length
  838. }
  839. })
  840. this.colsAll = colsAll
  841. },
  842. /** 创建座位 结束 */
  843. //列拖拽
  844. columnDrop() {
  845. // 阻止默认行为
  846. document.body.addEventListener("drop", (event) => {
  847. event.preventDefault();
  848. event.stopPropagation();
  849. });
  850. const wrapperTr = document.querySelector(".el-table__header-wrapper tr");
  851. this.sortable = Sortable.create(wrapperTr, {
  852. animation: 180,
  853. delay: 0,
  854. onEnd: (evt) => {
  855. const oldItem = this.dropCol[evt.oldIndex];
  856. this.dropCol.splice(evt.oldIndex, 1);
  857. this.dropCol.splice(evt.newIndex, 0, oldItem);
  858. },
  859. });
  860. },
  861. /** 批量操作 */
  862. // 批量选择
  863. handleSelectionChange(val){
  864. console.log('this.multipleSelection====',val)
  865. this.multipleSelection = val;
  866. },
  867. // 批量操作 打开弹窗编辑
  868. openFormDialogVisible(type,data){
  869. if(type == 'batchSetaName') { // 座位名称
  870. this.formAllType = 'batchSetaName'
  871. this.formDialogVisibleTitle = "批量修改座位名称"
  872. this.formDialogVisible = true
  873. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  874. seatWay: null,
  875. seatLaw: null,
  876. seatWell: null,
  877. colMin: null,
  878. colMax: null,
  879. name: null,
  880. name1: null,
  881. name2: null,
  882. })))
  883. }
  884. if(type == 'batchSetaType') { // 座位类型
  885. this.formAllType = 'batchSetaType'
  886. this.formDialogVisibleTitle = "批量修改座位类型"
  887. this.formDialogVisible = true
  888. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  889. seatTypeId: null,
  890. })))
  891. }
  892. if(type == 'batchSetaPriority') { // 优先级
  893. this.formAllType = 'batchSetaPriority'
  894. this.formDialogVisibleTitle = "批量修改优先级"
  895. this.formDialogVisible = true
  896. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  897. seatPriorityWay: null,
  898. setaPriorityNum: null,
  899. seatPriorityPosition: null
  900. })))
  901. }
  902. if(type == 'batchSetaDisable') { // 座位状态
  903. this.formAllType = 'batchSetaDisable'
  904. this.formDialogVisibleTitle = "批量修改座位状态"
  905. this.formDialogVisible = true
  906. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  907. status: null,
  908. })))
  909. }
  910. if(type == 'selectBatchSetaName') { // 座位名称
  911. this.formAllType = 'selectBatchSetaName'
  912. this.formDialogVisibleTitle = "批量修改座位名称"
  913. this.formDialogVisible = true
  914. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  915. seatWay: null,
  916. seatLaw: null,
  917. seatWell: null,
  918. colMin: null,
  919. colMax: null,
  920. name: null,
  921. name1: null,
  922. name2: null,
  923. })))
  924. }
  925. if(type == 'selectBatchSetaType') { // 座位类型
  926. this.formAllType = 'selectBatchSetaType'
  927. this.formDialogVisibleTitle = "批量修改座位类型"
  928. this.formDialogVisible = true
  929. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  930. seatTypeId: null,
  931. })))
  932. }
  933. if(type == 'selectBatchSetaPriority') { // 优先级
  934. this.formAllType = 'selectBatchSetaPriority'
  935. this.formDialogVisibleTitle = "批量修改优先级"
  936. this.formDialogVisible = true
  937. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  938. seatPriorityWay: null,
  939. setaPriorityNum: null,
  940. seatPriorityPosition: null
  941. })))
  942. }
  943. if(type == 'selectBatchSetaDisable') { // 座位状态
  944. this.formAllType = 'selectBatchSetaDisable'
  945. this.formDialogVisibleTitle = "批量修改座位状态"
  946. this.formDialogVisible = true
  947. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  948. status: null,
  949. })))
  950. }
  951. if(type == 'singleEdit') { // 单个编辑
  952. console.log("data===",data)
  953. this.formAllType = 'singleEdit'
  954. this.formDialogVisibleTitle = "修改" + data.name
  955. this.formDialogVisible = true
  956. this.$set(this,'formAll',JSON.parse(JSON.stringify({
  957. ...data
  958. })))
  959. }
  960. this.$nextTick(()=>{
  961. this.$refs['formAll'].clearValidate()
  962. })
  963. },
  964. // 批量操作 表单验证
  965. chekeFormAll(formName){
  966. this.$refs[formName].validate((valid) => {
  967. if (valid) {
  968. if(this.formAllType == 'batchSetaType') {
  969. this.batchSetaTypeFun()
  970. }else if(this.formAllType == 'batchSetaName') {
  971. this.batchSetaNameFun()
  972. }else if(this.formAllType == 'batchSetaPriority') {
  973. this.batchSetaPriorityFun()
  974. }else if(this.formAllType == 'selectBatchSetaType') {
  975. this.selectBatchSetaTypeFun()
  976. }else if(this.formAllType == 'selectBatchSetaName') {
  977. this.selectBatchSetaNameFun()
  978. }else if(this.formAllType == 'selectBatchSetaPriority') {
  979. this.selectBatchSetaPriorityFun()
  980. }else if(this.formAllType == 'singleEdit') {
  981. this.singleEditFun()
  982. }else if(this.formAllType == 'batchSetaDisable') {
  983. this.batchSetaDisableFun()
  984. }else if(this.formAllType == 'selectBatchSetaDisable') {
  985. this.selectBatchSetaDisableFun()
  986. }
  987. } else {
  988. console.log('error submit!!');
  989. return false;
  990. }
  991. });
  992. },
  993. // 修改单个
  994. singleEditFun(){
  995. let color = ''
  996. let seatLabel = ''
  997. this.seatTypeList.forEach((item,index)=>{
  998. if(this.formAll.seatTypeId == item.id) {
  999. color = item.color
  1000. seatLabel = item.name
  1001. }
  1002. })
  1003. for(let j=0;j<this.tableDataAll.length;j++){
  1004. if(this.formAll.styleCss.id == this.tableDataAll[j].styleCss.id){
  1005. this.tableDataAll[j] = {
  1006. ...this.tableDataAll[j],
  1007. name: this.formAll.name,
  1008. priority: this.formAll.priority,
  1009. seatTypeId: this.formAll.seatTypeId,
  1010. seatLabel: seatLabel,
  1011. color: color,// 座位类型对应的颜色
  1012. status: this.formAll.status,
  1013. //delFlag: this.formAll.delFlag,
  1014. }
  1015. break;
  1016. }
  1017. }
  1018. this.formDialogVisible = false
  1019. this.dataProcess()
  1020. },
  1021. // 座位状态
  1022. batchSetaDisableFun() {
  1023. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1024. for(let i=0;i<this.multipleSelection.length;i++){
  1025. for(let j=0;j<this.tableDataAll.length;j++){
  1026. if(this.multipleSelection[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1027. listTabel[j] = {
  1028. ...this.tableDataAll[j],
  1029. status: this.formAll.status,
  1030. }
  1031. break;
  1032. }
  1033. }
  1034. }
  1035. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1036. console.log("this.tableDataAll=====",this.tableDataAll)
  1037. // this.batchTableList = JSON.parse(JSON.stringify(this.tableDataAll))
  1038. this.formDialogVisible = false
  1039. this.handleQuery()
  1040. this.dataProcess()
  1041. },
  1042. //批量修改座位类型
  1043. batchSetaTypeFun() {
  1044. let color = ''
  1045. let seatLabel = ''
  1046. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1047. this.seatTypeList.forEach((item,index)=>{
  1048. if(this.formAll.seatTypeId == item.id) {
  1049. color = item.color
  1050. seatLabel = item.name
  1051. }
  1052. })
  1053. for(let i=0;i<this.multipleSelection.length;i++){
  1054. for(let j=0;j<this.tableDataAll.length;j++){
  1055. if(this.multipleSelection[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1056. listTabel[j] = {
  1057. ...this.tableDataAll[j],
  1058. seatLabel: seatLabel,
  1059. color: color,// 座位类型对应的颜色
  1060. seatTypeId: this.formAll.seatTypeId,
  1061. }
  1062. break;
  1063. }
  1064. }
  1065. }
  1066. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1067. console.log("this.tableDataAll=====",this.tableDataAll)
  1068. // this.batchTableList = JSON.parse(JSON.stringify(this.tableDataAll))
  1069. this.formDialogVisible = false
  1070. this.handleQuery()
  1071. this.dataProcess()
  1072. },
  1073. // 批量修改名称
  1074. batchSetaNameFun() {
  1075. if(this.formAll.seatWay == 1){ // 相同的
  1076. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1077. for(let i=0;i<this.multipleSelection.length;i++){
  1078. for(let j=0;j<this.tableDataAll.length;j++){
  1079. if(this.multipleSelection[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1080. listTabel[j] = {
  1081. ...this.tableDataAll[j],
  1082. name: this.formAll.name
  1083. }
  1084. break;
  1085. }
  1086. }
  1087. }
  1088. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1089. }else if(this.formAll.seatWay == 2){
  1090. let name = (this.formAll.name1?this.formAll.name1:'') + '${row}' + (this.formAll.name?this.formAll.name:'') + '${col}' + (this.formAll.name2?this.formAll.name2:'')
  1091. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1092. for(let i=0;i<this.multipleSelection.length;i++){
  1093. for(let j=0;j<this.tableDataAll.length;j++){
  1094. if(this.multipleSelection[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1095. listTabel[j] = {
  1096. ...this.tableDataAll[j],
  1097. name: name.replace('${row}',this.tableDataAll[j].rowNo).replace('${col}',this.tableDataAll[j].columnNo)
  1098. }
  1099. break;
  1100. }
  1101. }
  1102. }
  1103. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1104. }
  1105. this.formDialogVisible = false
  1106. this.handleQuery()
  1107. this.dataProcess()
  1108. },
  1109. // 批量修改优先级
  1110. batchSetaPriorityFun(){
  1111. if(this.formAll.seatPriorityWay == 1){
  1112. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1113. for(let i=0;i<this.multipleSelection.length;i++){
  1114. for(let j=0;j<this.tableDataAll.length;j++){
  1115. if(this.multipleSelection[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1116. listTabel[j] = {
  1117. ...this.tableDataAll[j],
  1118. priority: this.formAll.setaPriorityNum
  1119. }
  1120. break;
  1121. }
  1122. }
  1123. }
  1124. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1125. }else{
  1126. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1127. let listSelect = JSON.parse(JSON.stringify(this.multipleSelection))
  1128. if(this.formAll.seatPriorityPosition == 2) {
  1129. listSelect.reverse()
  1130. }
  1131. let num = Number(this.formAll.setaPriorityNum)
  1132. for(let i=0;i<listSelect.length;i++){
  1133. for(let j=0;j<this.tableDataAll.length;j++){
  1134. if(listSelect[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1135. listTabel[j] = {
  1136. ...this.tableDataAll[j],
  1137. priority: num
  1138. }
  1139. if(this.formAll.seatPriorityWay == 2){
  1140. num = num + 1
  1141. }else if(this.formAll.seatPriorityWay == 3){
  1142. num = num - 1
  1143. }
  1144. break;
  1145. }
  1146. }
  1147. }
  1148. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1149. }
  1150. this.formDialogVisible = false
  1151. this.handleQuery()
  1152. this.dataProcess()
  1153. },
  1154. /** 批量操作 结束 */
  1155. /** 筛选 */
  1156. handleQuery(){
  1157. let list = []
  1158. list = JSON.parse(JSON.stringify(this.tableDataAll))
  1159. if(this.queryParams.row){
  1160. list = list.filter((item)=>{
  1161. return item.rowNo == this.queryParams.row
  1162. })
  1163. }
  1164. if(this.queryParams.cols){
  1165. list = list.filter((item)=>{
  1166. return item.columnNo == this.queryParams.cols
  1167. })
  1168. }
  1169. if(this.queryParams.name){
  1170. list = list.filter((item)=>{
  1171. return item.name == this.queryParams.name
  1172. })
  1173. }
  1174. if(this.queryParams.seatTypeId){
  1175. list = list.filter((item)=>{
  1176. if(this.queryParams.seatTypeId == -1) {
  1177. return !item.seatTypeId
  1178. }else {
  1179. return item.seatTypeId == this.queryParams.seatTypeId
  1180. }
  1181. })
  1182. }
  1183. this.batchTableList = list
  1184. },
  1185. /** 重置 */
  1186. resetQuery(){
  1187. this.queryParams = {}
  1188. this.handleQuery()
  1189. },
  1190. /** 点击座位排序 座位排序 */
  1191. seatSortingFun(type){
  1192. let list = JSON.parse(JSON.stringify(this.currentTabelList))
  1193. if(type=='rise') { // 升序
  1194. list.sort(function(x,y){
  1195. let num1 = x.columnNo
  1196. let num2 = y.columnNo
  1197. return num1 - num2
  1198. })
  1199. }
  1200. if(type=='fall') { // 降序
  1201. list.sort(function(x,y){
  1202. let num1 = x.columnNo
  1203. let num2 = y.columnNo
  1204. return num2 - num1
  1205. })
  1206. }
  1207. if(type=='symmetry') { // 奇偶对称
  1208. let odd = []
  1209. let even = []
  1210. list.forEach((item,index)=>{
  1211. if(item.columnNo%2==0){
  1212. even.push(item)
  1213. }else {
  1214. odd.push(item)
  1215. }
  1216. })
  1217. odd.sort(function(x,y){
  1218. let num1 = x.columnNo
  1219. let num2 = y.columnNo
  1220. return num2 - num1
  1221. })
  1222. even.sort(function(x,y){
  1223. let num1 = x.columnNo
  1224. let num2 = y.columnNo
  1225. return num1 - num2
  1226. })
  1227. list = odd.concat(even)
  1228. }
  1229. if(type=='reversal'){
  1230. list.reverse()
  1231. }
  1232. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1233. for(let i=0;i<list.length;i++){
  1234. for(let j=0;j<this.tableDataAll.length;j++){
  1235. if(list[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1236. listTabel[j] = {
  1237. ...this.tableDataAll[j],
  1238. sortId: i,
  1239. styleCss: {
  1240. ...this.tableDataAll[j].styleCss,
  1241. sort: i,
  1242. }
  1243. }
  1244. break;
  1245. }
  1246. }
  1247. }
  1248. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1249. console.log("this.tableDataAll=====",this.tableDataAll)
  1250. this.formDialogVisible = false
  1251. this.handleQuery()
  1252. this.dataProcess()
  1253. this.currentTabelList = JSON.parse(JSON.stringify(this.tableData[this.currentRow-1][this.currentProperty]))
  1254. },
  1255. // 拖动排序
  1256. draggingSeatSort(){
  1257. let list = JSON.parse(JSON.stringify(this.currentTabelList))
  1258. let listTabel = JSON.parse(JSON.stringify(this.tableDataAll))
  1259. for(let i=0;i<list.length;i++){
  1260. for(let j=0;j<this.tableDataAll.length;j++){
  1261. if(list[i].styleCss.id == this.tableDataAll[j].styleCss.id){
  1262. listTabel[j] = {
  1263. ...this.tableDataAll[j],
  1264. sortId: i,
  1265. styleCss: {
  1266. ...this.tableDataAll[j].styleCss,
  1267. sort: i,
  1268. }
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. }
  1274. this.tableDataAll = JSON.parse(JSON.stringify(listTabel))
  1275. console.log("this.tableDataAll=====",this.tableDataAll)
  1276. console.log("list======",list)
  1277. this.formDialogVisible = false
  1278. this.dataProcess()
  1279. // this.currentTabelList = JSON.parse(JSON.stringify(this.tableData[this.currentRow-1][this.currentProperty]))
  1280. },
  1281. /** 座位升序 赋值 */
  1282. setSetaSote(){
  1283. let list = []
  1284. for(let j = 0;j<this.tableData.length;j++) {
  1285. list[j] = []
  1286. for(let i = 0;i<this.tableHeader.length;i++) {
  1287. list[j] = list[j].concat(this.tableData[j][this.tableHeader[i].key])
  1288. }
  1289. }
  1290. let listCopy = []
  1291. list.forEach((item,index)=>{
  1292. item.forEach((item1,index1)=>{
  1293. list[index][index1].sortId = index1+1
  1294. list[index][index1].styleCss.sort = index1+1
  1295. listCopy.push(list[index][index1])
  1296. })
  1297. })
  1298. console.log("list======",list)
  1299. this.tableDataAll = JSON.parse(JSON.stringify(listCopy))
  1300. },
  1301. /** 保存座位 */
  1302. saveSeat() {
  1303. this.setSetaSote()
  1304. console.log('this.tableDataAll',this.tableDataAll)
  1305. let list = JSON.parse(JSON.stringify(this.tableDataAll))
  1306. list.forEach((item,index)=>{
  1307. if(item.styleCss) {
  1308. list[index].styleCss = JSON.stringify(item.styleCss)
  1309. }
  1310. })
  1311. let styleCss = {
  1312. tableHeader: this.tableHeader
  1313. }
  1314. list.forEach((item,index)=>{
  1315. if(item.styleCss) {
  1316. list[index].styleCss = JSON.stringify(item.styleCss)
  1317. }
  1318. })
  1319. this.$emit('saveSeat',this.rowAll,this.colsAll,list,JSON.stringify(styleCss))
  1320. }
  1321. }
  1322. };
  1323. </script>
  1324. <style scoped lang="scss">
  1325. .sm {
  1326. width: 100%;
  1327. height: 100%;
  1328. box-sizing: border-box;
  1329. display: flex;
  1330. flex-direction: column;
  1331. justify-content: center;
  1332. align-items: center;
  1333. --top-tool-h: 60px;
  1334. --left-tool-w: 300px
  1335. }
  1336. .sm-box-top-tool {
  1337. width: 100%;
  1338. height: var(--top-tool-h);
  1339. box-sizing: border-box;
  1340. display: flex;
  1341. .sm-box-top-tool-legend {
  1342. width: 400px;
  1343. display: flex;
  1344. >div {
  1345. display: flex;
  1346. align-items: center;
  1347. margin-left: 10px;
  1348. >span:first-child {
  1349. display: block;
  1350. width: 10px;
  1351. height: 10px;
  1352. flex-shrink: 0;
  1353. }
  1354. >span:last-child {
  1355. white-space: nowrap;
  1356. margin-left: 5px;
  1357. font-size: 12px;
  1358. }
  1359. }
  1360. }
  1361. }
  1362. .sm-box {
  1363. width: 100%;
  1364. height: calc( 100% - var(--top-tool-h) );
  1365. box-sizing: border-box;
  1366. display: flex;
  1367. justify-content: center;
  1368. --row-w: 26px;
  1369. --row-h: 26px;
  1370. --row-scale: 1;
  1371. }
  1372. .sm-scroll-box {
  1373. width: calc( 100% - var(--left-tool-w) );
  1374. height: 100%;
  1375. border: 1px solid #ccc;
  1376. box-sizing: border-box;
  1377. background-color: aqua;
  1378. .row-item-box {
  1379. border: 1px dashed #ccc;
  1380. width: 100%;
  1381. height: 100%;
  1382. align-items: center;
  1383. padding: 5px;
  1384. }
  1385. .row-item-box:hover {
  1386. background-color: rgba(64, 158, 255,0.3);
  1387. }
  1388. .table-header {
  1389. display: flex;
  1390. padding: 0 20px;
  1391. align-items: center;
  1392. justify-content: center;
  1393. }
  1394. .table-header-item {
  1395. width: var(--row-w);
  1396. height: var(--row-h);
  1397. margin-left: 5px;
  1398. //border: 1px solid #ccc;
  1399. display: flex;
  1400. flex-direction: column;
  1401. flex-shrink: 0;
  1402. font-size: 12px;
  1403. align-items: center;
  1404. box-sizing: border-box;
  1405. justify-content: center;
  1406. overflow: hidden;
  1407. > div {
  1408. width: var(--row-w-i);
  1409. height: var(--row-h-i);
  1410. transform: scale(var(--row-scale));
  1411. display: flex;
  1412. flex-direction: column;
  1413. }
  1414. i {
  1415. color: #fff;
  1416. }
  1417. }
  1418. .table-header-item:first-child {
  1419. margin-left: 0;
  1420. }
  1421. .row-item {
  1422. position: relative;
  1423. width: var(--row-w);
  1424. height: var(--row-h);
  1425. margin-left: 5px;
  1426. border: 1px solid rgba(0,0,0,0.5);
  1427. border-radius: 2px;
  1428. display: flex;
  1429. flex-direction: column;
  1430. flex-shrink: 0;
  1431. font-size: 12px;
  1432. align-items: center;
  1433. box-sizing: border-box;
  1434. justify-content: center;
  1435. overflow: hidden;
  1436. > div {
  1437. width: var(--row-w-i);
  1438. height: var(--row-h-i);
  1439. transform: scale(var(--row-scale));
  1440. display: flex;
  1441. flex-direction: column;
  1442. padding: 5px;
  1443. }
  1444. i {
  1445. color: #000;
  1446. }
  1447. }
  1448. .row-item:first-child {
  1449. margin-left: 0;
  1450. }
  1451. .row-item-no::after {
  1452. content:"";
  1453. display:block;
  1454. position:absolute;
  1455. top:0;
  1456. left:0;
  1457. width: 100%;
  1458. height: 100%;
  1459. background-color:rgba(255,255,255,0.1);
  1460. z-index:-1;
  1461. background-image: url('../../../../assets/nos.png');
  1462. background-size: 50% 50%;
  1463. background-position: 50% 50%;
  1464. background-repeat: no-repeat;
  1465. z-index: 1;
  1466. }
  1467. .row-item-select {
  1468. border: 5px solid #1890ff;
  1469. }
  1470. // .row-item-select::after {
  1471. // content:"";
  1472. // display:block;
  1473. // position:absolute;
  1474. // top:0;
  1475. // left:0;
  1476. // width: 100%;
  1477. // height: 100%;
  1478. // border: 5px solid #1890ff;
  1479. // z-index: 1;
  1480. // padding: 5px;
  1481. // }
  1482. .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf {
  1483. border-bottom: none !important;
  1484. }
  1485. }
  1486. .table-tool {
  1487. width: var(--left-tool-w);
  1488. height: 100%;
  1489. padding: 0 10px;
  1490. box-sizing: border-box;
  1491. border: 1px solid #ccc;
  1492. }
  1493. .table-tool-tab {
  1494. width: 100%;
  1495. height: 100%;
  1496. ::v-deep .el-tabs {
  1497. width: 100%;
  1498. height: 100%
  1499. }
  1500. ::v-deep .el-tabs__content {
  1501. width: 100%;
  1502. height: calc( 100% - 60px );
  1503. }
  1504. ::v-deep .el-tab-pane {
  1505. width: 100%;
  1506. height: 100%;
  1507. box-sizing: border-box;
  1508. }
  1509. }
  1510. .qu-second-box {
  1511. width: 100%;
  1512. height: 100%;
  1513. .qu-second-row {
  1514. display: flex;
  1515. align-items: center;
  1516. }
  1517. .qu-second-form {
  1518. width: 100%;
  1519. height: 50px;
  1520. overflow: hidden;
  1521. padding-top: 5px;
  1522. box-sizing: border-box;
  1523. border-bottom: 1px solid #ccc;
  1524. }
  1525. .qu-second-info {
  1526. width: 100%;
  1527. height: calc( 100% - 60px );
  1528. overflow: hidden;
  1529. .qu-second-select{
  1530. width: 100%;
  1531. height: 30px;
  1532. display: flex;
  1533. align-items: flex-end;
  1534. padding-bottom: 5px;
  1535. span{
  1536. font-size: 16px;
  1537. font-weight: 600;
  1538. }
  1539. span:nth-child(3){
  1540. font-size: 12px;
  1541. margin-left: 10px;
  1542. font-weight: 400;
  1543. }
  1544. }
  1545. .qu-second-info-title {
  1546. width: 100%;
  1547. height: 25px;
  1548. display: flex;
  1549. align-items: flex-end;
  1550. padding-bottom: 5px;
  1551. span:first-child{
  1552. font-size: 14px;
  1553. font-weight: 600;
  1554. }
  1555. span:last-child{
  1556. font-size: 12px;
  1557. margin-left: 10px;
  1558. }
  1559. }
  1560. .qu-second-info-tool {
  1561. width: 100%;
  1562. height: 30px;
  1563. display: flex;
  1564. align-items: center;
  1565. padding-bottom: 5px;
  1566. span:first-child{
  1567. font-size: 14px;
  1568. font-weight: 600;
  1569. }
  1570. i {
  1571. font-size: 12px;
  1572. margin-left: 10px;
  1573. background-color: #1890FF;
  1574. color: #fff;
  1575. padding: 5px;
  1576. transform: scale(0.9);
  1577. border-radius: 5px;
  1578. cursor: pointer;
  1579. }
  1580. }
  1581. .qu-second-info-list {
  1582. width: 100%;
  1583. height: calc( 100% - 70px );
  1584. box-sizing: border-box;
  1585. padding-right: 5px;
  1586. overflow: hidden;
  1587. overflow-y: auto;
  1588. .qu-second-info-item {
  1589. width: 100%;
  1590. height: 40px;
  1591. box-sizing: border-box;
  1592. border: 1px solid #ccc;
  1593. margin-bottom: 5px;
  1594. display: flex;
  1595. justify-content: space-between;
  1596. align-items: center;
  1597. font-size: 16px;
  1598. border-radius: 10px;
  1599. padding: 0 10px;
  1600. >span {
  1601. width: 100%;
  1602. height: 100%;
  1603. display: flex;
  1604. align-items: center;
  1605. padding: 0 20px;
  1606. font-weight: 600;
  1607. }
  1608. >div {
  1609. display: flex;
  1610. flex-direction: column;
  1611. span {
  1612. display: flex;
  1613. padding: 0 10px;
  1614. height: 100%;
  1615. align-items: center;
  1616. font-size: 12px;
  1617. white-space: nowrap;
  1618. }
  1619. span:first-child {
  1620. color: #409eff;
  1621. }
  1622. span:last-child {
  1623. color: #f56c6c;
  1624. }
  1625. }
  1626. }
  1627. }
  1628. .qu-second-info-list::-webkit-scrollbar {
  1629. width: 2px;
  1630. }
  1631. .qu-second-info-list::-webkit-scrollbar-track {
  1632. background-color: #ccc;
  1633. }
  1634. }
  1635. }
  1636. .qu-batch-box {
  1637. width: 100%;
  1638. height: 100%;
  1639. box-sizing: border-box;
  1640. .qu-batch-form {
  1641. height: 120px;
  1642. box-sizing: border-box;
  1643. padding-top: 5px;
  1644. }
  1645. .qu-batch-tool {
  1646. border-top: 1px solid #ccc;
  1647. padding-top: 5px;
  1648. height: 80px;
  1649. box-sizing: border-box;
  1650. >div {
  1651. height: 50%;
  1652. display: flex;
  1653. align-items: center;
  1654. box-sizing: border-box;
  1655. }
  1656. }
  1657. .qu-batch-table {
  1658. height: calc( 100% - 210px );
  1659. box-sizing: border-box;
  1660. }
  1661. }
  1662. .qu-select-box {
  1663. width: 100%;
  1664. height: 100%;
  1665. box-sizing: border-box;
  1666. .qu-select-select {
  1667. height: 30px;
  1668. box-sizing: border-box;
  1669. font-size: 12px;
  1670. display: flex;
  1671. align-items: flex-end;
  1672. }
  1673. .qu-select-tool {
  1674. border-top: 1px solid #ccc;
  1675. padding-top: 5px;
  1676. height: 80px;
  1677. box-sizing: border-box;
  1678. >div {
  1679. height: 50%;
  1680. display: flex;
  1681. align-items: center;
  1682. box-sizing: border-box;
  1683. }
  1684. }
  1685. .qu-select-table {
  1686. height: calc( 100% - 120px );
  1687. box-sizing: border-box;
  1688. }
  1689. }
  1690. ::v-deep .exchange_table {
  1691. th {
  1692. padding: 0 !important;
  1693. height: 10px;
  1694. line-height: 10px;
  1695. }
  1696. td {
  1697. padding: 0 !important;
  1698. height: 30px;
  1699. line-height: 30px;
  1700. }
  1701. .cell {
  1702. height: 100%;
  1703. }
  1704. td.el-table__cell, th.el-table__cell.is-leaf {
  1705. border-bottom: none !important;
  1706. }
  1707. }
  1708. </style>