addrRepairs.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. <template>
  2. <view class="incidentList">
  3. <view class="head">
  4. <view class="tab" :class="{active: tab.value === dataInfo.tabActiveId}" v-for="tab in dataInfo.tabs" :key="tab.id" @click="clickTab(tab.value)">
  5. {{tab.name}}<text v-if="tab.num !== ''">({{tab.num}})</text>
  6. </view>
  7. <!-- <view class="filter" @click="filterClick">
  8. <text class="newicon newicon-shaixuan"></text>
  9. </view> -->
  10. </view>
  11. <view class="body" v-if="dataInfo.list.length">
  12. <view class="body_item" v-for="data in dataInfo.list" :key="data.id" @click="toIncidentDetail(data)">
  13. <view class="body_item_head ellipsis-multiline">
  14. <text :style="priorityStyle(data.priority)">{{data.priority ? data.priority.name + ' ' : ''}}</text>{{data.description}}
  15. </view>
  16. <view class="body_item_content">
  17. <view class="body_item_content_p">
  18. <text class="name ellipsis" v-if="data.repairIncidentType.value === 'dept'">报修科室:{{data.department?data.department.dept:''}}</text>
  19. <text class="name ellipsis" v-if="data.repairIncidentType.value === 'public'">报修类型:{{data.repairIncidentType.name}}</text>
  20. <view class="status" :style="stateStyle(data.state)">{{data.state ? data.state.name : ''}}</view>
  21. </view>
  22. <view class="body_item_content_p" v-if="data.place || data.houseNumber">
  23. <text class="name ellipsis">详细地址:{{data.place ? data.place.building.buildingName : ''}}{{data.place ? data.place.floorName : ''}}<text v-if="data.place && data.place.floorName">层</text> {{data.houseNumber}}</text>
  24. </view>
  25. <!-- <view class="body_item_content_p" v-if="data.overtimeRemark">
  26. <text class="name ellipsis">延期处理:{{data.overtimeRemark}}</text>
  27. </view> -->
  28. <!-- <view class="body_item_content_p">
  29. <text class="name" v-if="data.assigneeName">
  30. 处理人:{{data.assigneeName}}<template v-if="computedSynergetic(data.synergetic)">,{{computedSynergetic(data.synergetic)}}</template>
  31. </text>
  32. <text class="name" v-else-if="data.candidateGroupsName">
  33. 处理组:{{data.candidateGroupsName}}<template v-if="computedSynergetic(data.synergetic)">,{{computedSynergetic(data.synergetic)}}</template>
  34. </text>
  35. <text class="name" v-else>
  36. <template v-if="computedSynergetic(data.synergetic)">,{{computedSynergetic(data.synergetic)}}</template>
  37. </text>
  38. <view class="icon_all">
  39. <text class="mic-filled" v-if="data.callID" @click.stop="attachmentClick(data)"><uni-icons type="mic-filled" :size="22" color="#949494"></uni-icons></text>
  40. <text class="mic-filled" v-if="data.reqRecord" @click.stop="attachmentRequireClick(data)"><uni-icons type="mic-filled" :size="22" color="#949494"></uni-icons></text>
  41. <text class="image-filled" v-if="data.reqAttachment" @click.stop="attachmentClick(data)"><uni-icons type="image-filled" :size="22" color="#949494"></uni-icons></text>
  42. </view>
  43. </view> -->
  44. </view>
  45. <view class="body_item_foot">
  46. <view class="foot_info">
  47. <view class="name" @click.stop="makePhoneCall(data.contactsInformation)">联系电话:{{data.contactsInformation}}<uni-icons type="phone-filled" class="phone-filled" :size="18" :color="primaryColor"></uni-icons></view>
  48. <text class="date">{{formatDate(data.acceptDate, 'MM-dd HH:mm')}}</text>
  49. </view>
  50. <view class="btns">
  51. <button @click.stop="createOrder(data, data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'accept'">生成工单</button>
  52. <button @click.stop="noProcessing( data, data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'accept'">不受理</button>
  53. </view>
  54. </view>
  55. <div class="sign-style">
  56. <view class="img-box" v-if="data.repairIncidentType && data.repairIncidentType.value=='dept'">
  57. <view class="img-url1"></view>
  58. <view class="img-name">科</view>
  59. </view>
  60. <view class="img-box" v-if="data.repairIncidentType && data.repairIncidentType.value=='public'">
  61. <view class="img-url2"></view>
  62. <view class="img-name">公</view>
  63. </view>
  64. </div>
  65. </view>
  66. </view>
  67. <view class="zanwu" v-else>
  68. <text class="newicon newicon-zanwu"></text>
  69. </view>
  70. <IncidentListFilter v-if="dataInfo.isFilter" @cancelEmit="cancelFilter" @confirmEmit="conformFilter" :evt="dataInfo.evtFilter"></IncidentListFilter>
  71. <IncidentAttachment v-if="dataInfo.isAttachment" @knowEmit="knowAttachment" :incidentData="dataInfo.incidentData"></IncidentAttachment>
  72. <RequireAttachment v-if="dataInfo.isRequireAttachment" @knowEmit="knowRequireAttachment" :incidentData="dataInfo.incidentData"></RequireAttachment>
  73. <!-- 不受理 -->
  74. <uni-popup ref="inputDialog" type="dialog">
  75. <uni-popup-dialog ref="inputClose" :before-close="true" mode="input" title="不受理"
  76. placeholder="请输入不受理内容" @close="closeDialog" @confirm="dialogInputConfirm"></uni-popup-dialog>
  77. </uni-popup>
  78. </view>
  79. </template>
  80. <script setup>
  81. import IncidentListFilter from '@/components/IncidentListFilter.vue';
  82. import IncidentAttachment from '@/components/IncidentAttachment.vue';
  83. import RequireAttachment from '@/components/RequireAttachment.vue';
  84. import { startOfDay, endOfDay, format, add } from 'date-fns'
  85. import { ref, reactive, computed } from 'vue'
  86. import { onLoad, onUnload, onHide, onPullDownRefresh, onReachBottom, onTabItemTap } from '@dcloudio/uni-app'
  87. import { api_reject, api_getDictionary, api_incident, api_incident_count, api_incidentTask } from "@/http/api.js"
  88. import { filterFormatDate } from '@/filters/filterFormatDate.js'
  89. import { computedPriorityStyle } from '@/filters/computedPriorityStyle.js'
  90. import { computedStateStyle } from '@/filters/computedStateStyle.js'
  91. import { computedCurrentLogOverTime } from '@/filters/computedCurrentLogOverTime.js'
  92. import { defaultColor } from '@/static/js/theme.js'
  93. import { useSetTitle } from '@/share/useSetTitle.js'
  94. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  95. import { useSetTabbar } from '@/share/useSetTabbar.js'
  96. import { useLoginUserStore } from '@/stores/loginUser'
  97. import { useIncidentNumStore } from '@/stores/incidentNum'
  98. import { useIncidentListSearchStore } from '@/stores/incidentListSearch'
  99. import { useHandlerStore } from '@/stores/handler'
  100. import { useIncidentBuildStore } from '@/stores/incidentBuild'
  101. useSetTitle();
  102. const loginUserStore = useLoginUserStore();
  103. const incidentNumStore = useIncidentNumStore();
  104. const incidentListSearchStore = useIncidentListSearchStore();
  105. const { formatDate } = filterFormatDate();
  106. const { priorityStyle } = computedPriorityStyle();
  107. const { stateStyle } = computedStateStyle();
  108. const { currentLogOverTime } = computedCurrentLogOverTime();
  109. const { makePhoneCall } = useMakePhoneCall();
  110. const { setTabbar } = useSetTabbar();
  111. const handlerStore = useHandlerStore();
  112. const incidentBuildStore = useIncidentBuildStore();
  113. // 主题颜色
  114. const primaryColor = ref(defaultColor)
  115. const assignFlag = ref(false);//指派权限
  116. const qiangdan = ref(false);//接单权限
  117. const showDept = ref(false);//跨科权限
  118. // 判断是否显示接单按钮
  119. const computedReceive = computed(() => (data) => {
  120. let inUser = data.handlingPersonnelUser && data.handlingPersonnelUser.id == loginUserStore.loginUser.user.id;
  121. let inUser2 = data.currentLog.workerId == loginUserStore.loginUser.user.id;
  122. let inGroup = false;
  123. if(loginUserStore.loginUser.user&&loginUserStore.loginUser.user.group){
  124. loginUserStore.loginUser.user.group.forEach(item => {
  125. if(data.currentLog){
  126. if (item.id == data.currentLog.groupId) {
  127. inGroup = true;
  128. }
  129. }
  130. })
  131. }
  132. return data.state.value === 'pending' && (inUser2 || inGroup) && qiangdan.value;
  133. })
  134. // 转换协同人
  135. const computedSynergetic = computed(() => (synergetic) => {
  136. return (synergetic && synergetic.length) ? synergetic.map(v => v.name).join(',') : ''
  137. })
  138. // 数据
  139. const dataInfo = reactive({
  140. tabs: [
  141. {id: 0, name: '全部', value: 'accept,reject', num: ''},
  142. {id: 1, name: '待受理', value: 'accept', num: ''},
  143. {id: 2, name: '不受理', value: 'reject', num: ''},
  144. ],
  145. tabActiveId: 'accept,reject',//当前选择的tab
  146. list: [],//工单列表
  147. idx: 0,//页码
  148. hasMore: true,//是否有更多数据
  149. isFilter: false,//筛选框开关
  150. isAttachment: false,//图片和通话录音开关
  151. isRequireAttachment: false,//报修录音开关
  152. incidentId: undefined,
  153. evtFilter: {
  154. hospital: {},
  155. selected: 'todoingAll',
  156. area: {id: 0, area: '全部'},
  157. category: {id: 0, category: '全部'},
  158. acceptDate: [],
  159. dept: {text: '全部', value: 0},
  160. },//筛选框数据
  161. itemData: null
  162. })
  163. const inputDialog = ref(null);//指派权限
  164. // 工单详情
  165. function toIncidentDetail(data){
  166. uni.navigateTo({
  167. url: `/pages/addrRepairsDetail/addrRepairsDetail?incidentId=${data.id}`
  168. })
  169. }
  170. // 获取tab选项
  171. function getTabs(){
  172. uni.showLoading({
  173. title: "加载中",
  174. mask: true,
  175. });
  176. api_getDictionary({
  177. "type": "list",
  178. "key": "incident_status"
  179. }).then(res => {
  180. uni.hideLoading();
  181. let incidentStatusList = res || [];
  182. let pending = incidentStatusList.find(v => v.value === 'pending');
  183. let handler = incidentStatusList.find(v => v.value === 'handler');
  184. dataInfo.tabs = [{id: 0, name: '全部', value: 'all', num: ''}];
  185. pending && dataInfo.tabs.push({...pending, ...{num: ''}});
  186. handler && dataInfo.tabs.push({...handler, ...{num: ''}});
  187. })
  188. }
  189. // 点击tab
  190. function clickTab(value){
  191. dataInfo.tabActiveId = value;
  192. getList(0);
  193. }
  194. // 点击筛选
  195. function filterClick(){
  196. dataInfo.isFilter = true;
  197. }
  198. // 确认筛选
  199. function conformFilter(evtFilter){
  200. dataInfo.evtFilter = evtFilter;
  201. dataInfo.isFilter = false;
  202. getList(0);
  203. }
  204. // 关闭筛选
  205. function cancelFilter(){
  206. dataInfo.isFilter = false;
  207. }
  208. // 点击图片和录音
  209. function attachmentClick(incidentData){
  210. dataInfo.incidentData = incidentData;
  211. dataInfo.isAttachment = true;
  212. }
  213. // 返回图片和录音
  214. function knowAttachment(){
  215. dataInfo.isAttachment = false;
  216. }
  217. // 点击报修录音
  218. function attachmentRequireClick(incidentData){
  219. dataInfo.incidentData = incidentData;
  220. dataInfo.isRequireAttachment = true;
  221. }
  222. // 返回报修录音
  223. function knowRequireAttachment(){
  224. dataInfo.isRequireAttachment = false;
  225. }
  226. // 生成工单
  227. function createOrder(data, incidentId){
  228. let incidentData = {
  229. branch: data.hosId,
  230. assetDTO: data.assetDTO || undefined,
  231. assetId: data.assetDTO ? data.assetDTO.id : undefined,
  232. department: data.department,
  233. requester: data.requester || undefined,
  234. houseNumber: data.houseNumber,
  235. place: data.place || undefined,
  236. source: data.source.id,
  237. description: data.description,
  238. contacts: data.contacts,
  239. contactsInformation: data.contactsInformation,
  240. AttachmentId: data.id,
  241. reqAttachment: data.reqAttachment || false,
  242. repairIncidentType: data.repairIncidentType,
  243. id: data.id,
  244. state: data.state,
  245. entranceType: 'create',
  246. incidentsign: data.incidentsign,
  247. fromWx: true,
  248. // repairIncidentType: data.repairIncidentType.value
  249. }
  250. incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
  251. uni.navigateTo({
  252. url: `/pages/buildIncident/buildIncident?type=inspection`
  253. })
  254. }
  255. // 不处理
  256. function noProcessing(data, incidentId){
  257. dataInfo.itemData = data
  258. inputDialog.value.open()
  259. }
  260. function closeDialog(){
  261. inputDialog.value.close()
  262. }
  263. // 确认不受理
  264. function dialogInputConfirm(e){
  265. if(e==''){
  266. uni.showToast({
  267. icon: 'none',
  268. title: '请输入不受理内容',
  269. });
  270. return
  271. }
  272. uni.showLoading({
  273. title: "加载中",
  274. mask: true,
  275. });
  276. let postData = {
  277. incident:{
  278. rejectRemark: e,
  279. ...dataInfo.itemData
  280. }
  281. }
  282. api_reject(postData).then(res => {
  283. uni.hideLoading();
  284. if(res.state == 200){
  285. getList(0);
  286. inputDialog.value.close()
  287. uni.showToast({
  288. icon: 'none',
  289. title: '操作成功',
  290. });
  291. }else{
  292. uni.showToast({
  293. icon: 'none',
  294. title: res.msg || '请求数据失败!'
  295. });
  296. }
  297. })
  298. }
  299. // 接单调用方案
  300. function receiveFn(incidentData){
  301. let placeId = null
  302. if(incidentData.place){
  303. placeId = JSON.parse(JSON.stringify(incidentData.place.id))
  304. }
  305. uni.showLoading({
  306. title: "加载中",
  307. mask: true,
  308. });
  309. let postData = {
  310. incident: incidentData,
  311. }
  312. if(placeId){
  313. postData.incident.place = {}
  314. postData.incident.place.id = placeId
  315. }
  316. api_incidentTask('receive', postData).then(res => {
  317. uni.hideLoading();
  318. if(res.state == 200){
  319. getList(0);
  320. uni.showToast({
  321. icon: 'none',
  322. title: '接单成功',
  323. });
  324. }else{
  325. uni.showToast({
  326. icon: 'none',
  327. title: res.msg || '请求数据失败!'
  328. });
  329. }
  330. })
  331. }
  332. // 接单按钮
  333. function receive(incidentData){
  334. uni.showModal({
  335. title: '提示',
  336. content: `您确认要接单吗?`,
  337. confirmColor: defaultColor,
  338. confirmText: '确认',
  339. success: function(res) {
  340. if (res.confirm) {
  341. receiveFn(incidentData);
  342. }
  343. }
  344. });
  345. }
  346. // 获取列表信息
  347. function getList(idx){
  348. uni.showLoading({
  349. title: "加载中",
  350. mask: true,
  351. });
  352. dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
  353. if(dataInfo.idx === 0){
  354. dataInfo.list = [];
  355. }
  356. let postData = {
  357. "idx": dataInfo.idx,
  358. "sum": 10,
  359. "incident": {
  360. "state": {
  361. value: dataInfo.tabActiveId || undefined,
  362. }
  363. }
  364. }
  365. api_incident(postData).then(res => {
  366. uni.hideLoading();
  367. uni.stopPullDownRefresh();
  368. if(res.status == 200){
  369. let list = res.list || [];
  370. if(list.length){
  371. dataInfo.hasMore = true;
  372. dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  373. }else{
  374. dataInfo.hasMore = false;
  375. }
  376. }else{
  377. uni.showToast({
  378. icon: 'none',
  379. title: res.msg || '请求数据失败!'
  380. });
  381. }
  382. })
  383. getCount(postData.incident);
  384. }
  385. // 获取列表数量
  386. function getCount(incident = {}){
  387. let postData = {
  388. wxCount: 'true',
  389. incidentList: [],
  390. }
  391. dataInfo.tabs.forEach(v => {
  392. postData.incidentList = [
  393. {
  394. state:{
  395. value:'accept,reject'
  396. },
  397. queryTask: 'wxCount',
  398. },
  399. {
  400. state:{
  401. value:'accept'
  402. },
  403. queryTask: 'wxCount',
  404. },
  405. {
  406. state:{
  407. value:'reject'
  408. },
  409. queryTask: 'wxCount',
  410. }
  411. ]
  412. })
  413. api_incident_count(postData).then(res => {
  414. if(res.state == 200){
  415. let myData = res.data || [];
  416. dataInfo.tabs.forEach((v, i) => {
  417. v.num = myData[i];
  418. })
  419. }else{
  420. uni.showToast({
  421. icon: 'none',
  422. title: res.msg || '请求数据失败!'
  423. });
  424. }
  425. })
  426. }
  427. // 初始化
  428. function onLoadFn(){
  429. getTabs();
  430. }
  431. onLoad((option) => {
  432. getList(0);
  433. })
  434. onUnload(() => {
  435. dataInfo.isFilter = false;
  436. })
  437. onHide(() => {
  438. dataInfo.isFilter = false;
  439. })
  440. onTabItemTap(e => {
  441. // onLoadFn();
  442. })
  443. onPullDownRefresh(() => {
  444. getList(0);
  445. })
  446. onReachBottom(() => {
  447. dataInfo.idx += 1;
  448. if (dataInfo.hasMore) {
  449. getList(); // 当触底时加载更多数据
  450. }
  451. })
  452. </script>
  453. <style lang="scss" scoped>
  454. page{
  455. height: calc(100vh - var(--window-bottom));
  456. }
  457. .incidentList{
  458. display: flex;
  459. flex-direction: column;
  460. justify-content: space-between;
  461. .head{
  462. height: 88rpx;
  463. display: flex;
  464. position: fixed;
  465. z-index: 99;
  466. width: 100%;
  467. background-color: #fff;
  468. font-size: 30rpx;
  469. .tab{
  470. flex: 1;
  471. display: flex;
  472. justify-content: center;
  473. align-items: center;
  474. border-bottom: 4rpx solid transparent;
  475. &.active{
  476. color: $uni-primary;
  477. border-color: $uni-primary;
  478. }
  479. }
  480. .filter{
  481. width: 84rpx;
  482. display: flex;
  483. justify-content: center;
  484. align-items: center;
  485. .newicon-shaixuan{
  486. font-size: 36rpx;
  487. color: #2C2C2C;
  488. }
  489. }
  490. }
  491. .body{
  492. margin-bottom: var(--window-bottom);
  493. margin-top: 88rpx;
  494. border-top: 6rpx solid #EBEBEB;
  495. .body_item{
  496. background: #fff;
  497. border-bottom: 8rpx solid #EBEBEB;
  498. position: relative;
  499. .sign-style{
  500. position: absolute;
  501. right: 0;
  502. top: 0rpx;
  503. .img-box{
  504. position: relative;
  505. .img-url1{
  506. width: 70rpx;
  507. height: 70rpx;
  508. background-image: url('../../static/img/jiaobiao1.png');
  509. }
  510. .img-url2{
  511. width: 70rpx;
  512. height: 70rpx;
  513. background-image: url('../../static/img/jiaobiao2.png');
  514. }
  515. .img-name{
  516. position: absolute;
  517. right: 8rpx;
  518. top: 0;
  519. color: #fff;
  520. font-size: 24rpx;
  521. }
  522. }
  523. }
  524. .body_item_head{
  525. word-break: break-all;
  526. text-align: justify;
  527. text-align: left;
  528. padding: 24rpx;
  529. font-size: 30rpx;
  530. }
  531. .body_item_content{
  532. border-top: 1rpx solid #D8D8D8;
  533. padding: 24rpx 24rpx 24rpx 48rpx;
  534. .body_item_content_p{
  535. color: #6A6A6A;
  536. font-size: 26rpx;
  537. display: flex;
  538. justify-content: space-between;
  539. align-items: center;
  540. margin-bottom: 24rpx;
  541. &:last-of-type{
  542. margin-bottom: 0;
  543. }
  544. .name{
  545. flex: 1;
  546. }
  547. .status{
  548. padding: 4rpx 10rpx;
  549. border-radius: 20rpx;
  550. background-color: #DBE8FE;
  551. font-size: 22rpx;
  552. color: #006CF9;
  553. }
  554. .icon_all{
  555. .mic-filled,
  556. .image-filled
  557. {
  558. margin-left: 16rpx;
  559. }
  560. }
  561. }
  562. }
  563. .body_item_foot{
  564. border-top: 1rpx solid #D8D8D8;
  565. font-size: 26rpx;
  566. padding: 24rpx;
  567. .foot_info{
  568. display: flex;
  569. justify-content: space-between;
  570. align-items: center;
  571. .phone-filled{
  572. margin-left: 5rpx;
  573. }
  574. }
  575. }
  576. }
  577. }
  578. .zanwu{
  579. box-sizing: border-box;
  580. margin-bottom: var(--window-bottom);
  581. margin-top: 88rpx;
  582. border-top: 6rpx solid #EBEBEB;
  583. height: calc(100vh - var(--window-bottom) - 88rpx);
  584. display: flex;
  585. justify-content: center;
  586. background-color: #F7F7F7;
  587. .newicon-zanwu{
  588. font-size: 256rpx;
  589. color: #D6D6D6;
  590. margin-top: 140rpx;
  591. }
  592. }
  593. }
  594. </style>