leaderIndex.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <!-- 首页-组长 -->
  2. <template>
  3. <view class="view_container leaderIndex">
  4. <!-- 头部 -->
  5. <view class="leaderIndex_header">
  6. <view class="info">
  7. <image :src="pageData.headImg" mode="center" class="headImg"></image>
  8. <text class="userName">{{pageData.userName}}</text>
  9. <!-- <image :src="eyeIcon.nowIcon" class="eyeIcon" @click="changeState('header')"></image> -->
  10. </view>
  11. <view class="slogan">
  12. <image src="/static/slogan_header_img.png" mode="aspectFit" class="slogan_img"></image>
  13. </view>
  14. </view>
  15. <!-- 标题 -->
  16. <view class="leaderIndex_title">
  17. <view class="title_left">
  18. <text>任务列表</text>
  19. <uni-badge class="uni-badge-left-margin" :text="pageData.taskNum" />
  20. </view>
  21. <view class="title_right" @click="toDetail">
  22. <text class="right_text">查看全部</text>
  23. <uni-icons type="right"></uni-icons>
  24. </view>
  25. </view>
  26. <!-- 列表 -->
  27. <view v-if="pageData.taskList.length!=0">
  28. <uni-card :isShadow="false" v-for="(item,index) in pageData.taskList" padding="0" spacing="0" class="leaderIndex_list">
  29. <view @click="showDetail(item)">
  30. <view class="list_title">
  31. <image :src="item.taskStatusIcon" class="statusIcon"></image>
  32. <view>{{item.name}}</view>
  33. <!-- <image :src="showIcon.nowIcon" class="showIcon" @click="changeState('list')"></image> -->
  34. </view>
  35. <view class="list_content">
  36. <view class="list_item">任务编号</view>
  37. <view class="list_item_text">{{item.id}}</view>
  38. </view>
  39. <view class="list_content">
  40. <view class="list_item">组长</view>
  41. <view class="list_item_text">{{item.zzName}}</view>
  42. </view>
  43. <view class="list_content">
  44. <view class="list_item">被质控代煎企业</view>
  45. <view class="list_item_text">{{item.bzkOrgName}}</view>
  46. </view>
  47. <view class="list_content">
  48. <view class="list_item">地址</view>
  49. <view class="list_item_text">{{item.address}}</view>
  50. </view>
  51. <view class="list_content">
  52. <view class="list_item">完成日期</view>
  53. <view class="list_item_text">{{item.finishTime}}</view>
  54. </view>
  55. </view>
  56. <view class="button_group">
  57. <view class="button_sign" @click="signTask(item)">签收</view>
  58. <view class="button_start" @click="startTask(item)">开始质控</view>
  59. </view>
  60. </uni-card>
  61. <!-- 更多点击查看全部 -->
  62. <view class="seeAll" v-if="pageData.taskList.length!=0">
  63. ————— 更多点击查看全部 —————
  64. </view>
  65. </view>
  66. <view v-else class="empty_data">
  67. <image src="@/static/empty_data.png" mode="aspectFit"></image>
  68. </view>
  69. <!-- 签收任务/开始质控对话框 -->
  70. <uni-popup ref="operatorDialog" type="dialog">
  71. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  72. </uni-popup>
  73. </view>
  74. </template>
  75. <script setup>
  76. import http from '@/utils/request';
  77. import {ystabbar} from '@/pages/index/tabShow.js';
  78. import { ref,reactive } from "vue";
  79. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  80. const pageData=reactive({
  81. // 任务编号
  82. taskId:'',
  83. headImg:'/static/header.png',
  84. userName:'',
  85. taskNum:0,
  86. taskList:[],
  87. // 对话框
  88. popupMessage:{
  89. // 标题
  90. title:'',
  91. // 提示内容
  92. showMessage:''
  93. }
  94. })
  95. const eyeIcon=reactive({
  96. nowIcon:'',
  97. showIcon:'/static/whiteDisplay.png',
  98. hideIcon:'/static/whiteHide.png'
  99. })
  100. const showIcon=reactive({
  101. nowIcon:'',
  102. showIcon:'/static/blackDisplay.png',
  103. hideIcon:'/static/blackHide.png'
  104. })
  105. // 质控状态显示的图标
  106. const statusIcon=reactive({
  107. daiIcon:'/static/dai_icon.png',
  108. wanIcon:'/static/wan_icon.png',
  109. zhiIcon:'/static/zhi_icon.png'
  110. })
  111. // 签收接口输入参数
  112. const signFormData=reactive({
  113. // 任务id
  114. taskId:''
  115. })
  116. // 开始质控接口输入参数
  117. const startFormData=reactive({
  118. // 任务id
  119. taskId:''
  120. })
  121. // 定义签收任务/开始质控对话框
  122. const operatorDialog=ref()
  123. // 签收任务/开始质控对话框确定事件
  124. const operatorDialogConfirm=()=>{
  125. if(pageData.popupMessage.title=='开始质控'){
  126. // 开始质控
  127. startFormData.taskId = pageData.taskId
  128. getStartTask()
  129. }else{
  130. // 签收
  131. signFormData.taskId=pageData.taskId
  132. getSignTask()
  133. }
  134. operatorDialog._value.close()
  135. }
  136. // 签收任务/开始质控对话框取消事件
  137. const operatorDialogClose=()=>{
  138. operatorDialog._value.close()
  139. }
  140. // 签收接口
  141. const getSignTask=()=>{
  142. http.get("app-api/index/qs",signFormData).then(res=>{
  143. if(res==true){
  144. uni.showToast({
  145. title:'签收成功',
  146. icon:'success'
  147. })
  148. }else{
  149. uni.showToast({
  150. title:'重复签收',
  151. icon:'error'
  152. })
  153. }
  154. })
  155. }
  156. // 开始质控接口
  157. const getStartTask=()=>{
  158. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  159. console.log(res)
  160. // 1表示开始质控,-1表示不是组长不能质控,其他表示开始质控失败
  161. if(res==1){
  162. uni.navigateTo({
  163. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  164. })
  165. }else if(res=-1){
  166. // 提示-只有组长能够开始质控
  167. uni.showModal({
  168. title: '提示',
  169. content: '只有组长能够开始质控',
  170. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  171. showCancel: false,//没有取消按钮的弹框
  172. buttonText: '确定'
  173. })
  174. }else{
  175. uni.showToast({
  176. title: '开始质控失败',
  177. icon:'none'
  178. });
  179. }
  180. })
  181. }
  182. // 切换显示与隐藏
  183. const changeState=(type)=>{
  184. if(type=='header'){
  185. console.log("头部切换")
  186. if(eyeIcon.nowIcon==eyeIcon.hideIcon){
  187. eyeIcon.nowIcon=eyeIcon.showIcon
  188. }else{
  189. eyeIcon.nowIcon=eyeIcon.hideIcon
  190. }
  191. }else if(type=='list'){
  192. console.log("列表切换")
  193. if(showIcon.nowIcon==showIcon.hideIcon){
  194. showIcon.nowIcon=showIcon.showIcon
  195. }else{
  196. showIcon.nowIcon=showIcon.hideIcon
  197. }
  198. }
  199. }
  200. // 跳转到任务详情
  201. const toDetail=()=>{
  202. uni.switchTab({
  203. url:'/pages/ypczk/zkTask/zkTaskList'
  204. })
  205. }
  206. // 存入taskData(taskId)
  207. const setTaskId=(id)=>{
  208. uni.setStorageSync("saveTaskId",{taskId:id})
  209. }
  210. const showDetail=(e)=>{
  211. setTaskId(e.id)
  212. uni.navigateTo({
  213. url: '/pages/ypczk/zkTask/zkTaskDetail/detailsList'
  214. });
  215. }
  216. // 签收
  217. const signTask=(e)=>{
  218. pageData.taskId=e.id
  219. operatorDialog._value.open()
  220. pageData.popupMessage.title='签收'
  221. pageData.popupMessage.showMessage='是否确认签收任务?'
  222. }
  223. // 开始质控
  224. const startTask=(e)=>{
  225. pageData.taskId=e.id
  226. if(e.isKszk==false){
  227. operatorDialog._value.open()
  228. pageData.popupMessage.title='开始质控'
  229. pageData.popupMessage.showMessage='是否确认开始质控任务?'
  230. }else{
  231. uni.navigateTo({
  232. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  233. })
  234. }
  235. }
  236. // 获取任务列表
  237. const getTaskData=()=>{
  238. uni.showLoading({
  239. title: '',
  240. mask: true
  241. });
  242. http.get("app-api/index/findList").then(res=>{
  243. uni.hideLoading()
  244. pageData.taskList=res.data
  245. pageData.taskList.forEach(item=>{
  246. if(item.wcrq1!=null && item.wcrq2!=null){
  247. item.finishTime=item.wcrq1 +' ~ '+item.wcrq2
  248. }
  249. if(item.status=='7002'){
  250. // 7002待质控
  251. item.taskStatusIcon=statusIcon.daiIcon
  252. }else if(item.status=='7003'){
  253. // 7003质控中
  254. item.taskStatusIcon=statusIcon.zhiIcon
  255. }else{
  256. item.taskStatusIcon=statusIcon.wanIcon
  257. }
  258. })
  259. })
  260. }
  261. // 获取用户信息
  262. const getUserInfo=()=>{
  263. try{
  264. const value=uni.getStorageSync("userInfo")
  265. pageData.userName = value.nickname
  266. }catch(e){
  267. //TODO handle the exception
  268. }
  269. }
  270. // 获取待质控数量
  271. const getZkNumber=()=>{
  272. http.get("app-api/index/getZkNumber").then(res=>{
  273. pageData.taskNum=res
  274. if(res==0){
  275. uni.removeTabBarBadge({
  276. index:1
  277. })
  278. }else{
  279. uni.setTabBarBadge({
  280. index:1,
  281. text:res.toString()
  282. })
  283. }
  284. })
  285. }
  286. onShow(()=>{
  287. ystabbar()
  288. eyeIcon.nowIcon=eyeIcon.hideIcon
  289. showIcon.nowIcon=showIcon.hideIcon
  290. getUserInfo()
  291. getTaskData()
  292. getZkNumber()
  293. })
  294. onPullDownRefresh(()=>{
  295. getTaskData()
  296. setTimeout(uni.stopPullDownRefresh(),1000)
  297. })
  298. </script>
  299. <style lang="scss" scoped>
  300. @import 'index.scss';
  301. </style>