KtCommonTable.vue 26 KB

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