amendsCostdetails.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  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="arrangeDisabled"
  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. // 列禁用
  197. arrangeDisabled:{
  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. if (this.handleSelectionData.length === 0) {
  378. this.$message.warning("请选择至少一条数据");
  379. return;
  380. }
  381. this.$confirm("确定将选择数据删除?", {
  382. confirmButtonText: "确定",
  383. cancelButtonText: "取消",
  384. type: "warning"
  385. }).then(()=>{
  386. let multiList = this.handleSelectionData
  387. let arr = this.tableData
  388. // 获取有id 的数据
  389. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  390. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  391. // 把选中的删除掉
  392. multiList.forEach((item)=>{
  393. for (let index in arr) {
  394. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  395. arr.splice(Number(index),1)
  396. }
  397. }
  398. })
  399. // 有id 的处理
  400. if(itemsWithId.length != 0) {
  401. feecenterRemove(arrIds.join(',')).then(res=>{
  402. this.$message.success('操作成功')
  403. // this.$emit('billsDetailfun')
  404. })
  405. }
  406. })
  407. },
  408. // 小删除
  409. deletefun(row,index) {
  410. this.$confirm("确定将选择数据删除?", {
  411. confirmButtonText: "确定",
  412. cancelButtonText: "取消",
  413. type: "warning"
  414. }).then(()=>{
  415. if (row.id) {
  416. // 删除接口
  417. feecenterRemove(row.id).then(res=>{
  418. this.$message({
  419. type: "success",
  420. message: "操作成功!"
  421. });
  422. this.$emit('amendsDetailfun')
  423. })
  424. }else {
  425. this.tableData.splice(index, 1)
  426. }
  427. })
  428. },
  429. // 下拉的回调
  430. corpChange(value,name,row) {
  431. if (name == 'corpCnName') {
  432. if (!value) {
  433. this.$set(row,'corpCnName','')
  434. this.$set(row,'corpEnName','')
  435. this.$set(row,'corpId','')
  436. }
  437. for(let item of this.corpCnNameData) {
  438. if (item.cnName == value){
  439. this.$set(row,'corpCnName',item.cnName)
  440. this.$set(row,'corpEnName',item.enName)
  441. this.$set(row,'corpId',item.id)
  442. }
  443. }
  444. }else if (name == 'feeCnName') {
  445. if (!value) {
  446. this.$set(row,'feeCnName','')
  447. this.$set(row,'feeEnName','')
  448. this.$set(row,'feeId','')
  449. this.$set(row,'feeCode','')
  450. // 选择费用简称带出核算要素
  451. this.$set(row,'elementsId','')
  452. this.$set(row,'elementsCnName','')
  453. this.$set(row,'elementsCode','')
  454. this.$set(row,'elementsEnName','')
  455. }
  456. for(let item of this.feeCnNameData) {
  457. if (item.cnName == value){
  458. this.$set(row,'feeCnName',item.cnName)
  459. this.$set(row,'feeEnName',item.enName)
  460. this.$set(row,'feeId',item.id)
  461. this.$set(row,'feeCode',item.code)
  462. // 选择费用简称带出核算要素
  463. this.$set(row,'elementsId',item.accElementId)
  464. this.$set(row,'elementsCnName',item.accElementName)
  465. this.$set(row,'elementsCode',item.elementsCode)
  466. this.$set(row,'elementsEnName',item.elementsEnName)
  467. // 拿取费用简称下的计量单位
  468. this.getBunitsPagefun(true,item,row)
  469. // 币别
  470. this.$set(row,'curCode',item.curNo)
  471. // 汇率
  472. bcurrencyGetExrate({
  473. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  474. dc:row.dc
  475. }).then(res=>{
  476. for (let item of res.data.data) {
  477. if (item.code == row.curCode) {
  478. this.$set(row,'exrate',item.exrate)
  479. }
  480. }
  481. })
  482. // 计算金额
  483. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  484. if (row.curCode == 'CNY') {
  485. this.$set(row,'rmbAmount',row.amount)
  486. this.$set(row,'usdAmount','')
  487. this.$set(row,'rmbAmountNet',row.amount)
  488. this.$set(row,'usdAmountNet','')
  489. }else {
  490. this.$set(row,'usdAmount',row.amount)
  491. this.$set(row,'rmbAmount','')
  492. this.$set(row,'usdAmountNet',row.amount)
  493. this.$set(row,'rmbAmountNet','')
  494. }
  495. }
  496. }
  497. }else if (name == 'unitNo') {
  498. // 计量单位
  499. this.$set(row,name,value)
  500. for (let item of this.unitNoData) {
  501. if (item.code == value) {
  502. // 按箱型
  503. if (item.quantityRule == 1) {
  504. // 选择的箱那边的数据
  505. if (item.boxquantity) {
  506. this.$set(row,'quantity',item.boxquantity)
  507. }
  508. }
  509. // 按票
  510. if (item.quantityRule == 2) {
  511. this.$set(row,'quantity',1)
  512. }
  513. // 按重量
  514. if (item.quantityRule == 3) {
  515. this.$set(row,'quantity',this.form.grossWeight)
  516. }
  517. // 按TEU
  518. if (item.quantityRule == 4) {
  519. this.$set(row,'quantity',item.boxquantity)
  520. }
  521. // 按尺码
  522. if (item.quantityRule == 5) {
  523. this.$set(row,'quantity',this.form.measurement)
  524. }
  525. // 按件数
  526. if (item.quantityRule == 6) {
  527. this.$set(row,'quantity',this.form.quantity)
  528. }
  529. }
  530. }
  531. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity?row.quantity:0))
  532. if (row.curCode == 'CNY') {
  533. this.$set(row,'rmbAmount',row.amount)
  534. this.$set(row,'usdAmount','')
  535. this.$set(row,'rmbAmountNet',row.amount)
  536. this.$set(row,'usdAmountNet','')
  537. }else {
  538. this.$set(row,'usdAmount',row.amount)
  539. this.$set(row,'rmbAmount','')
  540. this.$set(row,'usdAmountNet',row.amount)
  541. this.$set(row,'rmbAmountNet','')
  542. }
  543. } else if (name == 'elementsCnName') {
  544. if (!value) {
  545. this.$set(row,'elementsId','')
  546. this.$set(row,'elementsCnName','')
  547. this.$set(row,'elementsCode','')
  548. this.$set(row,'elementsEnName','')
  549. }
  550. // 核算要素
  551. for (let item of this.elementsData) {
  552. if (item.cnName == value) {
  553. this.$set(row,'elementsId',item.id)
  554. this.$set(row,'elementsCnName',item.cnName)
  555. this.$set(row,'elementsCode',item.code)
  556. this.$set(row,'elementsEnName',item.enName)
  557. }
  558. }
  559. }else if (name == 'curCode') {
  560. for(let item of this.curCodeData) {
  561. if (item.code == value){
  562. if (item.code == 'USD') {
  563. if (Number(item.exrate) <= 1) {
  564. this.$message.warning('当前选择的币别汇率不能小于零')
  565. return
  566. }
  567. }else {
  568. if (Number(item.exrate) == 0) {
  569. this.$message.warning('当前选择的币别汇率不能为零')
  570. return
  571. }
  572. }
  573. this.$set(row,'curCode',item.code)
  574. this.$set(row,'exrate',item.exrate)
  575. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  576. if (row.curCode == 'CNY') {
  577. this.$set(row,'rmbAmount',row.amount)
  578. this.$set(row,'usdAmount','')
  579. this.$set(row,'rmbAmountNet',row.amount)
  580. this.$set(row,'usdAmountNet','')
  581. }else {
  582. this.$set(row,'usdAmount',row.amount)
  583. this.$set(row,'rmbAmount','')
  584. this.$set(row,'usdAmountNet',row.amount)
  585. this.$set(row,'rmbAmountNet','')
  586. }
  587. }
  588. }
  589. } else {
  590. this.$set(row,name,value)
  591. }
  592. },
  593. // 费用信息明细保存按钮
  594. feecenterSubmitListfun(){
  595. if (!this.form.id) {
  596. return this.$message.warning('请先保存数据')
  597. }
  598. // 判断必填项
  599. let sum = '请输入'
  600. for (let item of this.tableData) {
  601. if (!item.dc) {
  602. sum += ` 应收序号${item.$index + 1}收/付`
  603. }
  604. if (!item.corpId) {
  605. sum += ` 应收序号${item.$index + 1}往来单位`
  606. }
  607. if (!item.feeId) {
  608. sum += ` 应收序号${item.$index + 1}费用简称`
  609. }
  610. if (!item.elementsId) {
  611. sum += ` 应收序号${item.$index + 1}核算要素`
  612. }
  613. if (!item.curCode) {
  614. sum += ` 应收序号${item.$index + 1}币种`
  615. }
  616. }
  617. if(sum != '请输入') {
  618. this.$confirm(sum, {
  619. confirmButtonText: "确定",
  620. cancelButtonText: "取消",
  621. type: "warning"
  622. })
  623. return;
  624. }
  625. this.$confirm("确定保存全部的费用信息?", {
  626. confirmButtonText: "确定",
  627. cancelButtonText: "取消",
  628. type: "warning"
  629. }).then(()=>{
  630. this.tableData.map((row,index)=>{
  631. row.dc = row.dc
  632. row.pid = this.form.id
  633. row.sort = Number(index) + 1
  634. row.businessType = this.form.businessType // 业务类型
  635. row.billType = this.form.billType // 单据类型
  636. row.billNo = this.form.billNo // 单据编号
  637. row.billDate = this.form.billDate // 单据日期
  638. row.billCorpId = this.form.corpId // 主表客户 id
  639. row.billCorpCnName = this.form.corpCnName // 主表客户中文名称
  640. row.billCorpEnName = this.form.corpEnName // 主表客户英文名称
  641. row.lineId = this.form.lineId // 航线 id
  642. row.lineCnName = this.form.lineCnName // 航线中文名称
  643. row.lineEnName = this.form.lineEnName // 航线英文名称
  644. row.vesselId = this.form.vesselId // 船名 id
  645. row.vesselCnName = this.form.vesselCnName // 中文船名
  646. row.vesselEnName = this.form.vesselEnName // 英文船名
  647. row.voyageNo = this.form.voyageNo // 航次
  648. row.mblno = this.form.mblno // MB/L NO
  649. row.hblno = this.form.hblno // HB/L NO
  650. row.etd = this.form.etd // 开船日期
  651. row.eta = this.form.eta // 到港日期
  652. row.polId = this.form.polId // 装货港 id
  653. row.polCode = this.form.polCode // 装货港代码
  654. row.polCnName = this.form.polCnName // 装货港中文名称
  655. row.polEnName = this.form.polEnName // 装货港英文名称
  656. row.podId = this.form.podId // 卸货港 id
  657. row.podCode = this.form.podCode // 卸货港代码
  658. row.podCnName = this.form.podCnName // 卸货港中文名称
  659. row.podEnName = this.form.podEnName // 卸货港英文名称
  660. row.corpArgreementNo = this.form.corpArgreementNo // 客户约号
  661. })
  662. feecenterSubmitList(this.tableData).then(res=>{
  663. this.$message({
  664. type: "success",
  665. message: "操作成功!"
  666. });
  667. this.$emit('amendsDetailfun')
  668. })
  669. })
  670. },
  671. // 单价
  672. priceinputfun(value,row){
  673. if (Number(value) <= 0) {
  674. this.$message({
  675. type: "warning",
  676. message: "单价不能输入负数!"
  677. });
  678. return
  679. }
  680. this.$set(row,'amount',Number(row.price) * Number(row.quantity?row.quantity:0))
  681. // 判断是否有币种
  682. if (!row.curCode) {
  683. return;
  684. }
  685. if (row.curCode == 'CNY') {
  686. this.$set(row,'rmbAmount',row.amount)
  687. this.$set(row,'usdAmount','')
  688. this.$set(row,'rmbAmountNet',row.amount)
  689. this.$set(row,'usdAmountNet','')
  690. }else {
  691. this.$set(row,'usdAmount',row.amount)
  692. this.$set(row,'rmbAmount','')
  693. this.$set(row,'usdAmountNet',row.amount)
  694. this.$set(row,'rmbAmountNet','')
  695. }
  696. },
  697. // 数量
  698. quantityinputfun(row) {
  699. if (row.quantity <= 0) {
  700. this.$message({
  701. type: "warning",
  702. message: "数量不能输入负数!"
  703. });
  704. this.$set(row,'quantity',1)
  705. return
  706. }
  707. this.$set(row,'amount',Number(row.price?row.price:0) * Number(row.quantity))
  708. // 判断是否有币种
  709. if (!row.curCode) {
  710. return;
  711. }
  712. if (row.curCode == 'CNY') {
  713. this.$set(row,'rmbAmount',row.amount)
  714. this.$set(row,'usdAmount','')
  715. }else {
  716. this.$set(row,'usdAmount',row.amount)
  717. this.$set(row,'rmbAmount','')
  718. }
  719. },
  720. // 获取客户数据
  721. getBcorpsListfun(cnName){
  722. getBcorpsList(1,10,{cnName}).then(res=>{
  723. this.corpCnNameData = res.data.data.records
  724. })
  725. },
  726. // 获取费用数据
  727. bfeesListfun(cnName){
  728. bfeesList(1,10,{cnName}).then(res=>{
  729. this.feeCnNameData = res.data.data.records
  730. })
  731. },
  732. // 获取费用信息 核算要素信息
  733. getBaccelementsListfun(cnName){
  734. getBaccelementsList(1,10,{cnName}).then(res=>{
  735. this.elementsData = res.data.data.records
  736. })
  737. },
  738. // 获取预付到付字典数据
  739. paymodeWorkDictsfun(){
  740. getWorkDicts('payment_method_los').then((res) => {
  741. this.paymodeData = res.data.data
  742. })
  743. },
  744. // 获取币别数据
  745. bcurrencyGetExratefun(dc){
  746. bcurrencyGetExrate({
  747. date:this.form.etd?this.form.etd.slice(0,10) + ' 00:00:00':dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00', // 开船日期
  748. dc:dc
  749. }).then(res=>{
  750. this.curCodeData = res.data.data
  751. })
  752. },
  753. // 获取计算属性
  754. async getBunitsPagefun(type,feeRow,row){
  755. let srcBillId = null
  756. if (this.form.billType == 'MH') {
  757. srcBillId = this.form.masterId
  758. }else {
  759. srcBillId = this.form.id
  760. }
  761. const res = await getBunitsPage({srcBillId})
  762. this.unitNoData = []
  763. let boxarr40 = ['40HC','40GP']
  764. let boxarr20 = ['20GP']
  765. let teunum = 0
  766. for (let item of res.data.data) {
  767. // 按箱型
  768. if (item.quantityRule != 1) {
  769. // TEU
  770. if (item.quantityRule == 4) {
  771. for (let data of this.form.preContainersList) {
  772. if (boxarr40.indexOf(data.cntrTypeCode) != -1) {
  773. teunum += Number(data.quantity) * 2
  774. }else if (boxarr20.indexOf(data.cntrTypeCode) != -1) {
  775. teunum += Number(data.quantity)
  776. }
  777. }
  778. this.unitNoData.push({...item, boxquantity: teunum})
  779. }else {
  780. this.unitNoData.push(item) // 不是TEU和不是箱的走这个
  781. }
  782. }
  783. }
  784. let arr = this.form.preContainersList.map(item=>{
  785. return {
  786. quantityRule:1, // 1 是按箱量
  787. code:item.cntrTypeCode,
  788. boxquantity:item.quantity,
  789. }
  790. })
  791. this.unitNoData = [...arr,...this.unitNoData]
  792. // 选择费用时带出第一条
  793. if (type) {
  794. let feeunitNodata = []
  795. for (let item of this.unitNoData) {
  796. if (item.quantityRule == feeRow.unitNo) {
  797. feeunitNodata.push(item)
  798. }
  799. }
  800. this.corpChange(feeunitNodata[0].code,'unitNo',row)
  801. }
  802. },
  803. // 多选选择的数据
  804. handleSelectionChange(arr){
  805. // this.$emit('handleSelectionChange',arr)
  806. this.handleSelectionData = arr
  807. },
  808. //自定义列保存
  809. async saveColumnTwo(ref, option, optionBack, code) {
  810. /**
  811. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  812. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  813. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  814. */
  815. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  816. if (inSave) {
  817. this.$message.success("保存成功");
  818. //关闭窗口
  819. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  820. }
  821. },
  822. //自定义列重置
  823. async resetColumnTwo(ref, option, optionBack, code) {
  824. this[option] = this[optionBack];
  825. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  826. if (inSave) {
  827. this.$message.success("重置成功");
  828. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  829. }
  830. },
  831. // 更改表格颜色
  832. headerClassName(tab) {
  833. //颜色间隔
  834. let back = ""
  835. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  836. if (tab.columnIndex % 2 === 0) {
  837. back = "back-one"
  838. } else if (tab.columnIndex % 2 === 1) {
  839. back = "back-two"
  840. }
  841. }
  842. return back;
  843. },
  844. },
  845. }
  846. </script>
  847. <style scoped>
  848. ::v-deep#out-table .back-one {
  849. background: #ecf5ff !important;
  850. text-align: center;
  851. padding: 4px 0;
  852. }
  853. ::v-deep#out-table .back-two {
  854. background: #ecf5ff !important;
  855. text-align: center;
  856. padding: 4px 0;
  857. }
  858. </style>