index.vue 21 KB

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