feesTemplateItems.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. <!--费用模板详情-->
  2. <template>
  3. <div class="borderless" v-loading="pageLoading">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  7. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  8. @click="backToList">返回列表
  9. </el-button>
  10. </div>
  11. <div class="add-customer-btn">
  12. <el-button size="small" type="primary" style="margin-right: 8px" v-if="basicData.disabled"
  13. :loading="saveLoading" @click="editHandle">编 辑
  14. </el-button>
  15. <el-button size="small" type="primary" style="margin-right: 8px" v-else :loading="saveLoading"
  16. @click="editCustomer">保 存
  17. </el-button>
  18. </div>
  19. </div>
  20. <div class="customer-main">
  21. <containerTitle title="基础信息"></containerTitle>
  22. <basic-container>
  23. <avue-form :option="basicData" v-model="form" ref="form">
  24. <tempalte slot="shippingCompanyCname">
  25. <dic-select v-model="form.shippingCompanyCname" placeholder="承运人" key="id" label="cnName"
  26. res="records" url="/blade-los/bcorps/selectList?corpTypeName=船公司" :filterable="true"
  27. :remote="true" dataName="cnName" @selectChange="dicChange('shippingCompanyCname', $event)"
  28. :disabled="basicData.disabled"></dic-select>
  29. </tempalte>
  30. <tempalte slot="addressCname">
  31. <dic-select v-model="form.addressCname" placeholder="" key="id" label="cnName" res="records"
  32. url="/blade-los/bports/list" :filterable="true" :remote="true" dataName="cnName"
  33. @selectChange="dicChange('addressCname', $event)"
  34. :disabled="basicData.disabled"></dic-select>
  35. </tempalte>
  36. </avue-form>
  37. </basic-container>
  38. </div>
  39. <div class="customer-main margintop">
  40. <containerTitle title="费用详情"></containerTitle>
  41. <basic-container>
  42. <avue-crud :option="option" :data="form.feesTemplateItemsList" id="out-table" ref="crud"
  43. :header-cell-class-name="headerClassName" :row-style="{ height: '20px', padding: '0px' }"
  44. :cell-style="{ height: '20px', padding: '0px' }">
  45. <template slot="indexHeader" slot-scope="{row,index}">
  46. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="basicData.disabled" circle
  47. @click="feestemplatepingCompanyAdd()">
  48. </el-button>
  49. </template>
  50. <template slot="index" slot-scope="{row,index}">
  51. <span>{{ index + 1 }}</span>
  52. </template>
  53. <template slot="corpTypeForm" slot-scope="{row,index}">
  54. <dic-select v-if="row.$cellEdit" v-model="row.corpType" label="cnName" res="records"
  55. url="/blade-los/bcorpstypedefine/list?status=0&current=1&size=20" :filterable="true"
  56. :remote="true" dataName="cnName"
  57. @selectChange="rowDicChange('corpType', $event, row)"></dic-select>
  58. <span v-else>{{ row.corpType }}</span>
  59. </template>
  60. <template slot="feeCnNameForm" slot-scope="{ row }">
  61. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" key="id" placeholder="费用名称"
  62. label="cnName" res="records" url="/blade-los/bfees/list?status=0&current=1&size=20"
  63. :filterable="true" :remote="true" dataName="cnName"
  64. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  65. <span v-else>{{ row.feeCnName }}</span>
  66. </template>
  67. <template slot="quantityRuleForm" slot-scope="{row,index}">
  68. <dic-select v-if="row.$cellEdit" v-model="row.quantityRule" key="id" label="dictValue"
  69. url="/blade-system/dict-biz/dictionary?code=number_rule" :filterable="true"></dic-select>
  70. <span v-else>{{ row.quantityRule }}</span>
  71. </template>
  72. <template slot="unitNoForm" slot-scope="{row,index}">
  73. <dic-select v-if="row.$cellEdit" v-model="row.unitNo" key="id" label="cnName"
  74. url="/blade-los/bunits/listAll" :filterable="true" :disabled="row.quantityRule == '按箱型'"
  75. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  76. <span v-else>{{ row.unitNo }}</span>
  77. </template>
  78. <template slot="quantityForm" slot-scope="{row,index}">
  79. <el-input-number style="width: 100%;" v-if="row.$cellEdit" v-model="row.quantity"
  80. :disabled="row.quantityRule == '按箱型'" :controls="false" size="small"></el-input-number>
  81. <span v-else>{{ row.quantity }}</span>
  82. </template>
  83. <template slot="priceForm" slot-scope="{row,index}">
  84. <el-input-number style="width: 100%;" v-if="row.$cellEdit" v-model="row.price"
  85. :disabled="row.quantityRule == '按箱型'" :controls="false" size="small"></el-input-number>
  86. <span v-else>{{ row.price }}</span>
  87. </template>
  88. <template slot="costPriceForm" slot-scope="{row,index}">
  89. <el-input-number style="width: 100%;" v-if="row.$cellEdit" v-model="row.costPrice"
  90. :disabled="row.quantityRule == '按箱型'" :controls="false" size="small"></el-input-number>
  91. <span v-else>{{ row.costPrice }}</span>
  92. </template>
  93. <template slot="curCodeForm" slot-scope="{ row }">
  94. <dic-select v-if="row.$cellEdit" :disabled="row.quantityRule == '按箱型'" v-model="row.curCode"
  95. placeholder="币别" label="dictValue"
  96. url="/blade-system/dict-biz/dictionary?code=currency"></dic-select>
  97. <span v-else>{{ row.curCode }}</span>
  98. </template>
  99. <template slot="menu" slot-scope="{ row, index }">
  100. <el-button v-if="row.quantityRule == '按箱型'" type="text" size="small"
  101. :disabled="basicData.disabled" @click="feestemplateCompanyEdit(index, row)">集装箱</el-button>
  102. <el-button size="small" type="text" :disabled="basicData.disabled" @click="rowCell(row, index)">
  103. {{ row.$cellEdit ? '保存' : '编辑' }}
  104. </el-button>
  105. <el-button size="small" type="text" :disabled="basicData.disabled"
  106. @click="feestemplateCompanyDelete(index, row)">删除</el-button>
  107. </template>
  108. </avue-crud>
  109. </basic-container>
  110. </div>
  111. <!--费用详细添加弹窗-->
  112. <el-dialog title="费用详情" :visible.sync="feestemplateVisible" width="60%" append-to-body :destroy-on-close="true"
  113. :modal-append-to-body="false" :close-on-click-modal="false" :before-close="feestemplateClose">
  114. <div>
  115. <avue-crud :option="sonOption" :data="feestemplateForm.sonItemsList">
  116. <template slot="indexHeader" slot-scope="{row,index}">
  117. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="basicData.disabled" circle
  118. @click="addRow()">
  119. </el-button>
  120. </template>
  121. <template slot="index" slot-scope="{row,index}">
  122. <span>{{ index + 1 }}</span>
  123. </template>
  124. <template slot="typeForm" slot-scope="{row,index}">
  125. <dic-select v-if="row.$cellEdit" v-model="row.type" key="id" label="dictValue"
  126. url="/blade-system/dict-biz/dictionary?code=corp_type" :filterable="true"></dic-select>
  127. <span v-else>{{ row.type }}</span>
  128. </template>
  129. <template slot="feeCnNameForm" slot-scope="{ row }">
  130. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" key="id" placeholder="箱型"
  131. label="cnName" res="records" url="/blade-los/bfees/list?status=0&current=1&size=20"
  132. :filterable="true" :remote="true" dataName="cnName"
  133. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  134. <span v-else>{{ row.feeCnName }}</span>
  135. </template>
  136. <template slot="unitNoForm" slot-scope="{row,index}">
  137. <span>
  138. <dic-select
  139. v-if="row.$cellEdit && (feestemplateForm.quantityRule == '按箱型' || feestemplateForm.quantityRule == '按TEU')"
  140. v-model="row.unitNo" key="id" label="cnName" res="records"
  141. url="/blade-los/bcntrtypes/list?status=0&current=1&size=20" :filterable="true"
  142. :remote="true" dataName="cnName"
  143. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  144. <dic-select
  145. v-if="row.$cellEdit && !(feestemplateForm.quantityRule == '按箱型' || feestemplateForm.quantityRule == '按TEU')"
  146. v-model="row.unitNo" key="id" label="cnName" res="records"
  147. url="/blade-los/bunits/list?status=0&current=1&size=20" :filterable="true"
  148. :remote="true" dataName="cnName"
  149. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  150. <span v-if="!row.$cellEdit">{{ row.unitNo }}</span>
  151. </span>
  152. </template>
  153. <template slot="menu" slot-scope="{ row, index }">
  154. <el-button size="small" type="text" :disabled="basicData.disabled" @click="rowEdit(row, index)">
  155. {{ row.$cellEdit ? '保存' : '编辑' }}
  156. </el-button>
  157. <el-button type="text" size="small" :disabled="basicData.disabled"
  158. @click="rowDel(index, row)">删除</el-button>
  159. </template>
  160. </avue-crud>
  161. </div>
  162. <span slot="footer" class="dialog-footer">
  163. <el-button @click="feestemplateVisible = false;">取 消</el-button>
  164. <el-button type="primary" @click="feestemplatecompanyConfirm">确 定</el-button>
  165. </span>
  166. </el-dialog>
  167. </div>
  168. </template>
  169. <script>
  170. import { losbfeestemplateDetail, losbfeestemplateSubmit, copytemplateDetail, itemRemove, remove } from "@/api/iosBasicData/losbfeestemplate";
  171. import { bfeesList } from "@/api/iosBasicData/bfees";
  172. import { getBcorpsList } from "@/api/iosBasicData/bcorps";
  173. import { getRateList } from "@/api/iosBasicData/rateManagement";
  174. import { getBunitsList } from "@/api/iosBasicData/bunits";
  175. import SearchQuery from '@/components/iosbasic-data/searchquery.vue'
  176. import bcorps from "@/views/iosBasicData/bcorps/index.vue";
  177. import bfeesdefine from "@/views/iosBasicData/bfeesdefine/index.vue";
  178. import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
  179. import bunits from "@/views/iosBasicData/bunits/index.vue";
  180. import { getWorkDicts } from "@/api/system/dictbiz";
  181. import { bcntrtypesList } from "@/api/iosBasicData/bcntrtypes";
  182. import dicSelect from "@/components/dicSelect/main";
  183. export default {
  184. components: { SearchQuery, bcorps, bfeesdefine, bbusinesstype, bunits, dicSelect },
  185. props: {
  186. detailData: {
  187. type: Object
  188. }
  189. },
  190. data() {
  191. return {
  192. sonOption: {
  193. calcHeight: 30,
  194. // tip: false,
  195. border: true,
  196. // addBtn: false,
  197. // viewBtn: false,
  198. editBtn: false,
  199. delBtn: false,
  200. // refreshBtn: false,
  201. // selection: true,
  202. header: false,
  203. align: 'center',
  204. menu: true,
  205. menuWidth: 100,
  206. column: [
  207. {
  208. label: "index",
  209. prop: "index",
  210. width: "55",
  211. headerslot: true,
  212. },
  213. {
  214. label: '计量单位',
  215. prop: 'unitNo',
  216. overHidden: true,
  217. cell: true,
  218. slot: true,
  219. formslot: true,
  220. },
  221. {
  222. label: '销售价',
  223. prop: 'salesPrice',
  224. cell: true,
  225. type: 'number',
  226. controls: false,
  227. overHidden: true,
  228. },
  229. {
  230. label: '成本价',
  231. prop: 'costPrice',
  232. cell: true,
  233. type: 'number',
  234. controls: false,
  235. overHidden: true,
  236. },
  237. {
  238. label: '币种',
  239. prop: 'curCode',
  240. overHidden: true,
  241. cell: true,
  242. type: 'select',
  243. dicData: [{
  244. label: 'CNY',
  245. value: 'CNY'
  246. }, {
  247. label: 'USD',
  248. value: 'USD'
  249. }],
  250. },
  251. ]
  252. },
  253. pageLoading: false,
  254. saveLoading: false,
  255. // 费用详细弹窗
  256. feestemplateVisible: false,
  257. // 费用详细弹窗绑定的数据
  258. feestemplateForm: {
  259. sonItemsList: []
  260. },
  261. feestemplateIndex: null,
  262. // 客户请求数据
  263. corpData: [],
  264. // 费用请求数据
  265. feeData: [],
  266. // 数量规则字典数据
  267. quantityRuleData: [],
  268. //客户类型
  269. corpTypeData: [],
  270. // 币别请求数据
  271. curCodeData: [],
  272. // 计算属性数据
  273. unitNoData: [],
  274. // 获取到的数据
  275. form: {
  276. isShared: '1',
  277. status: 0,
  278. feesTemplateItemsList: []
  279. },
  280. // 基础资料数据
  281. basicData: {
  282. menuBtn: false,
  283. span: 8,
  284. disabled: false,
  285. labelWidth: 100,
  286. column: [
  287. {
  288. label: "模版编号",
  289. prop: "code",
  290. disabled: false,
  291. rules: [{
  292. required: true,
  293. message: "请输入模版编号",
  294. trigger: "blur"
  295. }]
  296. },
  297. {
  298. label: "模版中文名称",
  299. prop: "cnName",
  300. disabled: false,
  301. rules: [{
  302. required: true,
  303. message: "请输入模版中文名称",
  304. trigger: "blur"
  305. }]
  306. },
  307. {
  308. label: "模版英文名称",
  309. prop: "enName",
  310. disabled: false,
  311. rules: [{
  312. required: true,
  313. message: "",
  314. trigger: "blur"
  315. }]
  316. },
  317. {
  318. label: "承运人",
  319. prop: "shippingCompanyCname",
  320. disabled: false,
  321. rules: [{
  322. required: true,
  323. message: "",
  324. trigger: "blur"
  325. }]
  326. },
  327. {
  328. label: "POD",
  329. prop: "addressCname",
  330. disabled: false,
  331. },
  332. {
  333. label: "运输条款",
  334. prop: "transportationTerms",
  335. disabled: false,
  336. type: 'select',
  337. filterable: true,
  338. remote: true,
  339. dicUrl: "/api/blade-los/bserviceterms/list?status=0&current=1&size=20&cnName={{key}}",
  340. props: {
  341. label: 'cnName',
  342. value: 'cnName',
  343. res: 'data.records'
  344. },
  345. },
  346. {
  347. label: "状态",
  348. prop: "status",
  349. disabled: false,
  350. type: 'select',
  351. dicData: [{
  352. label: '启用',
  353. value: 0
  354. }, {
  355. label: '停用',
  356. value: 1
  357. }],
  358. },
  359. {
  360. label: "备注",
  361. prop: "remarks",
  362. disabled: false,
  363. span: 24,
  364. type: 'textarea',
  365. minRows: 3,
  366. },
  367. ]
  368. },
  369. option: {
  370. // height: 'auto',
  371. calcHeight: 30,
  372. menuWidth: 160,
  373. border: true,
  374. header: false,
  375. editBtn: false,
  376. delBtn: false,
  377. align: 'center',
  378. menu: true,
  379. column: [
  380. {
  381. label: "index",
  382. prop: "index",
  383. width: "55",
  384. headerslot: true,
  385. },
  386. {
  387. label: "客户类型",
  388. prop: "corpType",
  389. width: "120",
  390. overHidden: true,
  391. cell: true,
  392. slot: true,
  393. formslot: true,
  394. },
  395. {
  396. label: "费用名称",
  397. prop: "feeCnName",
  398. width: "120",
  399. overHidden: true,
  400. cell: true,
  401. slot: true,
  402. formslot: true,
  403. rules: [{
  404. required: true,
  405. message: "请选择费用名称",
  406. trigger: "blur"
  407. }]
  408. },
  409. {
  410. label: "费用编码",
  411. prop: "feeCode",
  412. width: "120",
  413. overHidden: true,
  414. },
  415. {
  416. label: "费用英文",
  417. prop: "feeEnName",
  418. width: "120",
  419. overHidden: true,
  420. },
  421. {
  422. label: "数量规则",
  423. prop: "quantityRule",
  424. width: "120",
  425. overHidden: true,
  426. cell: true,
  427. slot: true,
  428. formslot: true,
  429. rules: [{
  430. required: true,
  431. message: "请选择数量规则",
  432. trigger: "blur"
  433. }]
  434. },
  435. {
  436. label: "数量",
  437. prop: "quantity",
  438. width: "120",
  439. cell: true,
  440. type: 'number',
  441. controls: false,
  442. overHidden: true,
  443. rules: [{
  444. required: true,
  445. message: "请输入数量",
  446. trigger: "blur"
  447. }]
  448. },
  449. {
  450. label: "销售价",
  451. prop: "price",
  452. width: "120",
  453. cell: true,
  454. type: 'number',
  455. controls: false,
  456. overHidden: true,
  457. rules: [{
  458. required: true,
  459. message: "请输入销售价",
  460. trigger: "blur"
  461. }]
  462. },
  463. {
  464. label: "成本价",
  465. prop: "costPrice",
  466. width: "120",
  467. cell: true,
  468. type: 'number',
  469. controls: false,
  470. overHidden: true,
  471. rules: [{
  472. required: true,
  473. message: "请输入成本价",
  474. trigger: "blur"
  475. }]
  476. },
  477. {
  478. label: "币别",
  479. prop: "curCode",
  480. width: "120",
  481. cell: true,
  482. type: 'select',
  483. dicData: [{
  484. label: 'CNY',
  485. value: 'CNY'
  486. }, {
  487. label: 'USD',
  488. value: 'USD'
  489. }],
  490. overHidden: true,
  491. rules: [{
  492. required: true,
  493. message: "请选择币别",
  494. trigger: "blur"
  495. }]
  496. },
  497. {
  498. label: "备注",
  499. prop: "remarks",
  500. cell: true,
  501. overHidden: true,
  502. }
  503. ]
  504. },
  505. // 费用详细数据
  506. feestemplateData: {
  507. column: [
  508. {
  509. label: "客户类型",
  510. prop: "corpType",
  511. },
  512. {
  513. label: "客户",
  514. prop: "corpCnName",
  515. // rules: [{
  516. // required: true,
  517. // message: "",
  518. // trigger: "blur"
  519. // }]
  520. },
  521. {
  522. label: "费用",
  523. prop: "feeCnName",
  524. rules: [{
  525. required: true,
  526. message: "",
  527. trigger: "blur"
  528. }]
  529. },
  530. {
  531. label: "费用编码",
  532. prop: "feeCode",
  533. disabled: true,
  534. },
  535. // {
  536. // label: "费用中文名称",
  537. // prop: "feeCnName",
  538. // disabled:true,
  539. // },
  540. {
  541. label: "费用英文名称",
  542. prop: "feeEnName",
  543. disabled: true,
  544. },
  545. {
  546. label: "数量规则",
  547. prop: "quantityRule",
  548. rules: [{
  549. required: true,
  550. message: "请输入数量规则,用于根据单位自动计算数量",
  551. trigger: "blur"
  552. }]
  553. },
  554. {
  555. label: "数量",
  556. prop: "quantity",
  557. rules: [{
  558. required: true,
  559. // message: "请输入数量",
  560. trigger: "blur"
  561. }, {
  562. pattern: /-?[1-9]\d*/,
  563. // message:"请输入数字",
  564. trigger: 'blur'
  565. }]
  566. },
  567. {
  568. label: "单价",
  569. prop: "price",
  570. rules: [{
  571. required: true,
  572. // message: "请输入单价",
  573. trigger: "blur"
  574. }, {
  575. // pattern:/[1-9]\d*.\d*|0\.\d*[1-9]\d*/,
  576. pattern: /-?[1-9]\d*/,
  577. // message:"请输入数字",
  578. trigger: 'blur'
  579. }]
  580. },
  581. {
  582. label: "计量单位",
  583. prop: "unitNo",
  584. rules: [{
  585. required: true,
  586. // message: "请输入计量单位",
  587. trigger: "blur"
  588. }]
  589. },
  590. {
  591. label: "币别",
  592. prop: "curCode",
  593. rules: [{
  594. required: true,
  595. // message: "请输入币别",
  596. trigger: "blur"
  597. }]
  598. },
  599. {
  600. label: "备注",
  601. prop: "remarks",
  602. span: 24,
  603. type: 'textarea',
  604. minRows: 3,
  605. },
  606. ]
  607. },
  608. }
  609. },
  610. created() {
  611. if (this.detailData.businessTypeId) {
  612. this.form = {
  613. businessTypeId: this.detailData.businessTypeId,
  614. businessTypeCnName: this.detailData.businessTypeCnName,
  615. businessTypeEnName: this.detailData.businessTypeEnName,
  616. businessTypeCode: this.detailData.businessTypeCode,
  617. isShared: '1',
  618. status: 0,
  619. feesTemplateItemsList: []
  620. }
  621. }
  622. this.getBcorpsListfun()
  623. this.bfeesListfun()
  624. this.quantityRuleWorkDictsfun()
  625. this.getRateListfun()
  626. this.getBunitsListfun()
  627. this.getcorpTypeData()
  628. if (this.detailData.id) {
  629. this.basicData.disabled = true
  630. this.losbfeestemplateDetailfun(this.detailData.id)
  631. }
  632. },
  633. methods: {
  634. rowCell(row, index) {
  635. if (!row.feeCnName || !row.quantityRule || !row.quantity || !row.price || !row.curCode) {
  636. this.$refs.crud.rowCell(row, index)
  637. return this.$message.error("请完善明细信息");
  638. }
  639. if (row.$cellEdit == true) {
  640. this.$set(row, "$cellEdit", false);
  641. } else {
  642. this.$set(row, "$cellEdit", true);
  643. }
  644. },
  645. rowEdit(row) {
  646. if (row.$cellEdit == true) {
  647. this.$set(row, "$cellEdit", false);
  648. } else {
  649. this.$set(row, "$cellEdit", true);
  650. }
  651. },
  652. rowDicChange(name, row, el) {
  653. if (name == 'corpCnName') {
  654. if (row) {
  655. el.corpId = row.id
  656. el.corpEnName = row.enName
  657. } else {
  658. el.corpId = null
  659. el.corpEnName = null
  660. el.corpCnName = null
  661. }
  662. }
  663. if (name == 'feeCnName') {
  664. if (row) {
  665. el.feeId = row.id
  666. el.feeCode = row.code
  667. el.feeEnName = row.enName
  668. } else {
  669. el.feeId = null
  670. el.feeCode = null
  671. el.feeCnName = null
  672. el.feeEnName = null
  673. }
  674. }
  675. if (name == 'unitNo') {
  676. if (row) {
  677. el.unitId = row.id
  678. } else {
  679. el.unitId = null
  680. el.unitNo = null
  681. }
  682. }
  683. if (name == 'corpType') {
  684. if (!row) {
  685. el.corpType = null
  686. }
  687. }
  688. },
  689. dicChange(name, row) {
  690. if (name == 'shippingCompanyCname') {
  691. if (row) {
  692. this.form.shippingCompanyId = row.id
  693. this.form.shippingCompanyCode = row.code
  694. } else {
  695. this.form.shippingCompanyId = null
  696. this.form.shippingCompanyCode = null
  697. this.form.shippingCompanyCname = null
  698. }
  699. }
  700. if (name == 'addressCname') {
  701. if (row) {
  702. this.form.addressId = row.id
  703. this.form.addressCode = row.code
  704. } else {
  705. this.form.podId = null
  706. this.form.addressCode = null
  707. this.form.addressCname = null
  708. }
  709. }
  710. },
  711. addRow() {
  712. this.feestemplateForm.sonItemsList.push({
  713. pid: this.form.id,
  714. curCode: this.feestemplateForm.curCode,
  715. salesPrice: 0,
  716. costPrice: 0,
  717. $cellEdit: true
  718. })
  719. },
  720. copyItem(index, row) {
  721. let item = this.deepClone(row)
  722. item.id = null;
  723. // item.pid = null;
  724. // this.feestemplateForm = item
  725. // this.feestemplateVisible = true
  726. this.form.feesTemplateItemsList.push(item)
  727. },
  728. getCopyTemplate(id) {
  729. this.pageLoading = true
  730. copytemplateDetail(id).then(res => {
  731. this.form = res.data.data;
  732. this.pageLoading = false
  733. this.editHandle()
  734. })
  735. },
  736. // 获取客户数据
  737. getBcorpsListfun(cnName) {
  738. getBcorpsList(1, 10, { cnName }).then(res => {
  739. this.corpData = res.data.data.records
  740. })
  741. },
  742. bfeesListfun(cnName) {
  743. bfeesList(1, 10, { cnName }).then(res => {
  744. this.feeData = res.data.data.records
  745. })
  746. },
  747. getcorpTypeData() {
  748. getWorkDicts('corp_type').then(res => {
  749. this.corpTypeData = res.data.data
  750. })
  751. },
  752. // 获取数量规则字典数据
  753. quantityRuleWorkDictsfun() {
  754. getWorkDicts('number_rule').then(res => {
  755. this.quantityRuleData = res.data.data
  756. })
  757. },
  758. // 获取币别数据
  759. getRateListfun(cnName) {
  760. getRateList({
  761. current: 1,
  762. size: 10,
  763. cnName
  764. }).then(res => {
  765. this.curCodeData = res.data.data.records
  766. })
  767. },
  768. // 获取计算属性
  769. getBunitsListfun(code) {
  770. if (this.feestemplateForm.quantityRule == 1 || this.feestemplateForm.quantityRule == 4) {
  771. bcntrtypesList(1, 10, { code, status: 0 }).then(res => {
  772. this.unitNoData = res.data.data.records
  773. })
  774. } else {
  775. getBunitsList(1, 10, { code, status: 0 }).then(res => {
  776. this.unitNoData = res.data.data.records
  777. })
  778. }
  779. },
  780. // 客户选择之后的回调
  781. corpCorpChange(value) {
  782. if (value) {
  783. for (let item of this.corpData) {
  784. if (item.cnName == value) {
  785. this.$set(this.feestemplateForm, 'corpId', item.id)
  786. this.$set(this.feestemplateForm, 'corpEnName', item.enName)
  787. this.$set(this.feestemplateForm, 'corpCnName', item.cnName)
  788. }
  789. }
  790. } else {
  791. this.$set(this.feestemplateForm, 'corpId', null)
  792. this.$set(this.feestemplateForm, 'corpEnName', null)
  793. this.$set(this.feestemplateForm, 'corpCnName', null)
  794. }
  795. },
  796. // 费用选择之后的回调
  797. feeCorpChange(value) {
  798. for (let item of this.feeData) {
  799. if (item.id == value) {
  800. this.$set(this.feestemplateForm, 'feeId', item.id)
  801. this.$set(this.feestemplateForm, 'feeCode', item.code)
  802. this.$set(this.feestemplateForm, 'feeEnName', item.enName)
  803. this.$set(this.feestemplateForm, 'feeCnName', item.cnName)
  804. // 核算要素
  805. this.$set(this.feestemplateForm, 'elementsId', item.accElementId)
  806. this.$set(this.feestemplateForm, 'elementsCnName', item.accElementName)
  807. this.$set(this.feestemplateForm, 'elementsCode', item.elementsCode)
  808. this.$set(this.feestemplateForm, 'elementsEnName', item.elementsEnName)
  809. }
  810. }
  811. },
  812. corpTypeChange(value) {
  813. if (value) {
  814. this.$set(this.feestemplateForm, 'corpType', value)
  815. } else {
  816. this.$set(this.feestemplateForm, 'corpType', null)
  817. }
  818. },
  819. // 数量规则下拉回调
  820. quantityRuleChange(value) {
  821. console.log(value)
  822. if (value == 1 || value == 4) {
  823. bcntrtypesList(1, 10, { status: 0 }).then(res => {
  824. this.unitNoData = res.data.data.records
  825. })
  826. } else {
  827. getBunitsList(1, 10, { status: 0 }).then(res => {
  828. this.unitNoData = res.data.data.records
  829. })
  830. }
  831. this.$set(this.feestemplateForm, 'quantityRule', value)
  832. this.$set(this.feestemplateForm, 'unitNo', '')
  833. },
  834. // 币别选择之后的回调
  835. curCodeCorpChange(value) {
  836. this.$set(this.feestemplateForm, 'curCode', value)
  837. },
  838. // 计算属性选择之后
  839. unitNoCorpChange(value) {
  840. for (let item of this.unitNoData) {
  841. if (item.code == value) {
  842. this.$set(this.feestemplateForm, 'unitId', item.id)
  843. this.$set(this.feestemplateForm, 'unitNo', item.code)
  844. }
  845. }
  846. },
  847. // 查找弹窗里选择导出
  848. eldialogConfirm(name) {
  849. console.log(name)
  850. if (name == 'corpCnName') {
  851. if (this.$refs.bcorps[0].isShow) {
  852. console.log('列表确认')
  853. this.$set(this.feestemplateForm, 'corpId', this.$refs.bcorps[0].selectionList[0].id)
  854. this.$set(this.feestemplateForm, 'corpEnName', this.$refs.bcorps[0].selectionList[0].enName)
  855. this.$set(this.feestemplateForm, 'corpCnName', this.$refs.bcorps[0].selectionList[0].cnName)
  856. } else {
  857. console.log('详情确认')
  858. this.$refs.bcorps[0].$refs.detail.submitForm()
  859. this.$set(this.feestemplateForm, 'corpCnName', this.$refs.bcorps[0].$refs.detail.formData.cnName)
  860. this.$set(this.feestemplateForm, 'corpEnName', this.$refs.bcorps[0].$refs.detail.formData.enName)
  861. this.$set(this.feestemplateForm, 'corpId', this.$refs.bcorps[0].$refs.detail.formData.id)
  862. }
  863. this.$refs.SearchCorp[0].corpVisible = false
  864. } else if (name == 'feeCnName') {
  865. this.$set(this.feestemplateForm, 'feeId', this.$refs.bfeesdefine[0].selectionList[0].id)
  866. this.$set(this.feestemplateForm, 'feeCode', this.$refs.bfeesdefine[0].selectionList[0].code)
  867. this.$set(this.feestemplateForm, 'feeEnName', this.$refs.bfeesdefine[0].selectionList[0].enName)
  868. this.$set(this.feestemplateForm, 'feeCnName', this.$refs.bfeesdefine[0].selectionList[0].cnName)
  869. // 核算要素
  870. this.$set(this.feestemplateForm, 'elementsId', this.$refs.bfeesdefine[0].selectionList[0].accElementId)
  871. this.$set(this.feestemplateForm, 'elementsCnName', this.$refs.bfeesdefine[0].selectionList[0].accElementName)
  872. this.$set(this.feestemplateForm, 'elementsCode', this.$refs.bfeesdefine[0].selectionList[0].elementsCode)
  873. this.$set(this.feestemplateForm, 'elementsEnName', this.$refs.bfeesdefine[0].selectionList[0].elementsEnName)
  874. this.$refs.SearchFee[0].corpVisible = false
  875. } else if (name == 'unitNo') {
  876. this.$set(this.feestemplateForm, 'unitId', this.$refs.bunits[0].selectionList[0].id)
  877. this.$set(this.feestemplateForm, 'unitNo', this.$refs.bunits[0].selectionList[0].code)
  878. this.$refs.SearchUnitNo[0].corpVisible = false
  879. }
  880. },
  881. // 下拉多选弹窗数据多选回调
  882. eldialogMultipleChoice(list, name) {
  883. console.log(list, name)
  884. let arr = []
  885. if (list.length > 1) {
  886. this.$refs[name][0].$refs.crud.toggleSelection() // 先清空所以选择的数据
  887. arr = [list[list.length - 1]] // 获取最新点击的数组
  888. this.$refs[name][0].$refs.crud.toggleSelection(arr, true) // 把刚点击的数组变成选择状态
  889. } else {
  890. arr = list
  891. }
  892. this.$refs[name][0].selectionList = arr
  893. },
  894. // 获取详情数据
  895. losbfeestemplateDetailfun(id) {
  896. this.pageLoading = true
  897. losbfeestemplateDetail(id).then(res => {
  898. this.form = res.data.data;
  899. }).finally(() => {
  900. this.pageLoading = false
  901. })
  902. },
  903. // 编辑按钮更改状态
  904. editHandle() {
  905. this.basicData.disabled = false;
  906. },
  907. // 保存按钮
  908. editCustomer() {
  909. this.$refs["form"].validate((valid, done) => {
  910. done();
  911. if (valid) {
  912. this.losbfeestemplateSubmitfun()
  913. } else {
  914. return false;
  915. }
  916. })
  917. },
  918. // 保存接口
  919. losbfeestemplateSubmitfun() {
  920. this.saveLoading = true
  921. losbfeestemplateSubmit(this.form).then((res) => {
  922. this.$message({
  923. type: "success",
  924. message: "操作成功!"
  925. });
  926. this.losbfeestemplateDetailfun(res.data.data.id)
  927. // this.basicData.disabled = true;
  928. }).finally(() => {
  929. this.saveLoading = false;
  930. })
  931. },
  932. // 费用详细添加
  933. feestemplatepingCompanyAdd() {
  934. if (!this.form.id) {
  935. this.$message({
  936. type: "error",
  937. message: "请保存数据!"
  938. });
  939. return
  940. }
  941. this.form.feesTemplateItemsList.push({
  942. quantity: 1,
  943. price: 1,
  944. quantityRule: '按箱型',
  945. curCode: 'CNY',
  946. unitNo: '箱量',
  947. sonItemsList: [],
  948. $cellEdit: true
  949. })
  950. // this.feestemplateForm = {
  951. // quantity: 1,
  952. // price: 1,
  953. // curCode: 'CNY',
  954. // unitNo: 'KGS',
  955. // sonItemsList: []
  956. // }
  957. // this.feestemplateVisible = true
  958. },
  959. // 费用详细编辑
  960. feestemplateCompanyEdit(index, row) {
  961. if (!row.feeCnName || !row.quantityRule || !row.quantity || !row.price || !row.curCode) {
  962. this.$refs.crud.rowCell(row, index)
  963. return this.$message.error("请完善明细信息");
  964. }
  965. this.feestemplateForm = JSON.parse(JSON.stringify(row))
  966. this.feestemplateIndex = index
  967. this.feestemplateVisible = true
  968. },
  969. // 费用详细删除
  970. feestemplateCompanyDelete(index, row) {
  971. if (row.id) {
  972. itemRemove({ ids: row.id }).then(res => {
  973. this.$message({
  974. type: "success",
  975. message: "删除成功!"
  976. });
  977. this.form.feesTemplateItemsList.splice(index, 1)
  978. })
  979. } else {
  980. this.$message({
  981. type: "success",
  982. message: "删除成功!"
  983. });
  984. this.form.feesTemplateItemsList.splice(index, 1)
  985. }
  986. },
  987. // 费用详细删除
  988. rowDel(index, row) {
  989. if (row.id) {
  990. remove({ ids: row.id }).then(res => {
  991. this.$message({
  992. type: "success",
  993. message: "删除成功!"
  994. });
  995. this.feestemplateForm.sonItemsList.splice(index, 1)
  996. })
  997. } else {
  998. this.$message({
  999. type: "success",
  1000. message: "删除成功!"
  1001. });
  1002. this.feestemplateForm.sonItemsList.splice(index, 1)
  1003. }
  1004. },
  1005. // 费用详细确认
  1006. feestemplatecompanyConfirm() {
  1007. // if (!this.feestemplateForm.corpCnName && !this.feestemplateForm.corpType) {
  1008. // c
  1009. // return
  1010. // }
  1011. // this.$refs.feestemplateForm.validate((valid) => {
  1012. // if (valid) {
  1013. // if (this.feestemplateIndex != null) {
  1014. // this.form.feesTemplateItemsList.splice(this.feestemplateIndex, 1, this.feestemplateForm)
  1015. // } else {
  1016. // if (!this.form.feesTemplateItemsList) {
  1017. // this.form.feesTemplateItemsList = []
  1018. // }
  1019. // this.form.feesTemplateItemsList.push(this.feestemplateForm)
  1020. // }
  1021. // this.feestemplateForm = {}
  1022. // this.feestemplateIndex = null
  1023. // this.feestemplateVisible = false
  1024. // }
  1025. // })
  1026. if (this.feestemplateIndex != null) {
  1027. this.form.feesTemplateItemsList.splice(this.feestemplateIndex, 1, this.feestemplateForm)
  1028. }
  1029. this.feestemplateForm = {}
  1030. this.feestemplateIndex = null
  1031. this.feestemplateVisible = false
  1032. },
  1033. // 费用详细关闭
  1034. feestemplateClose(done) {
  1035. done();
  1036. // this.$confirm('确认关闭?')
  1037. // .then(_ => {
  1038. // done();
  1039. // })
  1040. // .catch(_ => {});
  1041. },
  1042. //返回列表
  1043. backToList() {
  1044. this.$emit('goBack')
  1045. },
  1046. // 表头样式
  1047. tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
  1048. return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff;textAlign:center"
  1049. },
  1050. // 更改表格颜色
  1051. headerClassName(tab) {
  1052. //颜色间隔
  1053. let back = ""
  1054. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1055. if (tab.columnIndex % 2 === 0) {
  1056. back = "back-one"
  1057. } else if (tab.columnIndex % 2 === 1) {
  1058. back = "back-two"
  1059. }
  1060. }
  1061. return back;
  1062. },
  1063. }
  1064. }
  1065. </script>
  1066. <style scoped>
  1067. ::v-deep#out-table .back-one {
  1068. background: #ecf5ff !important;
  1069. }
  1070. ::v-deep#out-table .back-two {
  1071. background: #ecf5ff !important;
  1072. }
  1073. .borderless {
  1074. height: 100%;
  1075. box-sizing: border-box
  1076. }
  1077. .customer-main {
  1078. margin-bottom: 15px;
  1079. }
  1080. .margintop {
  1081. margin-top: 10px;
  1082. }
  1083. ::v-deep.el-form-item {
  1084. margin-bottom: 0;
  1085. }
  1086. .isShow {
  1087. display: none;
  1088. }
  1089. .nowrapClass {
  1090. width: 100%;
  1091. overflow: hidden;
  1092. white-space: nowrap;
  1093. text-overflow: ellipsis;
  1094. }
  1095. </style>