KtCommonTable.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  1. <template>
  2. <div style="position: relative" ref="commonTable">
  3. <!--表格栏-->
  4. <el-table
  5. id="commonTable"
  6. ref="doLayout"
  7. :data="data.content"
  8. :highlight-current-row="highlightCurrentRow"
  9. @selection-change="selectionChange"
  10. @row-click="rowClick"
  11. @current-change="handleCurrentChange"
  12. :element-loading-text="$t('action.loading')"
  13. :border="border"
  14. :stripe="stripe"
  15. :show-summary="showSummary"
  16. :summary-method="getSummaries"
  17. :show-overflow-tooltip="showOverflowTooltip"
  18. :height="tableHeights ? tableHeights : tableHeight"
  19. :size="size"
  20. :align="align"
  21. :header-cell-style="{
  22. fontWeight: '900',
  23. color: '#606266',
  24. }"
  25. style="width: 100%"
  26. :row-class-name="tableRowClassName"
  27. >
  28. <el-table-column
  29. type="expand"
  30. v-if="showSysUserAccountCardList"
  31. style="display: flex"
  32. >
  33. <template slot-scope="scope">
  34. <el-table
  35. :data="scope.row.sysUserAccountCardList"
  36. size="small"
  37. :header-cell-style="{
  38. background: '#ccc',
  39. fontWeight: '900',
  40. color: '#606266',
  41. }"
  42. style="width: 70%"
  43. >
  44. <el-table-column
  45. type="index"
  46. width="50"
  47. align="center"
  48. label="序号"
  49. >
  50. </el-table-column>
  51. <el-table-column prop="bankAccount" label="银行" style="flex: 1">
  52. </el-table-column>
  53. <el-table-column prop="bankAddress" label="开户行" style="flex: 1">
  54. </el-table-column>
  55. <el-table-column prop="bankNumber" label="银行卡号" style="flex: 1">
  56. </el-table-column>
  57. <el-table-column
  58. prop="realUserName"
  59. label="真实姓名"
  60. style="flex: 1"
  61. >
  62. </el-table-column>
  63. <el-table-column
  64. prop="auditStatus"
  65. label="审核状态"
  66. style="flex: 1"
  67. >
  68. <template slot-scope="scope1">
  69. <span>{{
  70. scope1.row.auditStatus == 0
  71. ? "未审核"
  72. : scope1.row.auditStatus == "1"
  73. ? "审核通过"
  74. : scope1.row.auditStatus == "2"
  75. ? "审核驳回"
  76. : scope1.row.auditStatus
  77. }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. prop="delFlag"
  82. label="是否解绑"
  83. style="flex: 1"
  84. width="150"
  85. >
  86. <template slot-scope="scope1">
  87. <el-row>
  88. <el-col :span="8">
  89. <span style="margin-right: 20px">{{
  90. scope1.row.delFlag == "0" ? "未解绑" : "已解绑"
  91. }}</span>
  92. </el-col>
  93. <el-col :span="8">
  94. <el-button
  95. v-if="scope1.row.delFlag == '0'"
  96. type="text"
  97. size="mini"
  98. @click="
  99. handleBreak(
  100. scope.$index,
  101. scope.row,
  102. scope1.$index,
  103. scope1.row
  104. )
  105. "
  106. >解绑</el-button
  107. >
  108. </el-col>
  109. <el-col :span="8">
  110. <el-button
  111. v-if="scope1.row.delFlag == '1'"
  112. type="text"
  113. size="mini"
  114. @click="
  115. handleRebind(
  116. scope.$index,
  117. scope.row,
  118. scope1.$index,
  119. scope1.row
  120. )
  121. "
  122. >重绑</el-button
  123. >
  124. </el-col>
  125. <el-col :span="8">
  126. <el-button
  127. type="text"
  128. size="mini"
  129. @click="
  130. handleTimeLine(
  131. scope.$index,
  132. scope.row,
  133. scope1.$index,
  134. scope1.row
  135. )
  136. "
  137. >轨迹</el-button
  138. >
  139. </el-col>
  140. </el-row>
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. type="selection"
  148. width="50"
  149. fixed
  150. align="center"
  151. v-if="
  152. showBatchDelete ||
  153. showBatchSettled ||
  154. showBatchPrint ||
  155. customToolseletted ||
  156. select
  157. "
  158. ></el-table-column>
  159. <el-table-column
  160. v-if="SerialShow"
  161. label="序号"
  162. type="index"
  163. width="50"
  164. align="center"
  165. ></el-table-column>
  166. <template v-for="column in columns">
  167. <el-table-column
  168. header-align="center"
  169. align="center"
  170. :prop="column.prop"
  171. :label="column.label"
  172. :width="column.width"
  173. :min-width="column.minWidth"
  174. :fixed="column.fixed"
  175. :key="column.prop"
  176. :type="column.type"
  177. :formatter="column.formatter"
  178. :sortable="column.sortable ? column.sortable : false"
  179. v-if="
  180. column.signIcon ||
  181. column.isImg ||
  182. column.isBtn ||
  183. column.isSex ||
  184. column.isStatus
  185. "
  186. >
  187. <template slot-scope="scope">
  188. <el-switch
  189. :disabled="column.isDisabled"
  190. v-if="column.signIcon"
  191. v-model="scope.row[column.prop]"
  192. active-value="1"
  193. inactive-value="0"
  194. @change="signStateChanged(scope.$index, scope.row)"
  195. ></el-switch>
  196. <img
  197. v-if="column.isImg"
  198. :width="column.imgWidth"
  199. :height="column.imgHeight"
  200. :src="scope.row[column.prop]"
  201. />
  202. <kt-button
  203. v-if="column.isBtn"
  204. icon="fa fa-edit"
  205. :label="column.btnName"
  206. :size="size"
  207. :perms="column.permsEdit"
  208. @click="handleBtnEdit(scope.$index, scope.row)"
  209. />
  210. <el-tag
  211. v-if="column.isSex && scope.row[column.prop]"
  212. :type="
  213. scope.row[column.prop] == '女'
  214. ? 'danger'
  215. : scope.row[column.prop] == '男'
  216. ? ''
  217. : 'danger'
  218. "
  219. effect="plain"
  220. >
  221. {{ scope.row[column.prop] }}
  222. </el-tag>
  223. <el-tag
  224. v-if="column.isStatus"
  225. :type="
  226. scope.row[column.prop] == '在职'
  227. ? 'success'
  228. : scope.row[column.prop] == '离司'
  229. ? 'info'
  230. : scope.row[column.prop] == '入司待审核'
  231. ? 'warning'
  232. : scope.row[column.prop] == '离司待审核'
  233. ? 'warning'
  234. : scope.row[column.prop] == '修改待审核'
  235. ? 'warning'
  236. : 'danger'
  237. "
  238. effect="plain"
  239. >
  240. {{ scope.row[column.prop] }}
  241. </el-tag>
  242. </template>
  243. </el-table-column>
  244. <el-table-column
  245. header-align="center"
  246. align="center"
  247. :prop="column.prop"
  248. :label="column.label"
  249. :width="column.width"
  250. :min-width="column.minWidth"
  251. :fixed="column.fixed"
  252. :key="column.prop"
  253. :type="column.type"
  254. :formatter="column.formatter"
  255. :sortable="column.sortable ? column.sortable : false"
  256. v-else
  257. >
  258. <template v-for="columnchildren in column.children">
  259. <el-table-column
  260. v-if="columnchildren"
  261. header-align="center"
  262. align="center"
  263. :prop="columnchildren.prop"
  264. :label="columnchildren.label"
  265. :width="columnchildren.width"
  266. :min-width="columnchildren.minWidth"
  267. :fixed="columnchildren.fixed"
  268. :key="columnchildren.prop"
  269. :type="columnchildren.type"
  270. :formatter="columnchildren.formatter"
  271. :sortable="
  272. columnchildren.sortable == null ? true : columnchildren.sortable
  273. "
  274. >
  275. </el-table-column>
  276. </template>
  277. </el-table-column>
  278. </template>
  279. <el-table-column
  280. :label="$t('action.operation')"
  281. :width="operationWidth"
  282. fixed="right"
  283. v-if="showOperation"
  284. header-align="center"
  285. align="center"
  286. class-name="table-fiexd"
  287. >
  288. <template slot-scope="scope">
  289. <kt-button
  290. type="primary"
  291. v-if="editButtonName"
  292. icon="fa fa-edit"
  293. :label="editButtonName"
  294. :perms="permsEdit"
  295. :size="size"
  296. @click="handleEdit(scope.$index, scope.row)"
  297. />
  298. <kt-button
  299. v-if="deleteButtonName"
  300. icon="fa fa-trash"
  301. :label="deleteButtonName"
  302. :perms="permsDelete"
  303. :size="size"
  304. type="danger"
  305. @click="handleDeleteFlag(scope.$index, scope.row)"
  306. />
  307. <kt-button
  308. :style="{
  309. background: button1Background + '',
  310. border: '1px solid' + button1Background,
  311. color: '#fff',
  312. }"
  313. v-if="button1Name"
  314. :label="button1Name"
  315. :perms="permsButton1"
  316. :size="size"
  317. :icon="button1Icon"
  318. @click="handleButton1(scope.$index, scope.row)"
  319. />
  320. <kt-button
  321. v-if="button2Name"
  322. :label="button2Name"
  323. :perms="permsButton2"
  324. :size="size"
  325. :type="button2Type"
  326. :icon="button2Icon"
  327. @click="handleButton2(scope.$index, scope.row)"
  328. />
  329. <kt-button
  330. v-if="button3Name"
  331. :label="button3Name"
  332. :perms="permsButton3"
  333. :size="size"
  334. :type="button3Type"
  335. :icon="button3Icon"
  336. @click="handleButton3(scope.$index, scope.row)"
  337. />
  338. <kt-button
  339. v-if="button4Name"
  340. :icon="button4Icon"
  341. :type="button4Type"
  342. :label="button4Name"
  343. :perms="permsButton4"
  344. :size="size"
  345. @click="handleButton4(scope.$index, scope.row)"
  346. />
  347. <kt-button
  348. v-if="button5Name"
  349. :label="button5Name"
  350. :size="size"
  351. :type="button5Type"
  352. :icon="button5Icon"
  353. @click="handleButton5(scope.$index, scope.row)"
  354. />
  355. <kt-button
  356. v-if="button6Name"
  357. :label="button6Name"
  358. :size="size"
  359. :type="button6Type"
  360. @click="handleButton6(scope.$index, scope.row)"
  361. />
  362. <kt-button
  363. v-if="button7Name && scope.row.status == button7Status"
  364. :label="button7Name"
  365. :size="size"
  366. :type="button7Type"
  367. @click="handleButton7(scope.$index, scope.row)"
  368. />
  369. <kt-button
  370. v-if="button8Name && scope.row.status == button8Status"
  371. :label="button8Name"
  372. :size="size"
  373. :type="button8Type"
  374. @click="handleButton8(scope.$index, scope.row)"
  375. />
  376. <kt-button
  377. v-if="button10Name && scope.row.status == button10Status"
  378. :label="button10Name"
  379. :size="size"
  380. :type="button10Type"
  381. @click="handleButton10(scope.$index, scope.row)"
  382. />
  383. <kt-button
  384. v-if="button9Name && scope.row.status == button9Status"
  385. :label="button9Name"
  386. :size="size"
  387. :type="button9Type"
  388. @click="handleButton9(scope.$index, scope.row)"
  389. />
  390. <el-button type="text" size="small" v-if="buttonDropdown.length > 0">
  391. <el-dropdown trigger="click">
  392. <span class="el-dropdown-link">
  393. 更多
  394. <i class="el-icon-arrow-down el-icon--right"></i>
  395. </span>
  396. <el-dropdown-menu slot="dropdown">
  397. <el-dropdown-item
  398. v-for="val in buttonDropdown"
  399. :key="val.label"
  400. >
  401. <el-button
  402. style="width: 100%"
  403. size="mini"
  404. type="text"
  405. v-if="!val.hide || (val.hide && val.hide(scope.row))"
  406. @click="val.click(scope.row)"
  407. >{{ val.label }}</el-button
  408. >
  409. </el-dropdown-item>
  410. </el-dropdown-menu>
  411. </el-dropdown>
  412. </el-button>
  413. </template>
  414. </el-table-column>
  415. </el-table>
  416. <!--分页栏-->
  417. <!-- 底部分页 -->
  418. <div class="bottomFixed" ref="bottomFixed">
  419. <kt-button
  420. :label="customToolName"
  421. :perms="permscustomTool"
  422. :size="size"
  423. type="danger"
  424. @click="customToolMethod()"
  425. :disabled="selections.length === 0"
  426. style="float: left"
  427. v-if="customToolseletted"
  428. />
  429. <kt-button
  430. class="debutton"
  431. :label="deleteName"
  432. :perms="permsDelete"
  433. :size="size"
  434. type="danger"
  435. @click="handleBatchDelete()"
  436. :disabled="selections.length === 0"
  437. style="float: left"
  438. v-if="showBatchDelete & showOperation"
  439. />
  440. <kt-button
  441. :label="settledName"
  442. :perms="permsSettled"
  443. :size="size"
  444. type="danger"
  445. @click="handleBatchSettled()"
  446. :disabled="selections.length === 0"
  447. style="float: left"
  448. v-if="showBatchSettled"
  449. />
  450. <kt-button
  451. label="导出Excel"
  452. :perms="permsExcel"
  453. :size="size"
  454. type="danger"
  455. @click="handleBatchPrint()"
  456. style="float: left"
  457. v-if="showBatchPrint"
  458. />
  459. <el-pagination
  460. background
  461. @size-change="handleSizeChange"
  462. layout="total, sizes, prev, pager, next, jumper"
  463. @current-change="refreshPageRequest"
  464. :current-page="data.pageNum"
  465. :page-size="data.pageSize"
  466. :page-sizes="[10, 20, 50, 100, 200, 300, 400, 500]"
  467. :total="data.totalSize"
  468. style="float: left; margin-left: 20px"
  469. v-if="isshowpagination"
  470. >
  471. </el-pagination>
  472. </div>
  473. </div>
  474. </template>
  475. <script>
  476. import KtButton from "@/views/Core/KtButton";
  477. import BigNumber from "bignumber.js";
  478. export default {
  479. name: "KtCommonTable",
  480. components: {
  481. KtButton,
  482. },
  483. props: {
  484. select: {
  485. type: Boolean,
  486. default: false,
  487. },
  488. tableHeights: {
  489. type: Number,
  490. },
  491. operationWidth: {
  492. type: Number,
  493. default: 200,
  494. },
  495. showBatchSettled: {
  496. //显示批量结算
  497. type: Boolean,
  498. default: false,
  499. },
  500. SerialShow: {
  501. type: Boolean,
  502. default: true,
  503. },
  504. customToolName: {
  505. type: String,
  506. },
  507. permscustomTool: {
  508. type: String,
  509. },
  510. customToolseletted: {
  511. // 自定义操作组件
  512. type: Boolean,
  513. default: false,
  514. },
  515. settledName: {
  516. //批量按钮name
  517. type: String,
  518. },
  519. deleteName: {
  520. type: String,
  521. },
  522. showBatchPrint: {
  523. //显示批量导出
  524. type: Boolean,
  525. default: false,
  526. },
  527. //显示合计
  528. showSummary: {
  529. type: Boolean,
  530. default: false,
  531. },
  532. button1Name: {
  533. type: String,
  534. },
  535. button2Name: {
  536. type: String,
  537. },
  538. button3Name: {
  539. type: String,
  540. },
  541. button4Name: {
  542. type: String,
  543. },
  544. button5Name: {
  545. type: String,
  546. },
  547. button6Name: {
  548. type: String,
  549. },
  550. button7Name: {
  551. type: String,
  552. },
  553. button7Status: {
  554. type: String,
  555. },
  556. button8Name: {
  557. type: String,
  558. },
  559. button8Status: {
  560. type: String,
  561. },
  562. button9Name: {
  563. type: String,
  564. },
  565. button9Status: {
  566. type: String,
  567. },
  568. button10Name: {
  569. type: String,
  570. },
  571. button10Status: {
  572. type: String,
  573. },
  574. buttonDropdown: {
  575. type: Array,
  576. default: () => [],
  577. },
  578. permsButton1: {
  579. type: String,
  580. },
  581. permsButton2: {
  582. type: String,
  583. },
  584. permsButton3: {
  585. type: String,
  586. },
  587. permsButton4: {
  588. type: String,
  589. },
  590. button1Background: {
  591. type: String,
  592. default: "#f56c6c",
  593. },
  594. button2Background: {
  595. type: String,
  596. default: "rgb(222, 80, 76)",
  597. },
  598. button3Background: {
  599. type: String,
  600. default: "rgb(14, 194, 22)",
  601. },
  602. button4Background: {
  603. type: String,
  604. default: "#1e87ed",
  605. },
  606. button1Icon: {
  607. type: String,
  608. default: "fa fa-trash",
  609. },
  610. button2Icon: {
  611. type: String,
  612. default: "",
  613. },
  614. button3Icon: {
  615. type: String,
  616. default: "",
  617. },
  618. button4Icon: {
  619. type: String,
  620. default: "",
  621. },
  622. button5Icon: {
  623. type: String,
  624. default: "",
  625. },
  626. button2Type: {
  627. type: String,
  628. default: "primary",
  629. },
  630. button3Type: {
  631. type: String,
  632. default: "primary",
  633. },
  634. button4Type: {
  635. type: String,
  636. default: "primary",
  637. },
  638. button5Type: {
  639. type: String,
  640. default: "primary",
  641. },
  642. button6Type: {
  643. type: String,
  644. default: "primary",
  645. },
  646. button7Type: {
  647. type: String,
  648. default: "primary",
  649. },
  650. button8Type: {
  651. type: String,
  652. default: "primary",
  653. },
  654. button9Type: {
  655. type: String,
  656. default: "primary",
  657. },
  658. button10Type: {
  659. type: String,
  660. default: "primary",
  661. },
  662. editButtonName: {
  663. type: String,
  664. },
  665. deleteButtonName: {
  666. type: String,
  667. },
  668. isshowpagination: {
  669. //是否显示分页栏
  670. type: Boolean,
  671. default: true,
  672. },
  673. showSummaryFieldList: Array, //自定义合计列配置
  674. keyName: String, //主键字段名
  675. columns: Array, // 表格列配置
  676. data: {}, // 表格分页数据
  677. permsEdit: String, // 编辑权限标识
  678. permsDelete: String, // 底部按钮标识
  679. permsSettled: String, // 底部按钮标识
  680. permsExcel: String, // 底部按钮标识
  681. size: {
  682. // 尺寸样式
  683. type: String,
  684. default: "small ",
  685. },
  686. align: {
  687. // 文本对齐方式
  688. type: String,
  689. default: "left",
  690. },
  691. // maxHeight: { // 表格最大高度
  692. // type: Number,
  693. // default: 1420
  694. // },
  695. // height: { // 表格最大高度
  696. // type: Number,
  697. // default: 250
  698. // },
  699. showOperation: {
  700. // 是否显示操作组件
  701. type: Boolean,
  702. default: true,
  703. },
  704. border: {
  705. // 是否显示边框
  706. type: Boolean,
  707. default: true,
  708. },
  709. stripe: {
  710. // 是否显示斑马线
  711. type: Boolean,
  712. default: true,
  713. },
  714. highlightCurrentRow: {
  715. // 是否高亮当前行
  716. type: Boolean,
  717. default: true,
  718. },
  719. showOverflowTooltip: {
  720. // 是否单行显示
  721. type: Boolean,
  722. default: true,
  723. },
  724. showBatchDelete: {
  725. // 是否显示操作组件
  726. type: Boolean,
  727. default: false,
  728. },
  729. showSysUserAccountCardList: {
  730. // 是否显示二级列组件
  731. type: Boolean,
  732. default: false,
  733. },
  734. showDefaultPage: {
  735. // 是否默认调用一次查询
  736. type: Boolean,
  737. default: true,
  738. }
  739. },
  740. data() {
  741. return {
  742. tableHeight: 0,
  743. loading: false, // 加载标识
  744. selections: [], // 列表选中列
  745. pageRequest: {
  746. pageNum: 1,
  747. pageSize: 20,
  748. },
  749. taskPool: false,
  750. };
  751. },
  752. methods: {
  753. tableRowClassName(row, rowIndex) {
  754. // if (!!row.fieldName24 && row.fieldName24.indexOf("未") >= 0) {
  755. // return "warningRow";
  756. // } else if (!!row.fieldName24 && row.fieldName24.indexOf("已") >= 0) {
  757. // return "successRow";
  758. // }
  759. if (!!this.taskPool) {
  760. if (row.row.isExternal === 1) {
  761. return "flagRow";
  762. } else {
  763. return "";
  764. }
  765. }
  766. this.$emit("tableRowClassName", row);
  767. // return '';
  768. },
  769. getSummaries(param) {
  770. const { columns, data } = param;
  771. const sums = [];
  772. columns.forEach((column, index) => {
  773. if (index === 0) {
  774. sums[index] = "合计"; // 假设第一列显示文本'合计'
  775. return;
  776. }
  777. if (this.showSummaryFieldList) {
  778. // 如果当前列名不在需要计算的列名数组中,直接返回空值或其他标记
  779. if (!this.showSummaryFieldList.includes(column.property)) {
  780. sums[index] = "-";
  781. return;
  782. }
  783. }
  784. let sum = new BigNumber(0);
  785. data.forEach((item) => {
  786. let value = item[column.property];
  787. let number = new BigNumber(value);
  788. if (!number.isNaN()) {
  789. sum = sum.plus(number);
  790. }
  791. });
  792. sums[index] = sum.toFixed(); // 转换成字符串避免精度问题
  793. });
  794. return sums;
  795. },
  796. // 分页查询
  797. findPage: function () {
  798. this.loading = true;
  799. let callback = (res) => {
  800. this.loading = false;
  801. //解决操作栏位置偏移问题
  802. this.$nextTick(() => {
  803. this.$refs.doLayout.doLayout();
  804. }, 200);
  805. };
  806. this.$emit("findPage", {
  807. pageRequest: this.pageRequest,
  808. callback: callback,
  809. });
  810. },
  811. hideLoading() {
  812. this.loading = false;
  813. },
  814. // 选择切换
  815. selectionChange: function (selections) {
  816. this.selections = selections;
  817. this.$emit("selectionChange", {
  818. selections: selections,
  819. });
  820. },
  821. // 选择切换
  822. handleCurrentChange: function (val) {
  823. this.$emit("handleCurrentChange", {
  824. val: val,
  825. });
  826. },
  827. rowClick: function (row) {
  828. this.$emit("rowClick", {
  829. row: row,
  830. });
  831. },
  832. // 换页刷新
  833. refreshPageRequest: function (pageNum) {
  834. this.pageRequest.pageNum = pageNum;
  835. // this.pageRequest.pageSize = 20;
  836. this.findPage();
  837. },
  838. // 每页条数发生改变
  839. handleSizeChange(pageSize) {
  840. this.pageRequest.pageSize = pageSize;
  841. this.findPage();
  842. },
  843. signStateChanged(index, row) {
  844. this.$emit("signStateChanged", {
  845. index: index,
  846. row: row,
  847. });
  848. },
  849. // 按钮编辑
  850. handleBtnEdit: function (index, row) {
  851. this.$emit("handleBtnEdit", {
  852. index: index,
  853. row: row,
  854. });
  855. },
  856. // 编辑
  857. handleEdit: function (index, row) {
  858. this.$emit("handleEdit", {
  859. index: index,
  860. row: row,
  861. });
  862. // this.$emit('findLeftTreeData')
  863. },
  864. handleBreak: function (index, row, i, r) {
  865. this.$emit("handleBreak", {
  866. index: index,
  867. row: row,
  868. i: i,
  869. r: r,
  870. });
  871. },
  872. handleTimeLine: function (index, row, i, r) {
  873. this.$emit("handleTimeLine", {
  874. index: index,
  875. row: row,
  876. i: i,
  877. r: r,
  878. });
  879. },
  880. handleRebind: function (index, row, i, r) {
  881. this.$emit("handleRebind", {
  882. index: index,
  883. row: row,
  884. i: i,
  885. r: r,
  886. });
  887. },
  888. // 删除
  889. handleDelete: function (index, row) {
  890. let _keyName = "id";
  891. if (!!this.keyName) {
  892. _keyName = this.keyName;
  893. }
  894. this.delete(row[_keyName]);
  895. },
  896. handleButton1: function (index, row) {
  897. this.$emit("handleButton1", {
  898. index: index,
  899. row: row,
  900. });
  901. },
  902. handleButton2: function (index, row) {
  903. this.$emit("handleButton2", {
  904. index: index,
  905. row: row,
  906. });
  907. },
  908. handleButton3: function (index, row) {
  909. this.$emit("handleButton3", {
  910. index: index,
  911. row: row,
  912. });
  913. },
  914. handleButton4: function (index, row) {
  915. this.$emit("handleButton4", {
  916. index: index,
  917. row: row,
  918. });
  919. },
  920. handleButton5: function (index, row) {
  921. this.$emit("handleButton5", {
  922. index: index,
  923. row: row,
  924. });
  925. },
  926. handleButton6: function (index, row) {
  927. this.$emit("handleButton6", {
  928. index: index,
  929. row: row,
  930. });
  931. },
  932. handleButton7: function (index, row) {
  933. this.$emit("handleButton7", {
  934. index: index,
  935. row: row,
  936. });
  937. },
  938. handleButton8: function (index, row) {
  939. this.$emit("handleButton8", {
  940. index: index,
  941. row: row,
  942. });
  943. },
  944. handleButton10: function (index, row) {
  945. this.$emit("handleButton10", {
  946. index: index,
  947. row: row,
  948. });
  949. },
  950. handleButton9: function (index, row) {
  951. this.$emit("handleButton9", {
  952. index: index,
  953. row: row,
  954. });
  955. },
  956. handleButton: function (index, row) {
  957. this.$emit("handleButton", {
  958. index: index,
  959. row: row,
  960. });
  961. },
  962. //删除单个
  963. handleDeleteFlag: function (index, row) {
  964. this.$emit("handleDeleteFlag", { index: index, row: row });
  965. // var _keyName = "id";
  966. // if (!!this.keyName) {
  967. // _keyName = this.keyName;
  968. // }
  969. // let ids = row[_keyName];
  970. // this.$confirm("确认删除吗?", "提示", {
  971. // type: "warning",
  972. // })
  973. // .then(() => {
  974. // let params = [];
  975. // let idArray = (ids + "").split(",");
  976. // for (var i = 0; i < idArray.length; i++) {
  977. // var obj = {};
  978. // obj[_keyName] = idArray[i];
  979. // params.push(obj);
  980. // }
  981. // this.loading = true;
  982. // let callback = (res) => {
  983. // if (res.code == 200) {
  984. // this.$message({
  985. // message: "操作成功",
  986. // type: "success",
  987. // });
  988. // this.findPage();
  989. // // this.$emit('findLeftTreeData')
  990. // } else {
  991. // this.$message({
  992. // message: "操作失败, " + res.msg,
  993. // type: "error",
  994. // });
  995. // }
  996. // };
  997. // this.$emit("handleDeleteFlag", {
  998. // params: params,
  999. // callback: callback,
  1000. // });
  1001. // this.loading = false;
  1002. // })
  1003. // .catch(() => {
  1004. // this.loading = false;
  1005. // });
  1006. },
  1007. // 批量删除
  1008. handleBatchDelete: function () {
  1009. let idlist = [];
  1010. this.selections.map((item) => idlist.push(item.id));
  1011. this.$emit("handleDelete", idlist);
  1012. },
  1013. //自定义批量操作按钮
  1014. customToolMethod() {
  1015. let idlist = [];
  1016. this.selections.map((item) => idlist.push(item.id));
  1017. this.$emit("customTool", idlist);
  1018. },
  1019. // 删除操作
  1020. delete: function (ids) {
  1021. var _keyName = "id";
  1022. if (!!this.keyName) {
  1023. _keyName = this.keyName;
  1024. }
  1025. this.$confirm("确认删除吗?", "提示", {
  1026. type: "warning",
  1027. })
  1028. .then(() => {
  1029. let params = [];
  1030. let idArray = (ids + "").split(",");
  1031. for (var i = 0; i < idArray.length; i++) {
  1032. var obj = {};
  1033. obj[_keyName] = idArray[i];
  1034. params.push(obj);
  1035. }
  1036. let callback = (res) => {
  1037. if (res.code == 200) {
  1038. this.$message({
  1039. message: "操作成功",
  1040. type: "success",
  1041. });
  1042. this.findPage();
  1043. // this.$emit('findLeftTreeData')
  1044. } else {
  1045. this.$message({
  1046. message: "操作失败, " + res.msg,
  1047. type: "error",
  1048. });
  1049. }
  1050. };
  1051. this.$emit("handleDelete", {
  1052. params: params,
  1053. callback: callback,
  1054. });
  1055. })
  1056. .catch(() => {});
  1057. },
  1058. //批量结算
  1059. handleBatchSettled: function () {
  1060. let _keyName = "orderno";
  1061. if (!!this.keyName) {
  1062. _keyName = this.keyName;
  1063. }
  1064. let idlist = [];
  1065. this.selections.map((item) => idlist.push(item[_keyName]));
  1066. this.$emit("handleSettled", idlist);
  1067. },
  1068. //批量打印
  1069. handleBatchPrint: function () {
  1070. // let _keyName = "orderno";
  1071. // if(!!this.keyName){
  1072. // _keyName = this.keyName;
  1073. // }
  1074. // let ids = this.selections.map(item => item[_keyName]).toString()
  1075. // console.log(ids);
  1076. this.$emit("handlePrint");
  1077. },
  1078. },
  1079. mounted() {
  1080. const that = this;
  1081. if(this.showDefaultPage){
  1082. that.refreshPageRequest(1);
  1083. }
  1084. setTimeout(() => {
  1085. let tableTop = that.$refs.commonTable.offsetTop;
  1086. let bottomTop = that.$refs.bottomFixed.offsetTop;
  1087. that.tableHeight = bottomTop - tableTop - 120 + "px";
  1088. }, 10);
  1089. // window.onresize = function () {
  1090. // let tableTop = that.$refs.commonTable.offsetTop;
  1091. // let bottomTop = that.$refs.bottomFixed.offsetTop;
  1092. // that.tableHeight = bottomTop - tableTop - 120 + "px";
  1093. // };
  1094. },
  1095. };
  1096. </script>
  1097. <style scoped>
  1098. /deep/ .el-table__fixed-body .el-table__fixed-right {
  1099. background-color: #f0f0f0; /* 你想要的背景色 */
  1100. }
  1101. /deep/ .table-fiexd {
  1102. background: #fff !important;
  1103. }
  1104. /* 底部固定分页 */
  1105. .bottomFixed {
  1106. height: 40px;
  1107. position: fixed;
  1108. bottom: 0;
  1109. width: 100%;
  1110. background: #fff;
  1111. /* margin-top: 10px; */
  1112. /* box-shadow: 0 -2px 0 0 #efefef; */
  1113. }
  1114. /deep/.el-table .el-table__row--striped {
  1115. background-color: inherit;
  1116. }
  1117. .el-table .warningRow {
  1118. background: oldlace;
  1119. }
  1120. .el-table .successRow {
  1121. background: #f0f9eb;
  1122. }
  1123. .el-dropdown-link {
  1124. cursor: pointer;
  1125. color: var(--themeColor);
  1126. font-size: 12px;
  1127. }
  1128. </style>
  1129. <style lang="scss" scoped>
  1130. /deep/ .el-tag--plain {
  1131. background: rgba(93, 125, 255, 0.1);
  1132. border-radius: 4px;
  1133. border: 1px solid #5d7dff;
  1134. }
  1135. /deep/ .el-tag--plain.el-tag--danger {
  1136. background: rgba(240, 85, 82, 0.1);
  1137. border-radius: 4px 4px 4px 4px;
  1138. border: 1px solid #f05552;
  1139. }
  1140. /deep/ .el-tag--plain.el-tag--info {
  1141. background: rgba(158, 158, 158, 0.1);
  1142. border-radius: 4px 4px 4px 4px;
  1143. border: 1px solid #9e9e9e;
  1144. }
  1145. /deep/ .el-tag--plain.el-tag--success {
  1146. background: rgba(81, 189, 44, 0.1);
  1147. border-radius: 4px 4px 4px 4px;
  1148. border: 1px solid #51bd2c;
  1149. }
  1150. /deep/ .el-tag--plain.el-tag--warning {
  1151. background: rgba(242, 153, 47, 0.1);
  1152. border-radius: 4px 4px 4px 4px;
  1153. border: 1px solid #f2992f;
  1154. }
  1155. </style>