index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-row>
  5. <el-col :span="6">
  6. <el-form-item label-width="100px" label="船名" prop="fVslid">
  7. <el-select
  8. v-model="queryParams.fVslid"
  9. placeholder="请选择船名"
  10. clearable
  11. size="small"
  12. filterable
  13. >
  14. <el-option
  15. v-for="item in vesselOptions"
  16. :key="item.fId"
  17. :label="item.fName"
  18. :value="item.fId"
  19. />
  20. </el-select>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="6">
  24. <el-form-item label-width="100px" label="航次" prop="fVoyid">
  25. <el-select
  26. v-model="queryParams.fVoyid"
  27. placeholder="请选择航次"
  28. clearable
  29. size="small"
  30. filterable
  31. >
  32. <el-option
  33. v-for="item in voyageOptions"
  34. :key="item.fId"
  35. :label="item.fNo"
  36. :value="item.fId"/>
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. </el-form>
  42. <el-row :gutter="10" style="padding-bottom: 10px">
  43. <el-col :span="1.5">
  44. <el-button type="primary" size="mini" :disabled="single" @click="departureShipment">离港出运</el-button>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-date-picker
  48. type="datetime"
  49. placeholder="选择离港时间"
  50. format="yyyy-MM-dd HH:mm"
  51. value-format="yyyy-MM-dd HH:mm"
  52. size="mini"
  53. v-model="departure"
  54. ></el-date-picker>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button type="primary" size="mini" :disabled="single" @click="unloading">到港卸船</el-button>
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-date-picker
  61. type="datetime"
  62. placeholder="选择到港时间"
  63. format="yyyy-MM-dd HH:mm"
  64. value-format="yyyy-MM-dd HH:mm"
  65. size="mini"
  66. v-model="arrival"
  67. ></el-date-picker>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button type="primary" size="mini" @click="shipInventoryExport">导出装卸船清单</el-button>
  71. </el-col>
  72. <el-col style="position: absolute;left:70%" :span="5" >
  73. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  74. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  75. </el-col>
  76. <div class="tabSetting">
  77. <right-toolbar
  78. :showSearch.sync="showSearch"
  79. @queryTable="getList"
  80. ></right-toolbar>
  81. <div style="margin: 0 12px">
  82. <el-button
  83. icon="el-icon-setting"
  84. size="mini"
  85. circle
  86. @click="showSetting = !showSetting"
  87. ></el-button>
  88. </div>
  89. </div>
  90. </el-row>
  91. <el-dialog title="提示" :visible.sync="showSetting" width="700px" v-dialogDrag>
  92. <template slot="title">
  93. <div class="avue-crud__dialog__header">
  94. <span class="el-dialog__title">
  95. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
  96. </span>
  97. </div>
  98. </template>
  99. <div>配置排序列数据(拖动调整顺序)</div>
  100. <div style="margin-left: 17px">
  101. <el-checkbox
  102. v-model="allCheck"
  103. label="全选"
  104. @change="allChecked"
  105. ></el-checkbox>
  106. </div>
  107. <div style="padding: 4px; display: flex; justify-content: center">
  108. <draggable
  109. v-model="setRowList"
  110. group="site"
  111. animation="300"
  112. @start="onStart"
  113. @end="onEnd"
  114. handle=".indraggable"
  115. >
  116. <transition-group>
  117. <div
  118. v-for="item in setRowList"
  119. :key="item.surface"
  120. class="listStyle"
  121. >
  122. <div style="width: 500px" class="indraggable">
  123. <div class="progress" :style="{ width: item.width + 'px' }">
  124. <el-checkbox
  125. :label="item.name"
  126. v-model="item.checked"
  127. :true-label="0"
  128. :false-label="1"
  129. >{{ item.name }}
  130. </el-checkbox>
  131. </div>
  132. </div>
  133. <el-input-number
  134. v-model.number="item.width"
  135. controls-position="right"
  136. :min="1"
  137. :max="500"
  138. size="mini"
  139. ></el-input-number>
  140. </div>
  141. </transition-group>
  142. </draggable>
  143. </div>
  144. <span slot="footer" class="dialog-footer">
  145. <el-button @click="showSetting = false">取 消</el-button>
  146. <el-button @click="delRow" type="danger">重 置</el-button>
  147. <el-button type="primary" @click="save()">确 定</el-button>
  148. </span>
  149. </el-dialog>
  150. <el-table :data="singleShipList" style="width: 100%" @selection-change="handleSelectionChange">
  151. <el-table-column type="selection" fixed="left" align="center"></el-table-column>
  152. <el-table-column type="expand" fixed="left">
  153. <slot slot-scope="props">
  154. <el-form label-position="left" inline id="demo-table-expand">
  155. <el-form-item
  156. v-for="(item, index) in props.row.children"
  157. :key="index"
  158. label="提单号"
  159. >
  160. <el-tooltip class="item" effect="dark" content="点击查看详情" placement="top">
  161. <span class="blNo" v-text="item.fMblno" @click="$refs.blNo.openDialog(item)"></span>
  162. </el-tooltip>
  163. </el-form-item>
  164. </el-form>
  165. </slot>
  166. </el-table-column>
  167. <el-table-column type="index" fixed="left" align="center" label="行号"></el-table-column>
  168. <el-table-column
  169. v-for="(item, index) in getRowList"
  170. :key="index"
  171. :label="item.name"
  172. :width="item.width"
  173. :prop="item.label"
  174. align="center"
  175. :fixed="item.fixed"
  176. :show-overflow-tooltip="true"
  177. sortable
  178. >
  179. </el-table-column>
  180. <!-- <el-table-column-->
  181. <!-- prop="vslName"-->
  182. <!-- label="船名"-->
  183. <!-- align="center"-->
  184. <!-- ></el-table-column>-->
  185. <!-- <el-table-column-->
  186. <!-- prop="voyNo"-->
  187. <!-- label="航次"-->
  188. <!-- align="center"-->
  189. <!-- ></el-table-column>-->
  190. <!-- <el-table-column-->
  191. <!-- prop="fAtd"-->
  192. <!-- label="开始日期"-->
  193. <!-- align="center"-->
  194. <!-- ></el-table-column>-->
  195. <!-- <el-table-column-->
  196. <!-- prop="fAta"-->
  197. <!-- label="到港日期"-->
  198. <!-- align="center"-->
  199. <!-- ></el-table-column>-->
  200. <!-- <el-table-column-->
  201. <!-- prop="fName"-->
  202. <!-- label="航线"-->
  203. <!-- align="center"-->
  204. <!-- ></el-table-column>-->
  205. <!-- <el-table-column-->
  206. <!-- prop="loadportName"-->
  207. <!-- label="装港"-->
  208. <!-- align="center"-->
  209. <!-- ></el-table-column>-->
  210. <!-- <el-table-column-->
  211. <!-- prop="destportName"-->
  212. <!-- label="卸港"-->
  213. <!-- align="center"-->
  214. <!-- ></el-table-column>-->
  215. </el-table>
  216. <pagination
  217. v-show="total > 0"
  218. :total="total"
  219. :page.sync="queryParams.pageNum"
  220. :limit.sync="queryParams.pageSize"
  221. @pagination="getList"
  222. />
  223. <blno ref="blNo"></blno>
  224. </div>
  225. </template>
  226. <script>
  227. import blno from "./BLNo";
  228. import { getVesselName } from '@/api/finance/applyForInvoice/chargeInvoice';
  229. import { getVoyageName } from '@/api/finance/applyForInvoice/feeDetail';
  230. import { download } from "../../../utils/ruoyi";
  231. import { listSingleVoyageByShip, listBLNo, cargoStatus, shipInventoryExport } from '@/api/kaihe/singleVoyageShip/index';
  232. import moment from "moment";
  233. import draggable from "vuedraggable";
  234. import { addSet, resetModule, select } from '@/api/system/set';
  235. import Cookies from 'js-cookie';
  236. export default {
  237. name: "index",
  238. components: {
  239. blno,
  240. draggable,
  241. },
  242. data() {
  243. return {
  244. setRowList: [],
  245. getRowList: [],
  246. tableDate: [
  247. {
  248. surface: "1",
  249. label: "vslName",
  250. name: "船名",
  251. checked: 0,
  252. width: 200,
  253. },
  254. {
  255. surface: "2",
  256. label: "voyNo",
  257. name: "航次",
  258. checked: 0,
  259. width: 200,
  260. },
  261. {
  262. surface: "3",
  263. label: "fAtd",
  264. name: "开始日期",
  265. checked: 0,
  266. width: 200,
  267. },
  268. {
  269. surface: "4",
  270. label: "fAta",
  271. name: "到港日期",
  272. checked: 0,
  273. width: 200,
  274. },
  275. {
  276. surface: "5",
  277. label: "fName",
  278. name: "航线",
  279. checked: 0,
  280. width: 200,
  281. },
  282. {
  283. surface: "6",
  284. label: "loadportName",
  285. name: "装港",
  286. checked: 0,
  287. width: 200,
  288. },
  289. {
  290. surface: "7",
  291. label: "destportName",
  292. name: "卸港",
  293. checked: 0,
  294. width: 200,
  295. },
  296. ],
  297. singleShipList: [],
  298. // 航次
  299. voyageOptions:[],
  300. // 船名
  301. vesselOptions:[],
  302. // 离港时间
  303. departure: null,
  304. // 到港时间
  305. arrival: null,
  306. // 离港到港船只数据
  307. ship: [],
  308. // 总条数
  309. total: 0,
  310. // 查询参数
  311. queryParams: {
  312. fVslid: null,
  313. fVoyid: null,
  314. fCargoPlanning: 0,
  315. pageNum: 1,
  316. pageSize: 10,
  317. },
  318. // 遮罩层
  319. loading: true,
  320. // 选中数组
  321. ids: [],
  322. // 非单个禁用
  323. single: true,
  324. // 非多个禁用
  325. multiple: true,
  326. // 显示搜索条件
  327. showSearch: true,
  328. //自定义列宽
  329. allCheck: false,
  330. showSetting:false,
  331. drag: false,
  332. }
  333. },
  334. created() {
  335. // this.getList();
  336. this.setRowList = this.tableDate;
  337. this.getRowList = this.tableDate;
  338. this.vessleRemthod();
  339. this.voyageRemthods();
  340. },
  341. activated() {
  342. this.getList();
  343. },
  344. methods: {
  345. async getList() {
  346. this.loading = false;
  347. await listSingleVoyageByShip(this.queryParams).then(response => {
  348. console.log(response.rows)
  349. this.singleShipList = response.rows;
  350. this.singleShipList.forEach((item, index) => {
  351. let blNo = {
  352. fCargoPlanning: 0,
  353. fVslid: item.fVslid,
  354. fVoyid: item.fVoyid,
  355. }
  356. listBLNo(blNo).then(res => {
  357. this.singleShipList[index].children = res.rows
  358. })
  359. })
  360. this.total = response.total;
  361. this.loading = false;
  362. })
  363. },
  364. handleQuery() {
  365. this.queryParams.pageNum = 1;
  366. this.queryParams.pageSize = 10;
  367. this.getList();
  368. },
  369. /** 重置按钮操作 */
  370. resetQuery() {
  371. this.departure = null;
  372. this.arrival = null;
  373. this.queryParams = {
  374. vslName: null,
  375. voyNo: null,
  376. },
  377. this.resetForm("queryForm");
  378. this.handleQuery();
  379. },
  380. //获取船名
  381. vessleRemthod() {
  382. getVesselName().then(response => {
  383. this.vesselOptions = response.rows;
  384. })
  385. },
  386. // 获取航次
  387. voyageRemthods(){
  388. getVoyageName().then(response=>{
  389. this.voyageOptions = response.rows;
  390. })
  391. },
  392. // 多选框选中数据
  393. handleSelectionChange(selection) {
  394. this.ship = selection;
  395. // this.ids = selection.map(item => item.fId)
  396. this.single = selection.length!==1;
  397. // this.multiple = !selection.length
  398. },
  399. // 离港出运
  400. departureShipment() {
  401. if (this.ship[0].fArrivalStatus === 0) {
  402. if (this.departure === null) {
  403. this.$message({
  404. showClose: true,
  405. message: '离港时间未选择',
  406. type: 'warning'
  407. });
  408. } else {
  409. const data = {
  410. fVsl: this.ship[0].vslName,
  411. fVoy: this.ship[0].voyNo,
  412. fVslid: this.ship[0].fVslid,
  413. fVoyid: this.ship[0].fVoyid,
  414. fUpdatetime: this.departure,
  415. updateStatus: '1',
  416. }
  417. cargoStatus(data).then(response => {
  418. this.getList();
  419. this.$message({
  420. showClose: true,
  421. message: '出港操作成功',
  422. type: 'success'
  423. });
  424. })
  425. }
  426. }else {
  427. this.$message({
  428. showClose: true,
  429. message: '该航次已离港或已到港',
  430. type: 'warning'
  431. });
  432. }
  433. },
  434. // 到港卸船
  435. unloading() {
  436. if (this.ship[0].fArrivalStatus === 1) {
  437. if (this.arrival === null) {
  438. this.$message({
  439. showClose: true,
  440. message: '到港时间未选择',
  441. type: 'warning'
  442. });
  443. } else {
  444. const data = {
  445. fVsl: this.ship[0].vslName,
  446. fVoy: this.ship[0].voyNo,
  447. fVslid: this.ship[0].fVslid,
  448. fVoyid: this.ship[0].fVoyid,
  449. fUpdatetime: this.arrival,
  450. updateStatus: '2',
  451. }
  452. cargoStatus(data).then(response => {
  453. this.getList();
  454. this.$message({
  455. showClose: true,
  456. message: '到港操作成功',
  457. type: 'success'
  458. });
  459. })
  460. }
  461. } else {
  462. this.$message({
  463. showClose: true,
  464. message: '该航次未离港或已到港',
  465. type: 'warning'
  466. });
  467. }
  468. },
  469. // 导出清单
  470. shipInventoryExport() {
  471. shipInventoryExport(this.queryParams).then(response => {
  472. this.download(response.msg)
  473. })
  474. },
  475. //列设置全选
  476. allChecked() {
  477. if (this.allCheck == true) {
  478. this.setRowList.map((e) => {
  479. return (e.checked = 0);
  480. });
  481. } else {
  482. this.setRowList.map((e) => {
  483. return (e.checked = 1);
  484. });
  485. }
  486. },
  487. //开始拖拽事件
  488. onStart() {
  489. this.drag = true;
  490. },
  491. //拖拽结束事件
  492. onEnd() {
  493. this.drag = false;
  494. },
  495. //重置列表
  496. delRow() {
  497. this.data = {
  498. tableName: "船舶信息",
  499. userId: Cookies.get("userName"),
  500. };
  501. resetModule(this.data).then((res) => {
  502. if (res.code == 200) {
  503. this.showSetting = false;
  504. this.setRowList = this.tableDate;
  505. console.log(this.setRowList)
  506. this.getRowList = this.tableDate;
  507. }
  508. });
  509. },
  510. //保存列设置
  511. save() {
  512. this.showSetting = false;
  513. this.data = {
  514. tableName: "船舶信息",
  515. userId: Cookies.get("userName"),
  516. sysTableSetList: this.setRowList,
  517. };
  518. addSet(this.data).then((res) => {
  519. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  520. });
  521. },
  522. }
  523. }
  524. </script>
  525. <style lang="scss" scoped>
  526. .blNo {
  527. cursor: pointer;
  528. }
  529. /deep/ #demo-table-expand {
  530. font-size: 0;
  531. }
  532. /deep/ #demo-table-expand label {
  533. width: 90px;
  534. color: #99a9bf;
  535. }
  536. /deep/ #demo-table-expand .el-form-item {
  537. margin-right: 0;
  538. margin-bottom: 0;
  539. width: 50%;
  540. }
  541. </style>