index.vue 21 KB

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