KtCommonTable.vue 36 KB

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