MedicalList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <el-card class="potential-list-card">
  3. <div class="header-box flex-r-c sb">
  4. <span class="card-title">{{title}}</span>
  5. <div class="flex-r-c center" v-show="!showEmpty">
  6. <div class="link-text" @click="changeSort(0)" :class="{active: listState.sort === 0}">数量倒序</div>
  7. <div class="link-text" @click="changeSort(1)" :class="{active: listState.sort === 1}">金额倒序</div>
  8. </div>
  9. </div>
  10. <div class="info-list" v-loading="listState.loading">
  11. <div
  12. v-for="(item, index) in getListData"
  13. :key="index"
  14. @click="$emit('goDetail', item)">
  15. <div v-show="!item.remove" class="flex-r-c center sb card-list-item">
  16. <div class="flex-c-c left">
  17. <div class="flex-r-c center sb">
  18. <div class="flex-r-c center">
  19. <i class="el-icon-jy-icon-company"></i>
  20. <span class="text--title">{{item.company_name}}</span>
  21. </div>
  22. </div>
  23. <div class="flex-r-c card-bottom-info">
  24. <span class="text--sm-name">项目数量:</span>
  25. <span class="text--sm-value">{{ item.project_count || '--'}}</span>
  26. <span class="text--sm-name">项目总金额:</span>
  27. <span class="text--sm-value">{{ item.project_money || '--'}}</span>
  28. <span class="text--sm-name">所在地:</span>
  29. <span class="text--sm-value" v-if="item.area || item.city">{{item.area}}&nbsp;&nbsp;
  30. {{item.area && item.city && item.area.slice(0,2) !== item.city.slice(0,2) ? item.city : ''}}
  31. </span>
  32. <span class="text--sm-value" v-else>-</span>
  33. </div>
  34. </div>
  35. <div class="pcor-right-group flex-c-c right">
  36. <div class="flex-r-c center" @click.stop="changeClaim(item)">
  37. <i :class="'el-icon-jy-renling' + (item.isClaim ? '-active' : '')"></i>
  38. <span>{{item.isClaim ? '已' : ''}}认领</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <empty v-if="showEmpty" :images="require('@/assets/images/empty/jy-smile.png')">
  44. <div v-if="isAllFirst">
  45. <span></span>
  46. </div>
  47. <div v-else>
  48. <span>暂无匹配信息</span>
  49. </div>
  50. </empty>
  51. </div>
  52. <div class="el-pagination-container" v-if="getShowPagination">
  53. <el-pagination
  54. background
  55. layout="prev, pager, next, slot, jumper"
  56. :hide-on-single-page="true"
  57. :current-page="listState.pageNum"
  58. :page-size="listState.pageSize"
  59. :total="listState.list.length"
  60. @current-change="onPageChange"
  61. >
  62. <em class="page-size-border">{{ listState.pageSize }}条/页</em>
  63. </el-pagination>
  64. </div>
  65. </el-card>
  66. </template>
  67. <script>
  68. import { Pagination, Card, Button, Dialog } from 'element-ui'
  69. import Empty from '@/components/common/Empty.vue'
  70. import { moneyUnit } from '@/utils/'
  71. import { getSearchMedicalList, setInstitutionClaim, institutionUnClaimed } from '@/api/modules/'
  72. export default {
  73. name: 'potential-list',
  74. components: {
  75. [Pagination.name]: Pagination,
  76. [Card.name]: Card,
  77. [Button.name]: Button,
  78. [Dialog.name]: Dialog,
  79. Empty
  80. },
  81. filters: {
  82. formatMoney (value) {
  83. return moneyUnit(value)
  84. }
  85. },
  86. props: {
  87. title: {
  88. type: String,
  89. default: '医疗机构列表'
  90. },
  91. filters: {
  92. type: Object,
  93. default () {
  94. return {}
  95. }
  96. }
  97. },
  98. computed: {
  99. showEmpty () {
  100. return this.listState.list.length === 0 && this.listState.loaded
  101. },
  102. getShowPagination () {
  103. let show = true
  104. if (this.listState.pageNum === 1 && this.listState.list.length < this.listState.pageSize) {
  105. show = false
  106. }
  107. return show
  108. },
  109. getFilters () {
  110. return this.filters
  111. },
  112. getListData () {
  113. return this.listState.list.slice((this.listState.pageNum - 1) * 10, (this.listState.pageNum) * 10)
  114. }
  115. },
  116. data () {
  117. return {
  118. isAllFirst: true,
  119. listState: {
  120. loaded: true, // 是否已经搜索过
  121. loading: false,
  122. pageNum: 1, // 当前页
  123. pageSize: 10, // 每页多少条数据
  124. total: 0, // 一共多少条数据
  125. sort: 0,
  126. list: [] // 查询请求返回的数据
  127. }
  128. }
  129. },
  130. created () {},
  131. methods: {
  132. async changeClaim (item) {
  133. if (item.isClaim) {
  134. // 取消认领
  135. const { error_code: code, error_msg: msg } = await institutionUnClaimed({
  136. ent_id: item.company_id
  137. })
  138. if (code === 0) {
  139. this.$toast('已取消认领')
  140. item.isClaim = false
  141. this.$forceUpdate()
  142. } else {
  143. this.$toast(msg, 2000)
  144. }
  145. } else {
  146. // 认领
  147. const { error_code: code, error_msg: msg } = await setInstitutionClaim({
  148. ent_id: item.company_id,
  149. ent_name: item.company_name
  150. })
  151. if (code === 0) {
  152. this.$toast('认领成功')
  153. item.isClaim = true
  154. this.$forceUpdate()
  155. } else {
  156. if (code === 1013) {
  157. this.$toast('医疗机构认领已达上限')
  158. } else {
  159. this.$toast(msg, 2000)
  160. }
  161. }
  162. }
  163. },
  164. changeSort (i) {
  165. this.listState.sort = i
  166. this.listState.pageNum = 1
  167. this.listState.list = []
  168. this.listState.total = 0
  169. this.getList()
  170. },
  171. // 恢复数据至第一次请求的状态(页码等)
  172. resetListState () {
  173. const state = {
  174. loaded: false,
  175. loading: false,
  176. pageNum: 1,
  177. total: 0,
  178. list: []
  179. }
  180. Object.assign(this.listState, state)
  181. },
  182. doQuery (filters) {
  183. this.resetListState()
  184. this.getList(filters)
  185. },
  186. async getList () {
  187. const query = {
  188. sort: this.listState.sort,
  189. company_name: this.getFilters.name,
  190. area_code: JSON.stringify(this.getFilters.area),
  191. level_code: this.getFilters.level,
  192. mi_type_code: this.getFilters.type,
  193. business_type_code: this.getFilters.nature,
  194. sdequipment_code: this.getFilters.scope
  195. }
  196. if (query && Object.keys(query).length > 0) {
  197. for (const key in query) {
  198. if (key !== 'sort' && !query[key]) {
  199. delete query[key]
  200. }
  201. }
  202. }
  203. this.listState.loading = true
  204. this.listState.loaded = false
  205. // 判断是否无筛选条件
  206. this.isAllFirst = false
  207. const res = await getSearchMedicalList(query)
  208. this.listState.loading = false
  209. this.listState.loaded = true
  210. if (res.error_code === 0) {
  211. this.listState.list = res.data || []
  212. } else {
  213. this.listState.list = []
  214. }
  215. },
  216. onPageChange (p) {
  217. this.listState.pageNum = p
  218. // this.getList()
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. @include diy-icon('edit', 20, 20);
  225. @include diy-icon('icon-company', 24, 24);
  226. @include diy-icon('renling', 18, 18);
  227. @include diy-icon('renling-01', 18, 18);
  228. @include diy-icon('renling-active', 18, 18);
  229. ::v-deep .el-icon-jy-icon-company {
  230. margin-right: 8px;
  231. flex-shrink: 0;
  232. }
  233. // card样式重置
  234. ::v-deep {
  235. .el-card__header {
  236. margin: 0 40px;
  237. padding-left: 0;
  238. padding-right: 0;
  239. }
  240. .el-card__body {
  241. padding: 0 0 20px;
  242. }
  243. .el-dialog__header {
  244. padding: 0;
  245. }
  246. .el-dialog__body {
  247. padding: 0;
  248. }
  249. .empty-container {
  250. margin-top: 60px;
  251. }
  252. .get-more {
  253. display: flex;
  254. .el-icon-arrow-right {
  255. margin-left: 4px;
  256. order: 2;
  257. }
  258. }
  259. .el-pagination__jump{
  260. margin-left: 8px;
  261. }
  262. }
  263. .sub-manager {
  264. display: flex;
  265. align-items: center;
  266. padding: 8px 16px;
  267. font-size: 14px;
  268. line-height: 24px;
  269. color: #1d1d1d;
  270. border-color: #E0E0E0;
  271. &.el-button:focus,
  272. &.el-button:hover {
  273. color: inherit;
  274. background-color: inherit;
  275. }
  276. }
  277. .potential-list-card {
  278. border-radius: 8px;
  279. box-shadow: none!important;
  280. overflow: hidden;
  281. .header-box {
  282. padding: 14px 40px;
  283. border-bottom: 1px solid #ECECEC;
  284. }
  285. .card-title {
  286. position: relative;
  287. line-height: 28px;
  288. color: $color_main;
  289. &::after{
  290. position: absolute;
  291. left: 0;
  292. bottom: -14px;
  293. content: '';
  294. width: 100%;
  295. height: 2px;
  296. background: $color_main;
  297. }
  298. }
  299. .pcor-right-group {
  300. > span {
  301. font-size: 12px;
  302. line-height: 23px;
  303. color: #AAAAAA;
  304. margin-top: 17px;
  305. &:hover {
  306. color: #2CB7CA;
  307. }
  308. }
  309. i + span {
  310. margin-left: 4px;
  311. font-size: 14px;
  312. line-height: 22px;
  313. color: #686868;
  314. white-space: nowrap;
  315. }
  316. &:hover{
  317. .el-icon-jy-renling{
  318. background-image: url('~@/assets/images/icon/renling-01.png');
  319. }
  320. span{
  321. color: #2CB7CA;
  322. }
  323. }
  324. }
  325. .link-text {
  326. font-size: 14px;
  327. line-height: 24px;
  328. text-decoration-line: underline;
  329. color: #1D1D1D;
  330. cursor: pointer;
  331. & + .link-text {
  332. margin-left: 20px;
  333. }
  334. &:hover,&.active {
  335. color: #2CB7CA;
  336. }
  337. }
  338. .text--{
  339. &sm-value {
  340. color: #1D1D1D;
  341. }
  342. &title {
  343. font-size: 16px;
  344. line-height: 24px;
  345. color: #1D1D1D;
  346. }
  347. &sm-time {
  348. font-size: 12px;
  349. line-height: 20px;
  350. color: #999999;
  351. }
  352. }
  353. .card-list-item {
  354. padding: 24px 0;
  355. padding-left: 40px;
  356. padding-right: 40px;
  357. box-sizing: border-box;
  358. box-shadow: inset 0px -1px 0px rgba(0, 0, 0, 0.05);
  359. cursor: pointer;
  360. &:hover {
  361. background: #F7F9FC;
  362. .text--title,
  363. .text--sm-value {
  364. color: #2CB7CA;
  365. }
  366. }
  367. }
  368. .card-bottom-info {
  369. margin-top: 12px;
  370. justify-content: flex-start;
  371. text-align: left;
  372. font-size: 14px;
  373. line-height: 22px;
  374. color: #999999;
  375. .text--sm-value {
  376. margin-right: 40px;
  377. &:last-child {
  378. margin-right: 0;
  379. }
  380. }
  381. }
  382. .sub-manager {
  383. float: right;
  384. }
  385. .info-list {
  386. min-height: 100px;
  387. border-top: 1px solid transparent;
  388. }
  389. .add-key-button {
  390. display: flex;
  391. align-items: center;
  392. justify-content: center;
  393. margin-top: 32px;
  394. padding: 8px 16px;
  395. color: #F7F9FA;
  396. border-radius: 6px;
  397. background-color: #2ABED1;
  398. cursor: pointer;
  399. .icon-chahao {
  400. margin-right: 4px;
  401. transform: rotate(-45deg);
  402. }
  403. .button-text {
  404. margin-left: 4px;
  405. white-space: nowrap;
  406. }
  407. }
  408. .icon-chahao {
  409. position: relative;
  410. display: inline-block;
  411. width: 14px;
  412. height: 14px;
  413. &:before,
  414. &:after {
  415. position: absolute;
  416. content: ''!important;
  417. background-color: #fff;
  418. top: 50%;
  419. left: 50%;
  420. width: 14px;
  421. height: 2px;
  422. border-radius: 2px;
  423. }
  424. &:before {
  425. transform: translate(-50%,-50%) rotate(45deg);
  426. }
  427. &:after {
  428. transform: translate(-50%,-50%) rotate(-45deg);
  429. }
  430. }
  431. .el-pagination-container {
  432. margin-right: 40px;
  433. }
  434. .page-size-border{
  435. display: inline-block;
  436. padding: 0 15px;
  437. height: 28px;
  438. line-height: 28px;
  439. border: 1px solid #ECECEC;
  440. border-radius: 2px;
  441. font-size: 14px;
  442. color: #1D1D1D;
  443. }
  444. }
  445. </style>