KtCommonTable.vue 37 KB

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