AddOrUpdate.vue 37 KB

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