AddOrUpdate.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222
  1. <template>
  2. <div>
  3. <div
  4. style="display: flex; justify-content: space-between; margin-bottom: 15px"
  5. >
  6. <div style="display: flex; align-items: center">
  7. <el-breadcrumb separator="/">
  8. <el-breadcrumb-item
  9. ><span style="font-weight: 700">运费规则</span></el-breadcrumb-item
  10. >
  11. <el-breadcrumb-item
  12. ><span style="font-weight: 700">运价维护</span></el-breadcrumb-item
  13. >
  14. </el-breadcrumb>
  15. <el-button
  16. style="margin-left: 10px"
  17. size="mini"
  18. icon="el-icon-arrow-left"
  19. @click="goBack"
  20. >返回列表</el-button
  21. >
  22. </div>
  23. </div>
  24. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  25. <el-row>
  26. <el-col :span="8">
  27. <el-form-item label="船公司" prop="fCorpid">
  28. <el-select
  29. size="small"
  30. v-model="form.fCorpid"
  31. clearable
  32. filterable
  33. placeholder="请输入关键词"
  34. style="width: 80%"
  35. :disabled="formStatus"
  36. >
  37. <el-option
  38. v-for="(item, index) in fMblnoOptions"
  39. :key="index.fId"
  40. :label="item.fName"
  41. :value="item.fId"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="8">
  47. <el-form-item label="起运港" prop="polId">
  48. <el-select
  49. size="small"
  50. v-model="form.polId"
  51. clearable
  52. filterable
  53. placeholder="请输入关键词"
  54. style="width: 80%"
  55. :disabled="formStatus"
  56. >
  57. <el-option
  58. v-for="(item, index) in podList"
  59. :key="index.fId"
  60. :label="item.fName"
  61. :value="item.fId"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="8">
  67. <el-form-item label="目的港" prop="podId">
  68. <el-select
  69. size="small"
  70. v-model="form.podId"
  71. clearable
  72. filterable
  73. placeholder="请输入关键词"
  74. style="width: 80%"
  75. :disabled="formStatus"
  76. >
  77. <el-option
  78. v-for="(item, index) in podList"
  79. :key="index.fId"
  80. :label="item.fName"
  81. :value="item.fId"
  82. ></el-option>
  83. </el-select>
  84. </el-form-item>
  85. </el-col>
  86. </el-row>
  87. <el-row>
  88. <el-col :span="8">
  89. <el-form-item label="有效期" prop="fValiddate">
  90. <el-date-picker
  91. v-model="form.fValiddate"
  92. type="date"
  93. placeholder="选择有效期"
  94. size="small"
  95. style="width: 80%"
  96. :clearable="false"
  97. value-format="timestamp"
  98. :disabled="formStatus"
  99. >
  100. </el-date-picker>
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="8">
  104. <el-form-item label="录入人" prop="createBy">
  105. <el-input
  106. size="small"
  107. v-model="form.createBy"
  108. style="width: 80%"
  109. disabled
  110. laceholder="录入人"
  111. >
  112. </el-input>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="8">
  116. <el-form-item label="业务类型" prop="fBilltype">
  117. <el-select
  118. size="small"
  119. v-model="form.fBilltype"
  120. placeholder="请选择结算方式"
  121. clearable
  122. style="width: 80%"
  123. :disabled="formStatus"
  124. >
  125. <el-option
  126. v-for="(item, index) in billTypeList"
  127. :key="index.dictValue"
  128. :label="item.dictLabel"
  129. :value="item.dictValue"
  130. />
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. </el-row>
  135. <el-row>
  136. <el-col :span="8">
  137. <el-form-item label="状态" prop="fBillstatus">
  138. <el-select
  139. size="small"
  140. clearable
  141. filterable
  142. placeholder="请选择"
  143. style="width: 80%"
  144. v-model="form.fBillstatus"
  145. :disabled="formStatus"
  146. >
  147. <el-option
  148. v-for="(item, index) in statusList"
  149. :key="index.dictValue"
  150. :label="item.dictLabel"
  151. :value="item.dictValue"
  152. />
  153. </el-select>
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span="8">
  157. <el-form-item label="航线" prop="fLineid">
  158. <el-select
  159. size="small"
  160. clearable
  161. filterable
  162. placeholder="请选择"
  163. style="width: 80%"
  164. v-model="form.fLineid"
  165. :disabled="formStatus"
  166. >
  167. <el-option
  168. v-for="(item, index) in fLineList"
  169. :key="index.fId"
  170. :label="item.fName"
  171. :value="item.fId"
  172. />
  173. </el-select>
  174. </el-form-item>
  175. </el-col>
  176. <el-col :span="8">
  177. <el-form-item label="订舱代理" prop="fBookagentid">
  178. <el-select
  179. size="small"
  180. clearable
  181. filterable
  182. placeholder="请选择"
  183. style="width: 80%"
  184. v-model="form.fBookagentid"
  185. :disabled="formStatus"
  186. >
  187. <el-option
  188. v-for="(item, index) in fBookagentList"
  189. :key="index.fId"
  190. :label="item.fName"
  191. :value="item.fId"
  192. />
  193. </el-select>
  194. </el-form-item>
  195. </el-col>
  196. </el-row>
  197. <el-row>
  198. <el-col :span="24">
  199. <el-form-item label="备注" prop="remarks">
  200. <el-input
  201. style="width: 94.5%"
  202. v-model="form.remarks"
  203. type="textarea"
  204. placeholder="请输入内容"
  205. :disabled="formStatus"
  206. />
  207. </el-form-item>
  208. </el-col>
  209. </el-row>
  210. </el-form>
  211. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  212. <el-tab-pane label="海运费" name="1">
  213. <div>
  214. <div
  215. style="
  216. display: flex;
  217. justify-content: space-between;
  218. margin-bottom: 10px;
  219. "
  220. >
  221. <div>
  222. <el-button
  223. type="primary"
  224. size="mini"
  225. @click="addDetailRow"
  226. :disabled="formStatus"
  227. >新增</el-button
  228. >
  229. <el-button
  230. type="success"
  231. size="mini"
  232. @click="saveForm"
  233. :disabled="formStatus"
  234. >保存</el-button
  235. >
  236. <el-button type="warning" size="mini" :disabled="formStatus"
  237. >打印</el-button
  238. >
  239. <el-button
  240. type="danger"
  241. size="mini"
  242. @click="submitForm"
  243. :disabled="formStatus"
  244. >请核</el-button
  245. >
  246. <el-button
  247. size="mini"
  248. type="info"
  249. @click="fixForm"
  250. :disabled="!formStatus"
  251. >修改</el-button
  252. >
  253. </div>
  254. <div>
  255. <el-button
  256. icon="el-icon-setting"
  257. size="mini"
  258. circle
  259. @click="showSetting = !showSetting"
  260. ></el-button>
  261. </div>
  262. </div>
  263. <el-table
  264. :data="detailList"
  265. tooltip-effect="dark"
  266. stripe
  267. @selection-change="Selectinventory"
  268. >
  269. <el-table-column type="selection" width="55" align="center" fixed />
  270. <el-table-column label="序号" type="index" width="50" fixed />
  271. <el-table-column
  272. v-for="(item, index) in getRowList"
  273. :key="index"
  274. :label="item.name"
  275. :width="item.width"
  276. :prop="item.label"
  277. align="center"
  278. :fixed="item.fixed"
  279. sortable
  280. >
  281. <template slot-scope="scope">
  282. <span v-if="item.label == 'fFeeid'">
  283. <el-select
  284. v-model="scope.row.fFeeid"
  285. filterable
  286. placeholder="请选择"
  287. :disabled="formStatus"
  288. >
  289. <el-option
  290. v-for="(item, index) in listFeesList"
  291. :key="index.fId"
  292. :label="item.fName"
  293. :value="item.fId"
  294. ></el-option>
  295. </el-select>
  296. </span>
  297. <span v-else-if="item.label == 'fSpecification1'">
  298. <el-input
  299. v-model="scope.row.fSpecification1"
  300. placeholder="请输入"
  301. v-input-limit="2"
  302. :disabled="formStatus"
  303. />
  304. </span>
  305. <span v-else-if="item.label == 'fSpecification2'">
  306. <el-input
  307. v-model="scope.row.fSpecification2"
  308. placeholder="请输入"
  309. v-input-limit="2"
  310. :disabled="formStatus"
  311. />
  312. </span>
  313. <span v-else-if="item.label == 'fSpecification3'">
  314. <el-input
  315. v-model="scope.row.fSpecification3"
  316. placeholder="请输入"
  317. v-input-limit="2"
  318. :disabled="formStatus"
  319. />
  320. </span>
  321. <span v-else-if="item.label == 'fSpecification4'">
  322. <el-input
  323. v-model="scope.row.fSpecification4"
  324. placeholder="请输入"
  325. v-input-limit="2"
  326. :disabled="formStatus"
  327. />
  328. </span>
  329. <span v-else-if="item.label == 'fSpecification5'">
  330. <el-input
  331. v-model="scope.row.fSpecification5"
  332. placeholder="请输入"
  333. v-input-limit="2"
  334. :disabled="formStatus"
  335. />
  336. </span>
  337. <span v-else-if="item.label == 'fSpecification6'">
  338. <el-input
  339. v-model="scope.row.fSpecification6"
  340. placeholder="请输入"
  341. v-input-limit="2"
  342. :disabled="formStatus"
  343. />
  344. </span>
  345. <span v-else-if="item.label == 'fExrate'">
  346. <el-input
  347. v-model="scope.row.fExrate"
  348. placeholder="请输入"
  349. v-input-limit="2"
  350. :disabled="formStatus"
  351. />
  352. </span>
  353. <span v-else-if="item.label == 'createTime'">
  354. {{ scope.row.createTime | fBsdateFormat }}
  355. </span>
  356. <span v-else-if="item.label == 'updateTime'">
  357. {{ scope.row.updateTime | fBsdateFormat }}
  358. </span>
  359. <span v-else-if="item.label == 'remark'">
  360. <el-input
  361. v-model="scope.row.remark"
  362. placeholder="备注"
  363. show-word-limit
  364. :disabled="formStatus"
  365. />
  366. </span>
  367. <span v-else>{{ scope.row[item.label] }}</span>
  368. </template>
  369. </el-table-column>
  370. <el-table-column
  371. header-align="center"
  372. align="center"
  373. label="操作"
  374. width="130px"
  375. fixed="right"
  376. >
  377. <template slot-scope="scope">
  378. <el-button
  379. type="text"
  380. @click.native.prevent="
  381. DeldetailRow(scope.row, scope.$index, detailList, 0)
  382. "
  383. size="small"
  384. :disabled="formStatus"
  385. >移除</el-button
  386. >
  387. </template>
  388. </el-table-column>
  389. </el-table>
  390. </div>
  391. <el-dialog
  392. title="自定义列显示"
  393. :visible.sync="showSetting"
  394. width="700px"
  395. v-dialogDrag
  396. :close-on-click-modal="false"
  397. >
  398. <template slot="title">
  399. <div class="avue-crud__dialog__header">
  400. <span class="el-dialog__title">
  401. <span
  402. style="
  403. display: inline-block;
  404. width: 3px;
  405. height: 20px;
  406. margin-right: 5px;
  407. float: left;
  408. margin-top: 2px;
  409. "
  410. ></span>
  411. </span>
  412. </div>
  413. </template>
  414. <div>配置排序列数据(拖动调整顺序)</div>
  415. <div style="margin-left: 17px">
  416. <el-checkbox
  417. v-model="allCheck"
  418. label="全选"
  419. @change="allChecked"
  420. ></el-checkbox>
  421. </div>
  422. <div style="padding: 4px; display: flex; justify-content: center">
  423. <draggable
  424. v-model="setRowList"
  425. group="site"
  426. animation="300"
  427. @start="onStart"
  428. @end="onEnd"
  429. handle=".indraggable"
  430. >
  431. <transition-group>
  432. <div
  433. v-for="item in setRowList"
  434. :key="item.surface"
  435. class="listStyle"
  436. >
  437. <div style="width: 500px" class="indraggable">
  438. <div class="progress" :style="{ width: item.width + 'px' }">
  439. <el-checkbox
  440. :label="item.name"
  441. v-model="item.checked"
  442. :true-label="0"
  443. :false-label="1"
  444. >{{ item.name }}
  445. </el-checkbox>
  446. </div>
  447. </div>
  448. <el-input-number
  449. v-model.number="item.width"
  450. controls-position="right"
  451. :min="1"
  452. :max="500"
  453. size="small"
  454. ></el-input-number>
  455. </div>
  456. </transition-group>
  457. </draggable>
  458. </div>
  459. <span slot="footer" class="dialog-footer">
  460. <el-button @click="showSetting = false">取 消</el-button>
  461. <el-button @click="delRow" type="danger">重 置</el-button>
  462. <el-button type="primary" @click="save()">确 定</el-button>
  463. </span>
  464. </el-dialog>
  465. </el-tab-pane>
  466. <el-tab-pane label="杂项费" name="2">
  467. <div>
  468. <div style="display: flex; margin-bottom: 10px">
  469. <div>
  470. <el-button
  471. type="primary"
  472. size="mini"
  473. @click="addDetailRow2"
  474. :disabled="formStatus"
  475. >新增</el-button
  476. >
  477. <el-button
  478. type="success"
  479. size="mini"
  480. @click="saveForm"
  481. :disabled="formStatus"
  482. >保存</el-button
  483. >
  484. <el-button type="warning" size="mini" :disabled="formStatus"
  485. >打印</el-button
  486. >
  487. <el-button
  488. type="danger"
  489. size="mini"
  490. @click="submitForm"
  491. :disabled="formStatus"
  492. >请核</el-button
  493. >
  494. <el-button
  495. size="mini"
  496. type="info"
  497. @click="fixForm"
  498. :disabled="!formStatus"
  499. >修改</el-button
  500. >
  501. </div>
  502. </div>
  503. <el-table
  504. :data="detailList2"
  505. tooltip-effect="dark"
  506. stripe
  507. @selection-change="Selectinventory"
  508. >
  509. <el-table-column type="selection" width="55" align="center" fixed />
  510. <el-table-column label="序号" type="index" width="50" fixed />
  511. <el-table-column label="费用" prop="fFeeid" align="center" sortable>
  512. <template slot-scope="scope">
  513. <el-select
  514. v-model="scope.row.fFeeid"
  515. filterable
  516. placeholder="请选择"
  517. :disabled="formStatus"
  518. >
  519. <el-option
  520. v-for="(item, index) in listFeesList"
  521. :key="index.fId"
  522. :label="item.fName"
  523. :value="item.fId"
  524. ></el-option>
  525. </el-select>
  526. </template>
  527. </el-table-column>
  528. <el-table-column
  529. label="单价"
  530. prop="fUnitprice"
  531. align="center"
  532. sortable
  533. >
  534. <template slot-scope="scope">
  535. <el-input
  536. v-model="scope.row.fUnitprice"
  537. placeholder="请输入"
  538. v-input-limit="2"
  539. :disabled="formStatus"
  540. />
  541. </template>
  542. </el-table-column>
  543. <el-table-column label="备注" prop="remark" align="center" sortable>
  544. <template slot-scope="scope">
  545. <el-input
  546. v-model="scope.row.remark"
  547. placeholder="请输入"
  548. :disabled="formStatus"
  549. />
  550. </template>
  551. </el-table-column>
  552. <el-table-column
  553. label="录入人"
  554. prop="createBy"
  555. align="center"
  556. sortable
  557. />
  558. <el-table-column
  559. label="录入时间"
  560. prop="createTime"
  561. align="center"
  562. sortable
  563. >
  564. <template slot-scope="scope">
  565. {{ scope.row.createTime | fBsdateFormat }}
  566. </template>
  567. </el-table-column>
  568. <el-table-column
  569. label="最新修改人"
  570. prop="updateBy"
  571. align="center"
  572. sortable
  573. />
  574. <el-table-column
  575. label="最新修改时间"
  576. prop="updateTime"
  577. align="center"
  578. sortable
  579. >
  580. <template slot-scope="scope">
  581. {{ scope.row.updateTime | fBsdateFormat }}
  582. </template>
  583. </el-table-column>
  584. <el-table-column
  585. header-align="center"
  586. align="center"
  587. label="操作"
  588. width="130px"
  589. fixed="right"
  590. >
  591. <template slot-scope="scope">
  592. <el-button
  593. type="text"
  594. @click.native.prevent="
  595. DeldetailRow(scope.row, scope.$index, detailList2, 1)
  596. "
  597. size="small"
  598. :disabled="formStatus"
  599. >移除</el-button
  600. >
  601. </template>
  602. </el-table-column>
  603. </el-table>
  604. </div>
  605. </el-tab-pane>
  606. </el-tabs>
  607. <br />
  608. <div
  609. style="display: flex; justify-content: flex-end; margin-top: 10px"
  610. ></div>
  611. </div>
  612. </template>
  613. <script>
  614. import {
  615. checkCode,
  616. saveSeaprice,
  617. addSeaprice,
  618. getForm,
  619. listCorpsList,
  620. shippingCompany, listRoute
  621. } from "@/api/warehouseBusiness/shipping";
  622. import { listCorps } from "@/api/basicdata/corps";
  623. import { listFees } from "@/api/basicdata/fees";
  624. import { queryUserVal } from "@/api/system/user";
  625. import ApprovalComments from "@/views/startApproval";
  626. import AddOrUpdate from "@/views/viewApproval";
  627. import Treeselect from "@riophae/vue-treeselect";
  628. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  629. import Cookies from "js-cookie";
  630. import { addSet, select, resetModule } from "@/api/system/set";
  631. import draggable from "vuedraggable";
  632. export default {
  633. name: "inStock",
  634. props: {
  635. chiId: {
  636. type: Number,
  637. required: null,
  638. },
  639. copyStatus: {
  640. type: Number,
  641. required: null,
  642. },
  643. },
  644. components: {
  645. Treeselect,
  646. AddOrUpdate,
  647. ApprovalComments,
  648. draggable,
  649. },
  650. data() {
  651. return {
  652. pageNum: 1,
  653. pageSize: 10,
  654. fMblnoOptions: [],
  655. form: {},
  656. rules: {
  657. fBilltype: [{ required: true, message: " ", trigger: "blur" }],
  658. fCorpid: [{ required: true, message: " ", trigger: "blur" }],
  659. fBillstatus: [{ required: true, message: " ", trigger: "blur" }],
  660. polId: [{ required: true, message: " ", trigger: "blur" }],
  661. podId: [{ required: true, message: " ", trigger: "blur" }],
  662. // fValiddate: [{ required: true, message: " ", trigger: "blur" }],
  663. },
  664. drag: false,
  665. tableDate: [
  666. {
  667. surface: "1",
  668. label: "fFeeid",
  669. name: "费用",
  670. checked: 0,
  671. width: 120,
  672. },
  673. {
  674. surface: "2",
  675. label: "fSpecification1",
  676. name: "20GP",
  677. checked: 0,
  678. width: 120,
  679. },
  680. {
  681. surface: "3",
  682. label: "fSpecification2",
  683. name: "40GP",
  684. checked: 0,
  685. width: 100,
  686. },
  687. {
  688. surface: "4",
  689. label: "fSpecification3",
  690. name: "40HC",
  691. checked: 0,
  692. width: 100,
  693. },
  694. {
  695. surface: "5",
  696. label: "fSpecification4",
  697. name: "45HC",
  698. checked: 0,
  699. width: 100,
  700. },
  701. {
  702. surface: "6",
  703. label: "fSpecification5",
  704. name: "20RH",
  705. checked: 0,
  706. width: 100,
  707. },
  708. {
  709. surface: "7",
  710. label: "fSpecification6",
  711. name: "40RH",
  712. checked: 0,
  713. width: 100,
  714. },
  715. {
  716. surface: "8",
  717. label: "fExrate",
  718. name: "汇率",
  719. checked: 0,
  720. width: 120,
  721. },
  722. {
  723. surface: "10",
  724. label: "remark",
  725. name: "备注",
  726. checked: 0,
  727. width: 120,
  728. },
  729. {
  730. surface: "11",
  731. label: "createBy",
  732. name: "录入人",
  733. checked: 0,
  734. width: 120,
  735. },
  736. {
  737. surface: "12",
  738. label: "createTime",
  739. name: "录入时间",
  740. checked: 0,
  741. width: 120,
  742. },
  743. {
  744. surface: "13",
  745. label: "updateBy",
  746. name: "最新修改人",
  747. checked: 0,
  748. width: 150,
  749. },
  750. {
  751. surface: "14",
  752. label: "updateTime",
  753. name: "最新修改时间",
  754. checked: 0,
  755. width: 150,
  756. },
  757. ],
  758. setRowList: [],
  759. getRowList: [],
  760. allCheck: false,
  761. showSetting: false,
  762. activeName: "1",
  763. detailList: [],
  764. detailList2: [],
  765. billTypeList: [],
  766. statusList: [],
  767. polList: [],
  768. podList: [],
  769. listFeesList: [],
  770. formStatus: false,
  771. deleteItem0: [],
  772. deleteItem1: [],
  773. fLineList: [],
  774. fBookagentList: [],
  775. };
  776. },
  777. created() {
  778. this.setRowList = this.tableDate;
  779. this.getRowList = this.tableDate;
  780. listCorps({ type: 1 }).then((response) => {
  781. this.fMblnoOptions = response.rows;
  782. });
  783. listFees().then((response) => {
  784. this.listFeesList = response.rows;
  785. });
  786. this.getDicts("data_billType").then((response) => {
  787. this.billTypeList = response.data;
  788. });
  789. listCorpsList().then( response =>{
  790. this.fLineList = response.rows
  791. })
  792. shippingCompany().then( response =>{
  793. this.fBookagentList = response.rows
  794. })
  795. this.getDicts("data_status").then((response) => {
  796. this.statusList = response.data;
  797. });
  798. // this.getDicts("port_start").then((response) => {
  799. // this.polList = response.data;
  800. // });
  801. // this.getDicts("port_end").then((response) => {
  802. // this.podList = response.data;
  803. // });
  804. listRoute({}).then(response => {
  805. response.rows.forEach(item=>item.fId = JSON.stringify(item.fId))
  806. this.podList = response.rows
  807. });
  808. this.form.fValiddate = new Date()
  809. this.queryUser();
  810. this.getRow();
  811. },
  812. filters: {
  813. fBsdateFormat(row) {
  814. if (row) {
  815. const dateMat = new Date(row);
  816. const year = dateMat.getFullYear();
  817. const month = dateMat.getMonth() + 1;
  818. const day = dateMat.getDate();
  819. const timeFormat = year + "-" + month + "-" + day;
  820. return timeFormat;
  821. }
  822. },
  823. },
  824. methods: {
  825. init() {
  826. this.resetForm("form");
  827. if(!this.copyStatus){
  828. this.formStatus = true;
  829. }
  830. this.getForm();
  831. },
  832. //列设置全选
  833. allChecked() {
  834. if (this.allCheck == true) {
  835. this.setRowList.map((e) => {
  836. return (e.checked = 0);
  837. });
  838. } else {
  839. this.setRowList.map((e) => {
  840. return (e.checked = 1);
  841. });
  842. }
  843. },
  844. //查询列数据
  845. getRow() {
  846. let that = this;
  847. this.data = {
  848. tableName: "运费规则",
  849. userId: Cookies.get("userName"),
  850. };
  851. select(this.data).then((res) => {
  852. if (res.data.length != 0) {
  853. this.getRowList = res.data.filter((e) => e.checked == 0);
  854. this.setRowList = res.data;
  855. this.setRowList = this.setRowList.reduce((res, item) => {
  856. res.push({
  857. surface: item.surface,
  858. label: item.label,
  859. name: item.name,
  860. checked: item.checked,
  861. width: item.width,
  862. fixed: item.fixed,
  863. });
  864. return res;
  865. }, []);
  866. }
  867. });
  868. },
  869. //重置列表
  870. delRow() {
  871. this.data = {
  872. tableName: "运费规则",
  873. userId: Cookies.get("userName"),
  874. };
  875. resetModule(this.data).then((res) => {
  876. if (res.code == 200) {
  877. this.showSetting = false;
  878. this.setRowList = this.$options.data().tableDate;
  879. this.getRowList = this.$options.data().tableDate;
  880. }
  881. });
  882. },
  883. //保存列设置
  884. save() {
  885. this.showSetting = false;
  886. this.data = {
  887. tableName: "运费规则",
  888. userId: Cookies.get("userName"),
  889. sysTableSetList: this.setRowList,
  890. };
  891. addSet(this.data).then((res) => {
  892. if (res.code == 200) {
  893. this.showSetting = false;
  894. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  895. }
  896. });
  897. },
  898. //开始拖拽事件
  899. onStart() {
  900. this.drag = true;
  901. },
  902. //拖拽结束事件
  903. onEnd() {
  904. this.drag = false;
  905. },
  906. handleClick(tab, event) {
  907. console.log(tab, event);
  908. },
  909. Selectinventory() {},
  910. addDetailRow() {
  911. this.detailList.push({
  912. fFeeid: null,
  913. fSpecification1: null,
  914. fSpecification2: null,
  915. fSpecification3: null,
  916. fSpecification4: null,
  917. fSpecification5: null,
  918. fSpecification6: null,
  919. fExrate: null,
  920. remark:'箱量',
  921. createBy: this.userVal.userName,
  922. createTime: Date.parse(new Date()),
  923. updateBy: this.userVal.userName,
  924. updateTime: Date.parse(new Date()),
  925. });
  926. },
  927. addDetailRow2() {
  928. this.detailList2.push({
  929. fFeeid: null,
  930. fUnitprice: null,
  931. remark:'票',
  932. createBy: this.userVal.userName,
  933. createTime: Date.parse(new Date()),
  934. updateBy: this.userVal.userName,
  935. updateTime: Date.parse(new Date()),
  936. });
  937. },
  938. DeldetailRow(row, index, rows, status) {
  939. if (status == 0 && row.fId) {
  940. this.deleteItem0.push(row.fId);
  941. this.form.deleteItem0 = this.deleteItem0;
  942. console.log(this.form.deleteItem0);
  943. }
  944. if (status == 1 && row.fId) {
  945. this.deleteItem1.push(row.fId);
  946. this.form.deleteItem1 = this.deleteItem1;
  947. console.log(this.form.deleteItem1);
  948. }
  949. rows.splice(index, 1);
  950. },
  951. TFformdata(data) {
  952. data.fBilltype = data.fBilltype ? data.fBilltype.toString() : null;
  953. data.fBillstatus = JSON.stringify(data.fBillstatus).length > 0?JSON.stringify(data.fBillstatus):null
  954. data.polId = data.polId ? data.polId.toString() : null;
  955. data.podId = data.podId ? data.podId.toString() : null;
  956. data.fLineid = data.fLineid ? Number(data.fLineid):null
  957. data.fBookagentid = data.fBookagentid ? Number(data.fBookagentid):null
  958. data.fValiddate = data.fValiddate ? Date.parse(data.fValiddate) : null;
  959. this.form = data;
  960. },
  961. getForm() {
  962. getForm(this.chiId).then((response) => {
  963. this.TFformdata(response.data.seaprice);
  964. this.detailList = response.data.seapriceItem;
  965. this.detailList2 = response.data.seapriceFees;
  966. if (this.copyStatus) {
  967. this.form.fId = null;
  968. this.form.fDateChanged = null;
  969. this.detailList.map((e) => {
  970. e.fId = null;
  971. e.fPid = null;
  972. });
  973. this.detailList2.map((e) => {
  974. e.fId = null;
  975. e.fPid = null;
  976. });
  977. // this.$set(this.form, "fId", null);
  978. // this.detailList;
  979. // this.$set(this.detailList, index);
  980. }
  981. });
  982. },
  983. fixForm() {
  984. let checkData = {
  985. fId: this.form.fId,
  986. fType: "freight",
  987. codeVal: this.form.fDateChanged,
  988. };
  989. checkCode(checkData).then((response) => {
  990. if (!response) {
  991. this.$confirm("数据发生变化,请更新一下数据?", "提示", {
  992. confirmButtonText: "确认",
  993. cancelButtonText: "取消",
  994. type: "warning",
  995. }).then(() => {
  996. this.getForm();
  997. });
  998. } else {
  999. this.formStatus = false;
  1000. }
  1001. });
  1002. },
  1003. saveForm(type) {
  1004. let checkData = {
  1005. fId: this.form.fId,
  1006. fType: "freight",
  1007. codeVal: this.form.fDateChanged,
  1008. };
  1009. checkCode(checkData).then((response) => {
  1010. if (!response) {
  1011. this.$confirm("数据发生变化,请更新一下数据?", "提示", {
  1012. confirmButtonText: "确认",
  1013. cancelButtonText: "取消",
  1014. type: "warning",
  1015. }).then(() => {
  1016. this.getForm();
  1017. });
  1018. } else {
  1019. this.$refs["form"].validate((valid) => {
  1020. if (valid) {
  1021. let formData = new window.FormData();
  1022. formData.append("seaprice", JSON.stringify(this.form));
  1023. // 库存明细1
  1024. formData.append("seapriceItem", JSON.stringify(this.detailList));
  1025. // 库存明细2
  1026. formData.append(
  1027. "seapriceFlees",
  1028. JSON.stringify(this.detailList2)
  1029. );
  1030. saveSeaprice(formData).then((response) => {
  1031. if (response.code == 200) {
  1032. this.TFformdata(response.data.seaprice);
  1033. this.detailList=response.data.itemList?response.data.itemList:[]
  1034. this.detailList2=response.data.itemList2?response.data.itemList2:[]
  1035. this.msgSuccess("保存成功");
  1036. if (!type){
  1037. this.cancel();
  1038. }
  1039. }
  1040. });
  1041. }
  1042. });
  1043. }
  1044. });
  1045. },
  1046. submitForm() {
  1047. let checkData = {
  1048. fId: this.form.fId,
  1049. fType: "freight",
  1050. codeVal: this.form.fDateChanged,
  1051. };
  1052. checkCode(checkData).then((response) => {
  1053. if (!response) {
  1054. this.$confirm("数据发生变化,请更新一下数据?", "提示", {
  1055. confirmButtonText: "确认",
  1056. cancelButtonText: "取消",
  1057. type: "warning",
  1058. }).then(() => {
  1059. this.getForm();
  1060. });
  1061. } else {
  1062. this.$refs["form"].validate((valid) => {
  1063. if (valid) {
  1064. if (!this.detailList.length) {
  1065. return this.$message.error("海运费不能为空");
  1066. }
  1067. for (let item in this.detailList) {
  1068. if (!this.detailList[item].fFeeid) {
  1069. return this.$message.error(
  1070. "海运费第" + (Number(item) + 1) + "行费用不能为空"
  1071. );
  1072. }
  1073. if (this.detailList[item].fSpecification1.length < 1) {
  1074. return this.$message.error(
  1075. "海运费第" + (Number(item) + 1) + "行20GP不能为空"
  1076. );
  1077. }
  1078. if (this.detailList[item].fSpecification2.length < 1) {
  1079. return this.$message.error(
  1080. "海运费第" + (Number(item) + 1) + "行40GP不能为空"
  1081. );
  1082. }
  1083. if (this.detailList[item].fSpecification3.length < 1) {
  1084. return this.$message.error(
  1085. "海运费第" + (Number(item) + 1) + "行40HC不能为空"
  1086. );
  1087. }
  1088. if (this.detailList[item].fSpecification4.length < 1) {
  1089. return this.$message.error(
  1090. "海运费第" + (Number(item) + 1) + "行45HC不能为空"
  1091. );
  1092. }
  1093. if (this.detailList[item].fSpecification5.length < 1) {
  1094. return this.$message.error(
  1095. "海运费第" + (Number(item) + 1) + "行20RH不能为空"
  1096. );
  1097. }
  1098. if (this.detailList[item].fSpecification6.length < 1) {
  1099. return this.$message.error(
  1100. "海运费第" + (Number(item) + 1) + "行40RH不能为空"
  1101. );
  1102. }
  1103. if (this.detailList[item].fExrate.length < 1) {
  1104. return this.$message.error(
  1105. "海运费第" + (Number(item) + 1) + "行汇率不能为空"
  1106. );
  1107. }
  1108. }
  1109. if (!this.detailList2.length) {
  1110. this.$message.error("杂项费不能为空");
  1111. }
  1112. for (let item in this.detailList2) {
  1113. if (!this.detailList2[item].fFeeid) {
  1114. return this.$message.error(
  1115. "杂项费第" + (Number(item) + 1) + "行费用不能为空"
  1116. );
  1117. }
  1118. if (!this.detailList2[item].fUnitprice) {
  1119. return this.$message.error(
  1120. "杂项费第" + (Number(item) + 1) + "行单价不能为空"
  1121. );
  1122. }
  1123. }
  1124. let formData = new window.FormData();
  1125. formData.append("seaprice", JSON.stringify(this.form));
  1126. formData.append("seapriceItem", JSON.stringify(this.detailList));
  1127. formData.append(
  1128. "seapriceFlees",
  1129. JSON.stringify(this.detailList2)
  1130. );
  1131. addSeaprice(formData).then((response) => {
  1132. if (response.code == 200) {
  1133. this.msgSuccess("请核成功");
  1134. this.cancel();
  1135. }
  1136. });
  1137. }
  1138. });
  1139. }
  1140. });
  1141. },
  1142. //获取登陆人
  1143. queryUser() {
  1144. queryUserVal().then((response) => {
  1145. if (response.user !== null) {
  1146. this.userVal = response.user;
  1147. this.$set(this.form, "fDeptid", this.userVal.deptId);
  1148. this.$set(this.form, "createBy", this.userVal.userName);
  1149. this.$set(this.form, "fStorekeeper", this.userVal.nickName);
  1150. this.$set(this.form, "fIfdamage", "1");
  1151. this.$set(this.form, "fIfweigh", "1");
  1152. this.$set(this.form, "fTrademodeid", "1");
  1153. this.$set(this.form, "createTime", Date.parse(new Date()));
  1154. this.$set(this.form, "fBstime", Date.parse(new Date()));
  1155. }
  1156. if (response.dept !== null) {
  1157. this.deptOptions = [];
  1158. this.deptOptions.push(response.dept);
  1159. }
  1160. });
  1161. },
  1162. cancel() {
  1163. if (this.$route.query.id) {
  1164. this.$router.push({ query: {} });
  1165. }
  1166. this.resetForm("form");
  1167. this.$emit("changeShow", "true");
  1168. },
  1169. goBack() {
  1170. this.$confirm("是否确定返回列表?", "提示", {
  1171. cancelButtonText: "取消",
  1172. confirmButtonText: "保存",
  1173. type: "warning",
  1174. }).then(() => {
  1175. this.saveForm(false);
  1176. }).catch(() => {
  1177. this.cancel();
  1178. });
  1179. },
  1180. },
  1181. watch: {
  1182. // 监听 addOrUpdateVisible 改变
  1183. addOrUpdateVisible(oldVal, newVal) {
  1184. this.showDialog = this.addOrUpdateVisible;
  1185. },
  1186. },
  1187. };
  1188. </script>
  1189. <style lang="scss" scoped>
  1190. .tag-hover:hover {
  1191. background-color: #d9ebfb;
  1192. }
  1193. .tag-hover {
  1194. border-top-left-radius: 0;
  1195. border-bottom-left-radius: 0;
  1196. height: 15px;
  1197. padding: 0px 1px;
  1198. line-height: 12px;
  1199. }
  1200. .print-div {
  1201. color: #000;
  1202. }
  1203. .print_table {
  1204. table {
  1205. border-right: 1px solid #000;
  1206. border-bottom: 1px solid #000;
  1207. font-size: 12px;
  1208. margin-bottom: 5px;
  1209. }
  1210. table td {
  1211. border-left: 1px solid #000;
  1212. border-top: 1px solid #000;
  1213. vertical-align: middle;
  1214. padding: 2px;
  1215. text-align: center;
  1216. }
  1217. }
  1218. .print_form {
  1219. font-size: 12px;
  1220. }
  1221. </style>