leaderIndex.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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 is-shadow="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. console.log(res)
  144. if(res==true){
  145. uni.showToast({
  146. title:'签收成功',
  147. icon:'success'
  148. })
  149. }else{
  150. uni.showToast({
  151. title:'重复签收',
  152. icon:'error'
  153. })
  154. }
  155. })
  156. }
  157. // 开始质控接口
  158. const getStartTask=()=>{
  159. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  160. console.log(res)
  161. // 1表示开始质控,-1表示不是组长不能质控,其他表示开始质控失败
  162. if(res==1){
  163. uni.navigateTo({
  164. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  165. })
  166. }else if(res=-1){
  167. // 提示-只有组长能够开始质控
  168. uni.showModal({
  169. title: '提示',
  170. content: '只有组长能够开始质控',
  171. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  172. showCancel: false,//没有取消按钮的弹框
  173. buttonText: '确定'
  174. })
  175. }else{
  176. uni.showToast({
  177. title: '开始质控失败',
  178. icon:'none'
  179. });
  180. }
  181. })
  182. }
  183. // 切换显示与隐藏
  184. const changeState=(type)=>{
  185. if(type=='header'){
  186. console.log("头部切换")
  187. if(eyeIcon.nowIcon==eyeIcon.hideIcon){
  188. eyeIcon.nowIcon=eyeIcon.showIcon
  189. }else{
  190. eyeIcon.nowIcon=eyeIcon.hideIcon
  191. }
  192. }else if(type=='list'){
  193. console.log("列表切换")
  194. if(showIcon.nowIcon==showIcon.hideIcon){
  195. showIcon.nowIcon=showIcon.showIcon
  196. }else{
  197. showIcon.nowIcon=showIcon.hideIcon
  198. }
  199. }
  200. }
  201. // 跳转到任务详情
  202. const toDetail=()=>{
  203. uni.switchTab({
  204. url:'/pages/ypczk/zkTask/zkTaskList'
  205. })
  206. }
  207. // 存入taskData(taskId)
  208. const setTaskId=(id)=>{
  209. uni.setStorageSync("saveTaskId",{taskId:id})
  210. }
  211. const showDetail=(e)=>{
  212. setTaskId(e.id)
  213. uni.navigateTo({
  214. url: '/pages/ypczk/zkTask/zkTaskDetail/detailsList'
  215. });
  216. }
  217. // 签收
  218. const signTask=(e)=>{
  219. pageData.taskId=e.id
  220. operatorDialog._value.open()
  221. pageData.popupMessage.title='签收'
  222. pageData.popupMessage.showMessage='是否确认签收任务?'
  223. }
  224. // 开始质控
  225. const startTask=(e)=>{
  226. pageData.taskId=e.id
  227. if(e.isKszk==false){
  228. operatorDialog._value.open()
  229. pageData.popupMessage.title='开始质控'
  230. pageData.popupMessage.showMessage='是否确认开始质控任务?'
  231. }else{
  232. uni.navigateTo({
  233. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  234. })
  235. }
  236. }
  237. // 获取任务列表
  238. const getTaskData=()=>{
  239. uni.showLoading({
  240. title: '',
  241. mask: true
  242. });
  243. http.get("app-api/index/findList").then(res=>{
  244. uni.hideLoading()
  245. console.log(res)
  246. pageData.taskList=res.data
  247. pageData.taskList.forEach(item=>{
  248. if(item.wcrq1!=null && item.wcrq2!=null){
  249. item.finishTime=item.wcrq1 +' ~ '+item.wcrq2
  250. }
  251. if(item.status=='7002'){
  252. // 7002待质控
  253. item.taskStatusIcon=statusIcon.daiIcon
  254. }else if(item.status=='7003'){
  255. // 7003质控中
  256. item.taskStatusIcon=statusIcon.zhiIcon
  257. }else{
  258. item.taskStatusIcon=statusIcon.wanIcon
  259. }
  260. })
  261. })
  262. }
  263. // 获取用户信息
  264. const getUserInfo=()=>{
  265. try{
  266. const value=uni.getStorageSync("userInfo")
  267. console.log(value);
  268. pageData.userName = value.nickname
  269. }catch(e){
  270. //TODO handle the exception
  271. }
  272. }
  273. // 获取待质控数量
  274. const getZkNumber=()=>{
  275. http.get("app-api/index/getZkNumber").then(res=>{
  276. pageData.taskNum=res
  277. if(res==0){
  278. uni.removeTabBarBadge({
  279. index:1
  280. })
  281. }else{
  282. uni.setTabBarBadge({
  283. index:1,
  284. text:res.toString()
  285. })
  286. }
  287. })
  288. }
  289. onShow(()=>{
  290. ystabbar()
  291. eyeIcon.nowIcon=eyeIcon.hideIcon
  292. showIcon.nowIcon=showIcon.hideIcon
  293. getUserInfo()
  294. getTaskData()
  295. getZkNumber()
  296. })
  297. onPullDownRefresh(()=>{
  298. getTaskData()
  299. setTimeout(uni.stopPullDownRefresh(),1000)
  300. })
  301. </script>
  302. <style lang="scss" scoped>
  303. @import 'index.scss';
  304. </style>