amendsCostdetails.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. <template>
  2. <div>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="tableData"
  6. v-model="form"
  7. id="out-table"
  8. :header-cell-class-name="headerClassName"
  9. ref="crud"
  10. :row-style="{height:'20px'}"
  11. :cell-style="{padding:'0px'}"
  12. @selection-change="handleSelectionChange"
  13. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 322.1)"
  14. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 322.1)" >
  15. <template slot="menuLeft">
  16. <el-button type="danger" plain size="small" :disabled="disabled"
  17. @click="batchDelete" >一键删除
  18. </el-button>
  19. <el-button type="info" plain size="small" :disabled="disabled"
  20. @click="feecenterSubmitListfun">一键保存
  21. </el-button>
  22. <el-button type="info" plain size="small" :disabled="disabled"
  23. @click="oneclickEditingfun">一键编辑
  24. </el-button>
  25. <el-button type="primary" plain size="small" :disabled="!form.id"
  26. @click="printingCostsfun()">打印账单</el-button>
  27. </template>
  28. <template slot="indexHeader" slot-scope="scope">
  29. <el-button type="primary" size="small" icon="el-icon-plus" circle
  30. :disabled="disabled"
  31. @click="addfun"></el-button>
  32. </template>
  33. <template slot="index" slot-scope="scope">
  34. <span>{{scope.index + 1}}</span>
  35. </template>
  36. <template slot="accStatus" slot-scope="{row,size}">
  37. <span>{{row.accStatus?'是':'否'}}</span>
  38. </template>
  39. <template slot="dc" slot-scope="{row,size}">
  40. <search-query v-if="editType"
  41. :datalist="dcData"
  42. :selectValue="row.dc"
  43. :filterable="true"
  44. :clearable="true"
  45. :remote="true"
  46. :buttonIf="false"
  47. :disabled="dcDisabled"
  48. @corpChange="corpChange($event,'dc',row)"
  49. placeholder="请选择收/付">
  50. </search-query>
  51. <span v-else >{{row.dc}}</span>
  52. </template>
  53. <template slot="corpCnName" slot-scope="{ row }">
  54. <search-query v-if="editType"
  55. :datalist="corpCnNameData"
  56. :selectValue="row.corpCnName"
  57. :filterable="true"
  58. :clearable="true"
  59. :remote="true"
  60. :buttonIf="false"
  61. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  62. @remoteMethod="getBcorpsListfun($event,'corpCnName')"
  63. @corpChange="corpChange($event,'corpCnName',row)"
  64. @corpFocus="getBcorpsListfun($event,'corpCnName')" >
  65. </search-query>
  66. <span v-else style="color: #1e9fff" @click="corpClick(row)">{{row.corpCnName}}</span>
  67. </template>
  68. <template slot="feeCnName" slot-scope="{ row }">
  69. <search-query v-if="editType"
  70. :datalist="feeCnNameData"
  71. :selectValue="row.feeCnName"
  72. :filterable="true"
  73. :clearable="true"
  74. :remote="true"
  75. :buttonIf="false"
  76. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  77. @remoteMethod="bfeesListfun($event,'feeCnName')"
  78. @corpChange="corpChange($event,'feeCnName',row)"
  79. @corpFocus="bfeesListfun($event,'feeCnName')" >
  80. </search-query>
  81. <span v-else >{{row.feeCnName}}</span>
  82. </template>
  83. <template slot="elementsCnName" slot-scope="{ row }">
  84. <search-query v-if="editType"
  85. :datalist="elementsData"
  86. :selectValue="row.elementsCnName"
  87. :filterable="true"
  88. :clearable="true"
  89. :remote="true"
  90. :buttonIf="false"
  91. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  92. @remoteMethod="getBaccelementsListfun($event,'elementsCnName')"
  93. @corpChange="corpChange($event,'elementsCnName',row,)"
  94. @corpFocus="getBaccelementsListfun($event,'elementsCnName')" >
  95. </search-query>
  96. <span v-else >{{row.elementsCnName}}</span>
  97. </template>
  98. <template slot="paymode" slot-scope="{ row }">
  99. <search-query v-if="editType"
  100. :datalist="paymodeData"
  101. :selectValue="row.paymode"
  102. :clearable="true"
  103. :buttonIf="false"
  104. :forParameter="{key:'dictKey',label:'dictValue',value:'dictKey'}"
  105. @corpChange="corpChange($event,'paymode',row)"
  106. @corpFocus="paymodeWorkDictsfun" >
  107. </search-query>
  108. <span v-else>{{row.paymode}}</span>
  109. </template>
  110. <template slot="unitNo" slot-scope="{ row }">
  111. <search-query v-if="editType"
  112. :datalist="unitNoData"
  113. :selectValue="row.unitNo"
  114. :filterable="true"
  115. :clearable="true"
  116. :remote="true"
  117. :buttonIf="false"
  118. :forParameter="{key:'id',label:'code',value:'code',disabled:'status'}"
  119. @corpFocus="getBunitsPagefun"
  120. @corpChange="corpChange($event,'unitNo',row)" >
  121. </search-query>
  122. <span v-else>{{row.unitNo}}</span>
  123. </template>
  124. <template slot="curCode" slot-scope="{ row }">
  125. <search-query v-if="editType"
  126. :datalist="curCodeData"
  127. :selectValue="row.curCode"
  128. :filterable="true"
  129. :clearable="true"
  130. :remote="true"
  131. :buttonIf="false"
  132. :forParameter="{key:'id',label:'code',value:'code'}"
  133. @remoteMethod="bcurrencyGetExratefun(row.dc)"
  134. @corpChange="corpChange($event,'curCode',row)"
  135. @corpFocus="bcurrencyGetExratefun(row.dc)" >
  136. </search-query>
  137. <span v-else>{{row.curCode}}</span>
  138. </template>
  139. <template slot="isTax" slot-scope="{row}">
  140. <span>{{row.isTax?'是':'否'}}</span>
  141. </template>
  142. <template slot="price" slot-scope="{ row }">
  143. <el-input v-if="editType" type="number" v-model="row.price" size="small" :min="1"
  144. placeholder="请输入" @blur="priceinputfun($event,row)"></el-input>
  145. <span v-else>{{row.price}}</span>
  146. </template>
  147. <template slot="quantity" slot-scope="{ row }">
  148. <el-input v-if="editType" type="number" v-model="row.quantity" size="small" :min="1"
  149. placeholder="请输入" @blur="quantityinputfun(row)"></el-input>
  150. <span v-else>{{row.quantity}}</span>
  151. </template>
  152. <template slot="remarks" slot-scope="{ row }">
  153. <el-input v-if="editType" v-model="row.remarks" size="small"
  154. placeholder="请输入" ></el-input>
  155. <span v-else>{{row.remarks}}</span>
  156. </template>
  157. <template slot-scope="scope" slot="menu">
  158. <el-button type="text" size="small" :disabled="disabled" @click="deletefun(scope.row,scope.index,)">删除</el-button>
  159. </template>
  160. </avue-crud>
  161. <!--往来单位弹窗-->
  162. <el-dialog
  163. title="提示"
  164. :visible.sync="corpVisible"
  165. append-to-body
  166. width="70%"
  167. :close-on-click-modal="false">
  168. <div style="padding-bottom: 30px;" >
  169. <el-table
  170. :data="corpDialog"
  171. border
  172. size="mini"
  173. :row-style="{height:'20px',padding:'0px',fontSize:'12px'}"
  174. :cell-style="{padding:'0px',fontSize:'12px'}"
  175. style="width: 100%">
  176. <el-table-column prop="corpCnName" label="客户名称" width="140px" >
  177. <template slot-scope="{ row }">
  178. <span class="textoverflow">{{row.corpCnName}}</span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="mblno" label="MB/L NO" width="140px" />
  182. <el-table-column prop="amountDr" label="应收金额" />
  183. <el-table-column prop="amountCr" label="应付金额" />
  184. <el-table-column prop="amountDrUsd" label="应收金额USD" width="140px" />
  185. <el-table-column prop="amountCrUsd" label="应付金额USD" width="140px" />
  186. <el-table-column prop="amountDrLoc" label="应收金额合计" width="140px" />
  187. <el-table-column prop="amountCrLoc" label="应付金额合计" width="140px" />
  188. <el-table-column prop="stlAmountDr" label="已结算应收金额" width="140px" />
  189. <el-table-column prop="stlAmountCr" label="已结算应付金额" width="140px" />
  190. <el-table-column prop="stlAmountDrUsd" label="已结算应收金额USD" width="140px" />
  191. <el-table-column prop="stlAmountCrUsd" label="已结算应付金额USD" width="140px" />
  192. <el-table-column prop="stlAmountDrLoc" label="已结算应收金额合计" width="140px" />
  193. <el-table-column prop="stlAmountCrLoc" label="已结算应付金额合计" width="140px" />
  194. </el-table>
  195. </div>
  196. </el-dialog>
  197. </div>
  198. </template>
  199. <script>
  200. import {getBcorpsList} from "@/api/iosBasicData/bcorps";
  201. import {bfeesList} from "@/api/iosBasicData/bfees";
  202. import {getBaccelementsList} from "@/api/iosBasicData/baccelements";
  203. import {bcurrencyGetExrate} from "@/api/iosBasicData/rateManagement";
  204. import {getWorkDicts} from "@/api/system/dictbiz";
  205. import {getBunitsPage} from "@/api/iosBasicData/bunits";
  206. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  207. import {dateFormat} from "@/util/date";
  208. import {
  209. feecenterRemove,
  210. feecenterSubmitList
  211. } from "@/api/iosBasicData/feecenter";
  212. import {listFeeCountByCorp} from "@/api/iosBasicData/bills";
  213. import {amendsDetail} from "@/api/iosBasicData/amends";
  214. export default {
  215. components: {SearchQuery},
  216. props:{
  217. tableData:{
  218. type:Array,
  219. default:[]
  220. },
  221. editType:{
  222. type:Boolean,
  223. default:false,
  224. },
  225. form:{
  226. type:Object,
  227. default:{}
  228. },
  229. disabled:{
  230. type:Boolean,
  231. default:false
  232. },
  233. // dc禁用
  234. dcDisabled:{
  235. type:Boolean,
  236. default:false
  237. },
  238. },
  239. data(){
  240. return {
  241. option:{},
  242. optionBack:{
  243. stripe:true,
  244. maxHeight:'250',
  245. calcHeight: 30,
  246. tip: false,
  247. searchShow: true,
  248. searchMenuSpan: 6,
  249. border: true,
  250. selection: true,
  251. dialogClickModal: false,
  252. addBtn:false,
  253. viewBtn:false,
  254. delBtn:false,
  255. editBtn:false,
  256. menuWidth:'100',
  257. refreshBtn:false,
  258. column:[
  259. {
  260. label: "index",
  261. prop: "index",
  262. width: "55",
  263. headerslot:true,
  264. },
  265. {
  266. label: "账单",
  267. prop: "accStatus",
  268. width: "60",
  269. },
  270. {
  271. label: "收/付",
  272. prop: "dc",
  273. width: "100",
  274. },
  275. {
  276. label: "往来单位",
  277. prop: "corpCnName",
  278. width: "160",
  279. overHidden:true,
  280. },
  281. {
  282. label: "费用简称",
  283. prop: "feeCnName",
  284. width: "120",
  285. overHidden:true,
  286. },
  287. {
  288. label: "预付/到付",
  289. prop: "paymode",
  290. width: "120",
  291. },
  292. {
  293. label: "计量单位",
  294. prop: "unitNo",
  295. width: "120",
  296. },
  297. {
  298. label: "币种",
  299. prop: "curCode",
  300. width: "120",
  301. },
  302. {
  303. label: "汇率",
  304. prop: "exrate",
  305. width: "100",
  306. },
  307. {
  308. label: "单价",
  309. prop: "price",
  310. width: "120",
  311. },
  312. {
  313. label: "数量",
  314. prop: "quantity",
  315. width: "120",
  316. },
  317. {
  318. label: "CNY(含税)",
  319. prop: "rmbAmount",
  320. width: "100",
  321. },
  322. {
  323. label: "USD(含税)",
  324. prop: "usdAmount",
  325. width: "100",
  326. },
  327. {
  328. label: "CNY(净额)",
  329. prop: "rmbAmountNet",
  330. width: "100",
  331. },
  332. {
  333. label: "USD(净额)",
  334. prop: "usdAmountNet",
  335. width: "100",
  336. },
  337. {
  338. label: "核算要素",
  339. prop: "elementsCnName",
  340. width: "120",
  341. overHidden:true,
  342. },
  343. {
  344. label: "付费申请金额",
  345. prop: "appliedAmount",
  346. width: "120",
  347. },
  348. {
  349. label: "发票申请金额",
  350. prop: "appliedInvoiceAmount",
  351. width: "120",
  352. },
  353. {
  354. label: "已开票金额",
  355. prop: "uninvoicedAmount",
  356. width: "120",
  357. },
  358. {
  359. label: "已结算金额",
  360. prop: "stlTtlAmount",
  361. width: "120",
  362. },
  363. {
  364. label: "备注",
  365. prop: "remarks",
  366. width: "100",
  367. },
  368. {
  369. label: "单价是否含税",
  370. prop: "isTax",
  371. width: "120",
  372. },
  373. ]
  374. },
  375. loading:false,
  376. form:{},
  377. // 收/付
  378. dcData:[
  379. {
  380. label:'收',
  381. value:'D'
  382. },
  383. {
  384. label:'付',
  385. value:'C'
  386. }
  387. ],
  388. corpCnNameData:[], // 往来单位数据
  389. feeCnNameData:[], // 费用数据
  390. elementsData:[], // 核算要素
  391. paymodeData:[], // 预付到付数据
  392. unitNoData:[], // 计算单位数据
  393. curCodeData:[], // 币别数据
  394. handleSelectionData:[], // 多选选择的数据
  395. corpVisible:false, // 往来单位弹窗
  396. corpDialog:[], // 往来单位弹窗数据
  397. }
  398. },
  399. async created() {
  400. this.option = await this.getColumnData(this.getColumnName(322.1), this.optionBack);
  401. },
  402. methods:{
  403. // 往来单位弹窗开启
  404. corpClick(row){
  405. this.corpVisible = true
  406. listFeeCountByCorp({
  407. corpId:row.corpId,
  408. dc:row.dc
  409. }).then(res=>{
  410. this.corpDialog = res.data.data
  411. })
  412. },
  413. printingCostsfun(){
  414. this.$emit('printingCostsfun')
  415. },
  416. // 应收新增
  417. addfun(){
  418. this.$emit('addfun')
  419. },
  420. // 一键编辑
  421. oneclickEditingfun(){
  422. this.$emit('oneclickEditingfun')
  423. },
  424. // 一键删除
  425. batchDelete(){
  426. if (this.handleSelectionData.length === 0) {
  427. this.$message.warning("请选择至少一条数据");
  428. return;
  429. }
  430. this.$confirm("确定将选择数据删除?", {
  431. confirmButtonText: "确定",
  432. cancelButtonText: "取消",
  433. type: "warning"
  434. }).then(()=>{
  435. let multiList = this.handleSelectionData
  436. let arr = this.tableData
  437. // 获取有id 的数据
  438. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  439. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  440. // 把选中的删除掉
  441. multiList.forEach((item)=>{
  442. for (let index in arr) {
  443. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  444. arr.splice(Number(index),1)
  445. }
  446. }
  447. })
  448. // 有id 的处理
  449. if(itemsWithId.length != 0) {
  450. feecenterRemove(arrIds.join(',')).then(res=>{
  451. this.$message.success('操作成功')
  452. // this.$emit('billsDetailfun')
  453. })
  454. }
  455. })
  456. },
  457. // 小删除
  458. deletefun(row,index) {
  459. this.$confirm("确定将选择数据删除?", {
  460. confirmButtonText: "确定",
  461. cancelButtonText: "取消",
  462. type: "warning"
  463. }).then(()=>{
  464. if (row.id) {
  465. // 删除接口
  466. feecenterRemove(row.id).then(res=>{
  467. this.$message({
  468. type: "success",
  469. message: "操作成功!"
  470. });
  471. this.$emit('amendsDetailfun')
  472. })
  473. }else {
  474. this.tableData.splice(index, 1)
  475. }
  476. })
  477. },
  478. // 下拉的回调
  479. corpChange(value,name,row) {
  480. if (name == 'corpCnName') {
  481. if (!value) {
  482. this.$set(row,'corpCnName','')
  483. this.$set(row,'corpEnName','')
  484. this.$set(row,'corpId','')
  485. }
  486. for(let item of this.corpCnNameData) {
  487. if (item.cnName == value){
  488. this.$set(row,'corpCnName',item.cnName)
  489. this.$set(row,'corpEnName',item.enName)
  490. this.$set(row,'corpId',item.id)
  491. }
  492. }
  493. }else if (name == 'feeCnName') {
  494. if (!value) {
  495. this.$set(row,'feeCnName','')
  496. this.$set(row,'feeEnName','')
  497. this.$set(row,'feeId','')
  498. this.$set(row,'feeCode','')
  499. // 选择费用简称带出核算要素
  500. this.$set(row,'elementsId','')
  501. this.$set(row,'elementsCnName','')
  502. this.$set(row,'elementsCode','')
  503. this.$set(row,'elementsEnName','')
  504. }
  505. for(let item of this.feeCnNameData) {
  506. if (item.cnName == value){
  507. this.$set(row,'feeCnName',item.cnName)
  508. this.$set(row,'feeEnName',item.enName)
  509. this.$set(row,'feeId',item.id)
  510. this.$set(row,'feeCode',item.code)
  511. // 选择费用简称带出核算要素
  512. this.$set(row,'elementsId',item.accElementId)
  513. this.$set(row,'elementsCnName',item.accElementName)
  514. this.$set(row,'elementsCode',item.elementsCode)
  515. this.$set(row,'elementsEnName',item.elementsEnName)
  516. // 拿取费用简称下的计量单位
  517. this.getBunitsPagefun(true,item,row)
  518. // 币别
  519. this.$set(row,'curCode',item.curNo)
  520. // 汇率
  521. bcurrencyGetExrate({
  522. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  523. dc:row.dc
  524. }).then(res=>{
  525. for (let item of res.data.data) {
  526. if (item.code == row.curCode) {
  527. this.$set(row,'exrate',item.exrate)
  528. }
  529. }
  530. })
  531. // 计算金额
  532. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  533. if (row.curCode == 'CNY') {
  534. this.$set(row,'rmbAmount',row.amount)
  535. this.$set(row,'usdAmount','')
  536. this.$set(row,'rmbAmountNet',row.amount)
  537. this.$set(row,'usdAmountNet','')
  538. }else {
  539. this.$set(row,'usdAmount',row.amount)
  540. this.$set(row,'rmbAmount','')
  541. this.$set(row,'usdAmountNet',row.amount)
  542. this.$set(row,'rmbAmountNet','')
  543. }
  544. }
  545. }
  546. }else if (name == 'unitNo') {
  547. // 计量单位
  548. this.$set(row,name,value)
  549. for (let item of this.unitNoData) {
  550. if (item.code == value) {
  551. // 按箱型
  552. if (item.quantityRule == 1) {
  553. // 选择的箱那边的数据
  554. if (item.boxquantity) {
  555. this.$set(row,'quantity',item.boxquantity)
  556. }
  557. }
  558. // 按票
  559. if (item.quantityRule == 2) {
  560. this.$set(row,'quantity',1)
  561. }
  562. // 按重量
  563. if (item.quantityRule == 3) {
  564. this.$set(row,'quantity',this.form.grossWeight)
  565. }
  566. // 按TEU
  567. if (item.quantityRule == 4) {
  568. this.$set(row,'quantity',item.boxquantity)
  569. }
  570. // 按尺码
  571. if (item.quantityRule == 5) {
  572. this.$set(row,'quantity',this.form.measurement)
  573. }
  574. // 按件数
  575. if (item.quantityRule == 6) {
  576. this.$set(row,'quantity',this.form.quantity)
  577. }
  578. }
  579. }
  580. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity?row.quantity:0))
  581. if (row.curCode == 'CNY') {
  582. this.$set(row,'rmbAmount',row.amount)
  583. this.$set(row,'usdAmount','')
  584. this.$set(row,'rmbAmountNet',row.amount)
  585. this.$set(row,'usdAmountNet','')
  586. }else {
  587. this.$set(row,'usdAmount',row.amount)
  588. this.$set(row,'rmbAmount','')
  589. this.$set(row,'usdAmountNet',row.amount)
  590. this.$set(row,'rmbAmountNet','')
  591. }
  592. } else if (name == 'elementsCnName') {
  593. if (!value) {
  594. this.$set(row,'elementsId','')
  595. this.$set(row,'elementsCnName','')
  596. this.$set(row,'elementsCode','')
  597. this.$set(row,'elementsEnName','')
  598. }
  599. // 核算要素
  600. for (let item of this.elementsData) {
  601. if (item.cnName == value) {
  602. this.$set(row,'elementsId',item.id)
  603. this.$set(row,'elementsCnName',item.cnName)
  604. this.$set(row,'elementsCode',item.code)
  605. this.$set(row,'elementsEnName',item.enName)
  606. }
  607. }
  608. }else if (name == 'curCode') {
  609. for(let item of this.curCodeData) {
  610. if (item.code == value){
  611. if (item.code == 'USD') {
  612. if (Number(item.exrate) <= 1) {
  613. this.$message.warning('当前选择的币别汇率不能小于零')
  614. return
  615. }
  616. }else {
  617. if (Number(item.exrate) == 0) {
  618. this.$message.warning('当前选择的币别汇率不能为零')
  619. return
  620. }
  621. }
  622. this.$set(row,'curCode',item.code)
  623. this.$set(row,'exrate',item.exrate)
  624. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  625. if (row.curCode == 'CNY') {
  626. this.$set(row,'rmbAmount',row.amount)
  627. this.$set(row,'usdAmount','')
  628. this.$set(row,'rmbAmountNet',row.amount)
  629. this.$set(row,'usdAmountNet','')
  630. }else {
  631. this.$set(row,'usdAmount',row.amount)
  632. this.$set(row,'rmbAmount','')
  633. this.$set(row,'usdAmountNet',row.amount)
  634. this.$set(row,'rmbAmountNet','')
  635. }
  636. }
  637. }
  638. } else {
  639. this.$set(row,name,value)
  640. }
  641. },
  642. // 费用信息明细保存按钮
  643. feecenterSubmitListfun(){
  644. if (!this.form.id) {
  645. return this.$message.warning('请先保存数据')
  646. }
  647. // 判断必填项
  648. let sum = '请输入'
  649. for (let item of this.tableData) {
  650. if (!item.dc) {
  651. sum += ` 应收序号${item.$index + 1}收/付`
  652. }
  653. if (!item.corpId) {
  654. sum += ` 应收序号${item.$index + 1}往来单位`
  655. }
  656. if (!item.feeId) {
  657. sum += ` 应收序号${item.$index + 1}费用简称`
  658. }
  659. if (!item.elementsId) {
  660. sum += ` 应收序号${item.$index + 1}核算要素`
  661. }
  662. if (!item.curCode) {
  663. sum += ` 应收序号${item.$index + 1}币种`
  664. }
  665. }
  666. if(sum != '请输入') {
  667. this.$confirm(sum, {
  668. confirmButtonText: "确定",
  669. cancelButtonText: "取消",
  670. type: "warning"
  671. })
  672. return;
  673. }
  674. this.$confirm("确定保存全部的费用信息?", {
  675. confirmButtonText: "确定",
  676. cancelButtonText: "取消",
  677. type: "warning"
  678. }).then(()=>{
  679. this.tableData.map((row,index)=>{
  680. row.dc = row.dc
  681. row.pid = this.form.id
  682. row.sort = Number(index) + 1
  683. row.businessType = this.form.businessType // 业务类型
  684. row.billType = this.form.billType // 单据类型
  685. row.billNo = this.form.billNo // 单据编号
  686. row.billDate = this.form.billDate // 单据日期
  687. row.billCorpId = this.form.corpId // 主表客户 id
  688. row.billCorpCnName = this.form.corpCnName // 主表客户中文名称
  689. row.billCorpEnName = this.form.corpEnName // 主表客户英文名称
  690. row.lineId = this.form.lineId // 航线 id
  691. row.lineCnName = this.form.lineCnName // 航线中文名称
  692. row.lineEnName = this.form.lineEnName // 航线英文名称
  693. row.vesselId = this.form.vesselId // 船名 id
  694. row.vesselCnName = this.form.vesselCnName // 中文船名
  695. row.vesselEnName = this.form.vesselEnName // 英文船名
  696. row.voyageNo = this.form.voyageNo // 航次
  697. row.mblno = this.form.mblno // MB/L NO
  698. row.hblno = this.form.hblno // HB/L NO
  699. row.etd = this.form.etd // 开船日期
  700. row.eta = this.form.eta // 到港日期
  701. row.polId = this.form.polId // 装货港 id
  702. row.polCode = this.form.polCode // 装货港代码
  703. row.polCnName = this.form.polCnName // 装货港中文名称
  704. row.polEnName = this.form.polEnName // 装货港英文名称
  705. row.podId = this.form.podId // 卸货港 id
  706. row.podCode = this.form.podCode // 卸货港代码
  707. row.podCnName = this.form.podCnName // 卸货港中文名称
  708. row.podEnName = this.form.podEnName // 卸货港英文名称
  709. row.corpArgreementNo = this.form.corpArgreementNo // 客户约号
  710. })
  711. feecenterSubmitList(this.tableData).then(res=>{
  712. this.$message({
  713. type: "success",
  714. message: "操作成功!"
  715. });
  716. this.$emit('amendsDetailfun')
  717. })
  718. })
  719. },
  720. // 单价
  721. priceinputfun(value,row){
  722. if (Number(value) <= 0) {
  723. this.$message({
  724. type: "warning",
  725. message: "单价不能输入负数!"
  726. });
  727. return
  728. }
  729. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  730. // 判断是否有币种
  731. if (!row.curCode) {
  732. return;
  733. }
  734. if (row.curCode == 'CNY') {
  735. this.$set(row,'rmbAmount',row.amount)
  736. this.$set(row,'usdAmount','')
  737. this.$set(row,'rmbAmountNet',row.amount)
  738. this.$set(row,'usdAmountNet','')
  739. }else {
  740. this.$set(row,'usdAmount',row.amount)
  741. this.$set(row,'rmbAmount','')
  742. this.$set(row,'usdAmountNet',row.amount)
  743. this.$set(row,'rmbAmountNet','')
  744. }
  745. },
  746. // 数量
  747. quantityinputfun(row) {
  748. if (row.quantity <= 0) {
  749. this.$message({
  750. type: "warning",
  751. message: "数量不能输入负数!"
  752. });
  753. this.$set(row,'quantity',1)
  754. return
  755. }
  756. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity))
  757. // 判断是否有币种
  758. if (!row.curCode) {
  759. return;
  760. }
  761. if (row.curCode == 'CNY') {
  762. this.$set(row,'rmbAmount',row.amount)
  763. this.$set(row,'usdAmount','')
  764. }else {
  765. this.$set(row,'usdAmount',row.amount)
  766. this.$set(row,'rmbAmount','')
  767. }
  768. },
  769. // 获取客户数据
  770. getBcorpsListfun(cnName){
  771. getBcorpsList(1,10,{cnName}).then(res=>{
  772. this.corpCnNameData = res.data.data.records
  773. })
  774. },
  775. // 获取费用数据
  776. bfeesListfun(cnName){
  777. bfeesList(1,10,{cnName}).then(res=>{
  778. this.feeCnNameData = res.data.data.records
  779. })
  780. },
  781. // 获取费用信息 核算要素信息
  782. getBaccelementsListfun(cnName){
  783. getBaccelementsList(1,10,{cnName}).then(res=>{
  784. this.elementsData = res.data.data.records
  785. })
  786. },
  787. // 获取预付到付字典数据
  788. paymodeWorkDictsfun(){
  789. getWorkDicts('payment_method_los').then((res) => {
  790. this.paymodeData = res.data.data
  791. })
  792. },
  793. // 获取币别数据
  794. bcurrencyGetExratefun(dc){
  795. bcurrencyGetExrate({
  796. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  797. dc:dc
  798. }).then(res=>{
  799. this.curCodeData = res.data.data
  800. })
  801. },
  802. // 获取计算属性
  803. async getBunitsPagefun(type,feeRow,row){
  804. let srcBillId = null
  805. if (this.form.billType == 'MH') {
  806. srcBillId = this.form.masterId
  807. }else {
  808. srcBillId = this.form.id
  809. }
  810. const res = await getBunitsPage({srcBillId})
  811. this.unitNoData = []
  812. let boxarr40 = ['40HC','40GP']
  813. let boxarr20 = ['20GP']
  814. let teunum = 0
  815. for (let item of res.data.data) {
  816. // 按箱型
  817. if (item.quantityRule != 1) {
  818. // TEU
  819. if (item.quantityRule == 4) {
  820. for (let data of this.form.preContainersList) {
  821. if (boxarr40.indexOf(data.cntrTypeCode) != -1) {
  822. teunum += Number(data.quantity) * 2
  823. }else if (boxarr20.indexOf(data.cntrTypeCode) != -1) {
  824. teunum += Number(data.quantity)
  825. }
  826. }
  827. this.unitNoData.push({...item, boxquantity: teunum})
  828. }else {
  829. this.unitNoData.push(item) // 不是TEU和不是箱的走这个
  830. }
  831. }
  832. }
  833. let arr = this.form.preContainersList.map(item=>{
  834. return {
  835. quantityRule:1, // 1 是按箱量
  836. code:item.cntrTypeCode,
  837. boxquantity:item.quantity,
  838. }
  839. })
  840. this.unitNoData = [...arr,...this.unitNoData]
  841. // 选择费用时带出第一条
  842. if (type) {
  843. let feeunitNodata = []
  844. for (let item of this.unitNoData) {
  845. if (item.quantityRule == feeRow.unitNo) {
  846. feeunitNodata.push(item)
  847. }
  848. }
  849. this.corpChange(feeunitNodata[0].code,'unitNo',row)
  850. }
  851. },
  852. // 多选选择的数据
  853. handleSelectionChange(arr){
  854. // this.$emit('handleSelectionChange',arr)
  855. this.handleSelectionData = arr
  856. },
  857. //自定义列保存
  858. async saveColumnTwo(ref, option, optionBack, code) {
  859. /**
  860. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  861. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  862. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  863. */
  864. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  865. if (inSave) {
  866. this.$message.success("保存成功");
  867. //关闭窗口
  868. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  869. }
  870. },
  871. //自定义列重置
  872. async resetColumnTwo(ref, option, optionBack, code) {
  873. this[option] = this[optionBack];
  874. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  875. if (inSave) {
  876. this.$message.success("重置成功");
  877. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  878. }
  879. },
  880. // 更改表格颜色
  881. headerClassName(tab) {
  882. //颜色间隔
  883. let back = ""
  884. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  885. if (tab.columnIndex % 2 === 0) {
  886. back = "back-one"
  887. } else if (tab.columnIndex % 2 === 1) {
  888. back = "back-two"
  889. }
  890. }
  891. return back;
  892. },
  893. },
  894. }
  895. </script>
  896. <style scoped>
  897. ::v-deep#out-table .back-one {
  898. background: #ecf5ff !important;
  899. text-align: center;
  900. padding: 4px 0;
  901. }
  902. ::v-deep#out-table .back-two {
  903. background: #ecf5ff !important;
  904. text-align: center;
  905. padding: 4px 0;
  906. }
  907. .textoverflow {
  908. width: 100%;
  909. overflow: hidden;
  910. white-space: nowrap;
  911. text-overflow: ellipsis;
  912. }
  913. </style>