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-item label="提单号"><span class="blNo" v-text="props.row.tidan" @click="$refs.blNo.openDialog(props.row.tidan)"></span></el-form-item>-->
  165. </el-form>
  166. </slot>
  167. </el-table-column>
  168. <el-table-column type="index" fixed="left" align="center" label="行号"></el-table-column>
  169. <el-table-column
  170. v-for="(item, index) in getRowList"
  171. :key="index"
  172. :label="item.name"
  173. :width="item.width"
  174. :prop="item.label"
  175. align="center"
  176. :fixed="item.fixed"
  177. :show-overflow-tooltip="true"
  178. sortable
  179. >
  180. </el-table-column>
  181. <!-- <el-table-column-->
  182. <!-- prop="vslName"-->
  183. <!-- label="船名"-->
  184. <!-- align="center"-->
  185. <!-- ></el-table-column>-->
  186. <!-- <el-table-column-->
  187. <!-- prop="voyNo"-->
  188. <!-- label="航次"-->
  189. <!-- align="center"-->
  190. <!-- ></el-table-column>-->
  191. <!-- <el-table-column-->
  192. <!-- prop="fAtd"-->
  193. <!-- label="开始日期"-->
  194. <!-- align="center"-->
  195. <!-- ></el-table-column>-->
  196. <!-- <el-table-column-->
  197. <!-- prop="fAta"-->
  198. <!-- label="到港日期"-->
  199. <!-- align="center"-->
  200. <!-- ></el-table-column>-->
  201. <!-- <el-table-column-->
  202. <!-- prop="fName"-->
  203. <!-- label="航线"-->
  204. <!-- align="center"-->
  205. <!-- ></el-table-column>-->
  206. <!-- <el-table-column-->
  207. <!-- prop="loadportName"-->
  208. <!-- label="装港"-->
  209. <!-- align="center"-->
  210. <!-- ></el-table-column>-->
  211. <!-- <el-table-column-->
  212. <!-- prop="destportName"-->
  213. <!-- label="卸港"-->
  214. <!-- align="center"-->
  215. <!-- ></el-table-column>-->
  216. </el-table>
  217. <pagination
  218. v-show="total > 0"
  219. :total="total"
  220. :page.sync="queryParams.pageNum"
  221. :limit.sync="queryParams.pageSize"
  222. @pagination="getList"
  223. />
  224. <blno ref="blNo"></blno>
  225. </div>
  226. </template>
  227. <script>
  228. import blno from "./BLNo";
  229. import { getVesselName } from '@/api/finance/applyForInvoice/chargeInvoice';
  230. import { getVoyageName } from '@/api/finance/applyForInvoice/feeDetail';
  231. import { download } from "../../../utils/ruoyi";
  232. import { listSingleVoyageByShip, listBLNo, cargoStatus, shipInventoryExport } from '@/api/kaihe/singleVoyageShip/index';
  233. import moment from "moment";
  234. import draggable from "vuedraggable";
  235. import { addSet, resetModule, select } from '@/api/system/set';
  236. import Cookies from 'js-cookie';
  237. export default {
  238. name: "index",
  239. components: {
  240. blno,
  241. draggable,
  242. },
  243. data() {
  244. return {
  245. setRowList: [],
  246. getRowList: [],
  247. tableDate: [
  248. {
  249. surface: "1",
  250. label: "vslName",
  251. name: "船名",
  252. checked: 0,
  253. width: 200,
  254. },
  255. {
  256. surface: "2",
  257. label: "voyNo",
  258. name: "航次",
  259. checked: 0,
  260. width: 200,
  261. },
  262. {
  263. surface: "3",
  264. label: "fAtd",
  265. name: "开始日期",
  266. checked: 0,
  267. width: 200,
  268. },
  269. {
  270. surface: "4",
  271. label: "fAta",
  272. name: "到港日期",
  273. checked: 0,
  274. width: 200,
  275. },
  276. {
  277. surface: "5",
  278. label: "fName",
  279. name: "航线",
  280. checked: 0,
  281. width: 200,
  282. },
  283. {
  284. surface: "6",
  285. label: "loadportName",
  286. name: "装港",
  287. checked: 0,
  288. width: 200,
  289. },
  290. {
  291. surface: "7",
  292. label: "destportName",
  293. name: "卸港",
  294. checked: 0,
  295. width: 200,
  296. },
  297. ],
  298. singleShipList: [],
  299. // 航次
  300. voyageOptions:[],
  301. // 船名
  302. vesselOptions:[],
  303. // 离港时间
  304. departure: null,
  305. // 到港时间
  306. arrival: null,
  307. // 离港到港船只数据
  308. ship: [],
  309. // 总条数
  310. total: 0,
  311. // 查询参数
  312. queryParams: {
  313. fVslid: null,
  314. fVoyid: null,
  315. fCargoPlanning: 0,
  316. pageNum: 1,
  317. pageSize: 10,
  318. },
  319. // 遮罩层
  320. loading: true,
  321. // 选中数组
  322. ids: [],
  323. // 非单个禁用
  324. single: true,
  325. // 非多个禁用
  326. multiple: true,
  327. // 显示搜索条件
  328. showSearch: true,
  329. //自定义列宽
  330. allCheck: false,
  331. showSetting:false,
  332. drag: false,
  333. }
  334. },
  335. created() {
  336. this.getList();
  337. this.setRowList = this.tableDate;
  338. this.getRowList = this.tableDate;
  339. this.vessleRemthod();
  340. this.voyageRemthods();
  341. // const data = {
  342. // fVsl: '凯和志诚1',
  343. // fVoy: '02W1',
  344. // fVslid: 3,
  345. // fVoyid: 6,
  346. // fUpdatetime: '2021-08-11 14:08:00',
  347. // updateStatus: '1',
  348. // }
  349. // cargoStatus(data).then(response => {
  350. // console.log(response)
  351. // })
  352. },
  353. methods: {
  354. async getList() {
  355. this.loading = false;
  356. await listSingleVoyageByShip(this.queryParams).then(response => {
  357. this.singleShipList = response.rows;
  358. console.log(this.singleShipList)
  359. this.singleShipList.forEach((item, index) => {
  360. let blNo = {
  361. fCargoPlanning: 0,
  362. fVslid: item.fVslid,
  363. fVoyid: item.fVoyid,
  364. }
  365. listBLNo(blNo).then(res => {
  366. this.singleShipList[index].children = res.rows
  367. })
  368. })
  369. this.total = response.total;
  370. this.loading = false;
  371. })
  372. },
  373. handleQuery() {
  374. this.queryParams.pageNum = 1;
  375. this.queryParams.pageSize = 10;
  376. this.getList();
  377. },
  378. /** 重置按钮操作 */
  379. resetQuery() {
  380. this.departure = null;
  381. this.arrival = null;
  382. this.queryParams = {
  383. vslName: null,
  384. voyNo: null,
  385. },
  386. this.resetForm("queryForm");
  387. this.handleQuery();
  388. },
  389. //获取船名
  390. vessleRemthod() {
  391. getVesselName().then(response => {
  392. this.vesselOptions = response.rows
  393. })
  394. },
  395. // 获取航次
  396. voyageRemthods(){
  397. getVoyageName().then(response=>{
  398. this.voyageOptions = response.rows
  399. })
  400. },
  401. // 多选框选中数据
  402. handleSelectionChange(selection) {
  403. this.ship = selection
  404. // this.ids = selection.map(item => item.fId)
  405. this.single = selection.length!==1
  406. // this.multiple = !selection.length
  407. },
  408. // 离港出运
  409. departureShipment() {
  410. if (this.departure === null) {
  411. this.$message({
  412. showClose: true,
  413. message: '离港时间未选择',
  414. type: 'warning'
  415. });
  416. } else {
  417. const data = {
  418. fVsl: this.ship[0].vslName,
  419. fVoy: this.ship[0].voyNo,
  420. fVslid: this.ship[0].fVslid,
  421. fVoyid: this.ship[0].fVoyid,
  422. fUpdatetime: this.departure,
  423. updateStatus: '1',
  424. }
  425. cargoStatus(data).then(response => {
  426. if (response.code === 200) {
  427. this.$message({
  428. showClose: true,
  429. message: '出港操作成功',
  430. type: 'success'
  431. });
  432. } else {
  433. this.$message({
  434. showClose: true,
  435. message: response.msg,
  436. type: 'warning'
  437. });
  438. }
  439. })
  440. }
  441. },
  442. // 到港卸船
  443. unloading() {
  444. if (this.arrival === null) {
  445. this.$message({
  446. showClose: true,
  447. message: '到港时间未选择',
  448. type: 'warning'
  449. });
  450. } else {
  451. const data = {
  452. fVsl: this.ship[0].vslName,
  453. fVoy: this.ship[0].voyNo,
  454. fVslid: this.ship[0].fVslid,
  455. fVoyid: this.ship[0].fVoyid,
  456. fUpdatetime: this.arrival,
  457. updateStatus: '2',
  458. }
  459. cargoStatus(data).then(response => {
  460. this.$message({
  461. showClose: true,
  462. message: '到港操作成功',
  463. type: 'success'
  464. });
  465. })
  466. }
  467. },
  468. // 导出清单
  469. shipInventoryExport() {
  470. shipInventoryExport(this.queryParams).then(response => {
  471. this.download(response.msg)
  472. })
  473. },
  474. //列设置全选
  475. allChecked() {
  476. if (this.allCheck == true) {
  477. this.setRowList.map((e) => {
  478. return (e.checked = 0);
  479. });
  480. } else {
  481. this.setRowList.map((e) => {
  482. return (e.checked = 1);
  483. });
  484. }
  485. },
  486. //开始拖拽事件
  487. onStart() {
  488. this.drag = true;
  489. },
  490. //拖拽结束事件
  491. onEnd() {
  492. this.drag = false;
  493. },
  494. //重置列表
  495. delRow() {
  496. this.data = {
  497. tableName: "船舶信息",
  498. userId: Cookies.get("userName"),
  499. };
  500. resetModule(this.data).then((res) => {
  501. if (res.code == 200) {
  502. this.showSetting = false;
  503. this.setRowList = this.tableDate;
  504. console.log(this.setRowList)
  505. this.getRowList = this.tableDate;
  506. }
  507. });
  508. },
  509. //保存列设置
  510. save() {
  511. this.showSetting = false;
  512. this.data = {
  513. tableName: "船舶信息",
  514. userId: Cookies.get("userName"),
  515. sysTableSetList: this.setRowList,
  516. };
  517. addSet(this.data).then((res) => {
  518. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  519. });
  520. },
  521. }
  522. }
  523. </script>
  524. <style lang="scss" scoped>
  525. .blNo {
  526. cursor: pointer;
  527. }
  528. /deep/ #demo-table-expand {
  529. font-size: 0;
  530. }
  531. /deep/ #demo-table-expand label {
  532. width: 90px;
  533. color: #99a9bf;
  534. }
  535. /deep/ #demo-table-expand .el-form-item {
  536. margin-right: 0;
  537. margin-bottom: 0;
  538. width: 50%;
  539. }
  540. </style>