index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <div style="margin-top: 10px">
  5. <el-tabs type="card" v-model="tabsValue" @tab-click="handleClick">
  6. <el-tab-pane label="任务列表" name="申请">
  7. <span slot="label">任务列表</span>
  8. </el-tab-pane>
  9. <el-tab-pane label="业务单据" name="销项">
  10. <span slot="label" style="color: #4c9e44">单据列表</span>
  11. </el-tab-pane>
  12. <el-tab-pane label="已完成" name="已完成"></el-tab-pane>
  13. </el-tabs>
  14. </div>
  15. <avue-crud v-show="tabsValue == '申请'"
  16. :option="applyOption"
  17. :table-loading="loading"
  18. :data="applyData"
  19. :page.sync="applyPage"
  20. ref="applyCrud"
  21. id="out-table"
  22. @search-change="searchChange"
  23. @selection-change="selectionChange"
  24. @search-reset="searchReset"
  25. @current-change="currentChange"
  26. @size-change="sizeChange"
  27. @refresh-change="refreshChange"
  28. :header-cell-class-name="headerClassName"
  29. @resetColumn="resetColumnTwo('applyCrud', 'applyOption', 'applyOptionBack', 319)"
  30. @saveColumn="saveColumnTwo('applyCrud', 'applyOption', 'applyOptionBack', 319)"
  31. @on-load="onLoad" >
  32. <template slot="menuLeft" slot-scope="{row}">
  33. <el-button type="success" size="small" @click="multipleInvoicing" >选择开票</el-button>
  34. </template>
  35. <template slot="menu" slot-scope="{row}">
  36. <el-button type="text" size="small"
  37. :disabled="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false"
  38. @click="invoicingfun(row)" >开票
  39. </el-button>
  40. </template>
  41. </avue-crud>
  42. <avue-crud v-show="tabsValue == '销项' || tabsValue == '已完成'"
  43. :option="option"
  44. :table-loading="loading"
  45. :data="data"
  46. :page.sync="page"
  47. :permission="permissionList"
  48. v-model="form"
  49. ref="crud"
  50. id="out-table"
  51. :header-cell-class-name="headerClassName"
  52. @row-del="rowDel"
  53. @search-change="searchChange"
  54. @search-reset="searchReset"
  55. @selection-change="selectionChange"
  56. @current-change="currentChange"
  57. @size-change="sizeChange"
  58. @refresh-change="refreshChange"
  59. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 319.1)"
  60. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 319.1)"
  61. @on-load="onLoad">
  62. <template slot="menuLeft">
  63. <el-button type="success"
  64. size="small"
  65. icon="el-icon-plus"
  66. plain
  67. @click="newbillFun">新建发票
  68. </el-button>
  69. <el-button type="danger"
  70. size="small"
  71. icon="el-icon-delete"
  72. plain
  73. @click="handleDelete">一键删除
  74. </el-button>
  75. </template>
  76. <template slot="menu" slot-scope="{row}">
  77. <el-button type="text"
  78. size="small"
  79. :disabled="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false"
  80. @click="editFun(row)">编辑
  81. </el-button>
  82. <el-button type="text"
  83. size="small"
  84. :disabled="row.status == 3 || (saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false)"
  85. @click="rowDel(row)">删除
  86. </el-button>
  87. </template>
  88. <template slot-scope="{ row }" slot="billNo">
  89. <span class="pointerClick"
  90. v-if="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id == row.createUser:true"
  91. @click="editFun(row)" >{{row.billNo}}
  92. </span>
  93. <span v-else>{{row.billNo}}</span>
  94. </template>
  95. <template slot-scope="{ row }" slot="billDate">
  96. {{row.billDate?row.billDate.slice(0,10):''}}
  97. </template>
  98. <template slot-scope="{ row }" slot="invoiceDate">
  99. {{row.invoiceDate?row.invoiceDate.slice(0,10):''}}
  100. </template>
  101. </avue-crud>
  102. </basic-container>
  103. <fininvoicesDetails ref="fininvoicesDetails" :editSave="editSave" v-if="!isShow" @goBack="goBack"></fininvoicesDetails>
  104. </div>
  105. </template>
  106. <script>
  107. import {
  108. fininvoicesList,
  109. fininvoicesDetail,
  110. fininvoicesRemove, fininvoicesSubmit
  111. } from "@/api/iosBasicData/fininvoices";
  112. import fininvoicesDetails from "@/views/iosBasicData/fininvoicesOutput/fininvoicesDetails.vue";
  113. import {mapGetters} from "vuex";
  114. import finstlbillsDetails from "@/views/iosBasicData/finstlbills/finstlbillsDetails.vue";
  115. import {getRateList} from "@/api/iosBasicData/rateManagement";
  116. export default {
  117. components:{finstlbillsDetails, fininvoicesDetails},
  118. data() {
  119. return {
  120. tabsValue:'申请',
  121. // 详情页面和列表切换
  122. isShow:true,
  123. editSave:false, // 编辑还是保存
  124. form: {},
  125. applyQuery:{}, // 任务列表
  126. query: {}, // 单据列表
  127. loading: true,
  128. // 业务单据
  129. page: {
  130. pageSize: 10,
  131. currentPage: 1,
  132. total: 0
  133. },
  134. // 任务列表数据
  135. applyPage:{
  136. pageSize: 10,
  137. currentPage: 1,
  138. total: 0
  139. },
  140. applySelectionList:[], // 任务列表多选
  141. // 业务单据 多选
  142. selectionList: [],
  143. // 任务列表
  144. applyOption:{},
  145. applyOptionBack: {
  146. height:'auto',
  147. calcHeight: 30,
  148. tip: false,
  149. searchShow: true,
  150. searchMenuSpan: 12,
  151. border: true,
  152. index: true,
  153. selection: true,
  154. dialogClickModal: false,
  155. menuWidth:100,
  156. addBtn:false,
  157. viewBtn:false,
  158. delBtn:false,
  159. editBtn:false,
  160. searchIcon: true,
  161. searchIndex: 3,
  162. column: [
  163. {
  164. label: "单据编号",
  165. prop: "billNo",
  166. search:true,
  167. overHidden:true,
  168. },
  169. {
  170. label: "单据日期",
  171. prop: "billDate",
  172. overHidden:true,
  173. },
  174. {
  175. label: "单据开始日期",
  176. prop: "invoiceDateStart",
  177. search:true,
  178. overHidden:true,
  179. hide:true,
  180. searchLabelWidth:"100",
  181. type: "date",
  182. format: "yyyy-MM-dd",
  183. valueFormat: "yyyy-MM-dd HH:mm:ss",
  184. },
  185. {
  186. label: "单据结束日期",
  187. prop: "invoiceDateEnd",
  188. search:true,
  189. overHidden:true,
  190. hide:true,
  191. searchLabelWidth:"100",
  192. type: "date",
  193. format: "yyyy-MM-dd",
  194. valueFormat: "yyyy-MM-dd HH:mm:ss",
  195. },
  196. {
  197. label: "客户名称",
  198. prop: "corpCnName",
  199. width:"120",
  200. search:true,
  201. overHidden:true,
  202. },
  203. {
  204. label: "发票抬头",
  205. prop: "invCorpCnName",
  206. width:"160",
  207. search:true,
  208. overHidden:true,
  209. },
  210. {
  211. label: "发票币种",
  212. prop: "invCurCode",
  213. search:true,
  214. type: 'select',
  215. dicData:[],
  216. dicUrl:'/api/blade-los/bcurrency/page?current=1&size=20',
  217. props: {
  218. label: "code",
  219. value: "code"
  220. },
  221. dicFormatter: (res => {
  222. return res.data.records
  223. }),
  224. overHidden:true,
  225. },
  226. {
  227. label: "开票金额",
  228. prop: "amountLoc",
  229. width: "120",
  230. overHidden:true,
  231. },
  232. {
  233. label: "申请人",
  234. prop: "applicantName",
  235. overHidden:true,
  236. },
  237. {
  238. label: "备注",
  239. prop: "remarks",
  240. overHidden:true,
  241. },
  242. ]
  243. },
  244. // 业务单据
  245. option:{},
  246. optionBack: {
  247. height:'auto',
  248. calcHeight: 30,
  249. tip: false,
  250. searchShow: true,
  251. searchMenuSpan: 6,
  252. border: true,
  253. index: true,
  254. selection: true,
  255. dialogClickModal: false,
  256. menuWidth:100,
  257. addBtn:false,
  258. viewBtn:false,
  259. delBtn:false,
  260. editBtn:false,
  261. column: [
  262. {
  263. label: "单据编号",
  264. prop: "billNo",
  265. search:true,
  266. rules: [{
  267. required: true,
  268. message: "请输入单据编号",
  269. trigger: "blur"
  270. }],
  271. overHidden:true,
  272. },
  273. {
  274. label: "客户名称",
  275. prop: "corpCnName",
  276. width:"120",
  277. search:true,
  278. overHidden:true,
  279. },
  280. {
  281. label: "发票抬头",
  282. prop: "invCorpCnName",
  283. width:"160",
  284. search:true,
  285. overHidden:true,
  286. },
  287. {
  288. label: "合计本位币(CNY)",
  289. prop: "amountLoc",
  290. width: "120",
  291. overHidden:true,
  292. },
  293. {
  294. label: "单据日期",
  295. prop: "billDate",
  296. rules: [{
  297. required: true,
  298. message: "请输入单据日期",
  299. trigger: "blur"
  300. }],
  301. overHidden:true,
  302. },
  303. {
  304. label: "发票号码",
  305. prop: "invoiceNo",
  306. search:true,
  307. rules: [{
  308. required: true,
  309. message: "请输入发票号码",
  310. trigger: "blur"
  311. }],
  312. overHidden:true,
  313. },
  314. {
  315. label: "单据日期",
  316. prop: "invoiceDate",
  317. overHidden:true,
  318. },
  319. {
  320. label: "单据开始日期",
  321. prop: "invoiceDateStart",
  322. search:true,
  323. overHidden:true,
  324. hide:true,
  325. searchLabelWidth:"100",
  326. type: "date",
  327. format: "yyyy-MM-dd",
  328. valueFormat: "yyyy-MM-dd HH:mm:ss",
  329. },
  330. {
  331. label: "单据结束日期",
  332. prop: "invoiceDateEnd",
  333. search:true,
  334. overHidden:true,
  335. hide:true,
  336. searchLabelWidth:"100",
  337. type: "date",
  338. format: "yyyy-MM-dd",
  339. valueFormat: "yyyy-MM-dd HH:mm:ss",
  340. },
  341. {
  342. label: "原发票号码",
  343. prop: "origInvoiceNo",
  344. width:"120",
  345. overHidden:true,
  346. },
  347. {
  348. label: "税务发票号码",
  349. prop: "taxInvoiceNo",
  350. width:"150",
  351. overHidden:true,
  352. },
  353. {
  354. label: "全电发票",
  355. prop: "invType",
  356. overHidden:true,
  357. },
  358. {
  359. label: "发票类型",
  360. prop: "taxType",
  361. width:"160",
  362. search:true,
  363. overHidden:true,
  364. },
  365. {
  366. label: "税率 %",
  367. prop: "taxRate",
  368. rules: [{
  369. required: true,
  370. message: "请输入税率 %",
  371. trigger: "blur"
  372. }],
  373. overHidden:true,
  374. },
  375. {
  376. label: "结算方式",
  377. prop: "stlMode",
  378. overHidden:true,
  379. },
  380. {
  381. label: "发票币种",
  382. prop: "invCurCode",
  383. rules: [{
  384. required: true,
  385. message: "请输入发票币种",
  386. trigger: "blur"
  387. }],
  388. overHidden:true,
  389. },
  390. {
  391. label: "客户英文名称",
  392. prop: "corpEnName",
  393. width:"120",
  394. overHidden:true,
  395. },
  396. {
  397. label: "开票单位英文名称",
  398. prop: "invCorpEnName",
  399. width:"150",
  400. overHidden:true,
  401. },
  402. {
  403. label: "开票单位税号",
  404. prop: "invCorpTaxNo",
  405. width:"140",
  406. overHidden:true,
  407. },
  408. {
  409. label: "开票单位CNY开户银行",
  410. prop: "invCorpAccountBankCny",
  411. width:"160",
  412. overHidden:true,
  413. },
  414. {
  415. label: "开票单位CNY银行账号",
  416. prop: "invCorpAccountNoCny",
  417. width:"160",
  418. overHidden:true,
  419. },
  420. {
  421. label: "开票单位USD开户银行",
  422. prop: "invCorpAccountBankUsd",
  423. width:"160",
  424. overHidden:true,
  425. },
  426. {
  427. label: "开票单位USD银行账号",
  428. prop: "invCorpAccountNoUsd",
  429. width:"160",
  430. overHidden:true,
  431. },
  432. {
  433. label: "船名/航次",
  434. prop: "vesselVoyno",
  435. width:"100",
  436. overHidden:true,
  437. },
  438. {
  439. label: "开船日",
  440. prop: "etd",
  441. overHidden:true,
  442. },
  443. {
  444. label: "装货港",
  445. prop: "pol",
  446. overHidden:true,
  447. },
  448. {
  449. label: "卸货港",
  450. prop: "pod",
  451. overHidden:true,
  452. },
  453. {
  454. label: "目的地",
  455. prop: "destination",
  456. overHidden:true,
  457. },
  458. {
  459. label: "箱型/箱量",
  460. prop: "containers",
  461. width:"100",
  462. overHidden:true,
  463. },
  464. {
  465. label: "币种",
  466. prop: "curCode",
  467. overHidden:true,
  468. },
  469. {
  470. label: "原汇率",
  471. prop: "exrate",
  472. overHidden:true,
  473. },
  474. {
  475. label: "是否转换为人民币",
  476. prop: "isExchangeToCny",
  477. width:"140",
  478. dicData:[{
  479. label:'否',
  480. value:0
  481. },{
  482. label:'是',
  483. value:1
  484. }],
  485. overHidden:true,
  486. },
  487. {
  488. label: "业务类型",
  489. prop: "businessTypes",
  490. overHidden:true,
  491. },
  492. {
  493. label: "业务单据编号",
  494. prop: "businessNo",
  495. width:"120",
  496. overHidden:true,
  497. },
  498. {
  499. label: "对账单编号",
  500. prop: "checkNo",
  501. width:"120",
  502. overHidden:true,
  503. },
  504. {
  505. label: "MBL NO",
  506. prop: "mblno",
  507. overHidden:true,
  508. },
  509. {
  510. label: "HBL NO",
  511. prop: "hblno",
  512. overHidden:true,
  513. },
  514. {
  515. label: "订舱",
  516. prop: "bookingNo",
  517. overHidden:true,
  518. },
  519. {
  520. label: "中文船名",
  521. prop: "vesselCnName",
  522. overHidden:true,
  523. },
  524. {
  525. label: "英文船名",
  526. prop: "vesselEnName",
  527. overHidden:true,
  528. },
  529. {
  530. label: "航次",
  531. prop: "voyageNo",
  532. overHidden:true,
  533. },
  534. {
  535. label: "财务开始日期",
  536. prop: "accountDateFrom",
  537. width:"100",
  538. overHidden:true,
  539. },
  540. {
  541. label: "财务结束日期",
  542. prop: "accountDateTo",
  543. width:"100",
  544. overHidden:true,
  545. },
  546. {
  547. label: "申请人",
  548. prop: "applicantName",
  549. overHidden:true,
  550. },
  551. {
  552. label: "审核人",
  553. prop: "approverName",
  554. overHidden:true,
  555. },
  556. {
  557. label: "是否代理发票",
  558. prop: "isAgent",
  559. width:"120",
  560. dicData:[{
  561. label:'否',
  562. value:0
  563. },{
  564. label:'是',
  565. value:1
  566. }],
  567. overHidden:true,
  568. },
  569. {
  570. label: "是否DK",
  571. prop: "isDk",
  572. dicData:[{
  573. label:'否',
  574. value:0
  575. },{
  576. label:'是',
  577. value:1
  578. }],
  579. overHidden:true,
  580. },
  581. {
  582. label: "是否RP",
  583. prop: "isRp",
  584. dicData:[{
  585. label:'否',
  586. value:0
  587. },{
  588. label:'是',
  589. value:1
  590. }],
  591. overHidden:true,
  592. },
  593. {
  594. label: "RP名称",
  595. prop: "rpName",
  596. overHidden:true,
  597. },
  598. {
  599. label: "导出日期",
  600. prop: "exportDate",
  601. width: "100",
  602. overHidden:true,
  603. },
  604. {
  605. label: "导出人",
  606. prop: "exportName",
  607. overHidden:true,
  608. },
  609. {
  610. label: "是否导出船名航次",
  611. prop: "isExportVslvoy",
  612. width: "140",
  613. dicData:[{
  614. label:'否',
  615. value:0
  616. },{
  617. label:'是',
  618. value:1
  619. }],
  620. overHidden:true,
  621. },
  622. {
  623. label: "是否导出主单号",
  624. prop: "isExportMblno",
  625. width: "140",
  626. dicData:[{
  627. label:'否',
  628. value:0
  629. },{
  630. label:'是',
  631. value:1
  632. }],
  633. overHidden:true,
  634. },
  635. {
  636. label: "是否导出分单号",
  637. prop: "isExportHblno",
  638. width: "140",
  639. dicData:[{
  640. label:'否',
  641. value:0
  642. },{
  643. label:'是',
  644. value:1
  645. }],
  646. overHidden:true,
  647. },
  648. {
  649. label: "发票本位币(CNY)",
  650. prop: "amountCny",
  651. width: "140",
  652. overHidden:true,
  653. },
  654. {
  655. label: "发票USD",
  656. prop: "amountUsd",
  657. width: "100",
  658. overHidden:true,
  659. },
  660. {
  661. label: "税额(CNY)",
  662. prop: "amountTax",
  663. width: "100",
  664. overHidden:true,
  665. },
  666. {
  667. label: "全电发票备注",
  668. prop: "elecRemarks",
  669. width: "120",
  670. overHidden:true,
  671. },
  672. {
  673. label: "银行进账单出票人名称",
  674. prop: "bankReceiptCorpName",
  675. width: "160",
  676. overHidden:true,
  677. },
  678. {
  679. label: "银行进账单出票银行",
  680. prop: "bankReceiptBankName",
  681. width: "160",
  682. overHidden:true,
  683. },
  684. {
  685. label: "银行进账单出票银行账号",
  686. prop: "bankReceiptAccountNo",
  687. width: "160",
  688. overHidden:true,
  689. },
  690. {
  691. label: "银行进账单票据种类",
  692. prop: "bankReceiptBillType",
  693. width: "160",
  694. overHidden:true,
  695. },
  696. {
  697. label: "银行进账单票据张数",
  698. prop: "bankReceiptBillCount",
  699. width: "160",
  700. overHidden:true,
  701. },
  702. {
  703. label: "银行进账单是否已进账(收款)",
  704. prop: "bankReceiptIsIncome",
  705. width: "180",
  706. overHidden:true,
  707. },
  708. {
  709. label: "备注",
  710. prop: "remarks",
  711. rules: [{
  712. required: true,
  713. message: "请输入备注",
  714. trigger: "blur"
  715. }],
  716. overHidden:true,
  717. },
  718. ]
  719. },
  720. data: [], // 业务单据数据
  721. applyData:[], // 任务列表数据
  722. saberUserInfo:{}, // 当前登录人个人信息
  723. };
  724. },
  725. watch:{},
  726. computed: {
  727. ...mapGetters(["permission"]),
  728. permissionList() {
  729. return {
  730. addBtn: this.vaildData(this.permission.fininvoices_add, false),
  731. viewBtn: this.vaildData(this.permission.fininvoices_view, false),
  732. delBtn: this.vaildData(this.permission.fininvoices_delete, false),
  733. editBtn: this.vaildData(this.permission.fininvoices_edit, false)
  734. };
  735. },
  736. ids() {
  737. let ids = [];
  738. this.selectionList.forEach(ele => {
  739. ids.push(ele.id);
  740. });
  741. return ids.join(",");
  742. }
  743. },
  744. async created() {
  745. // 获取当前登录人个人信息
  746. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  747. this.applyOption = await this.getColumnData(this.getColumnName(319), this.applyOptionBack);
  748. this.option = await this.getColumnData(this.getColumnName(319.1), this.optionBack);
  749. this.getRateListfun()
  750. },
  751. methods: {
  752. // 获取币别数据
  753. getRateListfun(){
  754. getRateList({current:1,size:20}).then(res=>{
  755. this.findObject(this.applyOptionBack.column, "invCurCode").dicData = res.data.data.records
  756. })
  757. },
  758. // 单个开票
  759. invoicingfun(row){
  760. this.isShow = false
  761. this.editSave = false
  762. this.$nextTick(()=>{
  763. this.$refs.fininvoicesDetails.fininvoicesGenerateFinInvoicesfun(row.id)
  764. })
  765. },
  766. // 多个开票
  767. multipleInvoicing(){
  768. if (this.applySelectionList.length == 0) {
  769. this.$message.warning('请选择要开票的数据')
  770. return
  771. }
  772. // 判断是否可以编辑别人业务 true 就没有权限
  773. if (this.ModifyOthersfun()) return;
  774. let arrId = this.applySelectionList.map(item=>{
  775. return item.id
  776. })
  777. this.isShow = false
  778. this.editSave = false
  779. this.$nextTick(()=>{
  780. this.$refs.fininvoicesDetails.fininvoicesGenerateFinInvoicesfun(arrId.join(','))
  781. })
  782. },
  783. // 新建发票
  784. newbillFun(){
  785. this.isShow = false;
  786. },
  787. // 编辑
  788. editFun(row) {
  789. this.isShow = false
  790. this.editSave = true
  791. this.$nextTick(()=>{
  792. this.$refs.fininvoicesDetails.fininvoicesDetailfun(row.id)
  793. })
  794. },
  795. // 详情的返回列表
  796. goBack() {
  797. // 初始化数据
  798. // this.detailData = this.$options.data().detailData;
  799. if (JSON.stringify(this.$route.query) != "{}") {
  800. this.$router.$avueRouter.closeTag();
  801. this.$router.push({
  802. path: "/iosBasicData/fininvoices/index"
  803. });
  804. }
  805. this.isShow = true;
  806. this.onLoad(this.page, this.search);
  807. },
  808. rowDel(row) {
  809. this.$confirm("确定将选择数据删除?", {
  810. confirmButtonText: "确定",
  811. cancelButtonText: "取消",
  812. type: "warning"
  813. })
  814. .then(() => {
  815. return fininvoicesRemove(row.id);
  816. })
  817. .then(() => {
  818. this.onLoad(this.page);
  819. this.$message({
  820. type: "success",
  821. message: "操作成功!"
  822. });
  823. });
  824. },
  825. // 一键删除
  826. handleDelete() {
  827. if (this.selectionList.length === 0) {
  828. this.$message.warning("请选择至少一条数据");
  829. return;
  830. }
  831. // 判断是否可以编辑别人业务 true 就没有权限
  832. if (this.ModifyOthersfun()) return;
  833. // 已经提交请核的提示不让删除
  834. let sumArr = []
  835. const h = this.$createElement
  836. for (let item of this.selectionList) {
  837. if (item.status == 3) {
  838. sumArr.push(h('p', `序号${item.$index + 1}的数据已经确认提交请勿删除`))
  839. }
  840. }
  841. if(sumArr.length != 0) {
  842. this.$confirm('提示', {
  843. message:h('div', sumArr),
  844. confirmButtonText: "确定",
  845. cancelButtonText: "取消",
  846. type: "warning"
  847. })
  848. return;
  849. }
  850. this.$confirm("确定将选择数据删除?", {
  851. confirmButtonText: "确定",
  852. cancelButtonText: "取消",
  853. type: "warning"
  854. })
  855. .then(() => {
  856. return fininvoicesRemove(this.ids);
  857. })
  858. .then(() => {
  859. this.onLoad(this.page);
  860. this.$message({
  861. type: "success",
  862. message: "操作成功!"
  863. });
  864. this.$refs.crud.toggleSelection();
  865. });
  866. },
  867. // 判断是否可以编辑别人业务
  868. ModifyOthersfun(){
  869. let sumArr = []
  870. const h = this.$createElement
  871. // 判断是否有权限
  872. if (this.saberUserInfo.role_name.indexOf('允许修改他人业务') != -1) return false
  873. // 当前登录人和选择的创建人对比是不是一个人
  874. for (let item of this.selectionList) {
  875. if (this.saberUserInfo.user_id != item.createUser) {
  876. sumArr.push(h('p', `你没有"允许修改他人业务"权限,请重新选择数据`))
  877. }
  878. }
  879. if(sumArr.length != 0) {
  880. this.$confirm('提示', {
  881. message:h('div', sumArr),
  882. confirmButtonText: "确定",
  883. cancelButtonText: "取消",
  884. type: "warning"
  885. }).catch(err=>{})
  886. return true
  887. }
  888. },
  889. // tabs 切换
  890. handleClick(){
  891. if(this.tabsValue == '申请') {
  892. this.applyPage.currentPage = 1;
  893. this.onLoad(this.applyPage);
  894. }else {
  895. this.page.currentPage = 1;
  896. this.onLoad(this.page);
  897. }
  898. },
  899. // 清除
  900. searchReset() {
  901. this.query = {};
  902. this.onLoad(this.page);
  903. },
  904. // 搜索
  905. searchChange(params, done) {
  906. if(this.tabsValue == '申请') {
  907. this.applyQuery = params;
  908. this.applyPage.currentPage = 1;
  909. this.applyQuery.billDateList = []
  910. this.onLoad(this.applyPage, params);
  911. }else {
  912. this.query = params;
  913. this.page.currentPage = 1;
  914. this.onLoad(this.page, params);
  915. }
  916. done();
  917. },
  918. // 多选反的数据
  919. selectionChange(list) {
  920. if(this.tabsValue == '申请') {
  921. this.applySelectionList = list;
  922. }else {
  923. this.selectionList = list;
  924. }
  925. },
  926. selectionClear() {
  927. if(this.tabsValue == '申请') {
  928. this.applySelectionList = [];
  929. this.$refs.applyCrud.toggleSelection();
  930. }else {
  931. this.selectionList = [];
  932. this.$refs.crud.toggleSelection();
  933. }
  934. },
  935. // 分页
  936. currentChange(currentPage){
  937. if(this.tabsValue == '申请') {
  938. this.applyPage.currentPage = currentPage;
  939. }else {
  940. this.page.currentPage = currentPage;
  941. }
  942. },
  943. sizeChange(pageSize){
  944. if(this.tabsValue == '申请') {
  945. this.applyPage.pageSize = pageSize;
  946. }else {
  947. this.page.pageSize = pageSize;
  948. }
  949. },
  950. // 刷新
  951. refreshChange() {
  952. if (this.tabsValue == '申请') {
  953. this.onLoad(this.applyPage, this.applyQuery);
  954. }else {
  955. this.onLoad(this.page, this.query);
  956. }
  957. },
  958. // 获取列表数据
  959. onLoad(page, params = {}) {
  960. this.loading = true;
  961. let type = null
  962. let status = null
  963. let billStatus = null
  964. if (this.tabsValue == '申请') {
  965. type = '申请'
  966. status = 3
  967. billStatus = 0
  968. }else if (this.tabsValue == '销项') {
  969. type = '销项'
  970. status = 0
  971. }else if (this.tabsValue == '已完成') {
  972. type = '销项'
  973. status = 3
  974. }
  975. fininvoicesList(page.currentPage, page.pageSize, {
  976. ...Object.assign(params, this.query),
  977. type:type,
  978. status:status,
  979. billStatus:billStatus
  980. }).then(res => {
  981. const data = res.data.data;
  982. if (this.tabsValue == '申请') {
  983. this.applyPage.total = data.total;
  984. this.applyData = data.records;
  985. }else {
  986. this.page.total = data.total;
  987. this.data = data.records;
  988. }
  989. this.loading = false;
  990. this.selectionClear();
  991. });
  992. },
  993. //自定义列保存
  994. async saveColumnTwo(ref, option, optionBack, code) {
  995. /**
  996. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  997. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  998. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  999. */
  1000. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1001. if (inSave) {
  1002. this.$message.success("保存成功");
  1003. //关闭窗口
  1004. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1005. }
  1006. },
  1007. //自定义列重置
  1008. async resetColumnTwo(ref, option, optionBack, code) {
  1009. this[option] = this[optionBack];
  1010. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1011. if (inSave) {
  1012. this.$message.success("重置成功");
  1013. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1014. }
  1015. },
  1016. // 更改表格颜色
  1017. headerClassName(tab) {
  1018. //颜色间隔
  1019. let back = ""
  1020. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1021. if (tab.columnIndex % 2 === 0) {
  1022. back = "back-one"
  1023. } else if (tab.columnIndex % 2 === 1) {
  1024. back = "back-two"
  1025. }
  1026. }
  1027. return back;
  1028. },
  1029. }
  1030. };
  1031. </script>
  1032. <style scoped>
  1033. ::v-deep#out-table .back-one {
  1034. background: #ecf5ff !important;
  1035. text-align: center;
  1036. }
  1037. ::v-deep#out-table .back-two {
  1038. background: #ecf5ff !important;
  1039. text-align: center;
  1040. }
  1041. /deep/ .el-col-md-8 {
  1042. width: 24.33333%;
  1043. }
  1044. .pointerClick {
  1045. cursor:pointer;
  1046. color: #1e9fff;
  1047. }
  1048. </style>