queryTemplate.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-11-17 13:43:58
  4. * @LastEditTime: 2022-06-12 00:04:05
  5. * @LastEditors: your name
  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. <DataTable tableHeight="700" :data-id="dataId" :rows="12" labelWidth="100px" :min-height="70" width="800px" is-statuser show-overflow-tooltip with-column-set with-preview @handleAdd="handleAdd" @handleEdit="handleEdit" @preview="handlePreview">
  12. <template v-slot:header>
  13. <div class="status flex-wrap">
  14. <div class="manageTitle">查询模板</div>
  15. </div>
  16. </template>
  17. </DataTable>
  18. <!--搜索-->
  19. <!-- <div class="airportInfo-search">
  20. <Search title="查询模板" @getSearchData="getSearchData" :isSearch="false">
  21. <button @click="handleAdd" class="btnAdd">新增</button>
  22. </Search>
  23. </div> -->
  24. <!--内容区域-->
  25. <!-- <div class="airportInfo-content">
  26. <el-row :gutter="24">
  27. <el-col
  28. v-for="(item, index) in arr"
  29. class="airportInfo-content-list"
  30. :key="index"
  31. :data="serachBox"
  32. :span="4"
  33. >
  34. <div class="grid-content box-public-shadow">
  35. <div class="flex list">
  36. <div class="ult flex-wrap er">
  37. <el-tooltip
  38. class="item"
  39. effect="dark"
  40. :content="item.queryTemplateName"
  41. placement="bottom"
  42. >
  43. <div class="title">{{ item.queryTemplateName }}</div>
  44. </el-tooltip>
  45. <div @click="airEdit(item)" class="edit_log"></div>
  46. </div>
  47. <div class="close">
  48. <span
  49. @click.stop="handleMove(item, index)"
  50. class="el-icon-close icon"
  51. ></span>
  52. </div>
  53. </div>
  54. <div class="list desc">{{ item.queryTemplateDescribe }}</div>
  55. </div>
  56. </el-col>
  57. </el-row>
  58. </div> -->
  59. <!--删除弹框-->
  60. <Dialog :flag="flag">
  61. <div class="airportInfoDialog">
  62. <div class="del-title">删除分类信息</div>
  63. <div class="content er">
  64. <div class="log" />
  65. 是否确认删除
  66. <p style="color: #eb2f3b; margin-top: 0px; margin-bottom: 0px">
  67. {{ rmObj.name }}
  68. </p>
  69. </div>
  70. <div class="DelFoot right t30">
  71. <el-button size="medium" class="r25 buwitch" type="danger" @click="remove()">删除</el-button>
  72. <el-button size="medium" class="r26" @click="flag = false">取消</el-button>
  73. </div>
  74. </div>
  75. </Dialog>
  76. </div>
  77. </template>
  78. <script>
  79. // import Search from '@/layout/components/Search/index.vue'
  80. import Dialog from "@/layout/components/Dialog/index.vue";
  81. import { findarrays } from "@/utils/validate";
  82. // import { AirlinesInquiry } from '@/api/SystemSettings'
  83. import {
  84. exceptiontype,
  85. exceptionadd,
  86. // exceptiondel
  87. } from "@/api/acquisition";
  88. import { GeneralDataReception, Query } from "@/api/dataIntegration";
  89. import DataTable from "@/components/Table";
  90. export default {
  91. name: "AirportInfo",
  92. components: {
  93. // Search,
  94. Dialog,
  95. DataTable,
  96. },
  97. data () {
  98. return {
  99. dataId: DATACONTENT_ID.sysQueryTabId,
  100. arr: [
  101. {
  102. typeName: "名称",
  103. typeCode: "测试",
  104. },
  105. ], // 内容数据
  106. flag: false, // 删除弹框开关
  107. addFlag: false, // 新增机场信息弹框开关
  108. EditFlag: false,
  109. ids: null,
  110. idss: null,
  111. listDate: {},
  112. rmObj: {
  113. // 删除内容
  114. name: "",
  115. },
  116. ruleForm: {
  117. // 新增机场信息表单
  118. name: "",
  119. fullName: "",
  120. code: "",
  121. },
  122. EditForm: {
  123. name: "",
  124. fullName: "",
  125. code: "",
  126. },
  127. rules: {
  128. // 新增机场信息表单验证
  129. name: [{ required: true, message: "请输入航司简称", trigger: "blur" }],
  130. fullName: [
  131. { required: true, message: "请输入航司全称", trigger: "blur" },
  132. ],
  133. code: [
  134. { required: true, message: "请输入航司二字码", trigger: "blur" },
  135. ],
  136. },
  137. modid: "",
  138. };
  139. },
  140. computed: {
  141. serachBox () {
  142. if (this.searchInfo) {
  143. return this.arr.filter((data) => {
  144. return Object.keys(data).some((key) => {
  145. return (
  146. String(data[key]).toLowerCase().indexOf(this.searchInfo) > -1
  147. );
  148. });
  149. });
  150. }
  151. return this.arr;
  152. },
  153. },
  154. created () {
  155. // this.getAirlines();
  156. // this.exceptionlist();
  157. },
  158. methods: {
  159. // 异常列表查询
  160. async exceptionlist () {
  161. const params = {
  162. id: "",
  163. };
  164. const result = await exceptiontype(params);
  165. if (Number(result.code) === 0) {
  166. this.arr = result.returnData;
  167. }
  168. },
  169. // 搜索
  170. getSearchData (val) {
  171. const that = this;
  172. that.exceptionlist().then(function (data) {
  173. if (val) {
  174. that.arr = findarrays(that.arr, "typeName", val);
  175. } else {
  176. that.exceptionlist();
  177. }
  178. });
  179. //
  180. },
  181. // 删除信息
  182. handleMove (item) {
  183. this.listDate = item;
  184. this.flag = true;
  185. this.rmObj = {
  186. name: item.queryTemplateName,
  187. };
  188. },
  189. async EditSubmit () {
  190. let arr = 0;
  191. this.$refs["ruleFormall"].validate((valid) => {
  192. if (valid) {
  193. arr = 1;
  194. } else {
  195. arr = 0;
  196. return false;
  197. }
  198. });
  199. if (arr === 1) {
  200. const params = {
  201. id: this.modid.id,
  202. typeName: this.EditForm.name,
  203. typeCode: this.EditForm.fullName,
  204. };
  205. const result = await exceptionadd(params);
  206. if (Number(result.code) === 0) {
  207. this.$message.success("成功");
  208. this.exceptionlist();
  209. this.$refs.ruleFormall.resetFields();
  210. }
  211. this.EditFlag = false;
  212. }
  213. },
  214. closeForm () {
  215. this.$refs.ruleForm.resetFields();
  216. },
  217. // 获取模板列表
  218. async getAirlines () {
  219. try {
  220. const res = await Query({
  221. id: 77,
  222. dataContent: [],
  223. });
  224. if (res.code === "0") {
  225. this.arr = res.returnData;
  226. } else {
  227. this.$message.error(res.message ?? "失败");
  228. }
  229. } catch (error) {
  230. this.$message.error("失败");
  231. }
  232. },
  233. // 新增机场信息-弹框
  234. handleAdd () {
  235. this.$router.push("/systemSettings/queryTemplateadd");
  236. },
  237. // 新增机场信息-弹框
  238. handleEdit (item) {
  239. // this.modid = item;
  240. // this.EditForm.name = item.typeName;
  241. // this.EditForm.fullName = item.typeCode;
  242. this.$router.push({
  243. path: "/systemSettings/queryTemplateedit",
  244. query: { queryTemplateID: item.queryTemplateID },
  245. });
  246. // this.EditForm.code = item.code2;
  247. // this.EditFlag = true;
  248. },
  249. // 新增机场信息-弹框-取消
  250. resetForm () {
  251. this.addFlag = false;
  252. this.EditFlag = false;
  253. this.ruleForm.name = "";
  254. this.ruleForm.fullName = "";
  255. this.$refs.ruleForms.resetFields();
  256. this.$refs.ruleFormall.resetFields();
  257. },
  258. // 删除
  259. async remove (data) {
  260. this.listDate.operate = "3";
  261. try {
  262. const res = await GeneralDataReception({
  263. serviceId: 5,
  264. dataContent: JSON.stringify(this.listDate),
  265. });
  266. if (res.code === "0") {
  267. this.$message.success(res.message ?? "成功");
  268. this.flag = false;
  269. this.listDate = {};
  270. this.getAirlines();
  271. } else {
  272. this.$message.error(res.message ?? "失败");
  273. }
  274. } catch (error) {
  275. this.$message.error("失败");
  276. }
  277. },
  278. // 查询模板预览
  279. handlePreview ({ queryTemplateID, queryTemplateName }) {
  280. this.$router.push({
  281. path: '/systemSettings/queryTemplatePreview',
  282. query: {
  283. queryTemplateID,
  284. queryTemplateName
  285. }
  286. })
  287. }
  288. },
  289. };
  290. </script>
  291. <style lang="scss" scoped>
  292. .airportInfo {
  293. ::v-deep .el-form-item {
  294. margin-bottom: 20px;
  295. }
  296. .log {
  297. width: 26px;
  298. height: 26px;
  299. background: #eb2f3b;
  300. border-radius: 50%;
  301. margin-right: 15px;
  302. background: url("../../../../assets/index/ic_close_hint.png") no-repeat;
  303. background-size: 100% 100%;
  304. }
  305. .er {
  306. display: flex;
  307. align-items: center;
  308. }
  309. .airportInfo-search {
  310. margin: 40px 0 30px 0;
  311. }
  312. .airportInfo-content {
  313. img {
  314. margin: 0 auto;
  315. margin-top: 10%;
  316. display: -webkit-box;
  317. -webkit-box-pack: center;
  318. -webkit-box-align: center;
  319. -webkit-box-orient: vertical;
  320. text-align: center;
  321. }
  322. .grid-content {
  323. height: 144px;
  324. padding: 24px;
  325. margin-bottom: 24px;
  326. .title {
  327. font-size: 16px;
  328. font-family: Microsoft YaHei;
  329. font-weight: bold;
  330. color: #303133;
  331. white-space: nowrap;
  332. overflow: hidden;
  333. text-overflow: ellipsis;
  334. max-width: 150px;
  335. }
  336. .edit_log {
  337. position: relative;
  338. // top: -2px;
  339. }
  340. .icon {
  341. cursor: pointer;
  342. }
  343. .desc {
  344. font-size: 14px;
  345. font-family: Microsoft YaHei;
  346. font-weight: 400;
  347. color: #101116;
  348. margin-top: 60px;
  349. }
  350. }
  351. }
  352. }
  353. </style>