index.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778
  1. <template>
  2. <view class="report-export-page">
  3. <view class="report-export-search-bar-container">
  4. <view class="report-export-search-bar">
  5. <view class="report-export-search-input-wrap">
  6. <image src="../../../static/images/search.png" mode="scaleToFill" class="report-export-search-icon" />
  7. <input class="report-export-search-input" v-model="keyword" placeholder="搜索公司" />
  8. <view class="report-export-search-btn" @click="onSearch">搜索</view>
  9. </view>
  10. <view class="report-export-filter-btn" @click="onFilter">
  11. <image src="../../../static/images/filter.png" mode="scaleToFill" class="report-export-filter-icon" />
  12. <text class="report-export-filter-text">筛选</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="scan-rate-ranges-container">
  17. <view class="scan-rate-ranges">
  18. <view class="scan-rate-ranges-content">
  19. <view v-for="(value, i) in options.status" :key="value" class="scan-rate-range" :class="{
  20. 'scan-rate-active': filterForm.status == value,
  21. }" @click.stop="pickFilterOption('status', value)">{{ value }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view v-if="loading" class="report-export-list-scroll" :style="{ height: 'auto' }">
  26. <view class="report-export-loading-row">
  27. <view class="report-export-loading-wrapper">
  28. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  29. </view>
  30. </view>
  31. </view>
  32. <scroll-view v-else-if="list.length > 0" class="report-export-list-scroll" scroll-y="true"
  33. :style="{ height: listViewHeight }" @scrolltolower="onScrollToLower">
  34. <view class="report-export-item-card" v-for="(item, i) in list" :key="item.id">
  35. <view class="report-export-item-header">
  36. <text class="report-export-item-title" @click="showModal(item)">{{ getCustomerName(item) }}报表</text>
  37. <text class="report-export-status" :class="'report-export-status-' + item.status">{{
  38. getStatusText(item.status) }}</text>
  39. </view>
  40. <view class="report-export-item-row">品种:{{ item.physicName || "" }}</view>
  41. <view class="report-export-item-row">规格:{{ item.pkgSpec || "" }}</view>
  42. <view class="report-export-item-row">时间:{{ formatDate(item.beginTime) }}--{{
  43. formatDate(item.endTime)
  44. }}</view>
  45. <view v-if="item.status == 2" class="report-export-progress-wrap">
  46. <view class="report-export-progress">
  47. <view class="report-export-progress-fill" :style="{ width: 60 + '%' }"></view>
  48. <text class="report-export-progress-text">{{ 60 }}</text>
  49. </view>
  50. </view>
  51. <view v-if="item.status == 1" class="report-export-action-row">
  52. <view class="report-export-action-btn report-export-primary" @click="onStart(item)">
  53. 确认开始计算
  54. </view>
  55. </view>
  56. <view v-else-if="item.status == 3" class="report-export-action-row">
  57. <view class="report-export-action-btn report-export-info" @click="toDetail(item)">查看</view>
  58. <view class="report-export-action-btn report-export-primary" @click="onSend(item)">
  59. 导出
  60. </view>
  61. </view>
  62. </view>
  63. <view class="report-export-loading-row" v-if="hasmore">
  64. <view class="report-export-loading-wrapper">
  65. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  66. </view>
  67. </view>
  68. </scroll-view>
  69. <EmptyView v-else text="暂无导出任务" />
  70. <view class="report-export-footer">
  71. <view class="report-export-footer-btn" @click="onCreate">新建任务</view>
  72. </view>
  73. <view v-show="createModalOpen || filterModalOpen || emailModalOpen" class="report-export-create-modal-mask"
  74. @click="closeCreate">
  75. </view>
  76. <view class="report-export-create-modal" :class="{ 'report-export-create-modal--open': createModalOpen }">
  77. <view class="report-export-create-modal-title" @click="closeDropdownAll">
  78. <text>{{ taskTitle }}</text>
  79. <view class="report-export-create-modal-close" @click.stop="closeCreate">×</view>
  80. </view>
  81. <view class="report-export-create-modal-body" :style="{ paddingBottom: 0 }" @click="closeDropdownAll">
  82. <scroll-view scroll-y="true" :style="{
  83. height: '750rpx',
  84. paddingBottom: '40rpx',
  85. }">
  86. <view class="report-export-create-modal-row">
  87. <text class="report-export-create-modal-label">省份</text>
  88. <view class="report-export-create-modal-inputwrap"
  89. @click.stop="modalType !== 'read' && openDropdown('region')">
  90. <view class="report-export-create-modal-static">{{
  91. form.region && form.region.regionName
  92. ? form.region.regionName
  93. : "请选择省份"
  94. }}</view>
  95. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  96. <view class="report-export-create-modal-dropdown" v-if="dropdown.region" @click.stop
  97. :style="dropdownPosStyle()">
  98. <view class="report-export-dropdown-search-row">
  99. <input class="report-export-dropdown-search-input" v-model="searchForm.region"
  100. :disabled="modalType === 'read'" @input="modalType !== 'read' && onInput('region')"
  101. @focus="onSearchFocus" @blur="onSearchBlur" />
  102. </view>
  103. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y>
  104. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in filteredOptions('region')"
  105. :key="'r-' + i" @click.stop="modalType !== 'read' && pickOption('region', op)">{{ op.regionName }}
  106. </view>
  107. <view v-if="!filteredOptions('region') || filteredOptions('region').length === 0"
  108. class="report-export-create-modal-dropdown-item">
  109. 未查找到该省份</view>
  110. </scroll-view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="report-export-create-modal-row">
  115. <text class="report-export-create-modal-label">客户类型</text>
  116. <view class="report-export-create-modal-inputwrap"
  117. @click.stop="modalType !== 'read' && openDropdown('customerType')">
  118. <view class="report-export-create-modal-static">{{
  119. form.customerType || "请选择客户类型"
  120. }}</view>
  121. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  122. <view class="report-export-create-modal-dropdown" v-if="dropdown.customerType" @click.stop
  123. :style="dropdownPosStyle()">
  124. <view class="report-export-create-modal-dropdown-item"
  125. v-for="(op, i) in filteredOptions('customerType')" :key="'t-' + i" @click.stop="
  126. modalType !== 'read' && pickOption('customerType', op)
  127. ">{{ op }}</view>
  128. <view v-if="filteredOptions('customerType').length === 0"
  129. class="report-export-create-modal-dropdown-item">未查找到该客户类型</view>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="report-export-create-modal-row">
  134. <text class="report-export-create-modal-label">客户</text>
  135. <view class="report-export-create-modal-inputwrap"
  136. @click.stop="modalType !== 'read' && openDropdown('customer')">
  137. <view class="report-export-create-modal-static" :style="{ maxHeight: 'auto', overflowY: 'visible' }">
  138. <block v-if="Array.isArray(form.customer) && form.customer.length">
  139. <view :style="{
  140. maxHeight: '100rpx',
  141. overflowY: 'auto',
  142. paddingRight: '40rpx',
  143. }">
  144. <text v-for="(op, i) in form.customer" :key="'cust-tag-' + i" class="customer-chip">
  145. {{ op.customerName }}
  146. <text class="customer-chip-close" @click.stop="
  147. modalType !== 'read' &&
  148. removeCustomer(op.customerName)
  149. ">×</text>
  150. </text>
  151. </view>
  152. </block>
  153. <text v-else>请选择客户</text>
  154. <text v-if="
  155. form.customer &&
  156. form.customer.length &&
  157. modalType !== 'read'
  158. " class="customer-clear-all" @click.stop="modalType !== 'read' && clearAllCustomers()">×</text>
  159. </view>
  160. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  161. <view class="report-export-create-modal-dropdown" v-if="dropdown.customer" @click.stop :style="[
  162. dropdownPosStyle(),
  163. { maxHeight: 'none', overflow: 'visible' },
  164. ]">
  165. <view class="report-export-dropdown-search-row">
  166. <input class="report-export-dropdown-search-input" v-model="customerSearch"
  167. :disabled="modalType === 'read'" @input="modalType !== 'read' && onInput('customer')"
  168. @focus="onSearchFocus" @blur="onSearchBlur" />
  169. </view>
  170. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y lower-threshold="20"
  171. @scrolltolower="getCustomerOptions">
  172. <view class="report-export-create-modal-dropdown-item" :class="{
  173. 'report-export-selected': isCustomerSelected(
  174. op.customerName
  175. ),
  176. }" v-for="(op, i) in customers" :key="'cust-' + i" @click.stop="
  177. modalType !== 'read' && pickOption('customer', op)
  178. ">{{ op.customerName }}</view>
  179. <view v-if="customers.length === 0 && !customerHasMore"
  180. class="report-export-create-modal-dropdown-item">未查找到该客户</view>
  181. <view v-if="customerHasMore" class="report-export-loading-row">
  182. <view class="report-export-loading-wrapper">
  183. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  184. </view>
  185. </view>
  186. </scroll-view>
  187. </view>
  188. </view>
  189. </view>
  190. <view class="report-export-create-modal-row">
  191. <text class="report-export-create-modal-label">其它客户</text>
  192. <view class="report-export-create-modal-inputwrap">
  193. <input class="report-export-dropdown-search-input" v-model="form.otherCustomer"
  194. placeholder="请填写(多个客户用半角逗号隔开)" placeholder-class="report-export-dropdown-other-customer-input"
  195. :disabled="modalType === 'read'" :style="{ color: '#666', padding: 0, border: 'none' }" />
  196. </view>
  197. </view>
  198. <view class="report-export-create-modal-row">
  199. <text class="report-export-create-modal-label">品种</text>
  200. <view class="report-export-create-modal-inputwrap"
  201. @click.stop="modalType !== 'read' && openDropdown('product')">
  202. <view class="report-export-create-modal-static">{{
  203. form.product?.physicName || "请选择品种"
  204. }}</view>
  205. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  206. <view class="report-export-create-modal-dropdown" :style="[{ top: 'auto', bottom: '84rpx' }]"
  207. v-if="dropdown.product" @click.stop>
  208. <view class="report-export-dropdown-search-row">
  209. <input class="report-export-dropdown-search-input" v-model="searchForm.product"
  210. :disabled="modalType === 'read'" @input="modalType !== 'read' && onInput('product')"
  211. @focus="onSearchFocus" @blur="onSearchBlur" />
  212. </view>
  213. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y
  214. @scrolltolower="loadMoreProducts('create')">
  215. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in displayProducts"
  216. :key="'p-' + i" @click.stop="
  217. modalType !== 'read' && pickOption('product', op)
  218. ">{{ op.physicName }}
  219. </view>
  220. <view v-if="displayProducts?.length === 0" class="report-export-create-modal-dropdown-item">
  221. 未查找到该品种</view>
  222. </scroll-view>
  223. </view>
  224. </view>
  225. </view>
  226. <view class="report-export-create-modal-row">
  227. <text class="report-export-create-modal-label">规格</text>
  228. <view class="report-export-create-modal-inputwrap"
  229. :class="{ 'report-export-input-disabled': !form.product?.drugEntBaseInfoId }"
  230. @click.stop="modalType !== 'read' && form.product?.drugEntBaseInfoId && openDropdown('pkgSpec')">
  231. <view class="report-export-create-modal-static">{{
  232. form.pkgSpec || "请选择规格(请先选择品种)"
  233. }}</view>
  234. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  235. <view class="report-export-create-modal-dropdown" v-if="dropdown.pkgSpec" @click.stop
  236. :style="[{ top: 'auto', bottom: '84rpx' }]">
  237. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in filteredOptions('pkgSpec')"
  238. :key="'t-' + i" @click.stop="
  239. modalType !== 'read' && pickOption('pkgSpec', op)
  240. ">{{ op }}</view>
  241. <view v-if="filteredOptions('pkgSpec')?.length === 0" class="report-export-create-modal-dropdown-item">
  242. 未查找到该品种规格</view>
  243. </view>
  244. </view>
  245. </view>
  246. <view class="report-export-create-modal-row">
  247. <text class="report-export-create-modal-label">时间</text>
  248. <view class="report-export-create-modal-inputwrap">
  249. <uni-datetime-picker type="daterange" :border="false" :disabled="modalType === 'read'" v-model="dateRange"
  250. @change="onDateChange" />
  251. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  252. </view>
  253. </view>
  254. </scroll-view>
  255. </view>
  256. <view class="report-export-create-modal-footer" @click="closeDropdownAll">
  257. <view class="report-export-create-modal-btn" @click.stop="confirmCreate" v-if="modalType !== 'read'">{{
  258. modalType === "create" ? "新建任务" : "修改任务" }}</view>
  259. <view :style="{ display: 'flex', 'justify-content': 'space-between' }" v-else>
  260. <view class="report-export-create-modal-btn" :style="{ flex: '0 0 40%' }" @click.stop="closeCreate">关闭</view>
  261. <view class="report-export-create-modal-btn" :style="{ background: 'red', flex: '0 0 40%' }"
  262. @click.stop="confirmDelete">删除</view>
  263. </view>
  264. </view>
  265. </view>
  266. <view class="report-export-create-modal" :class="{ 'report-export-create-modal--open': filterModalOpen }">
  267. <view class="report-export-create-modal-title" @click="closeDropdownAll">筛选条件</view>
  268. <view class="report-export-create-modal-body" @click="closeDropdownAll">
  269. <view class="report-export-create-modal-row">
  270. <text class="report-export-create-modal-label">品种:</text>
  271. <view class="report-export-create-modal-inputwrap" @click.stop="openFilterDropdown('product')">
  272. <view class="report-export-create-modal-static">{{
  273. filterForm.product?.physicName || "请选择品种"
  274. }}</view>
  275. <view class="report-export-create-modal-dropdown" :style="[{ top: 'auto', bottom: '84rpx' }]"
  276. v-if="filterDropdown.product" @click.stop>
  277. <view class="report-export-dropdown-search-row">
  278. <input class="report-export-dropdown-search-input" v-model="filterSearchForm.product"
  279. @input="onFilterInput('product')" @focus="onSearchFocus" @blur="onSearchBlur" />
  280. </view>
  281. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y
  282. @scrolltolower="loadMoreProducts('filter')">
  283. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in filterDisplayProducts"
  284. :key="'prd-' + i" @click.stop="pickFilterOption('product', op)">{{ op.physicName }}</view>
  285. <view v-if="filterDisplayProducts?.length === 0" class="report-export-create-modal-dropdown-item">
  286. 未查找到该品种
  287. </view>
  288. </scroll-view>
  289. </view>
  290. </view>
  291. </view>
  292. <!-- <view class="report-export-create-modal-row">
  293. <text class="report-export-create-modal-label">规格</text>
  294. <view class="report-export-create-modal-inputwrap"
  295. :class="{ 'report-export-input-disabled': !filterForm.product?.drugEntBaseInfoId }"
  296. @click.stop="filterForm.product?.drugEntBaseInfoId && openFilterDropdown('pkgSpec')">
  297. <view class="report-export-create-modal-static">{{
  298. filterForm.pkgSpec || "请选择品种规格(请先选择品种)"
  299. }}</view>
  300. <view class="report-export-input-arrow"></view>
  301. <view class="report-export-create-modal-dropdown" v-if="filterDropdown.pkgSpec" @click.stop
  302. :style="[{ top: 'auto', bottom: '84rpx' }]">
  303. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in filteredOptions('pkgSpec')"
  304. :key="'t-' + i" @click.stop="
  305. pickFilterOption('pkgSpec', op)
  306. ">{{ op }}</view>
  307. <view v-if="filteredOptions('pkgSpec')?.length === 0" class="report-export-create-modal-dropdown-item">
  308. 未查找到该品种规格</view>
  309. </view>
  310. </view>
  311. </view> -->
  312. <view class="report-export-create-modal-row">
  313. <text class="report-export-create-modal-label">时间:</text>
  314. <view class="report-export-create-modal-inputwrap">
  315. <uni-datetime-picker type="daterange" :border="false" v-model="filterDateRange"
  316. @change="onFilterDateChange" />
  317. </view>
  318. </view>
  319. </view>
  320. <view class="report-export-create-modal-footer" @click="closeDropdownAll">
  321. <view class="report-export-create-modal-btn" @click.stop="confirmFilter">确认</view>
  322. </view>
  323. </view>
  324. <view class="report-export-create-modal report-export-create-email-modal"
  325. :class="{ 'report-export-create-modal--open': emailModalOpen }" :style="{ transform: 'translateY(1000%)' }">
  326. <view class="report-export-create-modal-title">
  327. <text>发送至邮箱</text>
  328. <view class="report-export-create-modal-close" @click.stop="closeEmailModal">×</view>
  329. </view>
  330. <view class="report-export-create-modal-body" :style="{ padding: '40rpx' }">
  331. <!-- <view class="report-export-email-input-wrap" :class="{ 'report-export-input-error': emailError }">
  332. <input class="report-export-email-input" v-model="emailForm.email" placeholder="请填写邮箱"
  333. placeholder-style="color: #c0c4cc" @input="emailError = false" />
  334. <text class="report-export-email-suffix">@999.com.cn</text>
  335. </view> -->
  336. <up-input v-model="emailForm.email" border="none" :customStyle="{
  337. backgroundColor: '#ebf3fb',
  338. height: '80rpx',
  339. paddingLeft: '20rpx',
  340. }" placeholder="请填写邮箱">
  341. <template #suffix style="margin-right: 30rpx"> @999.com.cn </template>
  342. </up-input>
  343. <text v-if="emailError" class="report-export-error-text">请输入邮箱</text>
  344. </view>
  345. <view class="report-export-create-modal-footer" :style="{
  346. padding: '20rpx 40rpx 40rpx',
  347. display: 'flex',
  348. 'justify-content': 'space-between',
  349. }">
  350. <view class="report-export-create-modal-btn" :style="{
  351. background: '#fff',
  352. color: '#666',
  353. border: '1rpx solid #dcdfe6',
  354. flex: '0 0 45%',
  355. }" @click.stop="closeEmailModal">取消</view>
  356. <view class="report-export-create-modal-btn" :style="{ flex: '0 0 45%' }" @click.stop="handleSendEmail">发送
  357. </view>
  358. </view>
  359. </view>
  360. </view>
  361. </template>
  362. <script>
  363. import EmptyView from "../../../wigets/empty.vue";
  364. import { formatDate, getPaginatedList } from "../../../utils/utils.js";
  365. import request from "../../../request/index.js";
  366. const customerTypeMap = {
  367. VIP客户: "VIP",
  368. 二级客户: "二级",
  369. 三级客户: "三级",
  370. };
  371. const statusMap = {
  372. "全部": 0,
  373. "待开始": 1,
  374. "进行中": 2,
  375. "已完成": 3,
  376. };
  377. export default {
  378. components: {
  379. EmptyView,
  380. },
  381. data() {
  382. return {
  383. keyword: "",
  384. totalCount: 0,
  385. loading: true,
  386. hasmore: true,
  387. fetchLoading: false,
  388. pageNum: 1,
  389. pageSize: 10,
  390. list: [],
  391. listViewHeight: "400px",
  392. createModalOpen: false,
  393. form: {
  394. region: { regionName: "" },
  395. customerType: "",
  396. customer: [],
  397. product: { physicName: "" },
  398. otherCustomer: "",
  399. },
  400. dateRange: [],
  401. computeTimer: null,
  402. dropdown: {
  403. region: false,
  404. customerType: false,
  405. customer: false,
  406. product: false,
  407. pkgSpec: false,
  408. },
  409. options: {
  410. region: [],
  411. customerType: ["VIP客户", "二级客户", "三级客户"],
  412. product: [],
  413. pkgSpec: [],
  414. status: ["全部", "待开始", "进行中", "已完成"],
  415. },
  416. // dropdown search inputs (create modal)
  417. searchForm: {
  418. region: "",
  419. product: "",
  420. },
  421. // Pagination state for products
  422. productPage: 0,
  423. productPageSize: 10,
  424. displayProducts: [], // Currently displayed products
  425. // dropdown search inputs (filter modal)
  426. filterSearchForm: {
  427. product: "",
  428. },
  429. // Pagination state for filter products
  430. filterProductPage: 0,
  431. filterDisplayProducts: [],
  432. customers: [],
  433. customerPage: 1,
  434. customerPageSize: 10,
  435. customerTotal: null,
  436. customerHasMore: true,
  437. customerLoading: false,
  438. customerDebounceTimer: null,
  439. taskTitle: "创建任务",
  440. filterModalOpen: false,
  441. filterForm: {
  442. product: { physicName: "" },
  443. status: "全部",
  444. pkgSpec: "",
  445. },
  446. filterDropdown: { product: false, pkgSpec: false },
  447. filterDateRange: [],
  448. modalType: "",
  449. dropdownUpward: false,
  450. customerSearch: "",
  451. currentItem: {},
  452. emailModalOpen: false,
  453. emailForm: {
  454. email: "",
  455. },
  456. emailError: false,
  457. };
  458. },
  459. created() {
  460. const userInfo = uni.getStorageSync("userInfo");
  461. const staffEmail = userInfo?.staffEmail || "";
  462. this.emailForm.email = staffEmail.split("@")[0];
  463. console.log("reportExport\index.vue,storage,userInfo", userInfo);
  464. this.initList();
  465. this.getProviceList();
  466. this.getDrugInfoName();
  467. this.fetchList();
  468. try {
  469. uni.onKeyboardHeightChange(({ height }) => {
  470. this.dropdownUpward = height > 0;
  471. });
  472. } catch (e) { }
  473. },
  474. computed: {
  475. taskTitle() {
  476. if (this.modalType === "create") {
  477. return "创建任务";
  478. } else if (this.modalType == "edit") {
  479. return "修改任务";
  480. } else if (this.modalType == "read") {
  481. return "查看任务";
  482. }
  483. },
  484. },
  485. watch: {
  486. "form.customerType"(val) {
  487. this.customerPage = 1;
  488. this.customerTotal = null;
  489. this.customerHasMore = true;
  490. this.customers = [];
  491. if (this.customerDebounceTimer) clearTimeout(this.customerDebounceTimer);
  492. this.getCustomerOptions();
  493. },
  494. "form.region": {
  495. handler() {
  496. this.customerPage = 1;
  497. this.customerTotal = null;
  498. this.customerHasMore = true;
  499. this.customers = [];
  500. if (this.customerDebounceTimer)
  501. clearTimeout(this.customerDebounceTimer);
  502. this.getCustomerOptions();
  503. },
  504. deep: true,
  505. },
  506. "emailForm.email": {
  507. handler(newVal, oldVal) {
  508. if (!oldVal && !newVal && newVal !== oldVal) {
  509. this.emailError = false;
  510. } else {
  511. this.emailError = !newVal;
  512. }
  513. },
  514. deep: true,
  515. },
  516. "filterForm.status"(val) {
  517. this.resetFetch()
  518. }
  519. },
  520. methods: {
  521. getCustomerName(data = {}) {
  522. const { customerName = "", otherCustomer = "" } = data;
  523. let name = customerName || "";
  524. if (otherCustomer) {
  525. if (name) {
  526. name += `,${otherCustomer}`;
  527. } else {
  528. name = otherCustomer;
  529. }
  530. }
  531. const arr = name.split(",");
  532. if (arr.length == 0) return "--";
  533. return arr.length == 1 ? arr[0].trim() : `${arr.length}个公司`;
  534. },
  535. formatDate(date) {
  536. return formatDate({ date }, "YYYY-MM-DD");
  537. },
  538. getStatusText(status) {
  539. if (status == "1") {
  540. return "导出待开始";
  541. } else if (status == "2") {
  542. return "导出进行中";
  543. } else if (status == "3" || status == "4") {
  544. return "导出已完成";
  545. }
  546. return "未知状态";
  547. },
  548. getDrugInfoName() {
  549. request("/bills/getDrugInfoName", {
  550. path: "/reportExport/index.vue",
  551. }).then((res) => {
  552. if (res.code == 200) {
  553. const _data = res.data;
  554. this.options.product = _data;
  555. }
  556. });
  557. },
  558. getGuigeList(physicName) {
  559. if (!physicName) return;
  560. request("/report/getDrugSpec", { physicName, path: "/reportExport/index.vue" }).then(res => {
  561. if (res.code == 200) {
  562. this.options.pkgSpec = res.data || [];
  563. }
  564. });
  565. },
  566. getProviceList() {
  567. request("/common/getProviceList", {
  568. path: "/reportExport/index.vue",
  569. }).then((res) => {
  570. if (res.code == 200) {
  571. const _data = res.data;
  572. this.options.region = _data;
  573. }
  574. });
  575. },
  576. getCustomerOptions() {
  577. if (!this.customerHasMore || this.customerLoading) return;
  578. this.customerLoading = true;
  579. request("/customer/info/getCustomerInfo", {
  580. pageNum: this.customerPage,
  581. pageSize: this.customerPageSize,
  582. customerName: this.customerSearch || "",
  583. customerLevel: customerTypeMap?.[this.form.customerType] || undefined,
  584. provinceCode: this.form?.region?.regionCode || undefined,
  585. path: "/reportExport/index.vue",
  586. }).then((res) => {
  587. if (res.code == 200) {
  588. const _data = res.data || {};
  589. this.customerTotal = _data.total || 0;
  590. const list = Array.isArray(_data.list) ? _data.list : [];
  591. this.customers = [...this.customers, ...list];
  592. if (this.customers.length >= this.customerTotal) {
  593. this.customerHasMore = false;
  594. } else {
  595. this.customerPage++;
  596. this.customerHasMore = true;
  597. }
  598. }
  599. this.customerLoading = false;
  600. });
  601. },
  602. initList() {
  603. const info = uni.getSystemInfoSync();
  604. const h = info.windowHeight || 800;
  605. this.listViewHeight = Math.max(0, h - 280) + "px";
  606. // this.list = this.genItems(Math.min(10, this.totalCount));
  607. // this.animateAll();
  608. },
  609. onFilter() {
  610. this.filterModalOpen = true;
  611. },
  612. showModal(item = {}) {
  613. const map = {
  614. 1: "edit",
  615. 2: "read",
  616. 3: "read",
  617. };
  618. this.modalType = map[item?.status] || "create";
  619. if (this.modalType === "create") {
  620. this.taskTitle = "创建任务";
  621. } else {
  622. if (this.modalType == "edit") {
  623. this.taskTitle = "修改任务";
  624. } else if (this.modalType == "read") {
  625. this.taskTitle = "查看任务";
  626. }
  627. const cNames = item.customerName.split(",")
  628. const cCodes = (item.customerId || '').split(",")
  629. this.form = {
  630. customer: cCodes.map((i, index) => ({
  631. customerName: cNames[index],
  632. customerCode: i,
  633. })),
  634. region: {
  635. regionCode: item.regionCode,
  636. regionName: item.regionName,
  637. },
  638. customerType:
  639. item.customerType == 1
  640. ? "VIP客户"
  641. : item.customerType == 2
  642. ? "二级客户"
  643. : item.customerType == 3
  644. ? "三级客户"
  645. : "",
  646. product: {
  647. physicName: item.physicName,
  648. drugEntBaseInfoId: item.drugEntBaseInfoId,
  649. },
  650. pkgSpec: item?.pkgSpec || "",
  651. otherCustomer: item?.otherCustomer || "",
  652. };
  653. if (item.physicName) {
  654. this.getGuigeList(item.physicName);
  655. }
  656. this.dateRange = [item.beginTime, item.endTime];
  657. }
  658. this.createModalOpen = true;
  659. this.currentItem = item;
  660. },
  661. fetchList() {
  662. // this.list = [];
  663. // setTimeout(() => {
  664. // const n = Math.min(10, this.totalCount || 10);
  665. // this.list = this.genItems(n);
  666. // if (!this.totalCount) this.totalCount = this.list.length;
  667. // this.animateAll();
  668. // this.fetchLoading = false;
  669. // }, 1000);
  670. if (!this.hasmore) {
  671. setTimeout(() => {
  672. this.fetchLoading = false;
  673. this.loading = false;
  674. }, 500);
  675. return;
  676. }
  677. if (this.fetchLoading) return;
  678. this.fetchLoading = true;
  679. request("/report/getReportTaskPage", {
  680. reportType: 2,
  681. taskType: statusMap?.[this.filterForm?.status] || "",
  682. drugEntBaseInfoId: this.filterForm?.product?.drugEntBaseInfoId,
  683. pkgSpec: this.filterForm?.pkgSpec || "",
  684. beginTime: this.filterDateRange[0],
  685. endTime: this.filterDateRange[1],
  686. customerName: this.keyword || "",
  687. pageNum: this.pageNum,
  688. pageSize: this.pageSize,
  689. path: "reportExport/index.vue",
  690. }).then((res) => {
  691. if (res.code == 200) {
  692. const _data = res.data || {};
  693. const { list, total } = _data;
  694. this.totalCount = total || 0;
  695. this.list = Array.isArray(list)
  696. ? [...this.list, ...list]
  697. : [...this.list];
  698. if (this.list.length < this.totalCount) {
  699. this.hasmore = true;
  700. this.pageNum++;
  701. } else {
  702. this.hasmore = false;
  703. }
  704. // this.list.push({
  705. // ...this.list[1],
  706. // status: 3,
  707. // });
  708. // this.list.push({
  709. // ...this.list[0],
  710. // finishTime: "2025-12-15",
  711. // status: 3,
  712. // });
  713. // this.animateAll();
  714. }
  715. this.fetchLoading = false;
  716. this.loading = false;
  717. });
  718. },
  719. resetFetch() {
  720. this.loading = true;
  721. this.list = [];
  722. this.pageNum = 1;
  723. this.hasmore = true;
  724. this.fetchList();
  725. },
  726. toDetail(item) {
  727. uni.navigateTo({
  728. url: `/traceCodePackages/traceabilityReport/pages/reportExport/detail/index?id=${item.id
  729. }&title=${encodeURIComponent(
  730. this.getCustomerName(item.customerName)
  731. )}`,
  732. });
  733. },
  734. onSearch() {
  735. this.resetFetch();
  736. },
  737. onCreate() {
  738. this.modalType = "create";
  739. this.taskTitle = "创建任务";
  740. this.createModalOpen = true;
  741. },
  742. closeCreate() {
  743. this.filterModalOpen = false;
  744. this.createModalOpen = false;
  745. this.closeDropdownAll();
  746. this.form = {
  747. region: { regionName: "" },
  748. customerType: "",
  749. customer: [],
  750. product: { physicName: "" },
  751. otherCustomer: "",
  752. };
  753. this.searchForm = {
  754. region: "",
  755. product: "",
  756. };
  757. this.dateRange = [];
  758. if (this.computeTimer) {
  759. clearTimeout(this.computeTimer);
  760. this.computeTimer = null;
  761. }
  762. },
  763. confirmCreate() {
  764. let flag = false;
  765. Object.values(this.dropdown).forEach((v) => {
  766. if (v) {
  767. flag = true;
  768. }
  769. });
  770. if (flag) {
  771. this.closeDropdownAll();
  772. return;
  773. }
  774. if (!this.isFormComplete()) {
  775. // uni.showToast({ title: "请完整填写任务内容", icon: "none" });
  776. return;
  777. }
  778. // uni.showToast({ title: "已创建", icon: "none" });
  779. uni.showLoading({
  780. title: this.modalType === "create" ? "创建中..." : "修改中...",
  781. });
  782. const url =
  783. this.modalType === "create" ? `/report/save` : `/report/update`;
  784. const customerId = (this.form?.customer || [])
  785. .map((v) => v?.customerCode || "")
  786. .join(",");
  787. const customerName = (this.form?.customer || [])
  788. .map((v) => v?.customerName || "")
  789. .join(",");
  790. request(url, {
  791. id:
  792. this.modalType === "create" ? undefined : this.currentItem?.id || "",
  793. reportType: 2,
  794. regionCode: this.form?.region?.regionCode || "",
  795. customerType: customerTypeMap?.[this.form?.customerType] || "",
  796. customerId,
  797. customerName,
  798. otherCustomer: this.form?.otherCustomer || "",
  799. drugEntBaseInfoId: this.form?.product?.drugEntBaseInfoId || "",
  800. pkgSpec: this.form?.pkgSpec || "",
  801. physicName: this.form?.product?.physicName || "",
  802. beginTime: this.formatDate(this.dateRange[0], 'YYYY-MM-DD'),
  803. endTime: this.formatDate(this.dateRange[1], 'YYYY-MM-DD'),
  804. path: "",
  805. }).then((res) => {
  806. if (res.code == 200) {
  807. uni.hideLoading();
  808. uni.showToast({
  809. title: this.modalType === "create" ? "已创建" : "已修改",
  810. icon: "none",
  811. });
  812. this.resetFetch();
  813. this.closeCreate();
  814. }
  815. });
  816. },
  817. isFormComplete() {
  818. const f = this.form;
  819. const drOk =
  820. Array.isArray(this.dateRange) &&
  821. this.dateRange.length === 2 &&
  822. this.dateRange[0] &&
  823. this.dateRange[1];
  824. let customerOk = Array.isArray(f.customer)
  825. ? f.customer.length > 0
  826. : !!f.customer;
  827. customerOk = customerOk || f.otherCustomer
  828. if (!customerOk) {
  829. uni.showToast({ title: "请选择至少一个客户或其他客户", icon: "none" });
  830. return false
  831. }
  832. if (!f.product?.physicName) {
  833. uni.showToast({ title: "请选择品种", icon: "none" });
  834. return false
  835. }
  836. if (!drOk) {
  837. uni.showToast({ title: "请选择时间范围", icon: "none" });
  838. return false
  839. }
  840. return true
  841. // return (
  842. // f.region?.regionName &&
  843. // f.customerType &&
  844. // customerOk &&
  845. // f.product?.physicName &&
  846. // drOk
  847. // );
  848. },
  849. confirmDelete() {
  850. uni.showModal({
  851. title: "确认删除吗?",
  852. success: (res) => {
  853. if (res.confirm) {
  854. uni.showLoading();
  855. request("/report/delete", {
  856. id: this.currentItem?.id || "",
  857. path: "reportExport/index.vue",
  858. }).then((res) => {
  859. uni.hideLoading();
  860. if (res.code == 200) {
  861. uni.showToast({
  862. title: "删除成功",
  863. icon: "none",
  864. duration: 2000,
  865. });
  866. this.resetFetch();
  867. this.closeCreate();
  868. } else {
  869. uni.showToast({
  870. title: res?.msg || "删除失败",
  871. icon: "none",
  872. duration: 2000,
  873. });
  874. }
  875. });
  876. }
  877. },
  878. });
  879. },
  880. onInput(k) {
  881. this.closeDropdownAll();
  882. this.dropdown[k] = true;
  883. if (k === "customer") {
  884. this.customerPage = 1;
  885. this.customerTotal = null;
  886. this.customerHasMore = true;
  887. this.customers = [];
  888. if (this.customerDebounceTimer)
  889. clearTimeout(this.customerDebounceTimer);
  890. this.customerDebounceTimer = setTimeout(() => {
  891. this.getCustomerOptions();
  892. }, 500);
  893. return;
  894. }
  895. if (k === "product") {
  896. this.initProductList('create');
  897. }
  898. },
  899. closeDropdownAll() {
  900. this.dropdown = {
  901. region: false,
  902. customerType: false,
  903. customer: false,
  904. product: false,
  905. pkgSpec: false,
  906. };
  907. this.filterDropdown.product = false;
  908. this.filterDropdown.pkgSpec = false;
  909. },
  910. openFilterDropdown(k) {
  911. this.closeDropdownAll();
  912. this.filterDropdown[k] = true;
  913. if (k === "product") {
  914. this.initProductList('filter');
  915. }
  916. },
  917. toggleFilterDropdown(k) {
  918. this.filterDropdown[k] = !this.filterDropdown[k];
  919. },
  920. onFilterInput(k) {
  921. this.closeDropdownAll();
  922. this.filterDropdown[k] = true;
  923. if (k === "product") {
  924. this.initProductList('filter');
  925. }
  926. },
  927. pickFilterOption(k, v) {
  928. if (!["status"].includes(k) && this.filterForm[k] === v) {
  929. this.filterForm[k] = "";
  930. this.filterDropdown[k] = false;
  931. return;
  932. }
  933. this.filterForm[k] = v;
  934. if (k === "product") {
  935. this.filterForm.pkgSpec = "";
  936. this.getGuigeList(v.physicName);
  937. }
  938. this.filterDropdown[k] = false;
  939. },
  940. filteredFilterOptions(k) {
  941. const arr = k === "product" ? this.products || [] : [];
  942. const q = String(this.filterForm[k] || "").trim();
  943. if (!q) return arr;
  944. return arr.filter((it) => it.indexOf(q) !== -1);
  945. },
  946. onFilterDateChange() { },
  947. confirmFilter() {
  948. this.filterModalOpen = false;
  949. },
  950. openDropdown(k) {
  951. this.closeDropdownAll();
  952. this.dropdown[k] = true;
  953. if (k === "customer") {
  954. if (!this.customers || this.customers.length === 0) {
  955. this.customerPage = 1;
  956. this.customerTotal = null;
  957. this.customerHasMore = true;
  958. this.getCustomerOptions();
  959. }
  960. }
  961. if (k === "product") {
  962. this.initProductList('create');
  963. }
  964. },
  965. toggleDropdown(k) {
  966. this.dropdown[k] = !this.dropdown[k];
  967. },
  968. pickOption(k, v) {
  969. if (k === "customer") {
  970. if (!Array.isArray(this.form.customer)) this.form.customer = [];
  971. const idx = this.form.customer.indexOf(v);
  972. if (idx === -1) {
  973. this.form.customer.push(v);
  974. } else {
  975. this.form.customer.splice(idx, 1);
  976. }
  977. return;
  978. }
  979. this.form[k] = v;
  980. if (k === "product") {
  981. this.form.pkgSpec = "";
  982. this.getGuigeList(v.physicName);
  983. }
  984. this.dropdown[k] = false;
  985. },
  986. isCustomerSelected(name) {
  987. const arr = this.form.customer;
  988. if (!Array.isArray(arr)) return false;
  989. return arr.some((i) => i.customerName === name);
  990. },
  991. removeCustomer(name) {
  992. if (!Array.isArray(this.form.customer)) return;
  993. const idx = this.form.customer.findIndex((i) => i.customerName === name);
  994. if (idx !== -1) this.form.customer.splice(idx, 1);
  995. },
  996. clearAllCustomers() {
  997. this.form.customer = [];
  998. },
  999. filteredOptions(k, type) {
  1000. const arr = this.options[k] || [];
  1001. let q = "";
  1002. if (type === "filter") {
  1003. q = this.filterSearchForm[k] || "";
  1004. } else {
  1005. q = this.searchForm[k] || "";
  1006. }
  1007. q = String(q).trim().toLocaleLowerCase();
  1008. if (!q) return arr;
  1009. return arr.filter((it) => {
  1010. if (typeof it === "string")
  1011. return it.toLocaleLowerCase().indexOf(q) !== -1;
  1012. if (it && typeof it === "object") {
  1013. const name =
  1014. k === "region"
  1015. ? it.regionName || it.name || ""
  1016. : it.physicName || it.productName || "";
  1017. return String(name).toLocaleLowerCase().indexOf(q) !== -1;
  1018. }
  1019. return false;
  1020. });
  1021. },
  1022. // Initialize product list for pagination
  1023. initProductList(mode) {
  1024. const allProducts = this.filteredOptions('product', mode === 'filter' ? 'filter' : undefined);
  1025. const res = getPaginatedList({
  1026. page: 0,
  1027. size: 10,
  1028. initData: allProducts,
  1029. data: []
  1030. });
  1031. if (mode === 'filter') {
  1032. this.filterProductPage = res.page;
  1033. this.filterDisplayProducts = res.data;
  1034. } else {
  1035. this.productPage = res.page;
  1036. this.displayProducts = res.data;
  1037. }
  1038. },
  1039. // Load more products on scroll
  1040. loadMoreProducts(mode) {
  1041. const allProducts = this.filteredOptions('product', mode === 'filter' ? 'filter' : undefined);
  1042. const isFilter = mode === 'filter';
  1043. const currentPage = isFilter ? this.filterProductPage : this.productPage;
  1044. const currentData = isFilter ? this.filterDisplayProducts : this.displayProducts;
  1045. const res = getPaginatedList({
  1046. page: currentPage,
  1047. size: 10,
  1048. initData: allProducts,
  1049. data: currentData
  1050. });
  1051. if (res.data) {
  1052. if (isFilter) {
  1053. this.filterProductPage = res.page;
  1054. this.filterDisplayProducts = res.data;
  1055. } else {
  1056. this.productPage = res.page;
  1057. this.displayProducts = res.data;
  1058. }
  1059. }
  1060. },
  1061. onSearchFocus() {
  1062. this.dropdownUpward = true;
  1063. },
  1064. onSearchBlur() {
  1065. this.dropdownUpward = false;
  1066. },
  1067. dropdownPosStyle() {
  1068. // if (this.dropdownUpward) {
  1069. // return { bottom: "84rpx" };
  1070. // }
  1071. return { top: "84rpx" };
  1072. },
  1073. onDateChange() { },
  1074. onStart(item) {
  1075. uni.showModal({
  1076. title: "是否开始导出报表?",
  1077. success: (res) => {
  1078. if (res.confirm) {
  1079. uni.showLoading();
  1080. request("/report/confirm", {
  1081. id: item?.id || "",
  1082. path: "reportExport/index.vue",
  1083. }).then((res) => {
  1084. uni.hideLoading();
  1085. if (res.code == 200) {
  1086. uni.showToast({
  1087. title: "已开始导出",
  1088. icon: "none",
  1089. duration: 2000,
  1090. });
  1091. this.resetFetch();
  1092. this.closeCreate();
  1093. } else {
  1094. uni.showToast({
  1095. title: res?.msg || "请求失败",
  1096. icon: "none",
  1097. duration: 2000,
  1098. });
  1099. }
  1100. });
  1101. }
  1102. },
  1103. });
  1104. },
  1105. onSend(item) {
  1106. this.currentItem = item;
  1107. this.emailError = false;
  1108. this.emailModalOpen = true;
  1109. },
  1110. closeEmailModal() {
  1111. this.emailModalOpen = false;
  1112. },
  1113. handleSendEmail() {
  1114. const email = String(this.emailForm.email || '').trim()
  1115. if (!email) {
  1116. this.emailError = true;
  1117. return;
  1118. }
  1119. this.closeEmailModal();
  1120. uni.showLoading({
  1121. title: "发送中...",
  1122. });
  1123. const url = "/report/sendEmail";
  1124. request(url, {
  1125. taskId: this.currentItem?.id,
  1126. emailAddress: email + "@999.com.cn",
  1127. path: "reportExport/index.vue",
  1128. }).then((res) => {
  1129. uni.hideLoading();
  1130. if (res.code === 200) {
  1131. uni.showToast({
  1132. title: "发送成功",
  1133. icon: "none",
  1134. duration: 2000,
  1135. });
  1136. } else {
  1137. uni.showToast({
  1138. title: res?.msg || "发送失败",
  1139. icon: "none",
  1140. duration: 2000,
  1141. });
  1142. }
  1143. });
  1144. },
  1145. onScrollToLower() {
  1146. // if (this.isLoading) return;
  1147. // if (this.list.length >= this.totalCount) return;
  1148. // this.isLoading = true;
  1149. // const remain = this.totalCount - this.list.length;
  1150. // const toAdd = Math.min(10, remain);
  1151. // setTimeout(() => {
  1152. // const more = this.genItems(toAdd);
  1153. // this.list = this.list.concat(more);
  1154. // this.animateNew(more);
  1155. // this.isLoading = false;
  1156. // }, 800);
  1157. this.fetchList();
  1158. },
  1159. genItems(n) {
  1160. const res = [];
  1161. const base = this.list.length;
  1162. for (let i = 0; i < n; i++) {
  1163. const idx = base + i + 1;
  1164. const statusIdx = idx % 3;
  1165. const target = [60, 0, 100][statusIdx];
  1166. const sText = ["导出进行中", "导出待开始", "导出已完成"][statusIdx];
  1167. const sClass = ["ing", "wait", "done"][statusIdx];
  1168. const action = ["", "start", "done"][statusIdx];
  1169. res.push({
  1170. title: `第${idx}条公司报表`,
  1171. product: "感冒灵",
  1172. range: "2025-11-27—2025-12-27",
  1173. statusText: sText,
  1174. statusClass: sClass,
  1175. showProgress: statusIdx !== 1,
  1176. progress: 0,
  1177. progressTarget: target,
  1178. action,
  1179. });
  1180. }
  1181. return res;
  1182. },
  1183. // animateAll() {
  1184. // this.list.forEach((it) => this.animateItem(it));
  1185. // },
  1186. // animateNew(arr) {
  1187. // arr.forEach((it) => this.animateItem(it));
  1188. // },
  1189. // animateItem(item) {
  1190. // if (!item.showProgress) return;
  1191. // item.progress = 60;
  1192. // const target = Number(item.progressTarget) || 0;
  1193. // const step = Math.max(1, Math.round(target / 60));
  1194. // const timer = setInterval(() => {
  1195. // item.progress += step;
  1196. // if (item.progress >= target) {
  1197. // item.progress = target;
  1198. // clearInterval(timer);
  1199. // }
  1200. // }, 16);
  1201. // },
  1202. },
  1203. };
  1204. </script>
  1205. <style>
  1206. .report-export-page {
  1207. position: relative;
  1208. box-sizing: border-box;
  1209. /* padding: 170rpx 0 calc(50rpx + env(safe-area-inset-bottom)); */
  1210. padding-top: 290rpx;
  1211. }
  1212. .report-export-search-bar-container {
  1213. position: fixed;
  1214. top: 100rpx;
  1215. left: 0;
  1216. padding: 24rpx 24rpx 16rpx;
  1217. background-color: #f3f6f9;
  1218. z-index: 10;
  1219. box-sizing: border-box;
  1220. width: 100%;
  1221. }
  1222. .report-export-search-bar {
  1223. display: flex;
  1224. align-items: center;
  1225. background: #fff;
  1226. border-radius: 16rpx;
  1227. padding: 16rpx;
  1228. }
  1229. .report-export-search-input-wrap {
  1230. flex: 1;
  1231. position: relative;
  1232. background: #f3f6f9;
  1233. border-radius: 40rpx;
  1234. display: flex;
  1235. align-items: center;
  1236. height: 90rpx;
  1237. padding: 0 12rpx;
  1238. }
  1239. .report-export-search-icon {
  1240. width: 28rpx;
  1241. height: 28rpx;
  1242. margin-left: 16rpx;
  1243. }
  1244. .report-export-search-input {
  1245. flex: 1;
  1246. height: 90rpx;
  1247. padding: 0 16rpx;
  1248. font-size: 28rpx;
  1249. }
  1250. .report-export-search-btn {
  1251. height: 72rpx;
  1252. line-height: 72rpx;
  1253. padding: 0 34rpx;
  1254. border-radius: 36rpx;
  1255. background: #2c69ff;
  1256. color: #fff;
  1257. font-size: 34rpx;
  1258. margin-left: 12rpx;
  1259. }
  1260. .report-export-filter-btn {
  1261. margin-left: 12rpx;
  1262. display: flex;
  1263. flex-direction: column;
  1264. align-items: center;
  1265. justify-content: center;
  1266. }
  1267. .report-export-filter-icon {
  1268. width: 40rpx;
  1269. height: 40rpx;
  1270. }
  1271. .report-export-filter-text {
  1272. margin-top: 8rpx;
  1273. font-size: 24rpx;
  1274. color: #2c69ff;
  1275. }
  1276. .scan-rate-ranges-container {
  1277. position: fixed;
  1278. top: 262rpx;
  1279. left: 0;
  1280. width: 100%;
  1281. height: 120rpx;
  1282. background: #f3f6f9;
  1283. z-index: 6;
  1284. }
  1285. .scan-rate-ranges {
  1286. padding: 0rpx 24rpx 20rpx;
  1287. }
  1288. .scan-rate-ranges-content {
  1289. display: flex;
  1290. background: #fff;
  1291. padding: 20rpx 30rpx;
  1292. border-radius: 16rpx;
  1293. justify-content: space-between;
  1294. }
  1295. .scan-rate-range {
  1296. padding: 12rpx 35rpx;
  1297. border-radius: 5rpx;
  1298. background: rgb(240, 240, 240);
  1299. font-size: 26rpx;
  1300. }
  1301. .scan-rate-range.scan-rate-active {
  1302. background: #2c69ff;
  1303. color: #fff;
  1304. }
  1305. .report-export-list-scroll {
  1306. position: fixed;
  1307. top: 380rpx;
  1308. left: 0;
  1309. box-sizing: border-box;
  1310. width: 100%;
  1311. padding: 0 24rpx env(safe-area-inset-bottom);
  1312. box-sizing: border-box;
  1313. }
  1314. .report-export-item-card {
  1315. background: #fff;
  1316. border-radius: 16rpx;
  1317. padding: 24rpx;
  1318. margin-bottom: 16rpx;
  1319. }
  1320. .report-export-item-header {
  1321. width: 100%;
  1322. display: flex;
  1323. align-items: flex-start;
  1324. flex-wrap: wrap;
  1325. }
  1326. .report-export-item-title {
  1327. flex: 1;
  1328. width: 0;
  1329. word-break: break-word;
  1330. margin-right: 20rpx;
  1331. font-size: 38rpx;
  1332. color: #2c69ff;
  1333. display: -webkit-box;
  1334. -webkit-box-orient: vertical;
  1335. -webkit-line-clamp: 2;
  1336. overflow: hidden;
  1337. }
  1338. .report-export-status {
  1339. flex-shrink: 0;
  1340. padding: 8rpx 12rpx;
  1341. border-radius: 10rpx;
  1342. font-size: 22rpx;
  1343. color: #fff;
  1344. }
  1345. .report-export-status.report-export-status-2 {
  1346. background: #67c23a;
  1347. }
  1348. .report-export-status.report-export-status-1 {
  1349. background: #888;
  1350. }
  1351. .report-export-status.report-export-status-3,
  1352. .report-export-status.report-export-status-4 {
  1353. background: #2c69ff;
  1354. }
  1355. .report-export-item-row {
  1356. margin-top: 12rpx;
  1357. font-size: 28rpx;
  1358. color: #999;
  1359. }
  1360. .report-export-progress-wrap {
  1361. margin-top: 20rpx;
  1362. }
  1363. .report-export-progress {
  1364. margin-top: 8rpx;
  1365. height: 32rpx;
  1366. background: #e6ebf5;
  1367. border-radius: 999rpx;
  1368. overflow: hidden;
  1369. position: relative;
  1370. }
  1371. .report-export-progress-fill {
  1372. position: absolute;
  1373. left: 0;
  1374. top: 0;
  1375. height: 100%;
  1376. background: #2c69ff;
  1377. border-radius: 999rpx;
  1378. width: 0;
  1379. transition: width 0.2s linear;
  1380. }
  1381. .report-export-progress-text {
  1382. position: absolute;
  1383. left: 50%;
  1384. top: 50%;
  1385. transform: translate(-50%, -50%);
  1386. font-size: 26rpx;
  1387. color: #fff;
  1388. z-index: 2;
  1389. }
  1390. .report-export-action-row {
  1391. margin-top: 16rpx;
  1392. display: flex;
  1393. align-items: center;
  1394. justify-content: flex-end;
  1395. }
  1396. .report-export-action-btn {
  1397. height: 50rpx;
  1398. line-height: 50rpx;
  1399. padding: 0 28rpx;
  1400. border-radius: 12rpx;
  1401. font-size: 30rpx;
  1402. margin: 0;
  1403. }
  1404. .report-export-action-btn+.report-export-action-btn {
  1405. margin-left: 12rpx;
  1406. }
  1407. .report-export-action-btn.report-export-primary {
  1408. background: #2c69ff;
  1409. color: #fff;
  1410. }
  1411. .report-export-action-btn.report-export-info {
  1412. background: #67c23a;
  1413. color: #fff;
  1414. }
  1415. .report-export-loading-row {
  1416. justify-content: center;
  1417. }
  1418. .report-export-loading-wrapper {
  1419. width: 100%;
  1420. height: 76rpx;
  1421. display: flex;
  1422. align-items: center;
  1423. justify-content: center;
  1424. }
  1425. .report-export-loading-icon {
  1426. width: 40rpx;
  1427. height: 40rpx;
  1428. animation: spin 1s linear infinite;
  1429. }
  1430. @keyframes spin {
  1431. from {
  1432. transform: rotate(0deg);
  1433. }
  1434. to {
  1435. transform: rotate(360deg);
  1436. }
  1437. }
  1438. .report-export-footer {
  1439. position: fixed;
  1440. left: 0;
  1441. right: 0;
  1442. bottom: 0;
  1443. padding: 12rpx 30rpx calc(50rpx + env(safe-area-inset-bottom));
  1444. background: #fff;
  1445. }
  1446. .report-export-footer-btn {
  1447. height: 86rpx;
  1448. border-radius: 999rpx;
  1449. background: #2c69ff;
  1450. color: #fff;
  1451. display: flex;
  1452. align-items: center;
  1453. justify-content: center;
  1454. font-size: 30rpx;
  1455. box-shadow: 0 8rpx 24rpx rgba(44, 105, 255, 0.35);
  1456. }
  1457. .report-export-create-modal-mask {
  1458. position: fixed;
  1459. left: 0;
  1460. right: 0;
  1461. top: 0;
  1462. bottom: 0;
  1463. background: rgba(0, 0, 0, 0.35);
  1464. z-index: 99;
  1465. }
  1466. .report-export-create-modal {
  1467. position: fixed;
  1468. left: 0;
  1469. right: 0;
  1470. bottom: 0;
  1471. width: 100%;
  1472. background: #fff;
  1473. border-top-left-radius: 45rpx;
  1474. border-top-right-radius: 45rpx;
  1475. z-index: 100;
  1476. box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.12);
  1477. transform: translateY(100%);
  1478. transition: transform 0.25s ease-out;
  1479. }
  1480. .report-export-create-modal--open {
  1481. transform: translateY(0) !important;
  1482. }
  1483. .report-export-create-modal-title {
  1484. position: relative;
  1485. padding: 28rpx 28rpx 12rpx;
  1486. font-size: 34rpx;
  1487. color: #333;
  1488. text-align: center;
  1489. line-height: 60rpx;
  1490. font-weight: 500;
  1491. }
  1492. .report-export-create-modal-close {
  1493. position: absolute;
  1494. right: 32rpx;
  1495. top: 50%;
  1496. transform: translateY(-50%);
  1497. padding: 10rpx;
  1498. color: #909399;
  1499. font-size: 55rpx;
  1500. line-height: 1;
  1501. }
  1502. .report-export-create-modal-body {
  1503. padding: 0 32rpx 100rpx;
  1504. }
  1505. .report-export-create-modal-row {
  1506. display: flex;
  1507. flex-direction: column;
  1508. margin-top: 32rpx;
  1509. position: relative;
  1510. }
  1511. .report-export-create-modal-label {
  1512. width: auto;
  1513. font-size: 28rpx;
  1514. color: #333;
  1515. margin-bottom: 16rpx;
  1516. font-weight: 500;
  1517. }
  1518. .report-export-create-modal-inputwrap {
  1519. flex: 1;
  1520. position: relative;
  1521. border: 1rpx solid #dcdfe6;
  1522. border-radius: 12rpx;
  1523. display: flex;
  1524. align-items: center;
  1525. min-height: 80rpx;
  1526. padding: 0 24rpx;
  1527. background-color: #fff;
  1528. }
  1529. .report-export-create-modal-static {
  1530. position: relative;
  1531. flex: 1;
  1532. max-height: 115rpx;
  1533. font-size: 28rpx;
  1534. color: #606266;
  1535. line-height: 40rpx;
  1536. padding: 20rpx 0;
  1537. overflow-y: auto;
  1538. padding-right: 20rpx;
  1539. }
  1540. .report-export-create-modal-input {
  1541. flex: 1;
  1542. height: 80rpx;
  1543. font-size: 28rpx;
  1544. color: #606266;
  1545. }
  1546. /deep/.report-export-dropdown-other-customer-input {
  1547. color: #666;
  1548. }
  1549. /* .report-export-create-modal-select-arrow {
  1550. width: 18rpx;
  1551. height: 18rpx;
  1552. border: 5rpx solid #999;
  1553. border-top: none;
  1554. border-left: none;
  1555. transform: rotate(45deg);
  1556. margin: 0 8rpx 10rpx 12rpx;
  1557. }
  1558. .report-export-create-modal-select-arrow.disabled {
  1559. opacity: 0.4;
  1560. pointer-events: none;
  1561. } */
  1562. .report-export-create-modal-dropdown {
  1563. position: absolute;
  1564. left: 0;
  1565. right: 0;
  1566. background: #fff;
  1567. border: 1rpx solid #eef0f4;
  1568. border-radius: 12rpx;
  1569. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
  1570. z-index: 6;
  1571. max-height: 510rpx;
  1572. overflow-y: auto;
  1573. -webkit-overflow-scrolling: touch;
  1574. }
  1575. .report-export-create-modal-dropdown-list {
  1576. max-height: 350rpx;
  1577. }
  1578. .report-export-dropdown-search-row {
  1579. padding: 10rpx;
  1580. }
  1581. .report-export-dropdown-search-input {
  1582. width: 100%;
  1583. height: 60rpx;
  1584. border: 1rpx solid #eaeef4;
  1585. border-radius: 8rpx;
  1586. box-sizing: border-box;
  1587. padding: 0 16rpx;
  1588. font-size: 28rpx;
  1589. }
  1590. .report-export-create-modal-dropdown-item {
  1591. padding: 16rpx 20rpx;
  1592. font-size: 28rpx;
  1593. color: #333;
  1594. }
  1595. .report-export-selected {
  1596. background: #f0f5ff;
  1597. }
  1598. .report-export-input-arrow {
  1599. width: 16rpx;
  1600. height: 16rpx;
  1601. border-right: 3rpx solid #c0c4cc;
  1602. border-bottom: 3rpx solid #c0c4cc;
  1603. transform: rotate(45deg);
  1604. margin-top: -6rpx;
  1605. }
  1606. .customer-chip {
  1607. display: inline-block;
  1608. position: relative;
  1609. line-height: 50rpx;
  1610. border: 1rpx solid #eaeef4;
  1611. border-radius: 8rpx;
  1612. padding: 0rpx 44rpx 0rpx 16rpx;
  1613. margin-right: 8rpx;
  1614. margin-bottom: 8rpx;
  1615. font-size: 22rpx;
  1616. color: #333;
  1617. }
  1618. .customer-chip-close {
  1619. position: absolute;
  1620. right: 6rpx;
  1621. top: 0;
  1622. color: #666;
  1623. font-size: 28rpx;
  1624. padding: 0 8rpx;
  1625. border-radius: 6rpx;
  1626. }
  1627. .customer-clear-all {
  1628. position: absolute;
  1629. right: 6rpx;
  1630. top: 50%;
  1631. transform: translateY(-50%);
  1632. line-height: 50rpx;
  1633. padding: 8rpx 10rpx;
  1634. font-size: 40rpx;
  1635. }
  1636. .report-export-create-modal-estimated {
  1637. font-size: 28rpx;
  1638. color: #666;
  1639. }
  1640. .report-export-create-modal-footer {
  1641. padding: 18rpx 28rpx calc(50rpx + env(safe-area-inset-bottom));
  1642. }
  1643. .report-export-create-modal-btn {
  1644. line-height: 90rpx;
  1645. border-radius: 20rpx;
  1646. background: #2c69ff;
  1647. color: #fff;
  1648. text-align: center;
  1649. font-size: 30rpx;
  1650. }
  1651. .report-export-create-email-modal {
  1652. transform: translateY(200%);
  1653. height: auto;
  1654. top: 30%;
  1655. bottom: auto;
  1656. border-radius: 16rpx;
  1657. width: 600rpx;
  1658. left: 75rpx;
  1659. }
  1660. .report-export-email-input-wrap {
  1661. display: flex;
  1662. align-items: center;
  1663. background: #f5f7fa;
  1664. border-radius: 8rpx;
  1665. padding: 0 20rpx;
  1666. height: 80rpx;
  1667. border: 1rpx solid transparent;
  1668. }
  1669. .report-export-input-error {
  1670. border-color: #ff4d4f;
  1671. }
  1672. .report-export-email-input {
  1673. flex: 1;
  1674. font-size: 28rpx;
  1675. color: #333;
  1676. height: 100%;
  1677. }
  1678. .report-export-email-suffix {
  1679. font-size: 28rpx;
  1680. color: #333;
  1681. margin-left: 10rpx;
  1682. }
  1683. .report-export-error-text {
  1684. font-size: 24rpx;
  1685. color: #ff4d4f;
  1686. margin-top: 10rpx;
  1687. display: block;
  1688. }
  1689. .report-export-input-disabled {
  1690. background-color: #f5f7fa;
  1691. cursor: not-allowed;
  1692. opacity: 0.7;
  1693. }
  1694. </style>