index.vue 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377
  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
  20. v-for="(value, i) in options.status"
  21. :key="value"
  22. class="scan-rate-range"
  23. :class="{
  24. 'scan-rate-active': filterForm.status == value,
  25. }"
  26. @click.stop="pickFilterOption('status', value)"
  27. >{{ value }}</view
  28. >
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="loading" class="report-export-list-scroll" :style="{ height: 'auto' }">
  33. <view class="report-export-loading-row">
  34. <view class="report-export-loading-wrapper">
  35. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  36. </view>
  37. </view>
  38. </view>
  39. <scroll-view
  40. v-else-if="list.length > 0"
  41. class="report-export-list-scroll"
  42. scroll-y="true"
  43. :style="{ height: listViewHeight }"
  44. @scrolltolower="onScrollToLower">
  45. <view class="report-export-item-card" v-for="(item, i) in list" :key="item.id">
  46. <view class="report-export-item-header">
  47. <text class="report-export-item-title" @click="showModal(item)">{{ getCustomerName(item) }}报表</text>
  48. <text class="report-export-status" :class="'report-export-status-' + item.status">{{ getStatusText(item.status) }}</text>
  49. </view>
  50. <view class="report-export-item-row">创建人:{{ item.userName || "" }}</view>
  51. <view class="report-export-item-row">品种:{{ item.physicName || "" }}</view>
  52. <view class="report-export-item-row">规格:{{ item.pkgSpec || "" }}</view>
  53. <view class="report-export-item-row" v-if="getPrepnSpecText(item.prepnSpec)">制剂规格:{{ getPrepnSpecText(item.prepnSpec) }}</view>
  54. <view class="report-export-item-row">时间:{{ formatDate(item.beginTime) }}~{{ formatDate(item.endTime) }}</view>
  55. <!-- <view
  56. class="report-export-item-row"
  57. style="color: red"
  58. v-if="item.remark !== ''"
  59. >任务失败:{{ item.remark || "" }}</view
  60. > -->
  61. <view v-if="item.status == 2" class="report-export-progress-wrap">
  62. <view class="report-export-progress">
  63. <view class="report-export-progress-fill" :style="{ width: `${item.progress || 10}%` }"></view>
  64. <text class="report-export-progress-text">{{ item.progress || 10 }}</text>
  65. </view>
  66. </view>
  67. <view v-if="item.status == 1" class="report-export-action-row">
  68. <view class="report-export-action-btn report-export-primary" @click="onStart(item)"> 确认开始计算 </view>
  69. </view>
  70. <view v-else-if="item.status == 3" class="report-export-action-row">
  71. <view class="report-export-action-btn report-export-info" @click="toDetail(item)">查看</view>
  72. <view class="report-export-action-btn report-export-primary" @click="onSend(item)"> 导出 </view>
  73. </view>
  74. </view>
  75. <view class="report-export-loading-row" v-if="hasmore">
  76. <view class="report-export-loading-wrapper">
  77. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  78. </view>
  79. </view>
  80. </scroll-view>
  81. <EmptyView v-else text="暂无导出任务" />
  82. <view class="report-export-footer">
  83. <view class="report-export-footer-btn" @click="onCreate">新建任务</view>
  84. </view>
  85. <view v-show="createModalOpen || filterModalOpen || emailModalOpen" class="report-export-create-modal-mask" @click="closeCreate"> </view>
  86. <view class="report-export-create-modal" :class="{ 'report-export-create-modal--open': createModalOpen }">
  87. <view class="report-export-create-modal-title" @click="closeDropdownAll">
  88. <text>{{ taskTitle }}</text>
  89. <view class="report-export-create-modal-close" @click.stop="closeCreate">×</view>
  90. </view>
  91. <view class="report-export-create-modal-body" :style="{ paddingBottom: 0 }" @click="closeDropdownAll">
  92. <scroll-view
  93. scroll-y="true"
  94. :style="{
  95. height: '750rpx',
  96. paddingBottom: '20rpx',
  97. }">
  98. <view class="report-export-tips">
  99. <uni-icons type="help" size="16" color="606266"></uni-icons>
  100. 非协议客户请直接在“其他客户”输入客户名称</view
  101. >
  102. <view class="report-export-medical-tabs">
  103. <view
  104. class="report-export-medical-tab-indicator"
  105. :class="{ 'is-medical': searchForm.productMedical === '是' }"></view>
  106. <button
  107. class="report-export-medical-tab"
  108. :class="{ 'medical-active': searchForm.productMedical === '否' }"
  109. :aria-disabled="modalType === 'read'"
  110. @click.stop="modalType !== 'read' && setProductMedical('否', 'create')">
  111. OTC
  112. </button>
  113. <button
  114. class="report-export-medical-tab"
  115. :class="{ 'medical-active': searchForm.productMedical === '是' }"
  116. :aria-disabled="modalType === 'read'"
  117. @click.stop="modalType !== 'read' && setProductMedical('是', 'create')">
  118. 医疗
  119. </button>
  120. </view>
  121. <view class="report-export-create-modal-row">
  122. <text class="report-export-create-modal-label">省份</text>
  123. <view class="report-export-create-modal-inputwrap" @click.stop="modalType !== 'read' && openDropdown('region')">
  124. <view class="report-export-create-modal-static">{{ form.region && form.region.regionName ? form.region.regionName : "请选择省份" }}</view>
  125. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  126. <view class="report-export-create-modal-dropdown" v-if="dropdown.region" @click.stop :style="dropdownPosStyle()">
  127. <view class="report-export-dropdown-search-row">
  128. <input
  129. class="report-export-dropdown-search-input"
  130. v-model="searchForm.region"
  131. :disabled="modalType === 'read'"
  132. @input="modalType !== 'read' && onInput('region')"
  133. @focus="onSearchFocus"
  134. @blur="onSearchBlur" />
  135. </view>
  136. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y>
  137. <view
  138. class="report-export-create-modal-dropdown-item"
  139. v-for="(op, i) in filteredOptions('region')"
  140. :key="'r-' + i"
  141. @click.stop="modalType !== 'read' && pickOption('region', op)"
  142. >{{ op.regionName }}
  143. </view>
  144. <view v-if="!filteredOptions('region') || filteredOptions('region').length === 0" class="report-export-create-modal-dropdown-item">
  145. 未查找到该省份</view
  146. >
  147. </scroll-view>
  148. </view>
  149. </view>
  150. </view>
  151. <view v-if="searchForm.productMedical === '否'" class="report-export-create-modal-row">
  152. <text class="report-export-create-modal-label">客户性质</text>
  153. <view class="report-export-create-modal-inputwrap" @click.stop="modalType !== 'read' && openDropdown('customerType')">
  154. <view class="report-export-create-modal-static">{{ form.customerType || "请选择客户性质" }}</view>
  155. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  156. <view class="report-export-create-modal-dropdown" v-if="dropdown.customerType" @click.stop :style="dropdownPosStyle()">
  157. <view
  158. class="report-export-create-modal-dropdown-item"
  159. v-for="(op, i) in filteredOptions('customerType')"
  160. :key="'t-' + i"
  161. @click.stop="modalType !== 'read' && pickOption('customerType', op)"
  162. >{{ op }}</view
  163. >
  164. <view v-if="filteredOptions('customerType').length === 0" class="report-export-create-modal-dropdown-item">未查找到该客户性质</view>
  165. </view>
  166. </view>
  167. </view>
  168. <view class="report-export-create-modal-row">
  169. <text class="report-export-create-modal-label">客户</text>
  170. <view
  171. class="report-export-create-modal-inputwrap"
  172. :class="{ 'report-export-input-disabled': searchForm.productMedical === '否' && !form.customerType }"
  173. @click.stop="modalType !== 'read' && (searchForm.productMedical === '是' || form.customerType) && openDropdown('customer')">
  174. <view class="report-export-create-modal-static" :style="{ maxHeight: 'auto', overflowY: 'visible' }">
  175. <block v-if="Array.isArray(form.customer) && form.customer.length">
  176. <view
  177. :style="{
  178. maxHeight: '100rpx',
  179. overflowY: 'auto',
  180. paddingRight: '40rpx',
  181. }">
  182. <text v-for="(op, i) in form.customer" :key="'cust-tag-' + i" class="customer-chip">
  183. {{ op.customerName }}
  184. <text class="customer-chip-close" @click.stop="modalType !== 'read' && removeCustomer(op.customerName)">×</text>
  185. </text>
  186. </view>
  187. </block>
  188. <text v-else>{{ searchForm.productMedical === "否" && !form.customerType ? "请先选择客户性质" : "请选择客户" }}</text>
  189. <text
  190. v-if="form.customer && form.customer.length && modalType !== 'read'"
  191. class="customer-clear-all"
  192. @click.stop="modalType !== 'read' && clearAllCustomers()"
  193. >×</text
  194. >
  195. </view>
  196. <view class="report-export-input-arrow" v-if="modalType !== 'read' && (searchForm.productMedical === '是' || form.customerType)"></view>
  197. <view
  198. class="report-export-create-modal-dropdown"
  199. v-if="dropdown.customer"
  200. @click.stop
  201. :style="[dropdownPosStyle(), { maxHeight: 'none', overflow: 'visible' }]">
  202. <view class="report-export-dropdown-search-row">
  203. <input
  204. class="report-export-dropdown-search-input"
  205. v-model="customerSearch"
  206. :disabled="modalType === 'read'"
  207. @input="modalType !== 'read' && onInput('customer')"
  208. @focus="onSearchFocus"
  209. @blur="onSearchBlur" />
  210. </view>
  211. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y lower-threshold="20" @scrolltolower="getCustomerOptions">
  212. <view
  213. class="report-export-create-modal-dropdown-item"
  214. :class="{
  215. 'report-export-selected': isCustomerSelected(op.customerName),
  216. }"
  217. v-for="(op, i) in customers"
  218. :key="'cust-' + i"
  219. @click.stop="modalType !== 'read' && pickOption('customer', op)"
  220. >{{ op.customerName }}</view
  221. >
  222. <view v-if="customers.length === 0 && !customerHasMore" class="report-export-create-modal-dropdown-item">未查找到该客户</view>
  223. <view v-if="customerHasMore" class="report-export-loading-row">
  224. <view class="report-export-loading-wrapper">
  225. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  226. </view>
  227. </view>
  228. </scroll-view>
  229. </view>
  230. </view>
  231. </view>
  232. <view class="report-export-create-modal-row">
  233. <text class="report-export-create-modal-label">其它客户</text>
  234. <view class="report-export-create-modal-inputwrap" @click.stop="modalType !== 'read' && openDropdown('otherCustomer')">
  235. <view class="report-export-create-modal-static" :style="{ maxHeight: 'auto', overflowY: 'visible' }">
  236. <block v-if="getOtherCustomerArray().length">
  237. <view
  238. :style="{
  239. maxHeight: '100rpx',
  240. overflowY: 'auto',
  241. paddingRight: '40rpx',
  242. }">
  243. <text v-for="(name, i) in getOtherCustomerArray()" :key="'other-cust-tag-' + i" class="customer-chip">
  244. {{ name }}
  245. <text class="customer-chip-close" @click.stop="modalType !== 'read' && removeOtherCustomer(name)">×</text>
  246. </text>
  247. </view>
  248. </block>
  249. <text v-else>请选择其它客户</text>
  250. <text
  251. v-if="getOtherCustomerArray().length && modalType !== 'read'"
  252. class="customer-clear-all"
  253. @click.stop="modalType !== 'read' && clearAllOtherCustomers()"
  254. >×</text
  255. >
  256. </view>
  257. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  258. <view
  259. class="report-export-create-modal-dropdown"
  260. v-if="dropdown.otherCustomer"
  261. @click.stop
  262. :style="[dropdownPosStyle(), { maxHeight: 'none', overflow: 'visible' }]">
  263. <view class="report-export-dropdown-search-row">
  264. <input
  265. class="report-export-dropdown-search-input"
  266. v-model="otherCustomerSearch"
  267. :disabled="modalType === 'read'"
  268. @input="modalType !== 'read' && onInput('otherCustomer')"
  269. @focus="onSearchFocus"
  270. @blur="onSearchBlur"
  271. placeholder="请输入客户名称" />
  272. </view>
  273. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y>
  274. <view
  275. class="report-export-create-modal-dropdown-item"
  276. :class="{
  277. 'report-export-selected': isOtherCustomerSelected(op),
  278. }"
  279. v-for="(op, i) in otherCustomers"
  280. :key="'other-cust-' + i"
  281. @click.stop="modalType !== 'read' && pickOption('otherCustomer', op)"
  282. >{{ op }}</view
  283. >
  284. <view v-if="!otherCustomerSearch.trim()" class="report-export-create-modal-dropdown-item">请输入客户名称以搜索客户</view>
  285. <view v-else-if="otherCustomers.length === 0 && !otherCustomerLoading" class="report-export-create-modal-dropdown-item">未查找到该客户</view>
  286. <view v-if="otherCustomerLoading" class="report-export-loading-row">
  287. <view class="report-export-loading-wrapper">
  288. <image class="report-export-loading-icon" src="../../../static/images/loading.png" />
  289. </view>
  290. </view>
  291. </scroll-view>
  292. </view>
  293. </view>
  294. </view>
  295. <view class="report-export-create-modal-row">
  296. <text class="report-export-create-modal-label">其它客户信用代码</text>
  297. <view class="report-export-create-modal-inputwrap">
  298. <input
  299. class="report-export-dropdown-search-input"
  300. v-model="form.otherCustomerCode"
  301. placeholder="请填写信用代码(依照其他客户填写顺序用半角逗号隔开)"
  302. placeholder-class="report-export-dropdown-other-customer-input"
  303. :disabled="modalType === 'read'"
  304. :style="{ color: '#666', padding: 0, border: 'none' }" />
  305. </view>
  306. </view>
  307. <view class="report-export-create-modal-row">
  308. <text class="report-export-create-modal-label">品种</text>
  309. <view class="report-export-create-modal-inputwrap" @click.stop="modalType !== 'read' && openDropdown('product')">
  310. <view class="report-export-create-modal-static">{{ form.product?.physicName || "请选择品种" }}</view>
  311. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  312. <view class="report-export-create-modal-dropdown" :style="[{ top: 'auto', bottom: '84rpx' }]" v-if="dropdown.product" @click.stop>
  313. <view class="report-export-dropdown-search-row">
  314. <input
  315. class="report-export-dropdown-search-input"
  316. v-model="searchForm.product"
  317. :disabled="modalType === 'read'"
  318. @input="modalType !== 'read' && onInput('product')"
  319. @focus="onSearchFocus"
  320. @blur="onSearchBlur" />
  321. </view>
  322. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y @scrolltolower="loadMoreProducts('create')">
  323. <view
  324. class="report-export-create-modal-dropdown-item"
  325. v-for="(op, i) in displayProducts"
  326. :key="'p-' + i"
  327. @click.stop="modalType !== 'read' && pickOption('product', op)"
  328. >{{ op.physicName }}
  329. </view>
  330. <view v-if="displayProducts?.length === 0" class="report-export-create-modal-dropdown-item"> 未查找到该品种</view>
  331. </scroll-view>
  332. </view>
  333. </view>
  334. </view>
  335. <view class="report-export-create-modal-row">
  336. <text class="report-export-create-modal-label">规格</text>
  337. <view
  338. class="report-export-create-modal-inputwrap"
  339. :class="{
  340. 'report-export-input-disabled': !form.product?.drugEntBaseInfoId,
  341. }"
  342. @click.stop="modalType !== 'read' && form.product?.drugEntBaseInfoId && openDropdown('pkgSpec')">
  343. <view class="report-export-create-modal-static">{{ form.pkgSpec || "请选择规格(请先选择品种)" }}</view>
  344. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  345. <view class="report-export-create-modal-dropdown" v-if="dropdown.pkgSpec" @click.stop :style="[{ top: 'auto', bottom: '84rpx' }]">
  346. <view
  347. class="report-export-create-modal-dropdown-item"
  348. v-for="(op, i) in filteredOptions('pkgSpec')"
  349. :key="'t-' + i"
  350. @click.stop="modalType !== 'read' && pickOption('pkgSpec', op)"
  351. >{{ op }}</view
  352. >
  353. <view v-if="filteredOptions('pkgSpec')?.length === 0" class="report-export-create-modal-dropdown-item"> 未查找到该品种规格</view>
  354. </view>
  355. </view>
  356. </view>
  357. <view class="report-export-create-modal-row">
  358. <text class="report-export-create-modal-label">制剂规格</text>
  359. <view
  360. class="report-export-create-modal-inputwrap"
  361. :class="{
  362. 'report-export-input-disabled': !form.product?.drugEntBaseInfoId,
  363. }"
  364. @click.stop="modalType !== 'read' && form.product?.drugEntBaseInfoId && openDropdown('prepnSpec')">
  365. <view class="report-export-create-modal-static">{{ form.prepnSpec || "请选择制剂规格(不选则查询全部制剂规格)" }}</view>
  366. <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
  367. <view class="report-export-create-modal-dropdown" v-if="dropdown.prepnSpec" @click.stop :style="[{ top: 'auto', bottom: '84rpx' }]">
  368. <view
  369. class="report-export-create-modal-dropdown-item"
  370. v-for="(op, i) in filteredOptions('prepnSpec')"
  371. :key="'t-' + i"
  372. @click.stop="modalType !== 'read' && pickOption('prepnSpec', op)"
  373. >{{ op }}</view
  374. >
  375. <view v-if="filteredOptions('prepnSpec')?.length === 0" class="report-export-create-modal-dropdown-item"> 未查找到该品种制剂规格</view>
  376. </view>
  377. </view>
  378. </view>
  379. <view class="report-export-create-modal-row">
  380. <text class="report-export-create-modal-label">时间</text>
  381. <view class="report-export-create-modal-inputwrap" @click="openDatePicker">
  382. <view
  383. class="report-export-create-modal-static report-export-input-simulator"
  384. :style="{
  385. color: dateRange && dateRange.length ? '#333' : '#606266',
  386. }">
  387. <uni-icons type="calendar" size="22" color="#c0c4cc"></uni-icons>
  388. <view style="flex: 1; text-align: center">{{ dateRange && dateRange.length ? dateRange[0] : "开始时间" }} </view>
  389. <view>-</view>
  390. <view style="flex: 1; text-align: center">{{ dateRange && dateRange.length ? dateRange[1] : "结束时间" }} </view>
  391. </view>
  392. <view class="report-export-input-simulator-clear" v-if="dateRange && dateRange.length" @click.stop="dateRange = []">
  393. <uni-icons type="clear" size="22" color="#c0c4cc"></uni-icons>
  394. </view>
  395. </view>
  396. </view>
  397. </scroll-view>
  398. <!-- Hidden Picker for API access -->
  399. <view style="position: absolute; left: -10000px; top: 0">
  400. <uni-datetime-picker ref="datePicker" type="daterange" v-model="dateRange" @change="onDateChange" />
  401. </view>
  402. </view>
  403. <view class="report-export-create-modal-footer" @click="closeDropdownAll">
  404. <view class="report-export-create-modal-btn" @click.stop="confirmCreate" v-if="modalType !== 'read'">{{
  405. modalType === "create" ? "新建任务" : "修改任务"
  406. }}</view>
  407. <view :style="{ display: 'flex', 'justify-content': 'space-between' }" v-else>
  408. <view
  409. class="report-export-create-modal-btn"
  410. :style="currentItem.status !== '2' ? { flex: '0 0 40%' } : { flex: '0 0 100%' }"
  411. @click.stop="closeCreate"
  412. >关闭</view
  413. >
  414. <view
  415. class="report-export-create-modal-btn"
  416. :style="{ background: 'red', flex: '0 0 40%' }"
  417. @click.stop="confirmDelete"
  418. v-if="currentItem.status !== '2'"
  419. >删除</view
  420. >
  421. </view>
  422. </view>
  423. </view>
  424. <view class="report-export-create-modal" :class="{ 'report-export-create-modal--open': filterModalOpen }">
  425. <view class="report-export-create-modal-title" @click="closeDropdownAll">筛选条件</view>
  426. <view class="report-export-create-modal-body" @click="closeDropdownAll">
  427. <view class="report-export-create-modal-row">
  428. <text class="report-export-create-modal-label">品种:</text>
  429. <view class="report-export-create-modal-inputwrap" @click.stop="openFilterDropdown('product')">
  430. <view class="report-export-create-modal-static">{{ filterForm.product?.physicName || "请选择品种" }}</view>
  431. <view class="report-export-create-modal-dropdown" :style="[{ top: 'auto', bottom: '84rpx' }]" v-if="filterDropdown.product" @click.stop>
  432. <view class="report-export-dropdown-search-row">
  433. <input
  434. class="report-export-dropdown-search-input"
  435. v-model="filterSearchForm.product"
  436. @input="onFilterInput('product')"
  437. @focus="onSearchFocus"
  438. @blur="onSearchBlur" />
  439. </view>
  440. <view class="report-export-dropdown-medical-row">
  441. <text
  442. class="report-export-dropdown-medical-tag"
  443. :class="{ 'medical-active': filterSearchForm.productMedical === '' }"
  444. @click.stop="setProductMedical('', 'filter')"
  445. >全部</text
  446. >
  447. <text
  448. class="report-export-dropdown-medical-tag"
  449. :class="{ 'medical-active': filterSearchForm.productMedical === '是' }"
  450. @click.stop="setProductMedical('是', 'filter')"
  451. >医疗产品</text
  452. >
  453. <text
  454. class="report-export-dropdown-medical-tag"
  455. :class="{ 'medical-active': filterSearchForm.productMedical === '否' }"
  456. @click.stop="setProductMedical('否', 'filter')"
  457. >OTC</text
  458. >
  459. </view>
  460. <scroll-view class="report-export-create-modal-dropdown-list" scroll-y @scrolltolower="loadMoreProducts('filter')">
  461. <view
  462. class="report-export-create-modal-dropdown-item"
  463. v-for="(op, i) in filterDisplayProducts"
  464. :key="'prd-' + i"
  465. @click.stop="pickFilterOption('product', op)"
  466. >{{ op.physicName }}</view
  467. >
  468. <view v-if="filterDisplayProducts?.length === 0" class="report-export-create-modal-dropdown-item"> 未查找到该品种 </view>
  469. </scroll-view>
  470. </view>
  471. </view>
  472. </view>
  473. <!-- <view class="report-export-create-modal-row">
  474. <text class="report-export-create-modal-label">规格</text>
  475. <view class="report-export-create-modal-inputwrap"
  476. :class="{ 'report-export-input-disabled': !filterForm.product?.drugEntBaseInfoId }"
  477. @click.stop="filterForm.product?.drugEntBaseInfoId && openFilterDropdown('pkgSpec')">
  478. <view class="report-export-create-modal-static">{{
  479. filterForm.pkgSpec || "请选择品种规格(请先选择品种)"
  480. }}</view>
  481. <view class="report-export-input-arrow"></view>
  482. <view class="report-export-create-modal-dropdown" v-if="filterDropdown.pkgSpec" @click.stop
  483. :style="[{ top: 'auto', bottom: '84rpx' }]">
  484. <view class="report-export-create-modal-dropdown-item" v-for="(op, i) in filteredOptions('pkgSpec')"
  485. :key="'t-' + i" @click.stop="
  486. pickFilterOption('pkgSpec', op)
  487. ">{{ op }}</view>
  488. <view v-if="filteredOptions('pkgSpec')?.length === 0" class="report-export-create-modal-dropdown-item">
  489. 未查找到该品种规格</view>
  490. </view>
  491. </view>
  492. </view> -->
  493. <view class="report-export-create-modal-row">
  494. <text class="report-export-create-modal-label">时间:</text>
  495. <view class="report-export-create-modal-inputwrap" v-if="filterModalOpen">
  496. <uni-datetime-picker type="daterange" :border="false" v-model="filterDateRange" @change="onFilterDateChange" />
  497. </view>
  498. </view>
  499. </view>
  500. <view class="report-export-create-modal-footer" @click="closeDropdownAll" :style="{ display: 'flex', justifyContent: 'space-between' }">
  501. <view
  502. class="report-export-create-modal-btn"
  503. :style="{
  504. background: '#fff',
  505. color: '#666',
  506. border: '1rpx solid #dcdfe6',
  507. flex: '0 0 45%',
  508. }"
  509. @click.stop="resetFilter"
  510. >重置</view
  511. >
  512. <view class="report-export-create-modal-btn" :style="{ flex: '0 0 45%' }" @click.stop="confirmFilter">确认</view>
  513. </view>
  514. </view>
  515. <view
  516. class="report-export-create-modal report-export-create-email-modal"
  517. :class="{ 'report-export-create-modal--open': emailModalOpen }"
  518. v-if="emailModalOpen">
  519. <view class="report-export-create-modal-title">
  520. <text>发送至邮箱</text>
  521. <view class="report-export-create-modal-close" @click.stop="closeEmailModal">×</view>
  522. </view>
  523. <view class="report-export-create-modal-body" :style="{ padding: '40rpx' }">
  524. <!-- <view class="report-export-email-input-wrap" :class="{ 'report-export-input-error': emailError }">
  525. <input class="report-export-email-input" v-model="emailForm.email" placeholder="请填写邮箱"
  526. placeholder-style="color: #c0c4cc" @input="emailError = false" />
  527. <text class="report-export-email-suffix">@999.com.cn</text>
  528. </view> -->
  529. <up-input
  530. v-model="emailForm.email"
  531. border="none"
  532. :customStyle="{
  533. backgroundColor: '#ebf3fb',
  534. height: '80rpx',
  535. paddingLeft: '20rpx',
  536. }"
  537. placeholder="请填写邮箱"
  538. disabled>
  539. <template #suffix style="margin-right: 30rpx"> @999.com.cn </template>
  540. </up-input>
  541. <text v-if="emailError" class="report-export-error-text">请输入邮箱</text>
  542. </view>
  543. <view
  544. class="report-export-create-modal-footer"
  545. :style="{
  546. padding: '20rpx 40rpx 40rpx',
  547. display: 'flex',
  548. 'justify-content': 'space-between',
  549. }">
  550. <view
  551. class="report-export-create-modal-btn"
  552. :style="{
  553. background: '#fff',
  554. color: '#666',
  555. border: '1rpx solid #dcdfe6',
  556. flex: '0 0 45%',
  557. }"
  558. @click.stop="closeEmailModal"
  559. >取消</view
  560. >
  561. <view class="report-export-create-modal-btn" :style="{ flex: '0 0 45%' }" @click.stop="handleSendEmail">发送 </view>
  562. </view>
  563. </view>
  564. </view>
  565. </template>
  566. <script>
  567. import EmptyView from "../../../wigets/empty.vue";
  568. import { formatDate, getPaginatedList } from "../../../utils/utils.js";
  569. import request from "../../../request/index.js";
  570. const customerTypeOptions = ["VIP客户", "二级客户", "三级客户", "KA客户", "NKA客户", "区域核心连锁"];
  571. const customerTypeMap = {
  572. VIP客户: "VIP",
  573. 二级客户: "二级",
  574. 三级客户: "三级",
  575. 区域核心连锁: "区域核心连锁",
  576. NKA客户: "NKA客户",
  577. KA客户: "KA客户",
  578. };
  579. const customerTypeReverseMap = {
  580. VIP: "VIP客户",
  581. 二级: "二级客户",
  582. 三级: "三级客户",
  583. 区域核心连锁: "区域核心连锁",
  584. NKA客户: "NKA客户",
  585. KA客户: "KA客户",
  586. };
  587. const statusMap = {
  588. 全部: 0,
  589. 待开始: 1,
  590. 进行中: 2,
  591. 已完成: 3,
  592. };
  593. export default {
  594. components: {
  595. EmptyView,
  596. },
  597. data() {
  598. return {
  599. keyword: "",
  600. totalCount: 0,
  601. loading: true,
  602. hasmore: true,
  603. fetchLoading: false,
  604. pageNum: 1,
  605. pageSize: 10,
  606. list: [],
  607. listViewHeight: "400px",
  608. createModalOpen: false,
  609. form: {
  610. region: { regionName: "" },
  611. customerType: "",
  612. customer: [],
  613. product: { physicName: "" },
  614. pkgSpec: "",
  615. prepnSpec: "",
  616. otherCustomer: "",
  617. otherCustomerCode: "",
  618. },
  619. dateRange: [],
  620. computeTimer: null,
  621. dropdown: {
  622. region: false,
  623. customerType: false,
  624. customer: false,
  625. otherCustomer: false,
  626. product: false,
  627. pkgSpec: false,
  628. prepnSpec: false,
  629. },
  630. options: {
  631. region: [],
  632. customerType: customerTypeOptions,
  633. product: [],
  634. pkgSpec: [],
  635. prepnSpec: [],
  636. status: ["全部", "已完成", "待开始", "进行中"],
  637. },
  638. // dropdown search inputs (create modal)
  639. searchForm: {
  640. region: "",
  641. customerType: "",
  642. product: "",
  643. productMedical: "否",
  644. },
  645. // Pagination state for products
  646. productPage: 0,
  647. productPageSize: 10,
  648. displayProducts: [], // Currently displayed products
  649. // dropdown search inputs (filter modal)
  650. filterSearchForm: {
  651. product: "",
  652. productMedical: "",
  653. },
  654. // Pagination state for filter products
  655. filterProductPage: 0,
  656. filterDisplayProducts: [],
  657. customers: [],
  658. customerPage: 1,
  659. customerPageSize: 10,
  660. customerTotal: null,
  661. customerHasMore: true,
  662. customerLoading: false,
  663. customerDebounceTimer: null,
  664. customerRequestVersion: 0,
  665. taskTitle: "创建任务",
  666. filterModalOpen: false,
  667. filterForm: {
  668. product: { physicName: "" },
  669. status: "全部",
  670. pkgSpec: "",
  671. prepnSpec: "",
  672. },
  673. filterDropdown: { product: false, pkgSpec: false, prepnSpec: false },
  674. filterDateRange: [],
  675. modalType: "",
  676. dropdownUpward: false,
  677. customerSearch: "",
  678. otherCustomerSearch: "",
  679. otherCustomers: [],
  680. otherCustomerLoading: false,
  681. otherCustomerDebounceTimer: null,
  682. currentItem: {},
  683. emailModalOpen: false,
  684. emailForm: {
  685. email: "",
  686. },
  687. emailError: false,
  688. };
  689. },
  690. created() {
  691. const userInfo = uni.getStorageSync("userInfo");
  692. // const staffEmail = userInfo?.ldap || "";
  693. // this.emailForm.email = staffEmail.split("@")[0];
  694. const userEmail = uni.getStorageSync("traceCode_useremail");
  695. this.emailForm.email = userEmail;
  696. console.log("reportExport\index.vue,storage,userInfo", userInfo);
  697. this.initList();
  698. this.getProviceList();
  699. this.getDrugInfoName();
  700. this.fetchList();
  701. try {
  702. uni.onKeyboardHeightChange(({ height }) => {
  703. this.dropdownUpward = height > 0;
  704. });
  705. } catch (e) {}
  706. },
  707. computed: {
  708. taskTitle() {
  709. if (this.modalType === "create") {
  710. return "创建任务";
  711. } else if (this.modalType == "edit") {
  712. return "修改任务";
  713. } else if (this.modalType == "read") {
  714. return "查看任务";
  715. }
  716. },
  717. },
  718. watch: {
  719. "form.customerType"(val) {
  720. this.customerRequestVersion++;
  721. this.customerLoading = false;
  722. this.customerPage = 1;
  723. this.customerTotal = null;
  724. this.customerHasMore = true;
  725. this.customers = [];
  726. if (this.customerDebounceTimer) clearTimeout(this.customerDebounceTimer);
  727. this.getCustomerOptions();
  728. },
  729. "form.region": {
  730. handler() {
  731. this.customerRequestVersion++;
  732. this.customerLoading = false;
  733. this.customerPage = 1;
  734. this.customerTotal = null;
  735. this.customerHasMore = true;
  736. this.customers = [];
  737. if (this.customerDebounceTimer) clearTimeout(this.customerDebounceTimer);
  738. this.getCustomerOptions();
  739. },
  740. deep: true,
  741. },
  742. "emailForm.email": {
  743. handler(newVal, oldVal) {
  744. if (!oldVal && !newVal && newVal !== oldVal) {
  745. this.emailError = false;
  746. } else {
  747. this.emailError = !newVal;
  748. }
  749. },
  750. deep: true,
  751. },
  752. "filterForm.status"(val) {
  753. this.resetFetch();
  754. },
  755. },
  756. methods: {
  757. getCustomerName(data = {}) {
  758. const { customerName = "", otherCustomer = "" } = data;
  759. let name = customerName || "";
  760. if (otherCustomer) {
  761. if (name) {
  762. name += `,${otherCustomer}`;
  763. } else {
  764. name = otherCustomer;
  765. }
  766. }
  767. const arr = name?.split(",");
  768. if (arr.length == 0) return "--";
  769. return arr.length == 1 ? arr[0].trim() : `${arr[0].trim()}等${arr.length - 1}家公司`;
  770. },
  771. formatDate(date) {
  772. return formatDate({ date }, "YYYY-MM-DD");
  773. },
  774. normalizeDateToYMD(value) {
  775. if (!value) return "";
  776. if (typeof value === "string") {
  777. const trimmed = value.trim();
  778. if (trimmed.length >= 10) return trimmed.slice(0, 10);
  779. return trimmed;
  780. }
  781. return this.formatDate(value);
  782. },
  783. getPrepnSpecText(prepnSpec) {
  784. return this.normalizeSpecOptions(prepnSpec).join(",");
  785. },
  786. getStatusText(status) {
  787. if (status == "1") {
  788. return "导出待开始";
  789. } else if (status == "2") {
  790. return "导出进行中";
  791. } else if (status == "3" || status == "4") {
  792. return "导出已完成";
  793. }
  794. return "未知状态";
  795. },
  796. getDrugInfoName() {
  797. request("/bills/getDrugInfoName", {
  798. path: "/reportExport/index.vue",
  799. }).then((res) => {
  800. if (res.code == 200) {
  801. const _data = Array.isArray(res.data) ? res.data : [];
  802. this.options.product = _data;
  803. if (this.form?.product?.drugEntBaseInfoId || this.form?.product?.physicName) {
  804. this.setPrepnSpecOptions(this.form.product);
  805. }
  806. }
  807. });
  808. },
  809. normalizeSpecOptions(list) {
  810. const rawList = Array.isArray(list) ? list : list ? [list] : [];
  811. const values = rawList
  812. .map((item) => {
  813. if (typeof item === "string" || typeof item === "number") return String(item);
  814. if (item && typeof item === "object") {
  815. return item.prepnSpec || item.prepnSpecName || item.pkgSpec || item.pkgSpecName || item.specName || item.name || item.value || "";
  816. }
  817. return "";
  818. })
  819. .map((item) => String(item || "").trim())
  820. .filter(Boolean);
  821. return Array.from(new Set(values));
  822. },
  823. resolveProductOption(product = {}) {
  824. const productId = product?.drugEntBaseInfoId;
  825. const productName = product?.physicName;
  826. return (
  827. (this.options.product || []).find((item) => {
  828. const idMatched = productId && String(item?.drugEntBaseInfoId) === String(productId);
  829. const nameMatched = productName && item?.physicName === productName;
  830. return idMatched || nameMatched;
  831. }) ||
  832. product ||
  833. {}
  834. );
  835. },
  836. setPrepnSpecOptions(product) {
  837. const selectedProduct = this.resolveProductOption(product);
  838. this.options.prepnSpec = this.normalizeSpecOptions(selectedProduct?.prepnSpec);
  839. },
  840. getGuigeList(physicName) {
  841. if (!physicName) {
  842. this.options.pkgSpec = [];
  843. return;
  844. }
  845. request("/report/getDrugSpec", {
  846. physicName,
  847. path: "/reportExport/index.vue",
  848. }).then((res) => {
  849. if (res.code == 200) {
  850. this.options.pkgSpec = res.data || [];
  851. }
  852. });
  853. },
  854. getProviceList() {
  855. request("/common/getProviceList", {
  856. path: "/reportExport/index.vue",
  857. }).then((res) => {
  858. if (res.code == 200) {
  859. const _data = res.data;
  860. this.options.region = _data;
  861. }
  862. });
  863. },
  864. getCustomerOptions() {
  865. if (!this.customerHasMore || this.customerLoading) return;
  866. const isMedical = this.searchForm.productMedical === "是";
  867. if (!isMedical && !this.form.customerType) {
  868. this.customers = [];
  869. this.customerHasMore = false;
  870. return;
  871. }
  872. this.customerLoading = true;
  873. const requestVersion = this.customerRequestVersion;
  874. const params = {
  875. pageNum: this.customerPage,
  876. pageSize: this.customerPageSize,
  877. customerName: this.customerSearch || "",
  878. provinceCode: this.form?.region?.regionCode || undefined,
  879. path: "/reportExport/index.vue",
  880. };
  881. if (isMedical) {
  882. params.medicalFlag = "医疗";
  883. } else {
  884. params.customerLevel = customerTypeMap?.[this.form.customerType] || undefined;
  885. }
  886. request("/customer/info/getCustomerInfo", params).then((res) => {
  887. if (requestVersion !== this.customerRequestVersion) return;
  888. if (res.code == 200) {
  889. const _data = res.data || {};
  890. this.customerTotal = _data.total || 0;
  891. const list = Array.isArray(_data.list) ? _data.list : [];
  892. this.customers = [...this.customers, ...list];
  893. if (this.customers.length >= this.customerTotal) {
  894. this.customerHasMore = false;
  895. } else {
  896. this.customerPage++;
  897. this.customerHasMore = true;
  898. }
  899. }
  900. this.customerLoading = false;
  901. });
  902. },
  903. getOtherCustomerOptions() {
  904. const keyword = String(this.otherCustomerSearch || "").trim();
  905. if (!keyword) {
  906. if (!keyword) this.otherCustomers = [];
  907. return;
  908. }
  909. this.otherCustomerLoading = true;
  910. request(
  911. "/report/getEntName?entName=" + encodeURIComponent(keyword),
  912. {
  913. entName: keyword,
  914. path: "/reportExport/index.vue",
  915. },
  916. "get",
  917. ).then((res) => {
  918. if (res.code == 200) {
  919. const raw = Array.isArray(res.data) ? res.data : Array.isArray(res.data?.list) ? res.data.list : [];
  920. const names = raw
  921. .map((item) => (typeof item === "string" ? item : item?.entName || item?.customerName || ""))
  922. .map((name) => String(name || "").trim())
  923. .filter(Boolean);
  924. this.otherCustomers = Array.from(new Set(names));
  925. } else {
  926. this.otherCustomers = [];
  927. }
  928. this.otherCustomerLoading = false;
  929. });
  930. },
  931. initList() {
  932. const info = uni.getSystemInfoSync();
  933. const h = info.windowHeight || 800;
  934. this.listViewHeight = Math.max(0, h - 280) + "px";
  935. // this.list = this.genItems(Math.min(10, this.totalCount));
  936. // this.animateAll();
  937. },
  938. onFilter() {
  939. this.filterModalOpen = true;
  940. },
  941. showModal(item = {}) {
  942. const map = {
  943. 1: "edit",
  944. 2: "read",
  945. 3: "read",
  946. };
  947. this.modalType = map[item?.status] || "create";
  948. if (this.modalType === "create") {
  949. this.taskTitle = "创建任务";
  950. } else {
  951. if (this.modalType == "edit") {
  952. this.taskTitle = "修改任务";
  953. } else if (this.modalType == "read") {
  954. this.taskTitle = "查看任务";
  955. }
  956. const cNames = item.customerName ? item.customerName.split(",") : [];
  957. const cCodes = item.customerId ? String(item.customerId).split(",") : [];
  958. const regionCode = item.regionCode || item.provinceCode || "";
  959. let regionName = item.regionName || item.provinceName || "";
  960. if (!regionName && regionCode && Array.isArray(this.options.region)) {
  961. const regionItem = this.options.region.find((r) => r.regionCode === regionCode || r.provinceCode === regionCode);
  962. if (regionItem) {
  963. regionName = regionItem.regionName || regionItem.name || "";
  964. }
  965. }
  966. let customerTypeLabel = "";
  967. const cType = item.customerType;
  968. if (cType === 1 || cType === "1") {
  969. customerTypeLabel = "VIP客户";
  970. } else if (cType === 2 || cType === "2") {
  971. customerTypeLabel = "二级客户";
  972. } else if (cType === 3 || cType === "3") {
  973. customerTypeLabel = "三级客户";
  974. } else if (typeof cType === "string" && cType) {
  975. customerTypeLabel = customerTypeReverseMap[cType] || cType;
  976. }
  977. this.form = {
  978. customer: cCodes.map((i, index) => ({
  979. customerName: cNames[index],
  980. customerCode: i,
  981. })),
  982. region: {
  983. regionCode,
  984. regionName,
  985. },
  986. customerType: customerTypeLabel,
  987. product: {
  988. physicName: item.physicName,
  989. drugEntBaseInfoId: item.drugEntBaseInfoId,
  990. },
  991. pkgSpec: item?.pkgSpec || "",
  992. prepnSpec: item?.prepnSpec || "",
  993. otherCustomer: item?.otherCustomer || "",
  994. otherCustomerCode: item?.otherCustomerCode || "",
  995. };
  996. if (item.physicName) {
  997. this.getGuigeList(item.physicName);
  998. }
  999. this.setPrepnSpecOptions(this.form.product);
  1000. const selectedProduct = this.resolveProductOption(this.form.product);
  1001. this.searchForm.productMedical = selectedProduct?.isMedical || item?.isMedical || (customerTypeLabel === "医疗" ? "是" : "否");
  1002. this.dateRange = [this.normalizeDateToYMD(item.beginTime), this.normalizeDateToYMD(item.endTime)];
  1003. }
  1004. this.createModalOpen = true;
  1005. this.currentItem = item;
  1006. },
  1007. fetchList() {
  1008. // this.list = [];
  1009. // setTimeout(() => {
  1010. // const n = Math.min(10, this.totalCount || 10);
  1011. // this.list = this.genItems(n);
  1012. // if (!this.totalCount) this.totalCount = this.list.length;
  1013. // this.animateAll();
  1014. // this.fetchLoading = false;
  1015. // }, 1000);
  1016. if (!this.hasmore) {
  1017. setTimeout(() => {
  1018. this.fetchLoading = false;
  1019. this.loading = false;
  1020. }, 500);
  1021. return;
  1022. }
  1023. if (this.fetchLoading) return;
  1024. this.fetchLoading = true;
  1025. request("/report/getReportTaskPage", {
  1026. reportType: 2,
  1027. taskType: statusMap?.[this.filterForm?.status] || "",
  1028. drugEntBaseInfoId: this.filterForm?.product?.drugEntBaseInfoId,
  1029. pkgSpec: this.filterForm?.pkgSpec || "",
  1030. beginTime: this.filterDateRange[0],
  1031. endTime: this.filterDateRange[1],
  1032. customerName: this.keyword || "",
  1033. pageNum: this.pageNum,
  1034. pageSize: this.pageSize,
  1035. path: "reportExport/index.vue",
  1036. }).then((res) => {
  1037. if (res.code == 200) {
  1038. const _data = res.data || {};
  1039. const { list, total } = _data;
  1040. this.totalCount = total || 0;
  1041. const incoming = Array.isArray(list) ? list : [];
  1042. const existingIds = new Set(this.list.map((v) => v?.id));
  1043. const merged = incoming.filter((v) => {
  1044. const id = v?.id;
  1045. return id === undefined ? true : !existingIds.has(id);
  1046. });
  1047. if (merged.length === 0 && incoming.length > 0) {
  1048. this.hasmore = false;
  1049. } else {
  1050. this.list = [...this.list, ...merged];
  1051. }
  1052. if (this.list.length < this.totalCount) {
  1053. this.hasmore = true;
  1054. this.pageNum++;
  1055. } else {
  1056. this.hasmore = false;
  1057. }
  1058. // this.list.push({
  1059. // ...this.list[1],
  1060. // status: 3,
  1061. // });
  1062. // this.list.push({
  1063. // ...this.list[0],
  1064. // finishTime: "2025-12-15",
  1065. // status: 3,
  1066. // });
  1067. // this.animateAll();
  1068. }
  1069. this.fetchLoading = false;
  1070. this.loading = false;
  1071. });
  1072. },
  1073. resetFetch() {
  1074. this.loading = true;
  1075. this.list = [];
  1076. this.pageNum = 1;
  1077. this.hasmore = true;
  1078. this.fetchList();
  1079. },
  1080. toDetail(item) {
  1081. uni.navigateTo({
  1082. url: `/traceCodePackages/traceabilityReport/pages/reportExport/detail/index?id=${item.id}&title=${encodeURIComponent(this.getCustomerName(item))}`,
  1083. });
  1084. },
  1085. onSearch() {
  1086. this.resetFetch();
  1087. },
  1088. onCreate() {
  1089. this.modalType = "create";
  1090. this.taskTitle = "创建任务";
  1091. this.createModalOpen = true;
  1092. },
  1093. closeCreate() {
  1094. this.filterModalOpen = false;
  1095. this.createModalOpen = false;
  1096. this.closeDropdownAll();
  1097. this.form = {
  1098. region: { regionName: "" },
  1099. customerType: "",
  1100. customer: [],
  1101. product: { physicName: "" },
  1102. pkgSpec: "",
  1103. prepnSpec: "",
  1104. otherCustomer: "",
  1105. otherCustomerCode: "",
  1106. };
  1107. this.options.pkgSpec = [];
  1108. this.options.prepnSpec = [];
  1109. this.searchForm = {
  1110. region: "",
  1111. customerType: "",
  1112. product: "",
  1113. productMedical: "否",
  1114. };
  1115. this.otherCustomerSearch = "";
  1116. this.otherCustomers = [];
  1117. this.otherCustomerLoading = false;
  1118. this.customerRequestVersion++;
  1119. this.customerLoading = false;
  1120. if (this.otherCustomerDebounceTimer) {
  1121. clearTimeout(this.otherCustomerDebounceTimer);
  1122. this.otherCustomerDebounceTimer = null;
  1123. }
  1124. this.dateRange = [];
  1125. if (this.computeTimer) {
  1126. clearTimeout(this.computeTimer);
  1127. this.computeTimer = null;
  1128. }
  1129. },
  1130. confirmCreate() {
  1131. let flag = false;
  1132. Object.values(this.dropdown).forEach((v) => {
  1133. if (v) {
  1134. flag = true;
  1135. }
  1136. });
  1137. if (flag) {
  1138. this.closeDropdownAll();
  1139. return;
  1140. }
  1141. if (!this.isFormComplete()) {
  1142. // uni.showToast({ title: "请完整填写任务内容", icon: "none" });
  1143. return;
  1144. }
  1145. // uni.showToast({ title: "已创建", icon: "none" });
  1146. uni.showLoading({
  1147. title: this.modalType === "create" ? "创建中..." : "修改中...",
  1148. });
  1149. const url = this.modalType === "create" ? `/report/save` : `/report/update`;
  1150. const customerId = (this.form?.customer || []).map((v) => v?.customerCode || "").join(",");
  1151. const customerName = (this.form?.customer || []).map((v) => v?.customerName || "").join(",");
  1152. request(url, {
  1153. id: this.modalType === "create" ? undefined : this.currentItem?.id || "",
  1154. reportType: 2,
  1155. regionCode: this.form?.region?.regionCode || "",
  1156. customerType: this.form?.customerType === "医疗" ? "医疗" : customerTypeMap?.[this.form?.customerType] || "",
  1157. customerId,
  1158. customerName,
  1159. otherCustomer: this.form?.otherCustomer || "",
  1160. otherCustomerCode: this.form?.otherCustomerCode || "",
  1161. drugEntBaseInfoId: this.form?.product?.drugEntBaseInfoId || "",
  1162. pkgSpec: this.form?.pkgSpec || "",
  1163. prepnSpec: this.form?.prepnSpec || "",
  1164. physicName: this.form?.product?.physicName || "",
  1165. beginTime: this.formatDate(this.dateRange[0], "YYYY-MM-DD"),
  1166. endTime: this.formatDate(this.dateRange[1], "YYYY-MM-DD"),
  1167. path: "",
  1168. }).then((res) => {
  1169. if (res.code == 200) {
  1170. uni.hideLoading();
  1171. uni.showToast({
  1172. title: this.modalType === "create" ? "已创建" : "已修改",
  1173. icon: "none",
  1174. });
  1175. this.resetFetch();
  1176. this.closeCreate();
  1177. }
  1178. });
  1179. },
  1180. isFormComplete() {
  1181. const f = this.form;
  1182. const drOk = Array.isArray(this.dateRange) && this.dateRange.length === 2 && this.dateRange[0] && this.dateRange[1];
  1183. const hasSelectedCustomer = Array.isArray(f.customer) ? f.customer.length > 0 : !!f.customer;
  1184. const hasOtherCustomer = !!String(f.otherCustomer || "").trim();
  1185. const hasOtherCustomerCode = !!String(f.otherCustomerCode || "").trim();
  1186. const customerOk = hasSelectedCustomer || hasOtherCustomer || hasOtherCustomerCode;
  1187. if (!customerOk) {
  1188. uni.showToast({
  1189. title: "请至少填写客户、其它客户、其它客户信用代码中的一项",
  1190. icon: "none",
  1191. });
  1192. return false;
  1193. }
  1194. if (!f.product?.physicName) {
  1195. uni.showToast({ title: "请选择品种", icon: "none" });
  1196. return false;
  1197. }
  1198. if (!drOk) {
  1199. uni.showToast({ title: "请选择时间范围", icon: "none" });
  1200. return false;
  1201. }
  1202. return true;
  1203. // return (
  1204. // f.region?.regionName &&
  1205. // f.customerType &&
  1206. // customerOk &&
  1207. // f.product?.physicName &&
  1208. // drOk
  1209. // );
  1210. },
  1211. confirmDelete() {
  1212. uni.showModal({
  1213. title: "确认删除吗?",
  1214. success: (res) => {
  1215. if (res.confirm) {
  1216. uni.showLoading();
  1217. request("/report/delete", {
  1218. id: this.currentItem?.id || "",
  1219. path: "reportExport/index.vue",
  1220. }).then((res) => {
  1221. uni.hideLoading();
  1222. if (res.code == 200) {
  1223. uni.showToast({
  1224. title: "删除成功",
  1225. icon: "none",
  1226. duration: 2000,
  1227. });
  1228. this.resetFetch();
  1229. this.closeCreate();
  1230. } else {
  1231. uni.showToast({
  1232. title: res?.msg || "删除失败",
  1233. icon: "none",
  1234. duration: 2000,
  1235. });
  1236. }
  1237. });
  1238. }
  1239. },
  1240. });
  1241. },
  1242. onInput(k) {
  1243. this.closeDropdownAll();
  1244. this.dropdown[k] = true;
  1245. if (k === "customer") {
  1246. this.customerRequestVersion++;
  1247. this.customerLoading = false;
  1248. this.customerPage = 1;
  1249. this.customerTotal = null;
  1250. this.customerHasMore = true;
  1251. this.customers = [];
  1252. if (this.customerDebounceTimer) clearTimeout(this.customerDebounceTimer);
  1253. this.customerDebounceTimer = setTimeout(() => {
  1254. this.getCustomerOptions();
  1255. }, 500);
  1256. return;
  1257. }
  1258. if (k === "product") {
  1259. this.initProductList("create");
  1260. return;
  1261. }
  1262. if (k === "otherCustomer") {
  1263. const keyword = String(this.otherCustomerSearch || "").trim();
  1264. if (!keyword) {
  1265. this.otherCustomers = [];
  1266. this.otherCustomerLoading = false;
  1267. if (this.otherCustomerDebounceTimer) {
  1268. clearTimeout(this.otherCustomerDebounceTimer);
  1269. this.otherCustomerDebounceTimer = null;
  1270. }
  1271. return;
  1272. }
  1273. // 输入后先进入 loading,避免先闪“未查找到该客户”
  1274. this.otherCustomerLoading = true;
  1275. if (this.otherCustomerDebounceTimer) clearTimeout(this.otherCustomerDebounceTimer);
  1276. this.otherCustomerDebounceTimer = setTimeout(() => {
  1277. this.getOtherCustomerOptions();
  1278. }, 500);
  1279. }
  1280. },
  1281. closeDropdownAll() {
  1282. this.dropdown = {
  1283. region: false,
  1284. customerType: false,
  1285. customer: false,
  1286. otherCustomer: false,
  1287. product: false,
  1288. pkgSpec: false,
  1289. prepnSpec: false,
  1290. };
  1291. this.filterDropdown.product = false;
  1292. this.filterDropdown.pkgSpec = false;
  1293. this.filterDropdown.prepnSpec = false;
  1294. },
  1295. openFilterDropdown(k) {
  1296. this.closeDropdownAll();
  1297. this.filterDropdown[k] = true;
  1298. if (k === "product") {
  1299. this.initProductList("filter");
  1300. }
  1301. },
  1302. toggleFilterDropdown(k) {
  1303. this.filterDropdown[k] = !this.filterDropdown[k];
  1304. },
  1305. onFilterInput(k) {
  1306. this.closeDropdownAll();
  1307. this.filterDropdown[k] = true;
  1308. if (k === "product") {
  1309. this.initProductList("filter");
  1310. }
  1311. },
  1312. pickFilterOption(k, v) {
  1313. if (!["status"].includes(k) && this.filterForm[k] === v) {
  1314. this.filterForm[k] = "";
  1315. this.filterDropdown[k] = false;
  1316. return;
  1317. }
  1318. this.filterForm[k] = v;
  1319. if (k === "product") {
  1320. this.filterForm.pkgSpec = "";
  1321. this.filterForm.prepnSpec = "";
  1322. this.getGuigeList(v.physicName);
  1323. }
  1324. this.filterDropdown[k] = false;
  1325. },
  1326. filteredFilterOptions(k) {
  1327. const arr = k === "product" ? this.products || [] : [];
  1328. const q = String(this.filterForm[k] || "").trim();
  1329. if (!q) return arr;
  1330. return arr.filter((it) => it.indexOf(q) !== -1);
  1331. },
  1332. onFilterDateChange() {},
  1333. confirmFilter() {
  1334. this.filterModalOpen = false;
  1335. this.resetFetch();
  1336. },
  1337. resetFilter() {
  1338. this.filterForm = {
  1339. product: { physicName: "" },
  1340. status: "全部",
  1341. pkgSpec: "",
  1342. prepnSpec: "",
  1343. };
  1344. this.filterSearchForm = {
  1345. product: "",
  1346. productMedical: "",
  1347. };
  1348. this.filterProductPage = 0;
  1349. this.filterDisplayProducts = [];
  1350. this.filterDropdown = { product: false, pkgSpec: false, prepnSpec: false };
  1351. this.filterDateRange = [];
  1352. this.resetFetch();
  1353. },
  1354. openDropdown(k) {
  1355. this.closeDropdownAll();
  1356. this.dropdown[k] = true;
  1357. if (k === "customer") {
  1358. if (!this.customers || this.customers.length === 0) {
  1359. this.customerPage = 1;
  1360. this.customerTotal = null;
  1361. this.customerHasMore = true;
  1362. this.getCustomerOptions();
  1363. }
  1364. }
  1365. if (k === "product") {
  1366. this.initProductList("create");
  1367. }
  1368. if (k === "prepnSpec") {
  1369. this.setPrepnSpecOptions(this.form.product);
  1370. }
  1371. if (k === "otherCustomer" && !String(this.otherCustomerSearch || "").trim()) {
  1372. this.otherCustomers = [];
  1373. }
  1374. },
  1375. toggleDropdown(k) {
  1376. this.dropdown[k] = !this.dropdown[k];
  1377. },
  1378. pickOption(k, v) {
  1379. if (k === "customer") {
  1380. if (!Array.isArray(this.form.customer)) this.form.customer = [];
  1381. const idx = this.form.customer.indexOf(v);
  1382. if (idx === -1) {
  1383. this.form.customer.push(v);
  1384. } else {
  1385. this.form.customer.splice(idx, 1);
  1386. }
  1387. return;
  1388. }
  1389. if (k === "otherCustomer") {
  1390. const name = typeof v === "string" ? v : v?.entName || v?.customerName || "";
  1391. const selected = this.getOtherCustomerArray();
  1392. const idx = selected.findIndex((item) => item === name);
  1393. if (idx === -1) {
  1394. selected.push(name);
  1395. } else {
  1396. selected.splice(idx, 1);
  1397. }
  1398. this.form.otherCustomer = selected.join(",");
  1399. return;
  1400. }
  1401. if ((k === "customerType" || k === "region") && this.form[k] !== v) {
  1402. this.form.customer = [];
  1403. this.customerSearch = "";
  1404. }
  1405. this.form[k] = v;
  1406. if (k === "product") {
  1407. this.form.pkgSpec = "";
  1408. this.form.prepnSpec = "";
  1409. this.getGuigeList(v.physicName);
  1410. this.setPrepnSpecOptions(v);
  1411. }
  1412. this.dropdown[k] = false;
  1413. },
  1414. isCustomerSelected(name) {
  1415. const arr = this.form.customer;
  1416. if (!Array.isArray(arr)) return false;
  1417. return arr.some((i) => i.customerName === name);
  1418. },
  1419. removeCustomer(name) {
  1420. if (!Array.isArray(this.form.customer)) return;
  1421. const idx = this.form.customer.findIndex((i) => i.customerName === name);
  1422. if (idx !== -1) this.form.customer.splice(idx, 1);
  1423. },
  1424. clearAllCustomers() {
  1425. this.form.customer = [];
  1426. },
  1427. getOtherCustomerArray() {
  1428. return String(this.form.otherCustomer || "")
  1429. .split(",")
  1430. .map((i) => i.trim())
  1431. .filter(Boolean);
  1432. },
  1433. isOtherCustomerSelected(name) {
  1434. return this.getOtherCustomerArray().includes(name);
  1435. },
  1436. removeOtherCustomer(name) {
  1437. const arr = this.getOtherCustomerArray().filter((i) => i !== name);
  1438. this.form.otherCustomer = arr.join(",");
  1439. },
  1440. clearAllOtherCustomers() {
  1441. this.form.otherCustomer = "";
  1442. },
  1443. filteredOptions(k, type) {
  1444. const arr = this.options[k] || [];
  1445. let q = "";
  1446. let medical = "";
  1447. if (type === "filter") {
  1448. q = this.filterSearchForm[k] || "";
  1449. medical = this.filterSearchForm.productMedical || "";
  1450. } else {
  1451. q = this.searchForm[k] || "";
  1452. medical = this.searchForm.productMedical || "";
  1453. }
  1454. let result = arr;
  1455. if (k === "product" && medical) {
  1456. result = arr.filter((it) => it && typeof it === "object" && it.isMedical === medical);
  1457. }
  1458. q = String(q).trim().toLocaleLowerCase();
  1459. if (!q) return result;
  1460. return result.filter((it) => {
  1461. if (typeof it === "string") return it.toLocaleLowerCase().indexOf(q) !== -1;
  1462. if (it && typeof it === "object") {
  1463. const name = k === "region" ? it.regionName || it.name || "" : it.physicName || it.productName || "";
  1464. return String(name).toLocaleLowerCase().indexOf(q) !== -1;
  1465. }
  1466. return false;
  1467. });
  1468. },
  1469. setProductMedical(value, mode) {
  1470. if (mode === "filter") {
  1471. this.filterSearchForm.productMedical = value;
  1472. this.initProductList("filter");
  1473. } else {
  1474. if (this.searchForm.productMedical !== value) {
  1475. this.form.customerType = value === "是" ? "医疗" : "";
  1476. this.form.customer = [];
  1477. this.customers = [];
  1478. this.customerSearch = "";
  1479. this.customerPage = 1;
  1480. this.customerTotal = null;
  1481. this.customerHasMore = true;
  1482. this.form.product = { physicName: "" };
  1483. this.form.pkgSpec = "";
  1484. this.form.prepnSpec = "";
  1485. this.options.pkgSpec = [];
  1486. this.options.prepnSpec = [];
  1487. this.searchForm.product = "";
  1488. }
  1489. this.searchForm.productMedical = value;
  1490. this.closeDropdownAll();
  1491. this.initProductList("create");
  1492. }
  1493. },
  1494. // Initialize product list for pagination
  1495. initProductList(mode) {
  1496. const allProducts = this.filteredOptions("product", mode === "filter" ? "filter" : undefined);
  1497. const res = getPaginatedList({
  1498. page: 0,
  1499. size: 10,
  1500. initData: allProducts,
  1501. data: [],
  1502. });
  1503. if (mode === "filter") {
  1504. this.filterProductPage = res.page;
  1505. this.filterDisplayProducts = res.data;
  1506. } else {
  1507. this.productPage = res.page;
  1508. this.displayProducts = res.data;
  1509. }
  1510. },
  1511. // Load more products on scroll
  1512. loadMoreProducts(mode) {
  1513. const allProducts = this.filteredOptions("product", mode === "filter" ? "filter" : undefined);
  1514. const isFilter = mode === "filter";
  1515. const currentPage = isFilter ? this.filterProductPage : this.productPage;
  1516. const currentData = isFilter ? this.filterDisplayProducts : this.displayProducts;
  1517. const res = getPaginatedList({
  1518. page: currentPage,
  1519. size: 10,
  1520. initData: allProducts,
  1521. data: currentData,
  1522. });
  1523. if (res.data) {
  1524. if (isFilter) {
  1525. this.filterProductPage = res.page;
  1526. this.filterDisplayProducts = res.data;
  1527. } else {
  1528. this.productPage = res.page;
  1529. this.displayProducts = res.data;
  1530. }
  1531. }
  1532. },
  1533. onSearchFocus() {
  1534. this.dropdownUpward = true;
  1535. },
  1536. onSearchBlur() {
  1537. this.dropdownUpward = false;
  1538. },
  1539. dropdownPosStyle() {
  1540. // if (this.dropdownUpward) {
  1541. // return { bottom: "84rpx" };
  1542. // }
  1543. return { top: "84rpx" };
  1544. },
  1545. openDatePicker() {
  1546. if (this.modalType === "read") return;
  1547. this.$refs.datePicker.show();
  1548. },
  1549. onDateChange(val) {
  1550. const arr = Array.isArray(val) ? val : this.dateRange;
  1551. if (!Array.isArray(arr) || arr.length !== 2) return;
  1552. const startDate = new Date(arr[0].replace(/-/g, "/"));
  1553. const endDate = new Date(arr[1].replace(/-/g, "/"));
  1554. const diff = endDate.getTime() - startDate.getTime();
  1555. const limit = 183 * 24 * 3600 * 1000; // Approx 6 months
  1556. if (diff > limit) {
  1557. uni.showToast({
  1558. title: "时间范围不能超过半年",
  1559. icon: "none",
  1560. });
  1561. this.dateRange = [];
  1562. return;
  1563. }
  1564. this.dateRange = [this.normalizeDateToYMD(arr[0]), this.normalizeDateToYMD(arr[1])];
  1565. },
  1566. onStart(item) {
  1567. uni.showModal({
  1568. title: "是否开始导出报表?",
  1569. success: (res) => {
  1570. if (res.confirm) {
  1571. uni.showLoading();
  1572. request("/report/confirm", {
  1573. id: item?.id || "",
  1574. path: "reportExport/index.vue",
  1575. }).then((res) => {
  1576. uni.hideLoading();
  1577. if (res.code == 200) {
  1578. uni.showToast({
  1579. title: "已开始导出",
  1580. icon: "none",
  1581. duration: 2000,
  1582. });
  1583. this.resetFetch();
  1584. this.closeCreate();
  1585. } else {
  1586. uni.showToast({
  1587. title: res?.msg || "请求失败",
  1588. icon: "none",
  1589. duration: 2000,
  1590. });
  1591. }
  1592. });
  1593. }
  1594. },
  1595. });
  1596. },
  1597. onSend(item) {
  1598. this.currentItem = item;
  1599. this.emailError = false;
  1600. this.emailModalOpen = true;
  1601. },
  1602. closeEmailModal() {
  1603. this.emailModalOpen = false;
  1604. },
  1605. handleSendEmail() {
  1606. const email = String(this.emailForm.email || "").trim();
  1607. if (!email) {
  1608. this.emailError = true;
  1609. return;
  1610. }
  1611. this.closeEmailModal();
  1612. uni.showLoading({
  1613. title: "发送中...",
  1614. });
  1615. const url = "/report/sendemail";
  1616. request(url, {
  1617. taskId: this.currentItem?.id,
  1618. emailAddress: email + "@999.com.cn",
  1619. // emailAddress: "qianxinyu@dotouch.tech",
  1620. path: "reportExport/index.vue",
  1621. }).then((res) => {
  1622. uni.hideLoading();
  1623. if (res.code === 200) {
  1624. uni.showToast({
  1625. title: "发送成功",
  1626. icon: "none",
  1627. duration: 2000,
  1628. });
  1629. } else {
  1630. uni.showToast({
  1631. title: res?.msg || "发送失败",
  1632. icon: "none",
  1633. duration: 2000,
  1634. });
  1635. }
  1636. });
  1637. },
  1638. onScrollToLower() {
  1639. // if (this.isLoading) return;
  1640. // if (this.list.length >= this.totalCount) return;
  1641. // this.isLoading = true;
  1642. // const remain = this.totalCount - this.list.length;
  1643. // const toAdd = Math.min(10, remain);
  1644. // setTimeout(() => {
  1645. // const more = this.genItems(toAdd);
  1646. // this.list = this.list.concat(more);
  1647. // this.animateNew(more);
  1648. // this.isLoading = false;
  1649. // }, 800);
  1650. this.fetchList();
  1651. },
  1652. genItems(n) {
  1653. const res = [];
  1654. const base = this.list.length;
  1655. for (let i = 0; i < n; i++) {
  1656. const idx = base + i + 1;
  1657. const statusIdx = idx % 3;
  1658. const target = [60, 0, 100][statusIdx];
  1659. const sText = ["导出进行中", "导出待开始", "导出已完成"][statusIdx];
  1660. const sClass = ["ing", "wait", "done"][statusIdx];
  1661. const action = ["", "start", "done"][statusIdx];
  1662. res.push({
  1663. title: `第${idx}条公司报表`,
  1664. product: "感冒灵",
  1665. range: "2025-11-27—2025-12-27",
  1666. statusText: sText,
  1667. statusClass: sClass,
  1668. showProgress: statusIdx !== 1,
  1669. progress: 0,
  1670. progressTarget: target,
  1671. action,
  1672. });
  1673. }
  1674. return res;
  1675. },
  1676. // animateAll() {
  1677. // this.list.forEach((it) => this.animateItem(it));
  1678. // },
  1679. // animateNew(arr) {
  1680. // arr.forEach((it) => this.animateItem(it));
  1681. // },
  1682. // animateItem(item) {
  1683. // if (!item.showProgress) return;
  1684. // item.progress = 60;
  1685. // const target = Number(item.progressTarget) || 0;
  1686. // const step = Math.max(1, Math.round(target / 60));
  1687. // const timer = setInterval(() => {
  1688. // item.progress += step;
  1689. // if (item.progress >= target) {
  1690. // item.progress = target;
  1691. // clearInterval(timer);
  1692. // }
  1693. // }, 16);
  1694. // },
  1695. },
  1696. };
  1697. </script>
  1698. <style>
  1699. .report-export-page {
  1700. position: relative;
  1701. box-sizing: border-box;
  1702. /* padding: 170rpx 0 calc(50rpx + env(safe-area-inset-bottom)); */
  1703. padding-top: 290rpx;
  1704. }
  1705. .report-export-search-bar-container {
  1706. position: fixed;
  1707. top: 100rpx;
  1708. left: 0;
  1709. padding: 24rpx 24rpx 16rpx;
  1710. background-color: #f3f6f9;
  1711. z-index: 10;
  1712. box-sizing: border-box;
  1713. width: 100%;
  1714. }
  1715. .report-export-search-bar {
  1716. display: flex;
  1717. align-items: center;
  1718. background: #fff;
  1719. border-radius: 16rpx;
  1720. padding: 16rpx;
  1721. }
  1722. .report-export-search-input-wrap {
  1723. flex: 1;
  1724. position: relative;
  1725. background: #f3f6f9;
  1726. border-radius: 40rpx;
  1727. display: flex;
  1728. align-items: center;
  1729. height: 90rpx;
  1730. padding: 0 12rpx;
  1731. }
  1732. .report-export-search-icon {
  1733. width: 28rpx;
  1734. height: 28rpx;
  1735. margin-left: 16rpx;
  1736. }
  1737. .report-export-search-input {
  1738. flex: 1;
  1739. height: 90rpx;
  1740. padding: 0 16rpx;
  1741. font-size: 28rpx;
  1742. }
  1743. .report-export-search-btn {
  1744. height: 72rpx;
  1745. line-height: 72rpx;
  1746. padding: 0 34rpx;
  1747. border-radius: 36rpx;
  1748. background: #2c69ff;
  1749. color: #fff;
  1750. font-size: 34rpx;
  1751. margin-left: 12rpx;
  1752. }
  1753. .report-export-filter-btn {
  1754. margin-left: 12rpx;
  1755. display: flex;
  1756. flex-direction: column;
  1757. align-items: center;
  1758. justify-content: center;
  1759. }
  1760. .report-export-filter-icon {
  1761. width: 40rpx;
  1762. height: 40rpx;
  1763. }
  1764. .report-export-filter-text {
  1765. margin-top: 8rpx;
  1766. font-size: 24rpx;
  1767. color: #2c69ff;
  1768. }
  1769. .scan-rate-ranges-container {
  1770. position: fixed;
  1771. top: 262rpx;
  1772. left: 0;
  1773. width: 100%;
  1774. height: 120rpx;
  1775. background: #f3f6f9;
  1776. z-index: 6;
  1777. }
  1778. .scan-rate-ranges {
  1779. padding: 0rpx 24rpx 20rpx;
  1780. }
  1781. .scan-rate-ranges-content {
  1782. display: flex;
  1783. background: #fff;
  1784. padding: 20rpx 30rpx;
  1785. border-radius: 16rpx;
  1786. justify-content: space-between;
  1787. }
  1788. .scan-rate-range {
  1789. padding: 12rpx 35rpx;
  1790. border-radius: 5rpx;
  1791. background: rgb(240, 240, 240);
  1792. font-size: 26rpx;
  1793. }
  1794. .scan-rate-range.scan-rate-active {
  1795. background: #2c69ff;
  1796. color: #fff;
  1797. }
  1798. .report-export-list-scroll {
  1799. position: fixed;
  1800. top: 380rpx;
  1801. left: 0;
  1802. box-sizing: border-box;
  1803. width: 100%;
  1804. padding: 0 24rpx;
  1805. padding-bottom: calc(env(safe-area-inset-bottom) + 50rpx);
  1806. box-sizing: border-box;
  1807. }
  1808. .report-export-item-card {
  1809. background: #fff;
  1810. border-radius: 16rpx;
  1811. padding: 24rpx;
  1812. margin-bottom: 16rpx;
  1813. }
  1814. .report-export-item-header {
  1815. width: 100%;
  1816. display: flex;
  1817. align-items: flex-start;
  1818. flex-wrap: wrap;
  1819. }
  1820. .report-export-item-title {
  1821. flex: 1;
  1822. width: 0;
  1823. word-break: break-word;
  1824. margin-right: 20rpx;
  1825. font-size: 38rpx;
  1826. color: #2c69ff;
  1827. display: -webkit-box;
  1828. -webkit-box-orient: vertical;
  1829. -webkit-line-clamp: 2;
  1830. overflow: hidden;
  1831. text-decoration: underline;
  1832. }
  1833. .report-export-status {
  1834. flex-shrink: 0;
  1835. padding: 2rpx 10rpx;
  1836. border-radius: 6rpx;
  1837. font-size: 22rpx;
  1838. border: 1rpx solid transparent;
  1839. }
  1840. .report-export-status.report-export-status-2 {
  1841. background: rgba(103, 194, 58, 0.1);
  1842. border-color: rgba(103, 194, 58, 0.2);
  1843. color: #67c23a;
  1844. }
  1845. .report-export-status.report-export-status-1 {
  1846. background: rgba(136, 136, 136, 0.1);
  1847. border-color: rgba(136, 136, 136, 0.2);
  1848. color: #888;
  1849. }
  1850. .report-export-status.report-export-status-3,
  1851. .report-export-status.report-export-status-4 {
  1852. background: rgba(44, 105, 255, 0.1);
  1853. border-color: rgba(44, 105, 255, 0.2);
  1854. color: #2c69ff;
  1855. }
  1856. .report-export-item-row {
  1857. margin-top: 12rpx;
  1858. font-size: 28rpx;
  1859. color: #999;
  1860. }
  1861. .report-export-progress-wrap {
  1862. margin-top: 20rpx;
  1863. }
  1864. .report-export-progress {
  1865. margin-top: 8rpx;
  1866. height: 32rpx;
  1867. background: #e6ebf5;
  1868. border-radius: 999rpx;
  1869. overflow: hidden;
  1870. position: relative;
  1871. }
  1872. .report-export-progress-fill {
  1873. position: absolute;
  1874. left: 0;
  1875. top: 0;
  1876. height: 100%;
  1877. background: #2c69ff;
  1878. border-radius: 999rpx;
  1879. width: 0;
  1880. transition: width 0.2s linear;
  1881. }
  1882. .report-export-progress-text {
  1883. position: absolute;
  1884. left: 50%;
  1885. top: 50%;
  1886. transform: translate(-50%, -50%);
  1887. font-size: 26rpx;
  1888. color: #fff;
  1889. z-index: 2;
  1890. }
  1891. .report-export-action-row {
  1892. margin-top: 16rpx;
  1893. display: flex;
  1894. align-items: center;
  1895. justify-content: flex-end;
  1896. }
  1897. .report-export-action-btn {
  1898. height: 50rpx;
  1899. line-height: 50rpx;
  1900. padding: 0 28rpx;
  1901. border-radius: 12rpx;
  1902. font-size: 30rpx;
  1903. margin: 0;
  1904. }
  1905. .report-export-action-btn + .report-export-action-btn {
  1906. margin-left: 12rpx;
  1907. }
  1908. .report-export-action-btn.report-export-primary {
  1909. background: #2c69ff;
  1910. color: #fff;
  1911. }
  1912. .report-export-action-btn.report-export-info {
  1913. background: #67c23a;
  1914. color: #fff;
  1915. }
  1916. .report-export-loading-row {
  1917. justify-content: center;
  1918. }
  1919. .report-export-loading-wrapper {
  1920. width: 100%;
  1921. height: 76rpx;
  1922. display: flex;
  1923. align-items: center;
  1924. justify-content: center;
  1925. }
  1926. .report-export-loading-icon {
  1927. width: 40rpx;
  1928. height: 40rpx;
  1929. animation: spin 1s linear infinite;
  1930. }
  1931. @keyframes spin {
  1932. from {
  1933. transform: rotate(0deg);
  1934. }
  1935. to {
  1936. transform: rotate(360deg);
  1937. }
  1938. }
  1939. .report-export-footer {
  1940. position: fixed;
  1941. left: 0;
  1942. right: 0;
  1943. bottom: 0;
  1944. padding: 12rpx 30rpx calc(50rpx + env(safe-area-inset-bottom));
  1945. background: #fff;
  1946. }
  1947. .report-export-footer-btn {
  1948. height: 86rpx;
  1949. border-radius: 999rpx;
  1950. background: #2c69ff;
  1951. color: #fff;
  1952. display: flex;
  1953. align-items: center;
  1954. justify-content: center;
  1955. font-size: 30rpx;
  1956. box-shadow: 0 8rpx 24rpx rgba(44, 105, 255, 0.35);
  1957. }
  1958. .report-export-create-modal-mask {
  1959. position: fixed;
  1960. left: 0;
  1961. right: 0;
  1962. top: 0;
  1963. bottom: 0;
  1964. background: rgba(0, 0, 0, 0.35);
  1965. z-index: 90;
  1966. }
  1967. .report-export-create-modal {
  1968. position: fixed;
  1969. left: 0;
  1970. right: 0;
  1971. bottom: -100%;
  1972. width: 100%;
  1973. background: #fff;
  1974. border-top-left-radius: 45rpx;
  1975. border-top-right-radius: 45rpx;
  1976. z-index: 92;
  1977. box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.12);
  1978. /* transform: translateY(100%); */
  1979. transition: bottom 0.25s ease-out;
  1980. }
  1981. .report-export-create-modal--open {
  1982. /* transform: translateY(0) !important; */
  1983. bottom: 0 !important;
  1984. }
  1985. .report-export-create-modal-title {
  1986. position: relative;
  1987. padding: 28rpx 28rpx 12rpx;
  1988. font-size: 34rpx;
  1989. color: #333;
  1990. text-align: center;
  1991. line-height: 60rpx;
  1992. font-weight: 500;
  1993. }
  1994. .report-export-create-modal-close {
  1995. position: absolute;
  1996. right: 32rpx;
  1997. top: 50%;
  1998. transform: translateY(-50%);
  1999. padding: 10rpx;
  2000. color: #909399;
  2001. font-size: 55rpx;
  2002. line-height: 1;
  2003. }
  2004. .report-export-create-modal-body {
  2005. padding: 0 32rpx 100rpx;
  2006. position: relative;
  2007. }
  2008. .report-export-tips {
  2009. color: #606266;
  2010. font-size: 24rpx;
  2011. }
  2012. .report-export-medical-tabs {
  2013. display: flex;
  2014. position: relative;
  2015. height: 64rpx;
  2016. margin-top: 16rpx;
  2017. padding: 4rpx;
  2018. border-radius: 10rpx;
  2019. background: #f2f3f5;
  2020. overflow: hidden;
  2021. }
  2022. .report-export-medical-tab-indicator {
  2023. position: absolute;
  2024. top: 4rpx;
  2025. bottom: 4rpx;
  2026. left: 4rpx;
  2027. width: calc(50% - 4rpx);
  2028. border-radius: 8rpx;
  2029. background: #2c69ff;
  2030. box-shadow: 0 3rpx 8rpx rgba(44, 105, 255, 0.24);
  2031. transform: translateX(0);
  2032. transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  2033. will-change: transform;
  2034. }
  2035. .report-export-medical-tab-indicator.is-medical {
  2036. transform: translateX(100%);
  2037. }
  2038. .report-export-medical-tab {
  2039. flex: 1;
  2040. position: relative;
  2041. z-index: 1;
  2042. height: 64rpx;
  2043. margin: 0;
  2044. padding: 0;
  2045. border: 0;
  2046. border-radius: 8rpx;
  2047. background: transparent;
  2048. color: #606266;
  2049. font-size: 28rpx;
  2050. line-height: 64rpx;
  2051. transition: color 180ms ease-out, transform 100ms ease-out;
  2052. }
  2053. .report-export-medical-tab::after {
  2054. border: 0;
  2055. }
  2056. .report-export-medical-tab.medical-active {
  2057. color: #fff;
  2058. }
  2059. .report-export-medical-tab:active {
  2060. transform: scale(0.98);
  2061. }
  2062. @media (prefers-reduced-motion: reduce) {
  2063. .report-export-medical-tab-indicator,
  2064. .report-export-medical-tab {
  2065. transition-duration: 0.01ms;
  2066. }
  2067. }
  2068. .report-export-create-modal-row {
  2069. display: flex;
  2070. flex-direction: column;
  2071. margin-top: 32rpx;
  2072. position: relative;
  2073. }
  2074. .report-export-create-modal-label {
  2075. width: auto;
  2076. font-size: 28rpx;
  2077. color: #333;
  2078. margin-bottom: 16rpx;
  2079. font-weight: 500;
  2080. }
  2081. .report-export-create-modal-inputwrap {
  2082. flex: 1;
  2083. position: relative;
  2084. border: 1rpx solid #dcdfe6;
  2085. border-radius: 12rpx;
  2086. display: flex;
  2087. align-items: center;
  2088. min-height: 80rpx;
  2089. padding: 0 24rpx;
  2090. background-color: #fff;
  2091. }
  2092. .report-export-create-modal-static {
  2093. position: relative;
  2094. flex: 1;
  2095. max-height: 115rpx;
  2096. font-size: 28rpx;
  2097. color: #606266;
  2098. line-height: 40rpx;
  2099. padding: 20rpx 0;
  2100. overflow-y: auto;
  2101. padding-right: 20rpx;
  2102. }
  2103. .report-export-input-simulator {
  2104. display: flex;
  2105. justify-content: center;
  2106. align-items: center;
  2107. }
  2108. .report-export-create-modal-input {
  2109. flex: 1;
  2110. height: 80rpx;
  2111. font-size: 28rpx;
  2112. color: #606266;
  2113. }
  2114. .report-export-dropdown-other-customer-input {
  2115. color: #666;
  2116. }
  2117. /* .report-export-create-modal-select-arrow {
  2118. width: 18rpx;
  2119. height: 18rpx;
  2120. border: 5rpx solid #999;
  2121. border-top: none;
  2122. border-left: none;
  2123. transform: rotate(45deg);
  2124. margin: 0 8rpx 10rpx 12rpx;
  2125. }
  2126. .report-export-create-modal-select-arrow.disabled {
  2127. opacity: 0.4;
  2128. pointer-events: none;
  2129. } */
  2130. .report-export-create-modal-dropdown {
  2131. position: absolute;
  2132. left: 0;
  2133. right: 0;
  2134. background: #fff;
  2135. border: 1rpx solid #eef0f4;
  2136. border-radius: 12rpx;
  2137. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
  2138. z-index: 6;
  2139. max-height: 510rpx;
  2140. overflow-y: auto;
  2141. -webkit-overflow-scrolling: touch;
  2142. }
  2143. .report-export-create-modal-dropdown-list {
  2144. max-height: 350rpx;
  2145. }
  2146. .report-export-dropdown-search-row {
  2147. padding: 10rpx;
  2148. }
  2149. .report-export-dropdown-medical-row {
  2150. display: flex;
  2151. flex-direction: row;
  2152. align-items: center;
  2153. gap: 12rpx;
  2154. padding: 8rpx 16rpx;
  2155. }
  2156. .report-export-dropdown-medical-tag {
  2157. padding: 6rpx 18rpx;
  2158. border-radius: 24rpx;
  2159. background: #f2f3f5;
  2160. color: #666;
  2161. font-size: 24rpx;
  2162. }
  2163. .report-export-dropdown-medical-tag.medical-active {
  2164. background: #5497d5;
  2165. color: #fff;
  2166. }
  2167. .report-export-dropdown-search-input {
  2168. width: 100%;
  2169. height: 60rpx;
  2170. border: 1rpx solid #eaeef4;
  2171. border-radius: 8rpx;
  2172. box-sizing: border-box;
  2173. padding: 0 16rpx;
  2174. font-size: 28rpx;
  2175. }
  2176. .report-export-create-modal-dropdown-item {
  2177. padding: 16rpx 20rpx;
  2178. font-size: 28rpx;
  2179. color: #333;
  2180. }
  2181. .report-export-selected {
  2182. background: #f0f5ff;
  2183. }
  2184. .report-export-input-arrow {
  2185. width: 16rpx;
  2186. height: 16rpx;
  2187. border-right: 3rpx solid #c0c4cc;
  2188. border-bottom: 3rpx solid #c0c4cc;
  2189. transform: rotate(45deg);
  2190. margin-top: -6rpx;
  2191. }
  2192. .customer-chip {
  2193. display: inline-block;
  2194. position: relative;
  2195. line-height: 50rpx;
  2196. border: 1rpx solid #eaeef4;
  2197. border-radius: 8rpx;
  2198. padding: 0rpx 44rpx 0rpx 16rpx;
  2199. margin-right: 8rpx;
  2200. margin-bottom: 8rpx;
  2201. font-size: 22rpx;
  2202. color: #333;
  2203. }
  2204. .customer-chip-close {
  2205. position: absolute;
  2206. right: 6rpx;
  2207. top: 0;
  2208. color: #666;
  2209. font-size: 28rpx;
  2210. padding: 0 8rpx;
  2211. border-radius: 6rpx;
  2212. }
  2213. .customer-clear-all {
  2214. position: absolute;
  2215. right: 6rpx;
  2216. top: 50%;
  2217. transform: translateY(-50%);
  2218. line-height: 50rpx;
  2219. padding: 8rpx 10rpx;
  2220. font-size: 40rpx;
  2221. }
  2222. .report-export-create-modal-estimated {
  2223. font-size: 28rpx;
  2224. color: #666;
  2225. }
  2226. .report-export-create-modal-footer {
  2227. padding: 18rpx 28rpx calc(50rpx + env(safe-area-inset-bottom));
  2228. }
  2229. .report-export-create-modal-btn {
  2230. line-height: 90rpx;
  2231. border-radius: 20rpx;
  2232. background: #2c69ff;
  2233. color: #fff;
  2234. text-align: center;
  2235. font-size: 30rpx;
  2236. }
  2237. .report-export-create-email-modal {
  2238. /* transform: translateY(200%); */
  2239. height: 420rpx;
  2240. top: 30%;
  2241. bottom: auto;
  2242. border-radius: 16rpx;
  2243. width: 600rpx;
  2244. left: 75rpx;
  2245. }
  2246. .report-export-email-input-wrap {
  2247. display: flex;
  2248. align-items: center;
  2249. background: #f5f7fa;
  2250. border-radius: 8rpx;
  2251. padding: 0 20rpx;
  2252. height: 80rpx;
  2253. border: 1rpx solid transparent;
  2254. }
  2255. .report-export-input-error {
  2256. border-color: #ff4d4f;
  2257. }
  2258. .report-export-email-input {
  2259. flex: 1;
  2260. font-size: 28rpx;
  2261. color: #333;
  2262. height: 100%;
  2263. }
  2264. .report-export-email-suffix {
  2265. font-size: 28rpx;
  2266. color: #333;
  2267. margin-left: 10rpx;
  2268. }
  2269. .report-export-error-text {
  2270. font-size: 24rpx;
  2271. color: #ff4d4f;
  2272. margin-top: 10rpx;
  2273. display: block;
  2274. }
  2275. .report-export-input-disabled {
  2276. background-color: #f5f7fa;
  2277. cursor: not-allowed;
  2278. opacity: 0.7;
  2279. }
  2280. </style>