airportInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-11-17 13:43:58
  4. * @LastEditTime: 2021-12-13 16:30:43
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  7. * @FilePath: \CABaggageData\src\views\dashboard\views\info.vue
  8. -->
  9. <template>
  10. <div class="airportInfo">
  11. <!--搜索-->
  12. <!-- <div class="airportInfo-search">
  13. <Search
  14. title="机场信息维护"
  15. @getSearchData="getSearchData"
  16. :isSearch="false"
  17. >
  18. <button @click="handleAdd" class="btnAdd">
  19. {{ msgType ? "新增" : "编辑" }}
  20. </button>
  21. </Search>
  22. </div> -->
  23. <!--内容区域-->
  24. <div class="airportInfo-content">
  25. <el-row :gutter="24">
  26. <el-col :span="6">
  27. <div class="tree_left">
  28. <el-scrollbar style="height: 100%">
  29. <div class="corporate">{{ company }}</div>
  30. <el-tree
  31. :data="data"
  32. :props="defaultProps"
  33. accordion
  34. @node-click="handleNodeClick"
  35. >
  36. </el-tree>
  37. </el-scrollbar>
  38. </div>
  39. </el-col>
  40. <el-col :span="18">
  41. <DataTable
  42. :data-id="dataId"
  43. :rows="12"
  44. labelWidth="100px"
  45. :minHeight="70"
  46. width="800px"
  47. :withlodSet="true"
  48. :data-content="{ companyID, companyName }"
  49. tableHeight="680"
  50. />
  51. </el-col>
  52. </el-row>
  53. </div>
  54. <!--删除弹框-->
  55. <Dialog :flag="flag">
  56. <div class="airportInfoDialog">
  57. <div class="del-title">删除机场信息</div>
  58. <div class="content er">
  59. <div class="log"></div>
  60. 是否确认删除
  61. <p style="color: #eb2f3b; margin-top: 0px; margin-bottom: 0px">
  62. {{ rmObj.name }}
  63. </p>
  64. </div>
  65. <div class="DelFoot right t30">
  66. <el-button
  67. size="medium"
  68. @click="remove"
  69. class="r25 buwitch"
  70. type="danger"
  71. >删除</el-button
  72. >
  73. <el-button size="medium" class="r26" @click="flag = false"
  74. >取消</el-button
  75. >
  76. </div>
  77. </div>
  78. </Dialog>
  79. <!--删除航站楼-->
  80. <Dialog :flag="flaghall">
  81. <div class="airportInfoDialog">
  82. <div class="Deltitle">删除机场信息</div>
  83. <div class="content er">
  84. <div class="log"></div>
  85. 是否确认删除
  86. <p style="color: #eb2f3b; margin-top: 0px; margin-bottom: 0px">
  87. {{ rmhall.name }}
  88. </p>
  89. </div>
  90. <div class="DelFoot right t30">
  91. <el-button
  92. size="medium"
  93. @click="removeflaghall"
  94. class="r25 buwitch"
  95. type="danger"
  96. >删除</el-button
  97. >
  98. <el-button size="medium" class="r26" @click="flaghall = false"
  99. >取消</el-button
  100. >
  101. </div>
  102. </div>
  103. </Dialog>
  104. <!--新增机场信息弹框-->
  105. <Dialog :flag="addFlag" @close="closeForm">
  106. <div class="airportInfoDialog dialog-public-background">
  107. <div class="flx">新增机场信息</div>
  108. <div class="content">
  109. <el-form
  110. :model="ruleForm"
  111. :rules="rules"
  112. ref="ruleForm"
  113. label-width="100px"
  114. class="demo-ruleForm"
  115. >
  116. <el-form-item label="所属公司" prop="upname">
  117. <el-input
  118. size="medium"
  119. :disabled="true"
  120. placeholder=""
  121. v-model="ruleForm.upname"
  122. ></el-input>
  123. </el-form-item>
  124. <el-form-item label="机场中文名称" prop="name">
  125. <el-input
  126. size="medium"
  127. placeholder="请输入机场中文名称(必填)"
  128. v-model="ruleForm.name"
  129. ></el-input>
  130. </el-form-item>
  131. <el-form-item label="机场英文简称" prop="name">
  132. <el-input
  133. size="medium"
  134. placeholder="请输入机场英文简称(必填)"
  135. v-model="ruleForm.name"
  136. ></el-input>
  137. </el-form-item>
  138. <el-form-item label="机场全称">
  139. <el-input
  140. size="medium"
  141. placeholder="请输入机场全称(必填)"
  142. v-model="ruleForm.fullName"
  143. ></el-input>
  144. </el-form-item>
  145. <el-form-item label="机场三字码">
  146. <el-input
  147. size="medium"
  148. placeholder="请输入机场三字码(必填)"
  149. v-model="ruleForm.code3"
  150. ></el-input>
  151. </el-form-item>
  152. <el-form-item label="机场四字码">
  153. <el-input
  154. size="medium"
  155. placeholder="请输入机场四字码(必填)"
  156. v-model="ruleForm.code3"
  157. ></el-input>
  158. </el-form-item>
  159. </el-form>
  160. </div>
  161. <div class="foot center t30">
  162. <el-button
  163. size="medium"
  164. type="primary"
  165. @click="addSubmit()"
  166. class="r25 r26"
  167. >提交</el-button
  168. >
  169. <el-button class="r26" size="medium" @click="resetForm()"
  170. >取消</el-button
  171. >
  172. </div>
  173. </div>
  174. </Dialog>
  175. <Dialog :flag="addta" @close="closeta">
  176. <div class="airportInfoDialog dialog-public-background">
  177. <div class="flx">新增航站楼信息</div>
  178. <div class="content">
  179. <el-form
  180. :model="taForm"
  181. :rules="ruleta"
  182. ref="taForm"
  183. label-width="100px"
  184. class="demo-ruleForm"
  185. >
  186. <el-form-item label="航站楼名称" prop="name">
  187. <el-input
  188. size="medium"
  189. placeholder="请输入航站楼名称(必填)"
  190. v-model="ruleForm.name"
  191. ></el-input>
  192. </el-form-item>
  193. <el-form-item label="航站楼标识" prop="name">
  194. <el-input
  195. size="medium"
  196. placeholder="请输入航站楼标识(必填)"
  197. v-model="ruleForm.name"
  198. ></el-input>
  199. </el-form-item>
  200. </el-form>
  201. </div>
  202. <div class="foot center t30">
  203. <el-button
  204. size="medium"
  205. type="primary"
  206. @click="addter()"
  207. class="r25 r26"
  208. >提交</el-button
  209. >
  210. <el-button class="r26" size="medium" @click="addta = false"
  211. >取消</el-button
  212. >
  213. </div>
  214. </div>
  215. </Dialog>
  216. </div>
  217. </template>
  218. <script>
  219. import Search from "@/layout/components/Search/index.vue";
  220. import Dialog from "@/layout/components/Dialog/index.vue";
  221. import { AirportsList, AddAriports, DelAriports } from "@/api/SystemSettings";
  222. import { translateDataToTreeAll } from "@/utils/validate";
  223. import { Query } from "@/api/dataIntegration";
  224. import { findarrays } from "@/utils/validate";
  225. import DataTable from "@/components/TableAirport";
  226. export default {
  227. name: "AirportInfo",
  228. components: { Search, Dialog, DataTable },
  229. data() {
  230. return {
  231. dataId: DATACONTENT_ID.airportTableId,
  232. data: [],
  233. defaultProps: {
  234. children: "children",
  235. label: "companyName",
  236. },
  237. newUp: false, //新增开关
  238. newUpname: "",
  239. msgType: true, //新增/编辑切换
  240. flag: false, //删除弹框开关
  241. flaghall: false, //删除航站楼开关
  242. addFlag: false, //新增机场信息弹框开关
  243. addta: false, //新增航站楼
  244. ids: null,
  245. rmhall: {
  246. //删除航站楼
  247. index: 0,
  248. name: "",
  249. },
  250. rmObj: {
  251. //删除内容
  252. index: 0,
  253. name: "",
  254. },
  255. ruleForm: {
  256. //新增机场信息表单
  257. upname: "",
  258. name: "",
  259. fullName: "",
  260. code: "",
  261. },
  262. taForm: {
  263. //新增航站楼信息表单
  264. },
  265. rules: {
  266. //新增机场信息表单验证
  267. name: [{ required: true, message: "请输入机场简称", trigger: "blur" }],
  268. fullName: [
  269. { required: true, message: "请输入机场全称", trigger: "blur" },
  270. ],
  271. code: [
  272. { required: true, message: "请输入机场三字码", trigger: "blur" },
  273. ],
  274. },
  275. ruleta: {
  276. //新增机场信息表单验证
  277. name: [{ required: true, message: "请输入机场简称", trigger: "blur" }],
  278. fullName: [
  279. { required: true, message: "请输入机场全称", trigger: "blur" },
  280. ],
  281. code: [
  282. { required: true, message: "请输入机场三字码", trigger: "blur" },
  283. ],
  284. },
  285. companyID: "",
  286. companyName: "",
  287. company: "所属公司",
  288. };
  289. },
  290. mounted() {
  291. this.getAirlines();
  292. },
  293. methods: {
  294. //新增航站楼
  295. newterminal() {
  296. this.addta = true;
  297. },
  298. //点击树状图
  299. handleNodeClick(data) {
  300. this.companyID = data.companyID;
  301. this.companyName = data.companyName;
  302. },
  303. closeForm() {
  304. this.$refs.ruleForm.resetFields();
  305. },
  306. closeta() {
  307. this.$refs.taForm.resetFields();
  308. },
  309. // //模糊查询
  310. // findarrays(ar, feature, v) {
  311. // var arr = [];
  312. // for (var i = 0; i < ar.length; i++) {
  313. // var atxt = ar[i][feature];
  314. // var btxt = v;
  315. // // 将字符串按某个字符切割成若干个字符串,并以数组形式返回
  316. // var atxtarr = atxt.split("");
  317. // var btxtarr = btxt.split("");
  318. // var type = 0;
  319. // for (var k = 0; k < atxtarr.length; k++) {
  320. // for (var p = 0; p < btxtarr.length; p++) {
  321. // if (atxtarr[k] == btxtarr[p]) {
  322. // type = 1;
  323. // }
  324. // }
  325. // }
  326. // if (type == 1) {
  327. // arr.push(ar[i]);
  328. // }
  329. // }
  330. // return arr;
  331. // },
  332. getSearchData(val) {
  333. if (val) {
  334. this.arr = findarrays(this.arr, "name", val);
  335. } else {
  336. this.getAirlines();
  337. }
  338. },
  339. // 内容跳转
  340. toTink(item) {
  341. this.$router.push({
  342. path: "/BasicsData/airportInfoDetails",
  343. query: {
  344. id: item.id,
  345. name: item.name,
  346. fullName: item.fullName,
  347. code3: item.code3,
  348. },
  349. });
  350. },
  351. //公司列表
  352. async getAirlines() {
  353. try {
  354. const res = await Query({
  355. id: DATACONTENT_ID.airportTreeId,
  356. dataContent: [],
  357. });
  358. if (res.code === "0") {
  359. let arr = [];
  360. arr = translateDataToTreeAll(
  361. res.returnData.listValues,
  362. "parentID",
  363. "companyID"
  364. );
  365. this.data = arr;
  366. if (!this.companyID.length) {
  367. this.companyID = arr[0].companyID;
  368. this.company = arr[0].companyName;
  369. }
  370. } else {
  371. this.$message.error(res.message ?? "失败");
  372. }
  373. } catch (error) {
  374. console.log("错误", error);
  375. }
  376. },
  377. //删除信息
  378. handleMove(item) {
  379. this.ids = item.id;
  380. this.flag = true;
  381. this.rmObj = {
  382. name: item.name,
  383. };
  384. },
  385. //删除航站楼
  386. Tinkhall(res) {
  387. this.flaghall = true;
  388. this.rmhall = {
  389. name: res.name,
  390. };
  391. },
  392. //搜索
  393. removeflaghall() {
  394. this.flaghall = false;
  395. },
  396. //提交新增航站楼
  397. addter() {
  398. this.addta = false;
  399. },
  400. //新增机场信息-弹框
  401. handleAdd() {
  402. if (this.newUp) {
  403. this.addFlag = true;
  404. } else {
  405. this.$message.error("请选择所属公司");
  406. }
  407. },
  408. //新增机场信息-弹框-提交
  409. async addSubmit() {
  410. let arr = 0;
  411. this.$refs["ruleForm"].validate((valid) => {
  412. if (valid) {
  413. arr = 1;
  414. } else {
  415. arr = 0;
  416. return false;
  417. }
  418. });
  419. if (arr == 1) {
  420. if (this.ruleForm.name != "" && this.ruleForm.fullName != "") {
  421. const result = await AddAriports({
  422. id: null,
  423. code3: this.ruleForm.code3,
  424. name: this.ruleForm.name,
  425. fullName: this.ruleForm.fullName,
  426. });
  427. if (result.code === 0) {
  428. this.getAirlines();
  429. this.addFlag = false;
  430. this.$message.success("新增成功");
  431. } else {
  432. this.$message.error.message;
  433. }
  434. } else {
  435. this.$message.warning("请输入必填信息");
  436. }
  437. this.closeForm();
  438. }
  439. },
  440. //新增机场信息-弹框-取消
  441. resetForm() {
  442. this.addFlag = false;
  443. },
  444. //删除
  445. async remove() {
  446. const result = await DelAriports({
  447. id: this.ids,
  448. });
  449. if (result.code === 0) {
  450. this.flag = false;
  451. this.getAirlines();
  452. this.$message.success("删除成功");
  453. } else {
  454. this.$message.error.message;
  455. }
  456. },
  457. },
  458. };
  459. </script>
  460. <style lang="scss" scoped>
  461. .airportInfo {
  462. .airportInfo-search {
  463. margin: 40px 0 30px 0;
  464. }
  465. .log {
  466. width: 26px;
  467. height: 26px;
  468. background: #eb2f3b;
  469. border-radius: 50%;
  470. margin-right: 15px;
  471. background: url("../../../../assets/index/ic_close_hint.png") no-repeat;
  472. background-size: 100% 100%;
  473. }
  474. ::v-deep .el-tree-node__children {
  475. display: block;
  476. }
  477. ::v-deep .el-form-item {
  478. margin-bottom: 20px;
  479. }
  480. ::v-deep .el-form-item__content {
  481. margin-left: 120px !important;
  482. }
  483. ::v-deep .el-form-item__label {
  484. width: 120px !important;
  485. }
  486. .tree_left {
  487. width: 100%;
  488. height: 75.8vh;
  489. background: #ffffff;
  490. // box-shadow: 0px 3px 3px 0px rgba(0, 0, 0, 0.1);
  491. // border-radius: 4px;
  492. padding: 24px 24px;
  493. margin-top: 20px;
  494. overflow: hidden;
  495. .corporate {
  496. font-size: 16px;
  497. font-family: Microsoft YaHei;
  498. font-weight: bold;
  499. color: #101116;
  500. margin-bottom: 23px;
  501. }
  502. }
  503. .cont_right {
  504. width: 100%;
  505. height: 69vh;
  506. }
  507. .er {
  508. display: flex;
  509. align-items: center;
  510. }
  511. .airportInfo-content {
  512. img {
  513. margin: 0 auto;
  514. margin-top: 10%;
  515. display: -webkit-box;
  516. -webkit-box-pack: center;
  517. -webkit-box-align: center;
  518. -webkit-box-orient: vertical;
  519. text-align: center;
  520. }
  521. .grid-content {
  522. height: 144px;
  523. padding: 24px;
  524. margin-bottom: 24px;
  525. .title {
  526. font-size: 16px;
  527. font-family: Microsoft YaHei;
  528. font-weight: bold;
  529. color: #303133;
  530. }
  531. .edit_log {
  532. position: relative;
  533. // top: -2px;
  534. }
  535. .icon {
  536. cursor: pointer;
  537. }
  538. .desc {
  539. font-size: 14px;
  540. font-family: Microsoft YaHei;
  541. font-weight: 400;
  542. color: #101116;
  543. margin-top: 32px;
  544. display: flex;
  545. flex-wrap: wrap;
  546. align-items: center;
  547. }
  548. .plus {
  549. width: 20px;
  550. height: 20px;
  551. background: #ffffff;
  552. // background: url("../../../../assets/index/ic_close_s @2x.png") no-repeat;
  553. border: 1px solid #2d67e3;
  554. border-radius: 2px;
  555. margin-right: 8px;
  556. margin-bottom: 8px;
  557. display: flex;
  558. align-items: center;
  559. justify-content: center;
  560. color: #2d67e3;
  561. font-size: 14px;
  562. font-weight: 800;
  563. cursor: pointer;
  564. }
  565. .plus_list {
  566. width: 48px;
  567. height: 20px;
  568. background: #2d67e3;
  569. border-radius: 2px;
  570. display: flex;
  571. align-items: center;
  572. margin-bottom: 8px;
  573. margin-right: 8px;
  574. font-family: Helvetica;
  575. font-weight: bold;
  576. color: #ffffff;
  577. position: relative;
  578. padding-left: 8px;
  579. .logx {
  580. position: absolute;
  581. right: 8px;
  582. top: 6px;
  583. width: 7px;
  584. height: 7px;
  585. display: flex;
  586. align-items: center;
  587. justify-content: center;
  588. background: url("../../../../assets/index/ic_close_s @2x.png")
  589. no-repeat;
  590. background-size: 100% 100%;
  591. // background: #fff;
  592. cursor: pointer;
  593. color: #ffffff;
  594. }
  595. }
  596. }
  597. }
  598. }
  599. </style>