queryCondition.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="table-page-search-wrapper">
  3. <a-form layout="inline">
  4. <a-row :gutter="48">
  5. <a-col v-if="appList.length > 0" :md="8" :sm="24">
  6. <a-form-item label="应用归属">
  7. <a-select placeholder="请选择" @change="changeAppID">
  8. <a-select-option v-for="(option,key) in appList" :value=option.id :key="key">
  9. {{ option.appName }}
  10. </a-select-option>
  11. </a-select>
  12. </a-form-item>
  13. </a-col>
  14. <template v-if="appList.length > 0">
  15. <a-col v-for="(item, key) in queryValue" :key="key" :md="8" :sm="24">
  16. <a-form-item :label=item.name v-if="key < num">
  17. <a-select v-if="in_array(allSelectStatus, item.param)" v-model="selected" @change="changeStatus(key)">
  18. <a-select-option v-for="(option,index) in queryStatus" :value=option.selectValue :key="index">
  19. {{ option.selectText }}
  20. </a-select-option>
  21. </a-select>
  22. <a-select v-else-if="in_array(allSelectMessageStatus, item.param)" v-model="selectMessageStatus" @change="changeMessageStatus(key)">
  23. <a-select-option v-for="(option,index) in smsSendStatus" :value=option.selectValue :key="index">
  24. {{ option.selectText }}
  25. </a-select-option>
  26. </a-select>
  27. <a-select v-else-if="in_array(supportCustomSign, item.param)" v-model="selectedQuerySupport" @change="changeQuerySupport(key)">
  28. <a-select-option v-for="(option,index) in querySupport" :value=option.selectValue :key="index">
  29. {{ option.selectText }}
  30. </a-select-option>
  31. </a-select>
  32. <a-select v-else-if="in_array(supportQueryBalance, item.param)" v-model="selectedSupport" @change="changeSupport(key)">
  33. <a-select-option v-for="(option,index) in querySupport" :value=option.selectValue :key="index">
  34. {{ option.selectText }}
  35. </a-select-option>
  36. </a-select>
  37. <a-select v-else-if="in_array(allSelectTaskStatus, item.param)" v-model="selectTaskStatus" @change="changeTaskStatus(key)">
  38. <a-select-option v-for="(option,index) in taskStatus" :value=option.selectValue :key="index">
  39. {{ option.selectText }}
  40. </a-select-option>
  41. </a-select>
  42. <a-select v-else-if="in_array(allUserType, item.param)" v-model="selectUserType" @change="changeUserType(key)">
  43. <a-select-option v-for="(option,index) in userType" :value=option.selectValue :key="index">
  44. {{ option.selectText }}
  45. </a-select-option>
  46. </a-select>
  47. <a-select v-else-if="item.param == 'operatorType'" v-model="selectOperatorType" @change="changeOperatorType(key)">
  48. <a-select-option v-for="(option,index) in operatorType" :value=option.id :key="index">
  49. {{ option.typeName}}
  50. </a-select-option>
  51. </a-select>
  52. <a-input v-else v-model="item.value" :placeholder="'请输入' + item.name"/>
  53. </a-form-item>
  54. </a-col>
  55. </template>
  56. <template v-else>
  57. <a-col v-for="(item, key) in queryValue" :key="key" :md="8" :sm="24">
  58. <a-form-item :label=item.name v-if="key < twoNum">
  59. <a-select v-if="in_array(allSelectStatus, item.param)" v-model="selected" @change="changeStatus(key)">
  60. <a-select-option v-for="(option,index) in queryStatus" :value=option.selectValue :key="index">
  61. {{ option.selectText }}
  62. </a-select-option>
  63. </a-select>
  64. <a-select v-else-if="in_array(allSelectMessageStatus, item.param)" v-model="selectMessageStatus" @change="changeMessageStatus(key)">
  65. <a-select-option v-for="(option,index) in smsSendStatus" :value=option.selectValue :key="index">
  66. {{ option.selectText }}
  67. </a-select-option>
  68. </a-select>
  69. <a-select v-else-if="in_array(supportCustomSign, item.param)" v-model="selectedQuerySupport" @change="changeQuerySupport(key)">
  70. <a-select-option v-for="(option,index) in querySupport" :value=option.selectValue :key="index">
  71. {{ option.selectText }}
  72. </a-select-option>
  73. </a-select>
  74. <a-select v-else-if="in_array(supportQueryBalance, item.param)" v-model="selectedSupport" @change="changeSupport(key)">
  75. <a-select-option v-for="(option,index) in querySupport" :value=option.selectValue :key="index">
  76. {{ option.selectText }}
  77. </a-select-option>
  78. </a-select>
  79. <a-select v-else-if="in_array(allSelectTaskStatus, item.param)" v-model="selectTaskStatus" @change="changeTaskStatus(key)">
  80. <a-select-option v-for="(option,index) in taskStatus" :value=option.selectValue :key="index">
  81. {{ option.selectText }}
  82. </a-select-option>
  83. </a-select>
  84. <a-select v-else-if="in_array(allUserType, item.param)" v-model="selectUserType" @change="changeUserType(key)">
  85. <a-select-option v-for="(option,index) in userType" :value=option.selectValue :key="index">
  86. {{ option.selectText }}
  87. </a-select-option>
  88. </a-select>
  89. <a-select v-else-if="item.param == 'operatorType'" v-model="selectOperatorType" @change="changeOperatorType(key)">
  90. <a-select-option v-for="(option,index) in operatorType" :value=option.id :key="index">
  91. {{ option.typeName}}
  92. </a-select-option>
  93. </a-select>
  94. <a-input v-else v-model="item.value" :placeholder="'请输入' + item.name"/>
  95. </a-form-item>
  96. </a-col>
  97. </template>
  98. <a-col :md="!(advanced) && 8 || 24" :sm="24">
  99. <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
  100. <a-button type="primary" @click="inquire">查询</a-button>
  101. <a-button style="margin-left: 8px" @click="resetting">重置</a-button>
  102. <a @click="toggleAdvanced" style="margin-left: 8px">
  103. {{ advanced ? '收起' : '展开' }}
  104. <a-icon :type="advanced ? 'up' : 'down'"/>
  105. </a>
  106. </span>
  107. </a-col>
  108. </a-row>
  109. </a-form>
  110. </div>
  111. </template>
  112. <script>
  113. import {
  114. allSelectStatus,
  115. supportCustomSign,
  116. supportQueryBalance,
  117. allSelectMessageStatus,
  118. in_array,
  119. smsSendStatus,
  120. allSelectTaskStatus,
  121. taskStatus,
  122. querySupport,
  123. allUserType,
  124. userType
  125. } from '@/components/public';
  126. import { BASEURL, METHOD_POST } from '@/api/public';
  127. export default {
  128. name: "QueryCondition",
  129. props: {
  130. queryValue: {
  131. type: Array,
  132. required: true
  133. },
  134. queryStatus: {
  135. type: Array,
  136. required: true
  137. },
  138. appList: {
  139. type: Array,
  140. required: true
  141. }
  142. },
  143. data() {
  144. return {
  145. num: 1,
  146. twoNum: 2,
  147. selected: '全部',
  148. selectMessageStatus: '全部',
  149. selectedSupport: '全部',
  150. selectedQuerySupport: '全部',
  151. selectTaskStatus: '全部',
  152. selectUserType: '全部',
  153. querySupport: querySupport,
  154. advanced: false,
  155. allSelectStatus: allSelectStatus,
  156. allSelectMessageStatus: allSelectMessageStatus,
  157. supportCustomSign: supportCustomSign,
  158. supportQueryBalance: supportQueryBalance,
  159. in_array: in_array,
  160. smsSendStatus: smsSendStatus,
  161. allSelectTaskStatus: allSelectTaskStatus,
  162. taskStatus: taskStatus,
  163. allUserType: allUserType,
  164. userType: userType,
  165. operatorType: [],
  166. selectOperatorType: '全部'
  167. }
  168. },
  169. methods: {
  170. changeAppID(e) {
  171. console.log(e)
  172. this.appId = e
  173. this.$emit("changeAppID", e)
  174. },
  175. // 状态选择
  176. changeMessageStatus(key) {
  177. this.queryValue[key].value = this.selectMessageStatus
  178. },
  179. changeQuerySupport(key) {
  180. this.queryValue[key].value = this.selectedQuerySupport
  181. },
  182. changeSupport(key) {
  183. this.queryValue[key].value = this.selectedSupport
  184. },
  185. changeTaskStatus(key) {
  186. this.queryValue[key].value = this.selectTaskStatus
  187. },
  188. changeUserType(key) {
  189. this.queryValue[key].value = this.selectUserType
  190. },
  191. changeStatus(key) {
  192. this.queryValue[key].value = this.selected
  193. },
  194. changeOperatorType(key) {
  195. this.queryValue[key].value = this.selectOperatorType
  196. },
  197. //收起&展开
  198. toggleAdvanced(){
  199. this.advanced = !this.advanced
  200. if(this.appList.length > 0) {
  201. if(this.num == 1) {
  202. this.num = this.queryValue.length
  203. } else {
  204. this.num = 1
  205. }
  206. } else {
  207. if(this.twoNum == 2) {
  208. this.twoNum = this.queryValue.length
  209. } else {
  210. this.twoNum = 2
  211. }
  212. }
  213. },
  214. // 点击查询
  215. inquire() {
  216. this.$emit("inquire", this.queryValue)
  217. },
  218. // 重置
  219. resetting() {
  220. this.queryValue.forEach(item => {
  221. item.value = null
  222. });
  223. this.selected = '全部',
  224. this.selectMessageStatus = '全部',
  225. this.selectedSupport = '全部',
  226. this.selectedQuerySupport = '全部',
  227. this.selectTaskStatus = '全部',
  228. this.selectUserType = '全部'
  229. }
  230. },
  231. mounted() {
  232. let data = { currentPage:1, pageSize:10, where: this.queryCondition }
  233. for(let i in this.queryValue) {
  234. if(this.queryValue[i].param === 'operatorType') {
  235. this.axios({
  236. url: 'basic/operatorType/pageList',
  237. method: METHOD_POST,
  238. data: data
  239. }).then(res=>{
  240. if(res.code == 0) {
  241. this.operatorType = res.page.list
  242. } else {
  243. this.$message.error(res.msg);
  244. }
  245. }).catch(() => {
  246. this.loading = false;
  247. this.$message.error('请求超时!');
  248. })
  249. }
  250. }
  251. }
  252. }
  253. </script>
  254. <style scoped>
  255. </style>