amendsCostdetails.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  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 >{{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. </div>
  162. </template>
  163. <script>
  164. import {getBcorpsList} from "@/api/iosBasicData/bcorps";
  165. import {bfeesList} from "@/api/iosBasicData/bfees";
  166. import {getBaccelementsList} from "@/api/iosBasicData/baccelements";
  167. import {bcurrencyGetExrate} from "@/api/iosBasicData/rateManagement";
  168. import {getWorkDicts} from "@/api/system/dictbiz";
  169. import {getBunitsPage} from "@/api/iosBasicData/bunits";
  170. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  171. import {dateFormat} from "@/util/date";
  172. import {
  173. feecenterRemove,
  174. feecenterSubmitList
  175. } from "@/api/iosBasicData/feecenter";
  176. import {amendsDetail} from "@/api/iosBasicData/amends";
  177. export default {
  178. components: {SearchQuery},
  179. props:{
  180. tableData:{
  181. type:Array,
  182. default:[]
  183. },
  184. editType:{
  185. type:Boolean,
  186. default:false,
  187. },
  188. form:{
  189. type:Object,
  190. default:{}
  191. },
  192. disabled:{
  193. type:Boolean,
  194. default:false
  195. },
  196. // dc 列禁用
  197. dcDisabled:{
  198. type:Boolean,
  199. default:false
  200. }
  201. },
  202. data(){
  203. return {
  204. option:{},
  205. optionBack:{
  206. stripe:true,
  207. maxHeight:'250',
  208. calcHeight: 30,
  209. tip: false,
  210. searchShow: true,
  211. searchMenuSpan: 6,
  212. border: true,
  213. selection: true,
  214. dialogClickModal: false,
  215. addBtn:false,
  216. viewBtn:false,
  217. delBtn:false,
  218. editBtn:false,
  219. menuWidth:'100',
  220. refreshBtn:false,
  221. column:[
  222. {
  223. label: "index",
  224. prop: "index",
  225. width: "55",
  226. headerslot:true,
  227. },
  228. {
  229. label: "账单",
  230. prop: "accStatus",
  231. width: "60",
  232. },
  233. {
  234. label: "收/付",
  235. prop: "dc",
  236. width: "100",
  237. },
  238. {
  239. label: "往来单位",
  240. prop: "corpCnName",
  241. width: "160",
  242. overHidden:true,
  243. },
  244. {
  245. label: "费用简称",
  246. prop: "feeCnName",
  247. width: "120",
  248. overHidden:true,
  249. },
  250. {
  251. label: "预付/到付",
  252. prop: "paymode",
  253. width: "120",
  254. },
  255. {
  256. label: "计量单位",
  257. prop: "unitNo",
  258. width: "120",
  259. },
  260. {
  261. label: "币种",
  262. prop: "curCode",
  263. width: "120",
  264. },
  265. {
  266. label: "汇率",
  267. prop: "exrate",
  268. width: "100",
  269. },
  270. {
  271. label: "单价",
  272. prop: "price",
  273. width: "120",
  274. },
  275. {
  276. label: "数量",
  277. prop: "quantity",
  278. width: "120",
  279. },
  280. {
  281. label: "CNY(含税)",
  282. prop: "rmbAmount",
  283. width: "100",
  284. },
  285. {
  286. label: "USD(含税)",
  287. prop: "usdAmount",
  288. width: "100",
  289. },
  290. {
  291. label: "CNY(净额)",
  292. prop: "rmbAmountNet",
  293. width: "100",
  294. },
  295. {
  296. label: "USD(净额)",
  297. prop: "usdAmountNet",
  298. width: "100",
  299. },
  300. {
  301. label: "核算要素",
  302. prop: "elementsCnName",
  303. width: "120",
  304. overHidden:true,
  305. },
  306. {
  307. label: "付费申请金额",
  308. prop: "appliedAmount",
  309. width: "120",
  310. },
  311. {
  312. label: "发票申请金额",
  313. prop: "appliedInvoiceAmount",
  314. width: "120",
  315. },
  316. {
  317. label: "已开票金额",
  318. prop: "uninvoicedAmount",
  319. width: "120",
  320. },
  321. {
  322. label: "已结算金额",
  323. prop: "stlTtlAmount",
  324. width: "120",
  325. },
  326. {
  327. label: "备注",
  328. prop: "remarks",
  329. width: "100",
  330. },
  331. {
  332. label: "单价是否含税",
  333. prop: "isTax",
  334. width: "120",
  335. },
  336. ]
  337. },
  338. loading:false,
  339. form:{},
  340. // 收/付
  341. dcData:[
  342. {
  343. label:'收',
  344. value:'D'
  345. },
  346. {
  347. label:'付',
  348. value:'C'
  349. }
  350. ],
  351. corpCnNameData:[], // 往来单位数据
  352. feeCnNameData:[], // 费用数据
  353. elementsData:[], // 核算要素
  354. paymodeData:[], // 预付到付数据
  355. unitNoData:[], // 计算单位数据
  356. curCodeData:[], // 币别数据
  357. handleSelectionData:[], // 多选选择的数据
  358. }
  359. },
  360. async created() {
  361. this.option = await this.getColumnData(this.getColumnName(322.1), this.optionBack);
  362. },
  363. methods:{
  364. printingCostsfun(){
  365. this.$emit('printingCostsfun')
  366. },
  367. // 应收新增
  368. addfun(){
  369. this.$emit('addfun')
  370. },
  371. // 一键编辑
  372. oneclickEditingfun(){
  373. this.$emit('oneclickEditingfun')
  374. },
  375. // 一键删除
  376. batchDelete(){
  377. this.$confirm("确定将选择数据删除?", {
  378. confirmButtonText: "确定",
  379. cancelButtonText: "取消",
  380. type: "warning"
  381. }).then(()=>{
  382. let multiList = this.handleSelectionData
  383. let arr = this.tableData
  384. // 获取有id 的数据
  385. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  386. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  387. // 把选中的删除掉
  388. multiList.forEach((item)=>{
  389. for (let index in arr) {
  390. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  391. arr.splice(Number(index),1)
  392. }
  393. }
  394. })
  395. // 有id 的处理
  396. if(itemsWithId.length != 0) {
  397. feecenterRemove(arrIds.join(',')).then(res=>{
  398. this.$message.success('操作成功')
  399. // this.$emit('billsDetailfun')
  400. })
  401. }
  402. })
  403. },
  404. // 小删除
  405. deletefun(row,index) {
  406. this.$confirm("确定将选择数据删除?", {
  407. confirmButtonText: "确定",
  408. cancelButtonText: "取消",
  409. type: "warning"
  410. }).then(()=>{
  411. if (row.id) {
  412. // 删除接口
  413. feecenterRemove(row.id).then(res=>{
  414. this.$message({
  415. type: "success",
  416. message: "操作成功!"
  417. });
  418. this.$emit('amendsDetailfun')
  419. })
  420. }else {
  421. this.tableData.splice(index, 1)
  422. }
  423. })
  424. },
  425. // 下拉的回调
  426. corpChange(value,name,row) {
  427. if (name == 'corpCnName') {
  428. if (!value) {
  429. this.$set(row,'corpCnName','')
  430. this.$set(row,'corpEnName','')
  431. this.$set(row,'corpId','')
  432. }
  433. for(let item of this.corpCnNameData) {
  434. if (item.cnName == value){
  435. this.$set(row,'corpCnName',item.cnName)
  436. this.$set(row,'corpEnName',item.enName)
  437. this.$set(row,'corpId',item.id)
  438. }
  439. }
  440. }else if (name == 'feeCnName') {
  441. if (!value) {
  442. this.$set(row,'feeCnName','')
  443. this.$set(row,'feeEnName','')
  444. this.$set(row,'feeId','')
  445. this.$set(row,'feeCode','')
  446. // 选择费用简称带出核算要素
  447. this.$set(row,'elementsId','')
  448. this.$set(row,'elementsCnName','')
  449. this.$set(row,'elementsCode','')
  450. this.$set(row,'elementsEnName','')
  451. }
  452. for(let item of this.feeCnNameData) {
  453. if (item.cnName == value){
  454. this.$set(row,'feeCnName',item.cnName)
  455. this.$set(row,'feeEnName',item.enName)
  456. this.$set(row,'feeId',item.id)
  457. this.$set(row,'feeCode',item.code)
  458. // 选择费用简称带出核算要素
  459. this.$set(row,'elementsId',item.accElementId)
  460. this.$set(row,'elementsCnName',item.accElementName)
  461. this.$set(row,'elementsCode',item.elementsCode)
  462. this.$set(row,'elementsEnName',item.elementsEnName)
  463. // 拿取费用简称下的计量单位
  464. this.getBunitsPagefun(true,item,row)
  465. // 币别
  466. this.$set(row,'curCode',item.curNo)
  467. // 汇率
  468. bcurrencyGetExrate({
  469. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  470. dc:row.dc
  471. }).then(res=>{
  472. for (let item of res.data.data) {
  473. if (item.code == row.curCode) {
  474. this.$set(row,'exrate',item.exrate)
  475. }
  476. }
  477. })
  478. // 计算金额
  479. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  480. if (row.curCode == 'CNY') {
  481. this.$set(row,'rmbAmount',row.amount)
  482. this.$set(row,'usdAmount','')
  483. this.$set(row,'rmbAmountNet',row.amount)
  484. this.$set(row,'usdAmountNet','')
  485. }else {
  486. this.$set(row,'usdAmount',row.amount)
  487. this.$set(row,'rmbAmount','')
  488. this.$set(row,'usdAmountNet',row.amount)
  489. this.$set(row,'rmbAmountNet','')
  490. }
  491. }
  492. }
  493. }else if (name == 'unitNo') {
  494. // 计量单位
  495. this.$set(row,name,value)
  496. for (let item of this.unitNoData) {
  497. if (item.code == value) {
  498. // 按箱型
  499. if (item.quantityRule == 1) {
  500. // 选择的箱那边的数据
  501. if (item.boxquantity) {
  502. this.$set(row,'quantity',item.boxquantity)
  503. }
  504. }
  505. // 按票
  506. if (item.quantityRule == 2) {
  507. this.$set(row,'quantity',1)
  508. }
  509. // 按重量
  510. if (item.quantityRule == 3) {
  511. this.$set(row,'quantity',this.form.grossWeight)
  512. }
  513. // 按TEU
  514. if (item.quantityRule == 4) {
  515. this.$set(row,'quantity',item.boxquantity)
  516. }
  517. // 按尺码
  518. if (item.quantityRule == 5) {
  519. this.$set(row,'quantity',this.form.measurement)
  520. }
  521. // 按件数
  522. if (item.quantityRule == 6) {
  523. this.$set(row,'quantity',this.form.quantity)
  524. }
  525. }
  526. }
  527. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity?row.quantity:0))
  528. if (row.curCode == 'CNY') {
  529. this.$set(row,'rmbAmount',row.amount)
  530. this.$set(row,'usdAmount','')
  531. this.$set(row,'rmbAmountNet',row.amount)
  532. this.$set(row,'usdAmountNet','')
  533. }else {
  534. this.$set(row,'usdAmount',row.amount)
  535. this.$set(row,'rmbAmount','')
  536. this.$set(row,'usdAmountNet',row.amount)
  537. this.$set(row,'rmbAmountNet','')
  538. }
  539. } else if (name == 'elementsCnName') {
  540. if (!value) {
  541. this.$set(row,'elementsId','')
  542. this.$set(row,'elementsCnName','')
  543. this.$set(row,'elementsCode','')
  544. this.$set(row,'elementsEnName','')
  545. }
  546. // 核算要素
  547. for (let item of this.elementsData) {
  548. if (item.cnName == value) {
  549. this.$set(row,'elementsId',item.id)
  550. this.$set(row,'elementsCnName',item.cnName)
  551. this.$set(row,'elementsCode',item.code)
  552. this.$set(row,'elementsEnName',item.enName)
  553. }
  554. }
  555. }else if (name == 'curCode') {
  556. for(let item of this.curCodeData) {
  557. if (item.code == value){
  558. if (item.code == 'USD') {
  559. if (Number(item.exrate) <= 1) {
  560. this.$message.warning('当前选择的币别汇率不能小于零')
  561. return
  562. }
  563. }else {
  564. if (Number(item.exrate) == 0) {
  565. this.$message.warning('当前选择的币别汇率不能为零')
  566. return
  567. }
  568. }
  569. this.$set(row,'curCode',item.code)
  570. this.$set(row,'exrate',item.exrate)
  571. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  572. if (row.curCode == 'CNY') {
  573. this.$set(row,'rmbAmount',row.amount)
  574. this.$set(row,'usdAmount','')
  575. this.$set(row,'rmbAmountNet',row.amount)
  576. this.$set(row,'usdAmountNet','')
  577. }else {
  578. this.$set(row,'usdAmount',row.amount)
  579. this.$set(row,'rmbAmount','')
  580. this.$set(row,'usdAmountNet',row.amount)
  581. this.$set(row,'rmbAmountNet','')
  582. }
  583. }
  584. }
  585. } else {
  586. this.$set(row,name,value)
  587. }
  588. },
  589. // 费用信息明细保存按钮
  590. feecenterSubmitListfun(){
  591. if (!this.form.id) {
  592. return this.$message.warning('请先保存数据')
  593. }
  594. // 判断必填项
  595. let sum = '请输入'
  596. for (let item of this.tableData) {
  597. if (!item.dc) {
  598. sum += ` 应收序号${item.$index + 1}收/付`
  599. }
  600. if (!item.corpId) {
  601. sum += ` 应收序号${item.$index + 1}往来单位`
  602. }
  603. if (!item.feeId) {
  604. sum += ` 应收序号${item.$index + 1}费用简称`
  605. }
  606. if (!item.elementsId) {
  607. sum += ` 应收序号${item.$index + 1}核算要素`
  608. }
  609. if (!item.curCode) {
  610. sum += ` 应收序号${item.$index + 1}币种`
  611. }
  612. }
  613. if(sum != '请输入') {
  614. this.$confirm(sum, {
  615. confirmButtonText: "确定",
  616. cancelButtonText: "取消",
  617. type: "warning"
  618. })
  619. return;
  620. }
  621. this.$confirm("确定保存全部的费用信息?", {
  622. confirmButtonText: "确定",
  623. cancelButtonText: "取消",
  624. type: "warning"
  625. }).then(()=>{
  626. this.tableData.map((row,index)=>{
  627. row.dc = row.dc
  628. row.pid = this.form.id
  629. row.sort = Number(index) + 1
  630. row.businessType = this.form.businessType // 业务类型
  631. row.billType = this.form.billType // 单据类型
  632. row.billNo = this.form.billNo // 单据编号
  633. row.billDate = this.form.billDate // 单据日期
  634. row.billCorpId = this.form.corpId // 主表客户 id
  635. row.billCorpCnName = this.form.corpCnName // 主表客户中文名称
  636. row.billCorpEnName = this.form.corpEnName // 主表客户英文名称
  637. row.lineId = this.form.lineId // 航线 id
  638. row.lineCnName = this.form.lineCnName // 航线中文名称
  639. row.lineEnName = this.form.lineEnName // 航线英文名称
  640. row.vesselId = this.form.vesselId // 船名 id
  641. row.vesselCnName = this.form.vesselCnName // 中文船名
  642. row.vesselEnName = this.form.vesselEnName // 英文船名
  643. row.voyageNo = this.form.voyageNo // 航次
  644. row.mblno = this.form.mblno // MB/L NO
  645. row.hblno = this.form.hblno // HB/L NO
  646. row.etd = this.form.etd // 开船日期
  647. row.eta = this.form.eta // 到港日期
  648. row.polId = this.form.polId // 装货港 id
  649. row.polCode = this.form.polCode // 装货港代码
  650. row.polCnName = this.form.polCnName // 装货港中文名称
  651. row.polEnName = this.form.polEnName // 装货港英文名称
  652. row.podId = this.form.podId // 卸货港 id
  653. row.podCode = this.form.podCode // 卸货港代码
  654. row.podCnName = this.form.podCnName // 卸货港中文名称
  655. row.podEnName = this.form.podEnName // 卸货港英文名称
  656. row.corpArgreementNo = this.form.corpArgreementNo // 客户约号
  657. })
  658. feecenterSubmitList(this.tableData).then(res=>{
  659. this.$message({
  660. type: "success",
  661. message: "操作成功!"
  662. });
  663. this.$emit('amendsDetailfun')
  664. })
  665. })
  666. },
  667. // 单价
  668. priceinputfun(value,row){
  669. if (Number(value) <= 0) {
  670. this.$message({
  671. type: "warning",
  672. message: "单价不能输入负数!"
  673. });
  674. return
  675. }
  676. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  677. // 判断是否有币种
  678. if (!row.curCode) {
  679. return;
  680. }
  681. if (row.curCode == 'CNY') {
  682. this.$set(row,'rmbAmount',row.amount)
  683. this.$set(row,'usdAmount','')
  684. this.$set(row,'rmbAmountNet',row.amount)
  685. this.$set(row,'usdAmountNet','')
  686. }else {
  687. this.$set(row,'usdAmount',row.amount)
  688. this.$set(row,'rmbAmount','')
  689. this.$set(row,'usdAmountNet',row.amount)
  690. this.$set(row,'rmbAmountNet','')
  691. }
  692. },
  693. // 数量
  694. quantityinputfun(row) {
  695. if (row.quantity <= 0) {
  696. this.$message({
  697. type: "warning",
  698. message: "数量不能输入负数!"
  699. });
  700. this.$set(row,'quantity',1)
  701. return
  702. }
  703. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity))
  704. // 判断是否有币种
  705. if (!row.curCode) {
  706. return;
  707. }
  708. if (row.curCode == 'CNY') {
  709. this.$set(row,'rmbAmount',row.amount)
  710. this.$set(row,'usdAmount','')
  711. }else {
  712. this.$set(row,'usdAmount',row.amount)
  713. this.$set(row,'rmbAmount','')
  714. }
  715. },
  716. // 获取客户数据
  717. getBcorpsListfun(cnName){
  718. getBcorpsList(1,10,{cnName}).then(res=>{
  719. this.corpCnNameData = res.data.data.records
  720. })
  721. },
  722. // 获取费用数据
  723. bfeesListfun(cnName){
  724. bfeesList(1,10,{cnName}).then(res=>{
  725. this.feeCnNameData = res.data.data.records
  726. })
  727. },
  728. // 获取费用信息 核算要素信息
  729. getBaccelementsListfun(cnName){
  730. getBaccelementsList(1,10,{cnName}).then(res=>{
  731. this.elementsData = res.data.data.records
  732. })
  733. },
  734. // 获取预付到付字典数据
  735. paymodeWorkDictsfun(){
  736. getWorkDicts('payment_method_los').then((res) => {
  737. this.paymodeData = res.data.data
  738. })
  739. },
  740. // 获取币别数据
  741. bcurrencyGetExratefun(dc){
  742. bcurrencyGetExrate({
  743. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  744. dc:dc
  745. }).then(res=>{
  746. this.curCodeData = res.data.data
  747. })
  748. },
  749. // 获取计算属性
  750. async getBunitsPagefun(type,feeRow,row){
  751. let srcBillId = null
  752. if (this.form.billType == 'MH') {
  753. srcBillId = this.form.masterId
  754. }else {
  755. srcBillId = this.form.id
  756. }
  757. const res = await getBunitsPage({srcBillId})
  758. this.unitNoData = []
  759. let boxarr40 = ['40HC','40GP']
  760. let boxarr20 = ['20GP']
  761. let teunum = 0
  762. for (let item of res.data.data) {
  763. // 按箱型
  764. if (item.quantityRule != 1) {
  765. // TEU
  766. if (item.quantityRule == 4) {
  767. for (let data of this.form.preContainersList) {
  768. if (boxarr40.indexOf(data.cntrTypeCode) != -1) {
  769. teunum += Number(data.quantity) * 2
  770. }else if (boxarr20.indexOf(data.cntrTypeCode) != -1) {
  771. teunum += Number(data.quantity)
  772. }
  773. }
  774. this.unitNoData.push({...item, boxquantity: teunum})
  775. }else {
  776. this.unitNoData.push(item) // 不是TEU和不是箱的走这个
  777. }
  778. }
  779. }
  780. let arr = this.form.preContainersList.map(item=>{
  781. return {
  782. quantityRule:1, // 1 是按箱量
  783. code:item.cntrTypeCode,
  784. boxquantity:item.quantity,
  785. }
  786. })
  787. this.unitNoData = [...arr,...this.unitNoData]
  788. // 选择费用时带出第一条
  789. if (type) {
  790. let feeunitNodata = []
  791. for (let item of this.unitNoData) {
  792. if (item.quantityRule == feeRow.unitNo) {
  793. feeunitNodata.push(item)
  794. }
  795. }
  796. this.corpChange(feeunitNodata[0].code,'unitNo',row)
  797. }
  798. },
  799. // 多选选择的数据
  800. handleSelectionChange(arr){
  801. // this.$emit('handleSelectionChange',arr)
  802. this.handleSelectionData = arr
  803. },
  804. //自定义列保存
  805. async saveColumnTwo(ref, option, optionBack, code) {
  806. /**
  807. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  808. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  809. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  810. */
  811. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  812. if (inSave) {
  813. this.$message.success("保存成功");
  814. //关闭窗口
  815. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  816. }
  817. },
  818. //自定义列重置
  819. async resetColumnTwo(ref, option, optionBack, code) {
  820. this[option] = this[optionBack];
  821. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  822. if (inSave) {
  823. this.$message.success("重置成功");
  824. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  825. }
  826. },
  827. // 更改表格颜色
  828. headerClassName(tab) {
  829. //颜色间隔
  830. let back = ""
  831. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  832. if (tab.columnIndex % 2 === 0) {
  833. back = "back-one"
  834. } else if (tab.columnIndex % 2 === 1) {
  835. back = "back-two"
  836. }
  837. }
  838. return back;
  839. },
  840. },
  841. }
  842. </script>
  843. <style scoped>
  844. ::v-deep#out-table .back-one {
  845. background: #ecf5ff !important;
  846. text-align: center;
  847. padding: 4px 0;
  848. }
  849. ::v-deep#out-table .back-two {
  850. background: #ecf5ff !important;
  851. text-align: center;
  852. padding: 4px 0;
  853. }
  854. </style>