index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  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-form-item label="编号" prop="fNo">
  6. <el-input
  7. v-model="queryParams.fNo"
  8. style="width:200px"
  9. placeholder="请输入编号"
  10. clearable
  11. size="small"
  12. />
  13. </el-form-item>
  14. <el-form-item label="名称" prop="fName">
  15. <el-input
  16. v-model="queryParams.fName"
  17. style="width:200px"
  18. placeholder="请输入编号"
  19. clearable
  20. size="small"
  21. />
  22. </el-form-item>
  23. <el-form-item label="状态" prop="fStatus">
  24. <el-select
  25. v-model="queryParams.fStatus"
  26. style="width: 200px"
  27. placeholder="请选择状态"
  28. clearable
  29. size="small"
  30. @keyup.enter.native="handleQuery"
  31. >
  32. <el-option label="正常" value="T"/>
  33. <el-option label="停用" value="F"/>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="录入区间" prop="cLoadDate">
  37. <el-date-picker
  38. v-model="queryParams.cLoadDate"
  39. type="daterange"
  40. value-format="yyyy-MM-dd"
  41. range-separator="至"
  42. start-placeholder="开始日期"
  43. end-placeholder="结束日期"
  44. style="width: 250px"
  45. >
  46. </el-date-picker>
  47. </el-form-item>
  48. </el-row>
  49. <div v-show="queryParamsHidden">
  50. <el-row>
  51. <el-form-item label="录入人" prop="createBy">
  52. <el-input
  53. v-model="queryParams.createBy"
  54. style="width: 200px"
  55. placeholder="请输入录入人"
  56. clearable
  57. size="small"
  58. @keyup.enter.native="handleQuery"
  59. />
  60. </el-form-item>
  61. <el-form-item label="备注">
  62. <el-input
  63. v-model="queryParams.remark"
  64. type="textarea"
  65. style="width: 200px"
  66. clearable
  67. size="small"
  68. />
  69. </el-form-item>
  70. </el-row>
  71. </div>
  72. </el-form>
  73. <el-row :gutter="10" class="mb8">
  74. <el-col :span="1.5">
  75. <el-button
  76. type="success"
  77. icon="el-icon-plus"
  78. size="mini"
  79. @click="handleAdd"
  80. v-hasPermi="['shipping:address:add']"
  81. >新增</el-button>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-button
  85. type="warning"
  86. icon="el-icon-edit"
  87. size="mini"
  88. :disabled="single"
  89. @click="handleUpdate"
  90. v-hasPermi="['shipping:address:edit']"
  91. >修改</el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="danger"
  96. icon="el-icon-delete"
  97. size="mini"
  98. :disabled="multiple"
  99. @click="handleDelete"
  100. v-hasPermi="['shipping:address:remove']"
  101. >删除</el-button>
  102. </el-col>
  103. <el-col :span="1.5">
  104. <el-button
  105. type="primary"
  106. icon="el-icon-download"
  107. size="mini"
  108. @click="handleExport"
  109. v-hasPermi="['basicdata:yard:import']"
  110. >导入</el-button>
  111. </el-col>
  112. <el-col :span="1.5">
  113. <el-button
  114. type="primary"
  115. icon="el-icon-download"
  116. size="mini"
  117. @click="handleExport"
  118. v-hasPermi="['shipping:address:export']"
  119. >导出</el-button>
  120. </el-col>
  121. <el-col :span="1.5">
  122. <el-button
  123. type="info"
  124. icon="el-icon-download"
  125. size="mini"
  126. @click="handleExport"
  127. v-hasPermi="['basicdata:yard:list']"
  128. >取消</el-button>
  129. </el-col>
  130. <el-col style="position: absolute;left:75%" :span="5" >
  131. <el-button size="small" @click="queryParamsHidden ? (queryParamsHidden = false) : (queryParamsHidden = true)">{{ queryParamsHidden ? '隐藏' : '更多' }}</el-button>
  132. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  133. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  134. </el-col>
  135. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  136. </el-row>
  137. <el-table v-loading="loading" :data="corpsList" @selection-change="handleSelectionChange">
  138. <el-table-column type="selection" width="55" align="center" />
  139. <el-table-column type="index" width="55" label="行号" align="center" />
  140. <el-table-column label="编号" align="center" prop="fNo" width="100px"/>
  141. <el-table-column :show-overflow-tooltip="true" label="名称" align="center" prop="fName" width="100px"
  142. />
  143. <el-table-column :show-overflow-tooltip="true" label="英文全称" align="center" width="100px" prop="fEname" />
  144. <el-table-column :show-overflow-tooltip="true" label="国家代码" align="center" prop="fNationality" />
  145. <el-table-column :show-overflow-tooltip="true" label="船舶呼号" align="center" prop="fImo" />
  146. <el-table-column :show-overflow-tooltip="true" label="状态" align="center" prop="fStatus" />
  147. <el-table-column :show-overflow-tooltip="true" label="备注" align="center" prop="remark" />
  148. <el-table-column label="录入人" align="center" prop="createBy" />
  149. <el-table-column label="录入时间" align="center" prop="createTime" width="100">
  150. <template slot-scope="scope">
  151. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="最新修改人" align="center" prop="updateBy" width="100px"/>
  155. <el-table-column label="最新修改时间" align="center" prop="updateTime" width="100px">
  156. <template slot-scope="scope">
  157. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width" width="120px">
  161. <template slot-scope="scope">
  162. <el-button
  163. size="mini"
  164. type="text"
  165. icon="el-icon-edit"
  166. @click="handleUpdate(scope.row)"
  167. >查看</el-button>
  168. <el-button
  169. size="mini"
  170. type="text"
  171. icon="el-icon-delete"
  172. @click="handleDelete(scope.row)"
  173. >移除</el-button>
  174. </template>
  175. </el-table-column>
  176. </el-table>
  177. <pagination
  178. v-show="total>0"
  179. :total="total"
  180. :page.sync="queryParams.pageNum"
  181. :limit.sync="queryParams.pageSize"
  182. @pagination="getList"
  183. />
  184. <!-- 添加或修改客户详情对话框 -->
  185. <el-dialog
  186. v-dialogDrag
  187. :fullscreen="dialogFull"
  188. :title="title"
  189. :visible.sync="open"
  190. close-on-click-modal="false"
  191. width="60%"
  192. :close-on-click-modal="false"
  193. append-to-body>
  194. <template slot="title">
  195. <div class="avue-crud__dialog__header">
  196. <span class="el-dialog__title">
  197. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
  198. </span>
  199. <div class="avue-crud__dialog__menu enlarge" @click="full">
  200. <i style="cursor: pointer;display: block;width:12px;height:12px;border:1px solid #909399;border-top:3px solid #909399;margin-top: -3px;"></i>
  201. </div>
  202. </div>
  203. </template>
  204. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  205. <el-row>
  206. <el-col :span="12">
  207. <el-form-item label="编号" prop="fNo">
  208. <el-input
  209. v-model="form.fNo"
  210. style="width: 80%"
  211. placeholder="请输入编号"
  212. :disabled="doNot"
  213. />
  214. </el-form-item>
  215. </el-col>
  216. </el-row>
  217. <el-row>
  218. <el-col :span="12">
  219. <el-form-item label="全称" prop="fName">
  220. <el-input
  221. v-model="form.fName"
  222. style="width: 80%"
  223. placeholder="请输入全称"
  224. :disabled="doNot"/>
  225. </el-form-item>
  226. </el-col>
  227. <el-col :span="12">
  228. <el-form-item label="英文名" prop="fEname">
  229. <el-input v-model="form.fEname" style="width: 80%" placeholder="请输入英文名" :disabled="doNot"/>
  230. </el-form-item>
  231. </el-col>
  232. </el-row>
  233. <el-row>
  234. <el-col :span="12">
  235. <el-form-item label="状态" prop="fStatus">
  236. <el-select v-model="form.fStatus" style="width: 80%" placeholder="请输入英文名称" :disabled="doNot">
  237. <el-option label="正常" value="T"/>
  238. <el-option label="停用" value="F"/>
  239. </el-select>
  240. </el-form-item>
  241. </el-col>
  242. <!-- <el-col :span="12">-->
  243. <!-- <el-form-item label="类型" prop="fTypes">-->
  244. <!-- <el-select-->
  245. <!-- style="width: 80%"-->
  246. <!-- v-model="form.fTypes"-->
  247. <!-- disabled-->
  248. <!-- >-->
  249. <!-- <el-option-->
  250. <!-- v-for="(dict, index) in fTypesOptions"-->
  251. <!-- :key="index.dictValue"-->
  252. <!-- :label="dict.dictLabel"-->
  253. <!-- :value="dict.dictValue"/>-->
  254. <!-- </el-select>-->
  255. <!-- </el-form-item>-->
  256. <!-- </el-col>-->
  257. </el-row>
  258. <el-row>
  259. <el-col :span="24">
  260. <el-form-item label="备注" prop="remark">
  261. <el-input
  262. v-model="form.remark"
  263. style="width: 100%" placeholder=""
  264. :disabled="doNot"
  265. type="textarea"
  266. :autosize="{ minRows: 2}"
  267. />
  268. </el-form-item>
  269. </el-col>
  270. </el-row>
  271. </el-form>
  272. <div slot="footer" class="dialog-footer">
  273. <el-button type="info" round @click="doNot = false">修 改</el-button>
  274. <el-button type="success" round @click="submitForm" :disabled="doNot">保 存</el-button>
  275. <el-button @click="cancel" round>关 闭</el-button>
  276. </div>
  277. </el-dialog>
  278. </div>
  279. </template>
  280. <script>
  281. import { getyard,listCorps, getCorps, delCorps, addyard,getyardNo, getyardName, changeCorpsStatus,exportCorps } from "@/api/kaihe/shipDynamics/vessel";
  282. import {queryUserVal} from "@/api/system/user";
  283. import { isArray } from '@/utils/validate'
  284. import Vue from 'vue'
  285. import { getportinformation } from '@/api/kaihe/basicdata/portinformation'
  286. import { getroute } from '@/api/kaihe/basicdata/route'
  287. Vue.directive('dialogDrag', {
  288. bind(el, binding, vnode, oldVnode) {
  289. const dialogHeaderEl = el.querySelector('.el-dialog__header')
  290. const dragDom = el.querySelector('.el-dialog')
  291. const enlarge = el.querySelector('.enlarge')
  292. dialogHeaderEl.style.cursor = 'move'
  293. // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
  294. const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
  295. if(enlarge){
  296. enlarge.onclick = (e) => {
  297. dragDom.style.top = '0px'
  298. dragDom.style.left = '0px'
  299. }
  300. }
  301. dialogHeaderEl.onmousedown = (e) => {
  302. // 鼠标按下,计算当前元素距离可视区的距离
  303. const disX = e.clientX - dialogHeaderEl.offsetLeft
  304. const disY = e.clientY - dialogHeaderEl.offsetTop
  305. // 获取到的值带px 正则匹配替换
  306. let styL, styT
  307. // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
  308. if (sty.left.includes('%')) {
  309. styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
  310. styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
  311. } else {
  312. styL = +sty.left.replace(/\px/g, '')
  313. styT = +sty.top.replace(/\px/g, '')
  314. }
  315. document.onmousemove = function(e) {
  316. // 通过事件委托,计算移动的距离
  317. const l = e.clientX - disX
  318. const t = e.clientY - disY
  319. // 移动当前元素
  320. if ((t + styT) >= 0){
  321. dragDom.style.top = `${t + styT}px`
  322. }
  323. dragDom.style.left = `${l + styL}px`
  324. // 将此时的位置传出去
  325. // binding.value({x:e.pageX,y:e.pageY})
  326. }
  327. document.onmouseup = function(e) {
  328. document.onmousemove = null
  329. document.onmouseup = null
  330. }
  331. }
  332. }
  333. })
  334. export default {
  335. name: "yard",
  336. components: {
  337. },
  338. data() {
  339. return {
  340. //默认显示第一行
  341. queryParamsHidden:false,
  342. //查看置灰
  343. doNot:true,
  344. //模糊查询港口名称
  345. portNameOptions:[],
  346. //港口类型字典表
  347. fTypesOptions:[],
  348. //模糊查询堆场名称
  349. yardOptions:[],
  350. //全屏放大
  351. dialogFull:false,
  352. // 遮罩层
  353. loading: true,
  354. // 选中数组
  355. ids: [],
  356. // 非单个禁用
  357. single: true,
  358. // 非多个禁用
  359. multiple: true,
  360. // 显示搜索条件
  361. showSearch: true,
  362. // 总条数
  363. total: 0,
  364. // 客户详情表格数据
  365. corpsList: [],
  366. // 弹出层标题
  367. title: "",
  368. // 状态数据字典
  369. statusOptions: [],
  370. // 是否显示弹出层
  371. open: false,
  372. // 查询参数
  373. queryParams: {
  374. pageNum: 1,
  375. pageSize: 10,
  376. portName:null,
  377. fName:null,
  378. fStatus:null,
  379. createBy:null,
  380. fBsdate:null,
  381. remark:null,
  382. },
  383. // 表单参数
  384. form: {
  385. fNo:null,
  386. fName:null,
  387. fEname:null,
  388. fStatus:'T',
  389. fTypes:'3',
  390. remark:null,
  391. },
  392. // 表单校验
  393. rules: {
  394. fTypeid: [
  395. { required: true, message: "客户类别不能为空", trigger: "blur" }
  396. ],
  397. fNo: [
  398. { required: true, message: "编号不能为空", trigger: "blur" }
  399. ],
  400. fName: [
  401. { required: true, message: "名称不能为空", trigger: "blur" }
  402. ],
  403. fEname: [
  404. {
  405. validator: function(rule, value, callback) {
  406. // 校验英文的正则
  407. if (/[a-zA-z]$/.test(value) == false) {
  408. callback(new Error("请输入英文字母"));
  409. } else {
  410. //校验通过
  411. callback();
  412. }
  413. },
  414. trigger: "blur"
  415. }
  416. ],
  417. fCname:[
  418. { required: true, message: "简称不能为空", trigger: "blur" }
  419. ],
  420. fStatus: [
  421. { required: true, message: "状态默认 T ,正常T 停用F 下拉选择不能为空", trigger: "blur" }
  422. ],
  423. }
  424. };
  425. },
  426. created() {
  427. this.getList();
  428. this.getDicts("f_types").then(response => {
  429. this.fTypesOptions = response.data;
  430. });
  431. this.portRemoteMethod()
  432. this.yardRemoteMethod()
  433. },
  434. methods: {
  435. //模糊查询航线名称
  436. yardRemoteMethod(){
  437. let queryParams = { pageNum: 1,};
  438. getyard(queryParams).then((response) => {
  439. this.yardOptions = response.rows;
  440. });
  441. },
  442. //模糊查询港口名称
  443. portRemoteMethod(){
  444. let queryParams = { pageNum: 1,};
  445. getportinformation(queryParams).then(response =>{
  446. this.portNameOptions = response.rows
  447. })
  448. },
  449. full(){
  450. this.dialogFull = !this.dialogFull
  451. },
  452. /** 查询客户详情列表 */
  453. getList() {
  454. this.loading = true;
  455. listCorps(this.queryParams).then(response => {
  456. this.corpsList = response.rows;
  457. this.total = response.total;
  458. this.loading = false;
  459. });
  460. },
  461. // 取消按钮
  462. cancel() {
  463. this.open = false;
  464. this.reset();
  465. },
  466. // 表单重置
  467. reset() {
  468. this.form = {
  469. fNo:null,
  470. fName:null,
  471. fEname:null,
  472. fStatus:'T',
  473. remark:null,
  474. fTypes:'3'
  475. };
  476. this.resetForm("form");
  477. },
  478. // 状态修改
  479. handleStatusChange(row) {
  480. let text = row.fStatus === "0" ? "启用" : "停用";
  481. this.$confirm('确认要"' + text + '""' + row.fName + '"吗?', "警告", {
  482. confirmButtonText: "确定",
  483. cancelButtonText: "取消",
  484. type: "warning"
  485. }).then(function() {
  486. return changeCorpsStatus(row.fId, row.fStatus);
  487. }).then(() => {
  488. this.msgSuccess(text + "成功");
  489. }).catch(function() {
  490. row.fStatus = row.fStatus === "0" ? "1" : "0";
  491. });
  492. },
  493. /** 搜索按钮操作 */
  494. handleQuery() {
  495. this.queryParams.pageNum = 1;
  496. this.getList();
  497. },
  498. /** 重置按钮操作 */
  499. resetQuery() {
  500. this.resetForm("queryForm");
  501. this.handleQuery();
  502. },
  503. // 多选框选中数据
  504. handleSelectionChange(selection) {
  505. this.ids = selection.map(item => item.fId)
  506. this.single = selection.length!==1
  507. this.multiple = !selection.length
  508. },
  509. /** 新增按钮操作 */
  510. handleAdd() {
  511. this.doNot = false
  512. this.reset();
  513. this.open = true;
  514. this.title = "添加客户详情";
  515. },
  516. /** 修改按钮操作 */
  517. handleUpdate(row) {
  518. this.doNot = true
  519. this.reset();
  520. const fId = row.fId || this.ids
  521. getCorps(fId).then(response => {
  522. this.form = response.data;
  523. this.open = true;
  524. this.title = "修改客户详情";
  525. });
  526. },
  527. /** 提交按钮 */
  528. submitForm() {
  529. this.$refs["form"].validate(valid => {
  530. if (valid) {
  531. addyard(this.form).then(response => {
  532. this.msgSuccess("操作成功");
  533. this.open = false;
  534. this.getList();
  535. })
  536. }
  537. })
  538. },
  539. /** 删除按钮操作 */
  540. handleDelete(row) {
  541. const fIds = row.fId || this.ids;
  542. this.$confirm('是否确认删除客户详情编号为"' + fIds + '"的数据项?', "警告", {
  543. confirmButtonText: "确定",
  544. cancelButtonText: "取消",
  545. type: "warning"
  546. }).then(function() {
  547. return delCorps(fIds);
  548. }).then(() => {
  549. this.getList();
  550. this.msgSuccess("删除成功");
  551. })
  552. },
  553. /** 导出按钮操作 */
  554. handleExport() {
  555. const queryParams = this.queryParams;
  556. this.$confirm('是否确认导出所有客户详情数据项?', "警告", {
  557. confirmButtonText: "确定",
  558. cancelButtonText: "取消",
  559. type: "warning"
  560. }).then(function() {
  561. return exportCorps(queryParams);
  562. }).then(response => {
  563. this.download(response.msg);
  564. })
  565. }
  566. }
  567. };
  568. </script>
  569. <style lang="scss" scoped>
  570. .avue-crud__dialog__header {
  571. display: -webkit-box;
  572. display: -ms-flexbox;
  573. display: flex;
  574. -webkit-box-align: center;
  575. -ms-flex-align: center;
  576. align-items: center;
  577. -webkit-box-pack: justify;
  578. -ms-flex-pack: justify;
  579. justify-content: space-between;
  580. }
  581. .el-dialog__title {
  582. color: rgba(0,0,0,.85);
  583. font-weight: 500;
  584. word-wrap: break-word;
  585. }
  586. .avue-crud__dialog__menu {
  587. padding-right: 20px;
  588. float: left;
  589. }
  590. .avue-crud__dialog__menu i {
  591. color: #909399;
  592. font-size: 15px;
  593. }
  594. .el-icon-full-screen{
  595. cursor: pointer;
  596. }
  597. .el-icon-full-screen:before {
  598. content: "\e719";
  599. }
  600. </style>