feesTemplateItems.vue 53 KB

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