JSuperQuery.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div class="j-super-query-box">
  3. <slot name="button" :isActive="superQueryFlag" :isMobile="izMobile" :open="handleOpen" :reset="handleReset">
  4. <a-tooltip v-if="superQueryFlag" v-bind="tooltipProps" :mouseLeaveDelay="0.2">
  5. <!-- begin 不知道为什么不加上这段代码就无法生效 -->
  6. <span v-show="false">{{tooltipProps}}</span>
  7. <!-- end 不知道为什么不加上这段代码就无法生效 -->
  8. <template slot="title">
  9. <span>已有高级查询条件生效</span>
  10. <a-divider type="vertical"/>
  11. <a @click="handleReset">清空</a>
  12. </template>
  13. <a-button-group>
  14. <a-button type="primary" @click="handleOpen">
  15. <a-icon type="appstore" theme="twoTone" spin/>
  16. <span>高级查询</span>
  17. </a-button>
  18. <a-button v-if="izMobile" type="primary" icon="delete" @click="handleReset"/>
  19. </a-button-group>
  20. </a-tooltip>
  21. <a-button v-else type="primary" icon="filter" @click="handleOpen">高级查询</a-button>
  22. </slot>
  23. <j-modal
  24. title="高级查询构造器"
  25. :width="1000"
  26. :visible="visible"
  27. @cancel="handleCancel"
  28. :mask="false"
  29. :fullscreen="izMobile"
  30. draggable
  31. class="j-super-query-modal"
  32. style="top:5%;max-height: 95%;"
  33. >
  34. <template slot="footer">
  35. <div style="float: left">
  36. <a-button :loading="loading" @click="handleReset">重置</a-button>
  37. <a-button :loading="loading" @click="handleSave">保存查询条件</a-button>
  38. </div>
  39. <a-button :loading="loading" @click="handleCancel">关闭</a-button>
  40. <a-button :loading="loading" type="primary" @click="handleOk">查询</a-button>
  41. </template>
  42. <a-spin :spinning="loading">
  43. <a-row>
  44. <a-col :sm="24" :md="24-5">
  45. <a-empty v-if="queryParamsModel.length === 0" style="margin-bottom: 12px;">
  46. <div slot="description">
  47. <span>没有任何查询条件</span>
  48. <a-divider type="vertical"/>
  49. <a @click="handleAdd">点击新增</a>
  50. </div>
  51. </a-empty>
  52. <a-form v-else layout="inline">
  53. <a-row style="margin-bottom: 12px;">
  54. <a-col :md="12" :xs="24">
  55. <a-form-item label="过滤条件匹配" :labelCol="{md: 6,xs:24}" :wrapperCol="{md: 18,xs:24}" style="width: 100%;">
  56. <a-select v-model="matchType" :getPopupContainer="node=>node.parentNode" style="width: 100%;">
  57. <a-select-option value="and">AND(所有条件都要求匹配)</a-select-option>
  58. <a-select-option value="or">OR(条件中的任意一个匹配)</a-select-option>
  59. </a-select>
  60. </a-form-item>
  61. </a-col>
  62. </a-row>
  63. <a-row type="flex" style="margin-bottom:10px" :gutter="16" v-for="(item, index) in queryParamsModel" :key="index">
  64. <a-col :md="8" :xs="24" style="margin-bottom: 12px;">
  65. <a-tree-select
  66. showSearch
  67. v-model="item.field"
  68. :treeData="fieldTreeData"
  69. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  70. placeholder="选择查询字段"
  71. allowClear
  72. treeDefaultExpandAll
  73. :getPopupContainer="node=>node.parentNode"
  74. style="width: 100%"
  75. @select="(val,option)=>handleSelected(option,item)"
  76. >
  77. </a-tree-select>
  78. </a-col>
  79. <a-col :md="4" :xs="24" style="margin-bottom: 12px;">
  80. <a-select placeholder="匹配规则" :value="item.rule" :getPopupContainer="node=>node.parentNode" @change="handleRuleChange(item,$event)">
  81. <a-select-option value="eq">等于</a-select-option>
  82. <a-select-option value="like">包含</a-select-option>
  83. <a-select-option value="right_like">以..开始</a-select-option>
  84. <a-select-option value="left_like">以..结尾</a-select-option>
  85. <a-select-option value="in">在...中</a-select-option>
  86. <a-select-option value="ne">不等于</a-select-option>
  87. <a-select-option value="gt">大于</a-select-option>
  88. <a-select-option value="ge">大于等于</a-select-option>
  89. <a-select-option value="lt">小于</a-select-option>
  90. <a-select-option value="le">小于等于</a-select-option>
  91. </a-select>
  92. </a-col>
  93. <a-col :md="8" :xs="24" style="margin-bottom: 12px;">
  94. <!-- 下拉搜索 -->
  95. <j-search-select-tag v-if="item.type==='sel_search'" v-model="item.val" :dict="getDictInfo(item)" placeholder="请选择"/>
  96. <!-- 下拉框 -->
  97. <j-search-select-tag v-else-if="item.type==='list' && item.dictTable" v-model="item.val" :dict="getDictInfo(item)" placeholder="请选择"/>
  98. <!-- 下拉多选 -->
  99. <template v-else-if="item.type==='list_multi'">
  100. <j-multi-select-tag v-if="item.options" v-model="item.val" :options="item.options" placeholder="请选择"/>
  101. <j-multi-select-tag v-else v-model="item.val" :dictCode="getDictInfo(item)" placeholder="请选择"/>
  102. </template>
  103. <template v-else-if="item.dictCode">
  104. <template v-if="item.type === 'table-dict'">
  105. <j-popup
  106. v-model="item.val"
  107. :code="item.dictTable"
  108. :field="item.dictCode"
  109. :orgFields="item.dictCode"
  110. :destFields="item.dictCode"
  111. :multi="true"
  112. ></j-popup>
  113. </template>
  114. <template v-else>
  115. <j-multi-select-tag v-show="allowMultiple(item)" v-model="item.val" :dictCode="item.dictCode" placeholder="请选择"/>
  116. <j-dict-select-tag v-show="!allowMultiple(item)" v-model="item.val" :dictCode="item.dictCode" placeholder="请选择"/>
  117. </template>
  118. </template>
  119. <j-popup
  120. v-else-if="item.type === 'popup'"
  121. :value="item.val"
  122. v-bind="item.popup"
  123. group-id="superQuery"
  124. @input="(e,v)=>handleChangeJPopup(item,e,v)"
  125. :multi="true"/>
  126. <j-select-multi-user
  127. v-else-if="item.type === 'select-user' || item.type === 'sel_user'"
  128. v-model="item.val"
  129. :buttons="false"
  130. :multiple="allowMultiple(item)"
  131. placeholder="请选择用户"
  132. :returnKeys="['id', item.customReturnField || 'username']"
  133. />
  134. <j-select-depart
  135. v-else-if="item.type === 'select-depart' || item.type === 'sel_depart'"
  136. v-model="item.val"
  137. :multi="allowMultiple(item)"
  138. placeholder="请选择部门"
  139. :customReturnField="item.customReturnField || 'id'"
  140. />
  141. <a-select
  142. v-else-if="item.options instanceof Array"
  143. v-model="item.val"
  144. :options="item.options"
  145. allowClear
  146. placeholder="请选择"
  147. :mode="allowMultiple(item)?'multiple':''"
  148. />
  149. <j-area-linkage v-model="item.val" v-else-if="item.type==='area-linkage' || item.type==='pca'" style="width: 100%"/>
  150. <j-date v-else-if=" item.type=='date' " v-model="item.val" placeholder="请选择日期" style="width: 100%"></j-date>
  151. <j-date v-else-if=" item.type=='datetime' " v-model="item.val" placeholder="请选择时间" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"></j-date>
  152. <a-time-picker v-else-if="item.type==='time'" :value="item.val ? moment(item.val,'HH:mm:ss') : null" format="HH:mm:ss" style="width: 100%" @change="(time,value)=>item.val=value"/>
  153. <a-input-number v-else-if=" item.type=='int'||item.type=='number' " style="width: 100%" placeholder="请输入数值" v-model="item.val"/>
  154. <a-select v-else-if="item.type=='switch'" placeholder="请选择" v-model="item.val">
  155. <!-- update-begin-author:taoyan for: VUEN-242【online表单 高级查询】开关组件设置扩展参数为[0,1] 时,高级查询选择后查询仍然是Y/N -->
  156. <a-select-option :value="item.extendOption[0]">是</a-select-option>
  157. <a-select-option :value="item.extendOption[1]">否</a-select-option>
  158. <!-- update-end-author:taoyan for: VUEN-242【online表单 高级查询】开关组件设置扩展参数为[0,1] 时,高级查询选择后查询仍然是Y/N -->
  159. </a-select>
  160. <a-input v-else v-model="item.val" placeholder="请输入值"/>
  161. </a-col>
  162. <a-col :md="4" :xs="0" style="margin-bottom: 12px;">
  163. <a-button @click="handleAdd" icon="plus"></a-button>&nbsp;
  164. <a-button @click="handleDel( index )" icon="minus"></a-button>
  165. </a-col>
  166. <a-col :md="0" :xs="24" style="margin-bottom: 12px;text-align: right;">
  167. <a-button @click="handleAdd" icon="plus"></a-button>&nbsp;
  168. <a-button @click="handleDel( index )" icon="minus"></a-button>
  169. </a-col>
  170. </a-row>
  171. </a-form>
  172. </a-col>
  173. <a-col :sm="24" :md="5">
  174. <!-- 查询记录 -->
  175. <a-card class="j-super-query-history-card" :bordered="true">
  176. <div slot="title">
  177. 保存的查询
  178. </div>
  179. <a-empty v-if="saveTreeData.length === 0" class="j-super-query-history-empty" description="没有保存任何查询"/>
  180. <a-tree
  181. v-else
  182. class="j-super-query-history-tree"
  183. showIcon
  184. :treeData="saveTreeData"
  185. :selectedKeys="[]"
  186. @select="handleTreeSelect"
  187. >
  188. </a-tree>
  189. </a-card>
  190. </a-col>
  191. </a-row>
  192. </a-spin>
  193. <a-modal title="请输入保存的名称" :visible="prompt.visible" @cancel="prompt.visible=false" @ok="handlePromptOk">
  194. <a-input v-model="prompt.value"></a-input>
  195. </a-modal>
  196. </j-modal>
  197. </div>
  198. </template>
  199. <script>
  200. import moment from 'moment'
  201. import * as utils from '@/utils/util'
  202. import { mixinDevice } from '@/utils/mixin'
  203. import JDate from '@/components/jeecg/JDate.vue'
  204. import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  205. import JSelectMultiUser from '@/components/jeecgbiz/JSelectMultiUser'
  206. import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
  207. import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  208. export default {
  209. name: 'JSuperQuery',
  210. mixins: [mixinDevice],
  211. components: { JAreaLinkage, JMultiSelectTag, JDate, JSelectDepart, JSelectMultiUser },
  212. props: {
  213. /*
  214. fieldList: [{
  215. value:'',
  216. text:'',
  217. type:'',
  218. dictCode:'' // 只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
  219. }]
  220. type:date datetime int number string
  221. * */
  222. fieldList: {
  223. type: Array,
  224. required: true
  225. },
  226. /*
  227. * 这个回调函数接收一个数组参数 即查询条件
  228. * */
  229. callback: {
  230. type: String,
  231. required: false,
  232. default: 'handleSuperQuery'
  233. },
  234. // 当前是否在加载中
  235. loading: {
  236. type: Boolean,
  237. default: false
  238. },
  239. // 保存查询条件的唯一 code,通过该 code 区分
  240. // 默认为 null,代表以当前路由全路径为区分Code
  241. saveCode: {
  242. type: String,
  243. default: null
  244. }
  245. },
  246. data() {
  247. return {
  248. moment,
  249. fieldTreeData: [],
  250. prompt: {
  251. visible: false,
  252. value: ''
  253. },
  254. visible: false,
  255. queryParamsModel: [],
  256. treeIcon: <a-icon type="file-text"/>,
  257. // 保存查询条件的treeData
  258. saveTreeData: [],
  259. // 保存查询条件的前缀名
  260. saveCodeBefore: 'JSuperQuerySaved_',
  261. // 查询类型,过滤条件匹配(and、or)
  262. matchType: 'and',
  263. superQueryFlag: false,
  264. }
  265. },
  266. computed: {
  267. izMobile() {
  268. return this.device === 'mobile'
  269. },
  270. tooltipProps() {
  271. return this.izMobile ? { visible: false } : {}
  272. },
  273. fullSaveCode() {
  274. let saveCode = this.saveCode
  275. if (saveCode == null || saveCode === '') {
  276. saveCode = this.$route.fullPath
  277. }
  278. return this.saveCodeBefore + saveCode
  279. },
  280. },
  281. watch: {
  282. // 当 saveCode 变化时,重新查询已保存的条件
  283. fullSaveCode: {
  284. immediate: true,
  285. handler() {
  286. let list = this.$ls.get(this.fullSaveCode)
  287. if (list instanceof Array) {
  288. this.saveTreeData = list.map(i => this.renderSaveTreeData(i))
  289. }
  290. }
  291. },
  292. fieldList: {
  293. deep: true,
  294. immediate: true,
  295. handler(val) {
  296. let mainData = [], subData = []
  297. val.forEach(item => {
  298. let data = { ...item }
  299. data.label = data.label || data.text
  300. let hasChildren = (data.children instanceof Array)
  301. data.disabled = hasChildren
  302. data.selectable = !hasChildren
  303. if (hasChildren) {
  304. data.children = data.children.map(item2 => {
  305. let child = { ...item2 }
  306. child.label = child.label || child.text
  307. child.label = data.label + '-' + child.label
  308. // update--begin--author:sunjianlei-----date:20220121------for:【JTC-1167】【表单设计器】高级查询,一对一字段查询不好使
  309. // 是否仅包含字段名,不需要拼接子表表名
  310. if (!data.onlyFieldName) {
  311. child.value = data.value + ',' + child.value
  312. }
  313. // update--end--author:sunjianlei-----date:20220121------for:【JTC-1167】【表单设计器】高级查询,一对一字段查询不好使
  314. child.val = ''
  315. return child
  316. })
  317. data.val = ''
  318. subData.push(data)
  319. } else {
  320. mainData.push(data)
  321. }
  322. })
  323. this.fieldTreeData = mainData.concat(subData)
  324. }
  325. }
  326. },
  327. methods: {
  328. show() {
  329. if (!this.queryParamsModel || this.queryParamsModel.length === 0) {
  330. this.resetLine()
  331. }
  332. this.visible = true
  333. },
  334. getDictInfo(item) {
  335. let str = ''
  336. if(!item.dictTable){
  337. str = item.dictCode
  338. }else{
  339. str = item.dictTable+','+item.dictText+','+item.dictCode
  340. }
  341. console.log('高级查询字典信息',str)
  342. return str
  343. },
  344. handleOk() {
  345. if (!this.isNullArray(this.queryParamsModel)) {
  346. let event = {
  347. matchType: this.matchType,
  348. params: this.removeEmptyObject(this.queryParamsModel)
  349. }
  350. // 移动端模式下关闭弹窗
  351. if (this.izMobile) {
  352. this.visible = false
  353. }
  354. this.emitCallback(event)
  355. } else {
  356. this.$message.warn("不能查询空条件")
  357. }
  358. },
  359. emitCallback(event = {}, loadStatus = true) {
  360. let { params = [], matchType = this.matchType } = event
  361. this.superQueryFlag = (params && params.length > 0)
  362. for (let param of params) {
  363. if (Array.isArray(param.val)) {
  364. param.val = param.val.join(',')
  365. }
  366. }
  367. console.debug('---高级查询参数--->', { params, matchType })
  368. this.$emit(this.callback, params, matchType, loadStatus)
  369. },
  370. handleCancel() {
  371. this.close()
  372. },
  373. close() {
  374. this.$emit('close')
  375. this.visible = false
  376. },
  377. handleAdd() {
  378. this.addNewLine()
  379. },
  380. addNewLine() {
  381. this.queryParamsModel.push({ rule: 'eq' })
  382. },
  383. resetLine() {
  384. this.superQueryFlag = false
  385. this.queryParamsModel = []
  386. this.addNewLine()
  387. },
  388. handleDel(index) {
  389. this.queryParamsModel.splice(index, 1)
  390. },
  391. handleSelected(node, item) {
  392. let { type, dbType, options, dictCode, dictTable, dictText, customReturnField, popup } = node.dataRef
  393. item['type'] = type
  394. item['dbType'] = dbType
  395. item['options'] = options
  396. item['dictCode'] = dictCode
  397. item['dictTable'] = dictTable
  398. item['dictText'] = dictText
  399. //update-begin-author:taoyan for: VUEN-242【online表单 高级查询】开关组件设置扩展参数为[0,1] 时,高级查询选择后查询仍然是Y/N
  400. item['extendOption'] = node.dataRef.extendOption || ['Y', 'N']
  401. //update-begin-author:taoyan for: VUEN-242【online表单 高级查询】开关组件设置扩展参数为[0,1] 时,高级查询选择后查询仍然是Y/N
  402. item['customReturnField'] = customReturnField
  403. if (popup) {
  404. item['popup'] = popup
  405. }
  406. // 格式化字符串,一般用于高级查询的日期格式处理
  407. if (node.dataRef.formatStr) {
  408. item['formatStr'] = node.dataRef.formatStr
  409. }
  410. this.$set(item, 'val', undefined)
  411. },
  412. handleOpen() {
  413. this.show()
  414. },
  415. handleOutReset(loadStaus=true) {
  416. this.resetLine()
  417. this.emitCallback({}, loadStaus)
  418. },
  419. handleReset() {
  420. this.resetLine()
  421. this.emitCallback({}, true)
  422. },
  423. handleSave() {
  424. let queryParams = this.removeEmptyObject(this.queryParamsModel)
  425. if (this.isNullArray(queryParams)) {
  426. this.$message.warning('空条件不能保存')
  427. } else {
  428. this.prompt.value = ''
  429. this.prompt.visible = true
  430. }
  431. },
  432. handlePromptOk() {
  433. let { value } = this.prompt
  434. if(!value){
  435. this.$message.warning('保存名称不能为空')
  436. return
  437. }
  438. // 取出查询条件
  439. let records = this.removeEmptyObject(this.queryParamsModel)
  440. // 判断有没有重名的
  441. let filterList = this.saveTreeData.filter(i => i.originTitle === value)
  442. if (filterList.length > 0) {
  443. this.$confirm({
  444. content: `${value} 已存在,是否覆盖?`,
  445. onOk: () => {
  446. this.prompt.visible = false
  447. filterList[0].records = records
  448. this.saveToLocalStore()
  449. this.$message.success('保存成功')
  450. }
  451. })
  452. } else {
  453. // 没有重名的,直接添加
  454. this.prompt.visible = false
  455. // 添加到树列表中
  456. this.saveTreeData.push(this.renderSaveTreeData({
  457. title: value,
  458. matchType: this.matchType,
  459. records: records
  460. }))
  461. // 保存到 LocalStore
  462. this.saveToLocalStore()
  463. this.$message.success('保存成功')
  464. }
  465. },
  466. handleTreeSelect(idx, event) {
  467. if (event.selectedNodes[0]) {
  468. let { matchType, records } = event.selectedNodes[0].data.props
  469. // 将保存的matchType取出,兼容旧数据,如果没有保存就还是使用原来的
  470. this.matchType = matchType || this.matchType
  471. this.queryParamsModel = utils.cloneObject(records)
  472. }
  473. },
  474. handleRemoveSaveTreeItem(event, vNode) {
  475. // 阻止事件冒泡
  476. event.stopPropagation()
  477. this.$confirm({
  478. content: '是否删除当前查询?',
  479. onOk: () => {
  480. let { eventKey } = vNode
  481. this.saveTreeData.splice(Number.parseInt(eventKey.substring(2)), 1)
  482. this.saveToLocalStore()
  483. },
  484. })
  485. },
  486. // 将查询保存到 LocalStore 里
  487. saveToLocalStore() {
  488. let saveValue = this.saveTreeData.map(({ originTitle, matchType, records }) => ({ title: originTitle, matchType, records }))
  489. this.$ls.set(this.fullSaveCode, saveValue)
  490. },
  491. isNullArray(array) {
  492. //判断是不是空数组对象
  493. if (!array || array.length === 0) {
  494. return true
  495. }
  496. if (array.length === 1) {
  497. let obj = array[0]
  498. if (!obj.field || (obj.val == null || obj.val === '') || !obj.rule) {
  499. return true
  500. }
  501. }
  502. return false
  503. },
  504. // 去掉数组中的空对象
  505. removeEmptyObject(arr) {
  506. let array = utils.cloneObject(arr)
  507. for (let i = 0; i < array.length; i++) {
  508. let item = array[i]
  509. if (item == null || Object.keys(item).length <= 0) {
  510. array.splice(i--, 1)
  511. } else {
  512. if (Array.isArray(item.options)) {
  513. // 如果有字典属性,就不需要保存 options 了
  514. //update-begin-author:taoyan date:20200819 for:【开源问题】 高级查询 下拉框作为并且选项很多多多 LOWCOD-779
  515. delete item.options
  516. //update-end-author:taoyan date:20200819 for:【开源问题】 高级查询 下拉框作为并且选项很多多多 LOWCOD-779
  517. }
  518. }
  519. }
  520. return array
  521. },
  522. /** 渲染保存查询条件的 title(加个删除按钮) */
  523. renderSaveTreeData(item) {
  524. item.icon = this.treeIcon
  525. item.originTitle = item['title']
  526. item.title = (arg1, arg2) => {
  527. let vNode
  528. // 兼容旧版的Antdv
  529. if (arg1.dataRef) {
  530. vNode = arg1
  531. } else if (arg2.dataRef) {
  532. vNode = arg2
  533. } else {
  534. return <span style="color:red;">Antdv版本不支持</span>
  535. }
  536. let {originTitle} = vNode.dataRef
  537. return (
  538. <div class="j-history-tree-title">
  539. <span>{originTitle}</span>
  540. <div class="j-history-tree-title-closer" onClick={e => this.handleRemoveSaveTreeItem(e, vNode)}>
  541. <a-icon type="close-circle"/>
  542. </div>
  543. </div>
  544. )
  545. }
  546. return item
  547. },
  548. /** 判断是否允许多选 */
  549. allowMultiple(item) {
  550. return item.rule === 'in'
  551. },
  552. handleRuleChange(item, newValue) {
  553. let oldValue = item.rule
  554. this.$set(item, 'rule', newValue)
  555. // 上一个规则是否是 in,且type是字典或下拉
  556. if (oldValue === 'in') {
  557. if (item.dictCode || item.options instanceof Array) {
  558. let value = item.val
  559. if (typeof item.val === 'string') {
  560. value = item.val.split(',')[0]
  561. } else if (Array.isArray(item.val)) {
  562. value = item.val[0]
  563. }
  564. this.$set(item, 'val', value)
  565. }
  566. }
  567. },
  568. handleChangeJPopup(item, e, values) {
  569. item.val = values[item.popup['destFields']]
  570. },
  571. }
  572. }
  573. </script>
  574. <style lang="less" scoped>
  575. .j-super-query-box {
  576. display: inline-block;
  577. }
  578. .j-super-query-modal {
  579. .j-super-query-history-card {
  580. /deep/ .ant-card-body,
  581. /deep/ .ant-card-head-title {
  582. padding: 0;
  583. }
  584. /deep/ .ant-card-head {
  585. padding: 4px 8px;
  586. min-height: initial;
  587. }
  588. }
  589. .j-super-query-history-empty {
  590. /deep/ .ant-empty-image {
  591. height: 80px;
  592. line-height: 80px;
  593. margin-bottom: 0;
  594. }
  595. /deep/ img {
  596. width: 80px;
  597. height: 65px;
  598. }
  599. /deep/ .ant-empty-description {
  600. color: #afafaf;
  601. margin: 8px 0;
  602. }
  603. }
  604. .j-super-query-history-tree {
  605. .j-history-tree-title {
  606. width: calc(100% - 24px);
  607. position: relative;
  608. display: inline-block;
  609. &-closer {
  610. color: #999999;
  611. position: absolute;
  612. top: 0;
  613. right: 0;
  614. width: 24px;
  615. height: 24px;
  616. text-align: center;
  617. opacity: 0;
  618. transition: opacity 0.3s, color 0.3s;
  619. &:hover {
  620. color: #666666;
  621. }
  622. &:active {
  623. color: #333333;
  624. }
  625. }
  626. &:hover {
  627. .j-history-tree-title-closer {
  628. opacity: 1;
  629. }
  630. }
  631. }
  632. /deep/ .ant-tree-switcher {
  633. display: none;
  634. }
  635. /deep/ .ant-tree-node-content-wrapper {
  636. width: 100%;
  637. }
  638. }
  639. }
  640. </style>