seatManagementTable.vue 78 KB

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