searchFilter.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <u-popup mode="bottom" :round="10" :show="show" @close="close" @open="open" closeable>
  3. <u--form labelPosition="left" :model="formData" ref="uForm">
  4. <u-form-item label="品牌" @click="showBrandList" labelWidth="70">
  5. <Cell :val="formData.dictLabel" :isDelete="true" :border="true" @handleClear="clear('dictLabel')"></Cell>
  6. <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
  7. </u-form-item>
  8. <u-form-item label="实价范围" labelWidth="70">
  9. <u-input v-model="formData.minPrice" placeholder="最小价格" fontSize="14" border="bottom" clearable></u-input>
  10. &nbsp;&nbsp;——&nbsp;&nbsp;
  11. <u-input v-model="formData.maxPrice" placeholder="最大价格" fontSize="14" border="bottom" clearable></u-input>
  12. </u-form-item>
  13. <u-form-item label="位置" labelWidth="70">
  14. <u-input v-model="formData.location" fontSize="14" clearable border="bottom"></u-input>
  15. </u-form-item>
  16. <u-form-item label="回收时间" labelWidth="70" @click="openTimePicker">
  17. <Cell :val="time" :isDelete="true" :border="true" @handleClear="clear('time')"> </Cell>
  18. <jtimePickerPopup :isShowShortTimeList="true" shortTimeTitle="快捷时间" :shortTimeList="shortTimeList"
  19. :isShowSeletTimeTitle="true" seletTimeTitle="时间选择" cancelText="取消" confirmText="确认"
  20. :endSelectMonth="-1" :endSelectDay="-1" beginTimePlaceHolder='开始时间' endTimePlaceHolder="结束时间"
  21. :isDateTypeRange="true" :isShowSelectedTimeEcho="true" @confirm="getSelectTime" :defaultSelect="0"
  22. ref="jtimePickerPopupRef">
  23. </jtimePickerPopup>
  24. </u-form-item>
  25. <u-form-item label="机构部门" labelWidth="70" @click="recycleDeptClick">
  26. <Cell :val="formData.deptName" :isDelete="true" :border="true" @handleClear="clear('dept')"></Cell>
  27. <ba-tree-picker :selectParent="true" v-if="deptList.length > 0" ref="recycleDeptRef" :multiple='false'
  28. @select-change="deptSeletchang" border title="机构部门" :localdata="deptList" valueKey="deptId"
  29. textKey="deptName" childrenKey="children" :selectedValues="formData.deptId"
  30. :personNames="formData.deptName" />
  31. </u-form-item>
  32. <u-form-item label="回收人员" labelWidth="70" @click="recyclePersonClick">
  33. <Cell :val="formData.recyclePerson" :isDelete="true" :border="true" @handleClear="clear('recyclePerson')"></Cell>
  34. <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员" @selectPerson="handleSelectRecyclePerson"></PersonPicker>
  35. </u-form-item>
  36. <u-form-item label="鉴定人员" labelWidth="70" @click="identifyingPersonClick">
  37. <Cell :val="formData.identifyingPerson" :isDelete="true" :border="true" @handleClear="clear('identifyingPerson')"></Cell>
  38. <PersonPicker ref="identifyingPersonPickerRef" title="请选择鉴定人员" @selectPerson="handleSelectIdentifyingPerson"></PersonPicker>
  39. </u-form-item>
  40. <u-form-item label="商品属性" labelWidth="70">
  41. <TabSelect :tabList="productAttributeList" :colNum="3" :echoInfo="formData.productAttribute" mode="multiple" @tabChange="handleTabChangeProductAttribute"></TabSelect>
  42. </u-form-item>
  43. <u-form-item label="是否入库" labelWidth="70">
  44. <TabSelect :tabList="stockStatusListAll" :colNum="4" :echoInfo="formData.stockStatus" mode="single" @tabChange="handleTabChangeStockStatus"></TabSelect>
  45. </u-form-item>
  46. </u--form>
  47. <view class="btns">
  48. <u-button text="重置" @click="resetForm"></u-button>
  49. <u-button type="primary" text="确定" @click="handleSearch"></u-button>
  50. </view>
  51. </u-popup>
  52. </template>
  53. <script>
  54. import Cell from '@/components/custom-cell/index.vue'
  55. import BrandList from '@/components/brand-list/index.vue'
  56. import PersonPicker from '@/components/person-picker/index.vue'
  57. import TabSelect from '@/components/custom-tab-select/index.vue'
  58. import { productAttributeList, stockStatusListAll,shortTimeList } from '../js/public.js'
  59. import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
  60. export default {
  61. components: {
  62. Cell,
  63. BrandList,
  64. PersonPicker,
  65. TabSelect,
  66. jtimePickerPopup,
  67. },
  68. name: 'searchFilter',
  69. emits: ['confirm'],
  70. data() {
  71. return {
  72. show: false,
  73. formData: {
  74. dictLabel: '',
  75. dictValue: '',
  76. minPrice: '',
  77. maxPrice: '',
  78. location: '',
  79. startTime: '',
  80. endTime: '',
  81. deptId:'',
  82. deptName:'',
  83. recyclePerson:'',
  84. recyclePersonId: '',
  85. identifyingPerson:'',
  86. identifyingPersonId: '',
  87. productAttribute: [],
  88. stockStatus: '',
  89. },
  90. time:'',
  91. shortTimeList: shortTimeList,
  92. recyclePersonList: [],
  93. // 将导入的变量在data中重新定义,确保模板能够访问
  94. productAttributeList: productAttributeList,
  95. stockStatusListAll: stockStatusListAll,
  96. deptList: [],
  97. }
  98. },
  99. props: {
  100. },
  101. emits: [],
  102. mounted() {
  103. this.getDeptListAll();
  104. },
  105. methods: {
  106. getDeptListAll() {
  107. const params = {
  108. isDept:2
  109. }
  110. uni.$u.api.getDeptListAll(params).then(res => {
  111. if(res.data.length > 0){
  112. this.deptList = res.data;
  113. }else{
  114. uni.$u.toast('暂无机构部门');
  115. }
  116. })
  117. },
  118. deptSeletchang(ids, names) {
  119. this.formData.deptId = ids[0] || '';
  120. this.formData.deptName = names[0] || '';
  121. },
  122. handleSearch() {
  123. this.$emit('confirm', this.formData);
  124. this.close();
  125. },
  126. resetForm() {
  127. this.formData = {
  128. dictLabel: '',
  129. dictValue: '',
  130. minPrice: '',
  131. maxPrice: '',
  132. location: '',
  133. startTime: '',
  134. endTime: '',
  135. deptId:'',
  136. deptName:'',
  137. recyclePerson:'',
  138. recyclePersonId: '',
  139. identifyingPerson:'',
  140. identifyingPersonId: '',
  141. productAttribute: [],
  142. stockStatus: '',
  143. };
  144. },
  145. open() {
  146. this.show = true
  147. this.$nextTick(() => {
  148. this.$refs.jtimePickerPopupRef.handleInit();
  149. })
  150. },
  151. openTimePicker() {
  152. this.$refs.jtimePickerPopupRef.pickerShow();
  153. },
  154. close() {
  155. this.show = false
  156. },
  157. showBrandList() {
  158. this.$refs.brandListRef.showBrandList();
  159. },
  160. handleSelectedBrand(info) {
  161. this.formData.dictLabel = info.dictLabel;
  162. this.formData.dictValue = info.dictValue;
  163. },
  164. // 处理清空事件
  165. clear(field) {
  166. // 品牌
  167. if(field == 'dictLabel'){
  168. this.formData.dictLabel = '';
  169. this.formData.dictValue = '';
  170. return;
  171. }
  172. // 回收人
  173. if(field == 'recyclePerson'){
  174. this.formData.recyclePerson = '';
  175. this.formData.recyclePersonId = '';
  176. return;
  177. }
  178. // 鉴定人
  179. if(field == 'identifyingPerson'){
  180. this.formData.identifyingPerson = '';
  181. this.formData.identifyingPersonId = '';
  182. return;
  183. }
  184. // 回收时间
  185. if(field == 'time'){
  186. this.time = '';
  187. this.formData.startTime = '';
  188. this.formData.endTime = '';
  189. return;
  190. }
  191. // 机构部门
  192. if(field == 'dept'){
  193. this.formData.deptId = '';
  194. this.formData.deptName = '';
  195. this.$refs.recycleDeptRef._clear();
  196. return;
  197. }
  198. this.formData[field] = '';
  199. },
  200. getSelectTime(val) {
  201. this.formData.startTime = this.$dayjs(val.beginTime).format('YYYY-MM-DD');
  202. this.formData.endTime = this.$dayjs(val.endTime).format('YYYY-MM-DD');
  203. this.time = this.$dayjs(val.beginTime).format('YYYY-MM-DD') + ' 至 ' + this.$dayjs(val.endTime).format('YYYY-MM-DD');
  204. },
  205. recycleDeptClick() {
  206. this.$refs.recycleDeptRef._show();
  207. },
  208. recyclePersonClick() {
  209. this.$refs.recyclePersonPickerRef.open();
  210. },
  211. handleSelectRecyclePerson(info) {
  212. this.formData.recyclePerson = info.label;
  213. this.formData.recyclePersonId = info.id;
  214. },
  215. identifyingPersonClick() {
  216. this.$refs.identifyingPersonPickerRef.open();
  217. },
  218. handleSelectIdentifyingPerson(info) {
  219. this.formData.identifyingPerson = info.label;
  220. this.formData.identifyingPersonId = info.id;
  221. },
  222. handleTabChangeProductAttribute(e) {
  223. this.formData.productAttribute = e;
  224. },
  225. handleTabChangeStockStatus(e) {
  226. this.formData.stockStatus = e;
  227. },
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. @import "../styles/searchFilter.scss";
  233. </style>