searchModal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <!-- 待办单查询 -->
  3. <div class="modal-content">
  4. <u-popup v-model="isshow" class="search-popup" mode="right" @close="handleClose" :custom-style="{top:'var(--status-bar-height)'}" length="90%">
  5. <view class="search-title">待办单查询</view>
  6. <u-form class="form-content" :model="form" ref="uForm" label-width="150">
  7. <u-form-item label="发起时间" prop="time">
  8. <u-input clearable v-model="form.time" disabled placeholder="请选择发起时间区间" @click="openPicker"/>
  9. </u-form-item>
  10. <u-form-item label="门店" prop="storeName">
  11. <u-input v-model="form.storeName" placeholder="请输入门店名称" />
  12. </u-form-item>
  13. <u-form-item label="巡店人" prop="userName">
  14. <u-input v-model="form.userName" placeholder="请输入巡店人名称" />
  15. </u-form-item>
  16. <u-form-item label="单据状态" prop="status" label-position="top">
  17. <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in statusList" :key="item.id" @click="chooseStatus(item)">
  18. {{item.dispName}}
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="检查方式" prop="sourceType" label-position="top">
  22. <view :class="['status-item', item.checked ? 'active' : '']" v-for="item in sourceTypeList" :key="item.id" @click="chooseSourceType(item)">
  23. {{item.dispName}}
  24. </view>
  25. </u-form-item>
  26. </u-form>
  27. <view class="uni-list-btns">
  28. <button type="primary" @click="handleSearch">查询</button>
  29. <button type="info" @click="resetForm">重置</button>
  30. </view>
  31. <!-- 时间选择器 -->
  32. <mx-date-picker class="date-picker" :show="showPicker" type="range" format="yyyy-mm-dd" :value="form.time" :show-tips="true" @confirm="onSelected" @cancel="showPicker=false" />
  33. </u-popup>
  34. </div>
  35. </template>
  36. <script>
  37. import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue"
  38. export default {
  39. components: {
  40. MxDatePicker
  41. },
  42. props: {
  43. visible: {
  44. type: Boolean,
  45. default: false
  46. }
  47. },
  48. watch: {
  49. visible (newValue, oldValue) {
  50. if (newValue) {
  51. this.isshow = newValue
  52. } else {
  53. }
  54. },
  55. isshow (newValue, oldValue) {
  56. if (newValue) {
  57. } else {
  58. this.$emit('close')
  59. }
  60. }
  61. },
  62. data() {
  63. return {
  64. isshow: this.visible, // 显示隐藏
  65. showPicker: false, // 是否显示时间弹窗
  66. statusList: [
  67. {
  68. id: 1,
  69. code: 'pending',
  70. dispName: '待整改',
  71. checked: false
  72. },
  73. {
  74. id: 12,
  75. code: 'check_pending',
  76. dispName: '待审核',
  77. checked: false
  78. },
  79. {
  80. id: 13,
  81. code: 'finished',
  82. dispName: '整改完成',
  83. checked: false
  84. },
  85. {
  86. id: 14,
  87. code: 'expired',
  88. dispName: '已过期',
  89. checked: false
  90. },
  91. ], // 状态列表
  92. sourceTypeList: [
  93. {
  94. id: 1,
  95. code: 'remote_check',
  96. dispName: '远程巡店',
  97. checked: false
  98. },
  99. {
  100. id: 12,
  101. code: 'spot_check',
  102. dispName: '现场巡店',
  103. checked: false
  104. },
  105. {
  106. id: 13,
  107. code: 'point_check',
  108. dispName: '点检',
  109. checked: false
  110. },
  111. {
  112. id: 14,
  113. code: 'manual',
  114. dispName: '手动创建',
  115. checked: false
  116. },
  117. ], // 检查方式列表
  118. form: {
  119. time: '', // 发起时间区间
  120. storeName: '', // 门店名称
  121. userName: '' // 巡店人
  122. },
  123. beginDate: null, // 开始时间
  124. endDate: null, // 结束时间
  125. }
  126. },
  127. computed: {
  128. // 已选单据状态
  129. status() {
  130. return this.filterData(this.statusList)
  131. },
  132. // 检查方式
  133. sourceType () {
  134. return this.filterData(this.sourceTypeList)
  135. }
  136. },
  137. methods: {
  138. // 关闭弹窗
  139. handleClose () {
  140. this.isshow = false
  141. },
  142. // 打开时间选择弹框
  143. openPicker () {
  144. this.showPicker = true
  145. },
  146. // 确认日期选择
  147. onSelected (v) {
  148. console.log(v,'vvvvvvvv')
  149. this.form.time = v.value[0] + ' ~ ' + v.value[1]
  150. this.beginDate = v.value[0]
  151. this.endDate = v.value[1]
  152. this.showPicker = false
  153. },
  154. // 过滤已选数据
  155. filterData (data) {
  156. let arr = []
  157. data.map(item => {
  158. if (item.checked) {
  159. arr.push(item.code)
  160. }
  161. })
  162. return arr
  163. },
  164. // 选择单据状态
  165. chooseStatus (item) {
  166. item.checked = !item.checked
  167. },
  168. // 选择检查方式
  169. chooseSourceType (item) {
  170. item.checked = !item.checked
  171. },
  172. // 查询
  173. handleSearch () {
  174. let params = {
  175. beginDate: this.beginDate,
  176. endDate: this.endDate,
  177. storeName: this.form.storeName,
  178. userName: this.form.userName,
  179. status: this.status,
  180. sourceType: this.sourceType
  181. }
  182. this.$emit('refresh',params)
  183. this.isshow = false
  184. },
  185. // 重置
  186. resetForm () {
  187. this.$refs.uForm.resetFields()
  188. this.statusList.map(item=>{
  189. item.checked = false
  190. })
  191. this.sourceTypeList.map(item=>{
  192. item.checked = false
  193. })
  194. }
  195. },
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .modal-content {
  200. position: relative;
  201. }
  202. .search-popup{
  203. .search-title{
  204. text-align: center;
  205. padding: 22upx;
  206. color: #333;
  207. border-bottom: 1px solid #eee;
  208. }
  209. .form-content {
  210. padding: 0 20upx;
  211. .status-item {
  212. width: 30%;
  213. text-align: center;
  214. line-height: 60upx;
  215. background-color: #e2e2e2;
  216. color: #333;
  217. font-size: 24upx;
  218. margin: 0 10upx;
  219. }
  220. .active {
  221. background-color: #ffaa00;
  222. color: #fff;
  223. }
  224. }
  225. .uni-list{
  226. margin: 20upx;
  227. .uni-list-cell{
  228. display: flex;
  229. align-items: center;
  230. border-bottom: 1px dashed #EEEEEE;
  231. .uni-list-cell-db{
  232. flex: 1;
  233. }
  234. .uni-input{
  235. height: 2.5em;
  236. line-height: 2.5em;
  237. }
  238. }
  239. }
  240. .uni-list-btns{
  241. display: flex;
  242. padding: 20upx;
  243. uni-button{
  244. font-size: 28upx;
  245. margin: 0 30upx;
  246. flex:1;
  247. }
  248. }
  249. }
  250. .date-picker{
  251. }
  252. </style>