feesTemplateItems.vue 53 KB

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