index.vue 21 KB

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