index.vue 20 KB

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