leaderIndex.vue 7.2 KB

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