table.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <template>
  2. <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="newQueryTable">
  3. <template v-if="istableChild">
  4. <el-table ref="table" v-el-table-infinite-scroll="load" :data="dealedTableData" :summary-method="getSummaries" :span-method="tableSpanMethod" :show-summary="showSummary" :header-cell-class-name="headerCellClass" :row-class-name="rowClass" :cell-class-name="cellClass" height="100%" class="table infinite-list" stripe border @cell-click="cellClick">
  5. <el-table-column v-for="col in tableColsCopy" :key="col.columnName" :prop="col.columnName" :label="col.groupName" align="center">
  6. <el-table-column v-for="childCol in col.children" :key="childCol.columnName" :width="childCol.nameLength ? Number(childCol.nameLength) : ''" :prop="childCol.columnName" :label="childCol.columnLabel" :formatter="formatter">
  7. <template #header>
  8. <el-tooltip :content="childCol.columnDescribe || childCol.columnLabel" placement="top">
  9. <TableHeaderCell :label="childCol.columnLabel" :filter-options="tableDataFilters[childCol.columnName]" :filter-values.sync="filterValues[childCol.columnName]" :sortable="childCol.needSort" :sort-rule.sync="tableDataSortRules[childCol.columnName]" />
  10. </el-tooltip>
  11. </template>
  12. </el-table-column>
  13. </el-table-column>
  14. </el-table>
  15. </template>
  16. <template v-else>
  17. <el-table ref="table" v-el-table-infinite-scroll="load" :data="dealedTableData" :summary-method="getSummaries" :span-method="tableSpanMethod" :show-summary="showSummary" :header-cell-class-name="headerCellClass" :row-class-name="rowClass" :cell-class-name="cellClass" height="100%" class="table infinite-list" border stripe @cell-click="cellClick">
  18. <el-table-column v-for="(item, index) in tableColsCopy" :key="index" :width="item.nameLength ? Number(item.nameLength) : ''" :prop="item.columnName" :label="item.columnLabel" :show-overflow-tooltip="showOverflowTooltip" :formatter="formatter">
  19. <template #header>
  20. <el-tooltip :content="item.columnDescribe || item.columnLabel" placement="top">
  21. <TableHeaderCell :label="item.columnLabel" :filter-options="tableDataFilters[item.columnName]" :filter-values.sync="filterValues[item.columnName]" :sortable="item.needSort" :sort-rule.sync="tableDataSortRules[item.columnName]" />
  22. </el-tooltip>
  23. </template>
  24. </el-table-column>
  25. </el-table>
  26. </template>
  27. <template v-if="istableDown">
  28. <div :style="downStyle" class="down-btns">
  29. <img class="btn-square btn-shadow" src="@/assets/baggage/ic_export.png" title="下载" @click="exportHandler" />
  30. </div>
  31. </template>
  32. <template v-if="istableCol">
  33. <div :style="btnStyle" class="btns">
  34. <img class="btn-square btn-shadow" src="@/assets/baggage/ic_setting.png" title="列设置" @click="show" />
  35. </div>
  36. <Dialog :flag="dialogFlag" width="600px" class="dialog-check-group">
  37. <div class="dialog-wrapper">
  38. <div class="title">列设置</div>
  39. <div style="height: 600px" class="content">
  40. <el-scrollbar style="height: 100%">
  41. <el-tree ref="columnSetTree" :data="tableCols" :class="colsCheckClass" show-checkbox node-key="index" :default-expand-all="true" :props="{
  42. label: 'columnLabel',
  43. children: 'children',
  44. }" :default-checked-keys="checkedKeysTemp" @check="handleCheck" />
  45. </el-scrollbar>
  46. </div>
  47. <div class="foot right t30">
  48. <el-button size="medium" class="r24" type="primary" @click="onCheck('baggageTableData')">确定</el-button>
  49. <el-button size="medium" @click="hide">取消</el-button>
  50. </div>
  51. </div>
  52. </Dialog>
  53. </template>
  54. </div>
  55. </template>
  56. <script>
  57. import pf from '@/layout/mixin/publicFunc'
  58. import { getToken } from '@/utils/auth'
  59. import { getAuthData, formatOrder } from '@/utils/validate'
  60. import { exportToExcel } from '@/utils/table'
  61. import tableColsMixin from '../mix/tableCols'
  62. import Dialog from '@/layout/components/Dialog/index.vue'
  63. import TableHeaderCell from '@/components/TableHeaderCell/index.vue'
  64. export default {
  65. name: 'NewQueryTable',
  66. components: { Dialog, TableHeaderCell },
  67. mixins: [pf, tableColsMixin],
  68. props: {
  69. // 不换行,溢出隐藏
  70. showOverflowTooltip: {
  71. type: Boolean,
  72. default: true,
  73. },
  74. tableTag: {
  75. type: Object,
  76. default: () => ({}),
  77. },
  78. tableName: {
  79. type: String,
  80. default: '',
  81. },
  82. istableCol: {
  83. type: Boolean,
  84. default: false,
  85. },
  86. istableDown: {
  87. type: Boolean,
  88. default: false,
  89. },
  90. downName: {
  91. type: String,
  92. default: '',
  93. },
  94. istableChild: {
  95. type: Boolean,
  96. default: false,
  97. },
  98. btnStyle: {
  99. type: Object,
  100. default: () => { },
  101. },
  102. downStyle: {
  103. type: Object,
  104. default: () => { },
  105. },
  106. pageSize: {
  107. type: Number,
  108. default: 20,
  109. },
  110. shouldReset: {
  111. type: Boolean,
  112. default: true
  113. },
  114. fastFilter: {
  115. type: Function,
  116. default: () => () => true
  117. },
  118. },
  119. data () {
  120. return {
  121. page: 0,
  122. queryId: '',
  123. noMore: false,
  124. loading: false,
  125. tableCols: [], // 表头数据
  126. tableData: [], // 表格数据
  127. tableColsCopy: [], // 表头数据缓存
  128. tableDataFilters: {}, // 表头-下拉数据
  129. filterValues: {}, // 表头-下拉-选中数据
  130. tableDataCopy: [], // 缓存table数据
  131. tableGroups: [], // 表格分组数据
  132. colShowFilter: '', // 表头-下拉-箭头
  133. spanArr: [], // 表格分组数据缓存
  134. pos: 0, // 表格分组计数
  135. dataContent: [],
  136. authBtns: [],
  137. authBtnCol: [],
  138. authBtnColName: [],
  139. tableArrs: [], // 重组table-表头下拉
  140. tableOptions: {}, // 弹框-下来数据缓存
  141. showSummary: false, // 是否显示统计
  142. tableDataSortRules: {},
  143. tableCath: [],
  144. leaveCount: 0,
  145. checkPath: ['/newDeparture', '/newTransfer/in', '/newTransfer/out', '/newArrival']
  146. }
  147. },
  148. computed: {
  149. // 设置表头-下拉-选中数据
  150. fastFilteredTableData() {
  151. return this.tableData.filter(this.fastFilter)
  152. },
  153. dealedTableData () {
  154. const filtered = this.fastFilteredTableData.filter(item => {
  155. let flag = true
  156. Object.entries(this.filterValues).forEach(([key, arr]) => {
  157. if (arr.length && !arr.includes(String(item[key]))) {
  158. flag = false
  159. }
  160. })
  161. return flag
  162. })
  163. const sortRules = Object.entries(this.tableDataSortRules).reduce(
  164. (pre, [key, value]) => {
  165. if (value) {
  166. pre[0].push(key)
  167. value = value === 'ascending' ? 'asc' : 'desc'
  168. pre[1].push(value)
  169. }
  170. return pre
  171. },
  172. [[], []]
  173. )
  174. return this._.orderBy(filtered, sortRules[0], sortRules[1])
  175. },
  176. tableHeight () {
  177. return 100
  178. },
  179. fromDataType () {
  180. return function (type) {
  181. if (type) {
  182. return type.replace(/\([^\)]*\)/g, '')
  183. }
  184. }
  185. },
  186. },
  187. watch: {
  188. tableTag: {
  189. async handler (val) {
  190. this.dataContent = _.cloneDeep(val)
  191. delete this.dataContent.shouldReset
  192. this.restTable()
  193. if (val.shouldReset) {
  194. this.$emit('update:shouldReset', true)
  195. await this.$nextTick()
  196. }
  197. this.load()
  198. },
  199. deep: true,
  200. },
  201. },
  202. created () {
  203. if (this.AauthTable && this.AauthTable.length) {
  204. const t = this.AauthTable.filter(item => item.auth_name == this.tableName)
  205. const obj = t[0]
  206. this.AqueryParams = obj
  207. this.AqueryId = obj.queryTemplateID
  208. this.AauthId = obj.auth_id
  209. }
  210. this.getColumnData()
  211. },
  212. mounted () {
  213. this.setCellClick()
  214. },
  215. updated () {
  216. this.$refs['table']?.doLayout()
  217. },
  218. methods: {
  219. // 获取表头数据
  220. async getColumnData () {
  221. try {
  222. const { code, returnData } = await this.getQueryList(
  223. SERVICE_ID.sysUserAuthId,
  224. [
  225. {
  226. user_id: getToken('userid'),
  227. auth_id: this.AauthId,
  228. },
  229. ]
  230. )
  231. if (code == 0) {
  232. if (returnData && returnData.length) {
  233. if (!this.istableCol) {
  234. sessionStorage.setItem('tableColumns', JSON.stringify(returnData))
  235. this.$store.dispatch('auth/changeAuthMsg', returnData)
  236. }
  237. const msgDatas = returnData.filter(item => item.needShow)
  238. const msgCounts = msgDatas.filter(item => item.needCount)
  239. if (msgCounts.length) {
  240. this.showSummary = true
  241. }
  242. const msgDatasShows = formatOrder(msgDatas)
  243. this.tableCath = msgDatasShows
  244. if (this.istableChild) {
  245. const datas = _.cloneDeep(msgDatasShows)
  246. const cache = {}
  247. const indices = []
  248. const others = []
  249. datas.forEach(item => {
  250. if (!cache[item.groupName] && item.groupName) {
  251. cache[item.groupName] = item.groupName
  252. indices.push(item)
  253. } else {
  254. const newItem = _.cloneDeep(item)
  255. others.push(newItem)
  256. }
  257. })
  258. indices.map((item, index) => {
  259. item.tabIndex = index
  260. })
  261. others.forEach(item => {
  262. indices.forEach(p => {
  263. if (item.groupName == p.groupName && item.groupName) {
  264. item.tabIndex = p.tabIndex
  265. }
  266. })
  267. })
  268. indices.forEach(item => {
  269. item.children = [
  270. _.cloneDeep(item),
  271. ...this.formatCaps(item.tabIndex, others),
  272. ]
  273. })
  274. this.tableCols = _.cloneDeep(indices)
  275. } else {
  276. this.tableCols = _.cloneDeep(msgDatasShows)
  277. }
  278. this.tableColsCopy = _.cloneDeep(this.tableCols)
  279. this.initTableCols()
  280. this.setTableCols()
  281. }
  282. } else {
  283. this.$message.error('获取表头数据失败')
  284. }
  285. } catch (error) {
  286. console.log(error)
  287. }
  288. },
  289. setTableCols () {
  290. this.tableCath.forEach(({ columnName, needFilters, needSort }) => {
  291. if (needFilters) {
  292. this.$set(this.tableDataFilters, columnName, [])
  293. this.$set(this.filterValues, columnName, [])
  294. }
  295. if (needSort) {
  296. this.$set(this.tableDataSortRules, columnName, '')
  297. }
  298. })
  299. },
  300. formatCaps (order, arr) {
  301. const datas = []
  302. for (let i = 0; i < arr.length; i++) {
  303. const element = arr[i]
  304. if (element['tabIndex'] == order) {
  305. datas.push(element)
  306. }
  307. }
  308. return datas
  309. },
  310. // 获取表格数据
  311. async getQuery (id, dataContent = this.dataContent, page, pageSize) {
  312. try {
  313. if (this.shouldReset) {
  314. this.loading = true
  315. }
  316. this.$emit('update:shouldReset', false)
  317. await this.$nextTick()
  318. const { code, returnData } = await this.getQueryListAuth(
  319. id,
  320. dataContent,
  321. page,
  322. pageSize
  323. )
  324. if (code == 0) {
  325. if (returnData.length === 0) {
  326. this.page--
  327. this.noMore = true
  328. this.loading = false
  329. }
  330. if (this.shouldReset) {
  331. this.tableData.push(...returnData)
  332. } else {
  333. this.tableData = [...returnData]
  334. this.noMore = true
  335. }
  336. this.$emit('tableLoad', [...this.tableData])
  337. setTimeout(() => {
  338. this.initTableData()
  339. this.loading = false
  340. }, 100)
  341. } else {
  342. throw new Error('获取表格数据失败')
  343. }
  344. } catch (error) {
  345. this.page--
  346. this.loading = false
  347. this.$message.error(error.message)
  348. }
  349. },
  350. restTable () {
  351. this.loading = false
  352. this.page = 0
  353. this.noMore = false
  354. if (this.shouldReset) {
  355. this.tableData = []
  356. }
  357. },
  358. load () {
  359. if (this.tableTag && Object.keys(this.tableTag).length) {
  360. if (this.noMore || this.loading) {
  361. return
  362. }
  363. if (this.AqueryParams && this.AqueryParams.queryparams) {
  364. const newData = _.cloneDeep(this.tableTag)
  365. delete newData.shouldReset
  366. const paramsType = typeof this.AqueryParams.queryparams
  367. if (paramsType == 'string') {
  368. const dataObj = {}
  369. const paramsData = this.AqueryParams.queryparams.split(',')
  370. if (paramsData && paramsData.length) {
  371. for (const key in newData) {
  372. paramsData.map(item => {
  373. if (key === item) {
  374. dataObj[item] = newData[key]
  375. } else {
  376. if (item.includes('=')) {
  377. const newItem = item.split('=')
  378. if (key === newItem[0]) {
  379. dataObj[newItem[1]] = newData[key]
  380. }
  381. }
  382. }
  383. })
  384. }
  385. this.dataContent = dataObj
  386. }
  387. }
  388. }
  389. this.getQuery(
  390. this.AqueryId,
  391. this.dataContent,
  392. ++this.page,
  393. this.pageSize
  394. )
  395. }
  396. },
  397. setCellClick () {
  398. let table = null
  399. const { auth_id } = this.$route.meta
  400. const { arrs } = getAuthData(auth_id)
  401. if (this.tableName) {
  402. table = this.AauthTable.filter(item => item.auth_name == this.tableName)
  403. } else {
  404. table = arrs.filter(item => item.auth_type == 4)
  405. }
  406. if (table && table.length) {
  407. const obj = table[0]
  408. const { arrs } = getAuthData(obj.auth_id)
  409. this.authBtnCol = arrs.filter(item => Number(item.service_type) == 6)
  410. if (this.authBtnCol.length) {
  411. this.authBtnCol.forEach(item => {
  412. this.authBtnColName.push(item.relation_data)
  413. })
  414. }
  415. }
  416. },
  417. // 初始化表格
  418. initTableData () {
  419. this.tableDataCopy = _.cloneDeep(this.tableData)
  420. const datas = _.cloneDeep(this.tableColsCopy)
  421. // const reqUts = [];
  422. datas.forEach(async item => {
  423. if (item.needGroup) {
  424. this.tableGroups.push(item.columnName)
  425. }
  426. // if (item.listqueryTemplateID || item.listqueryTemplateID == 0) {
  427. // this.tableArrs.push(item.columnName);
  428. // if (!this.tableOptions[item.columnName]) {
  429. // this.tableOptions[item.columnName] = await this.getSelectData(item.listqueryTemplateID);
  430. // }
  431. // }
  432. })
  433. if (this.$route.path == '/newDeparture') {
  434. this.leaveCount = 0
  435. const nTableData = [...this.tableData]
  436. const cData = nTableData.filter(item => Number(item['NO_BSM_number']) + Number(item['check_in_baggage_number']) > 0)
  437. cData.forEach(item => {
  438. if (item.normalState == 'DEP' || item.normalState == 'ARR') {
  439. this.leaveCount++
  440. }
  441. })
  442. this.tableData = _.orderBy([...cData], ["scheduleTakeOffTime", "normalState"], ["asc", "desc"]);
  443. }
  444. const dats = this.setTableFilters(this.tableData, this.tableDataFilters)
  445. this.tableDataFilters = _.cloneDeep(dats)
  446. this.tableGroup(this.tableData)
  447. },
  448. setTableFilters (tableData, filters) {
  449. const tempSets = {}
  450. Object.keys(filters).forEach(key => {
  451. tempSets[key] = new Set()
  452. })
  453. tableData.forEach(item => {
  454. Object.keys(tempSets).forEach(key => {
  455. ; (item[key] ?? '') !== '' && tempSets[key].add(String(item[key]))
  456. })
  457. })
  458. Object.keys(tempSets).forEach(key => {
  459. filters[key] = _.orderBy(
  460. [...tempSets[key]].map(value => ({
  461. text: value,
  462. value,
  463. })),
  464. o => o.value
  465. )
  466. })
  467. return filters
  468. },
  469. // 分组
  470. tableGroup (tableData) {
  471. const spanArr = []
  472. let pos = 0
  473. let ifYj = this.tableGroups[0]
  474. for (let i = 0; i < tableData.length; i++) {
  475. if (i === 0) {
  476. spanArr.push(1)
  477. } else {
  478. if (tableData[i][ifYj] === tableData[i - 1][ifYj]) {
  479. spanArr[pos] += 1
  480. spanArr.push(0)
  481. } else {
  482. spanArr.push(1)
  483. pos = i
  484. }
  485. }
  486. }
  487. this.spanArr = spanArr
  488. this.pos = pos
  489. },
  490. popoverShowHandler (prop) {
  491. this.colShowFilter = prop
  492. },
  493. popoverHideHandler () {
  494. this.colShowFilter = ''
  495. },
  496. // 获取弹框-下拉数据
  497. async getSelectData (id) {
  498. // name ? [name] : name === null ? [null]: [],
  499. const { code, returnData } = await this.getQueryList(id, {})
  500. if (code == 0) {
  501. return returnData
  502. } else {
  503. return []
  504. }
  505. },
  506. // 设置表头-下拉-箭头样式
  507. arrowClass () {
  508. return function (prop) {
  509. const classes = []
  510. if (this.colShowFilter === prop) {
  511. classes.push('arrow-active')
  512. }
  513. if (
  514. Object.entries(this.tableDataFilters).find(
  515. ([key, arr]) => this.filterValues[prop]
  516. )
  517. ) {
  518. classes.push('arrow-blue')
  519. }
  520. return classes.join(' ')
  521. }
  522. },
  523. // 合计
  524. getSummaries (param) {
  525. const { columns, data } = param
  526. const sums = []
  527. columns.forEach((column, index) => {
  528. if (index === 0) {
  529. sums[index] = '合计:' + data.length
  530. return
  531. }
  532. this.tableCath.forEach(p => {
  533. if (column.property == p.columnName && p.needCount) {
  534. const values = data.map(item => Number(item[column.property]))
  535. if (!values.every(value => isNaN(value))) {
  536. sums[index] = values.reduce((prev, curr) => {
  537. const value = Number(curr)
  538. if (!isNaN(value)) {
  539. return prev + curr
  540. } else {
  541. return prev
  542. }
  543. }, 0)
  544. sums[index] += ''
  545. }
  546. }
  547. })
  548. })
  549. return sums
  550. },
  551. // 分组
  552. tableSpanMethod ({ row, column, rowIndex, columnIndex }) {
  553. if (this.tableGroups.includes(column['property'])) {
  554. const _row = this.spanArr[rowIndex]
  555. const _col = _row > 0 ? 1 : 0
  556. return {
  557. rowspan: _row,
  558. colspan: _col,
  559. }
  560. }
  561. },
  562. // 给表头单元格加上 ascending 或 descending 使用 element 自带的排序箭头变色
  563. headerCellClass ({ row, column, rowIndex, columnIndex }) {
  564. const classes = []
  565. const rule = this.tableDataSortRules[column.property]
  566. if (rule) {
  567. classes.push(rule)
  568. }
  569. return classes.join(' ')
  570. },
  571. // 表格-设置单元格样式
  572. cellClass ({ row, column, rowIndex, columnIndex }) {
  573. if (this.authBtnColName.includes(column.property) && Number(row[column.property]) !== 0) {
  574. return 'is-click-btn'
  575. }
  576. if (this.$route.path == '/newDeparture') {
  577. if (column.property === 'NO_check_number' && Number(row['NO_check_number']) > 0) {
  578. return 'cell-toUnload'
  579. }
  580. }
  581. },
  582. // 表格-设置行样式
  583. rowClass ({ row, rowIndex }) {
  584. const classes = []
  585. if (this.checkPath.includes(this.$route.path)) {
  586. const { abnormalState, normalState } = row
  587. if (abnormalState) {
  588. if (abnormalState == 'DLY') {
  589. classes.push('bgl-delayed')
  590. }
  591. if (abnormalState == 'CAN') {
  592. classes.push('bgl-canceled')
  593. }
  594. }
  595. if (normalState) {
  596. if (normalState == 'DEP' || normalState == 'ARR') {
  597. classes.push('bgl-hui')
  598. }
  599. }
  600. if (rowIndex === this.leaveCount - 1) {
  601. classes.push("redBorder");
  602. }
  603. }
  604. return classes
  605. },
  606. // 表格-单元格点击
  607. cellClick (row, column) {
  608. const dataBtns = this.authBtnCol
  609. if (dataBtns && dataBtns.length) {
  610. const clickBtn = dataBtns.filter(
  611. item => item.relation_data == column.property
  612. )[0]
  613. if (clickBtn) {
  614. const { open_method, route_info, pass_parameters, relation_data } = clickBtn
  615. if (Number(open_method) === 2 && Number(row[relation_data]) !== 0) {
  616. if (pass_parameters) {
  617. const query = pass_parameters.split(',')
  618. const obj = {}
  619. query.forEach(key => {
  620. obj[key] = row[key]
  621. })
  622. if (['Inbound_flight_number', 'Inbound_baggage_number'].includes(relation_data)) {
  623. obj.outAirport = obj.inbound_flights_departure_airport
  624. obj.landAirport = obj.current_airport
  625. delete obj.current_airport
  626. delete obj.inbound_flights_departure_airport
  627. }
  628. if (['departure_flights_number', 'departure_flights_transferred_bags_number'].includes(relation_data)) {
  629. obj.outAirport = obj.current_airport
  630. obj.landAirport = obj.departure_flights_destination_airport
  631. delete obj.current_airport
  632. delete obj.departure_flights_destination_airport
  633. }
  634. this.$router.push({
  635. path: route_info,
  636. query: obj,
  637. })
  638. }
  639. }
  640. }
  641. }
  642. },
  643. // 导出
  644. exportHandler () {
  645. const table = this.$refs['table'].$el.cloneNode(true)
  646. const fileName = `${this.downName || this.AqueryParams.auth_name}.xlsx`
  647. exportToExcel(table, `${this.downName || this.AqueryParams.auth_name}`, fileName)
  648. },
  649. formatter (row, column, cellValue, index) {
  650. let sameColumn = null
  651. this.tableCols.some(col => {
  652. if (col.columnName === column.property) {
  653. sameColumn = col
  654. return true
  655. } else if (col.children) {
  656. col.children.some(childCol => {
  657. if (childCol.columnName === column.property) {
  658. sameColumn = childCol
  659. return true
  660. }
  661. })
  662. }
  663. })
  664. if (sameColumn && this.fromDataType(sameColumn.dataType) === 'datetime') {
  665. return (cellValue ?? '').replace('T', ' ')
  666. }
  667. return cellValue
  668. },
  669. },
  670. }
  671. </script>
  672. <style lang="scss" scoped>
  673. .newQueryTable {
  674. height: 100%;
  675. position: relative;
  676. ::v-deep .table {
  677. .is-click-btn {
  678. .cell {
  679. color: #409eff;
  680. cursor: pointer;
  681. position: relative;
  682. }
  683. }
  684. .cell {
  685. color: #000;
  686. text-align: center;
  687. white-space: nowrap;
  688. padding: 0;
  689. .el-tooltip {
  690. white-space: nowrap;
  691. text-overflow: ellipsis;
  692. overflow: hidden;
  693. line-height: 34px;
  694. }
  695. }
  696. tr.bgl-delayed td {
  697. background: #fcf0b1;
  698. }
  699. tr.bgl-canceled td {
  700. background: #f7babe;
  701. }
  702. tr.bgl-hui td {
  703. background: #d2d6df;
  704. }
  705. .redBorder {
  706. position: relative;
  707. &::after {
  708. content: "";
  709. position: absolute;
  710. left: 0;
  711. bottom: 0;
  712. width: 100%;
  713. height: 2px;
  714. background: #e83f82;
  715. }
  716. }
  717. td.cell-toUnload {
  718. background: lightcoral !important;
  719. position: relative;
  720. &::after {
  721. content: "";
  722. display: block;
  723. width: 100%;
  724. height: 100%;
  725. position: absolute;
  726. top: 0;
  727. left: 0;
  728. border: 2px dashed red;
  729. }
  730. }
  731. }
  732. .btns {
  733. position: absolute;
  734. top: -50px;
  735. right: 32px;
  736. z-index: 10;
  737. }
  738. .down-btns {
  739. position: absolute;
  740. top: -50px;
  741. right: 72px;
  742. z-index: 10;
  743. }
  744. }
  745. </style>