leaderIndex.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 class="leaderIndex_list">
  30. <uni-card v-for="(item,index) in pageData.taskList" padding="10rpx 0">
  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. <text class="list_item">任务编号<text class="list_item_text">{{item.id}}</text></text>
  38. <text class="list_item">组长<text class="list_item_text">{{item.zzName}}</text></text>
  39. <text class="list_item">待质控代煎企业<text class="list_item_text">{{item.bzkOrgName}}</text></text>
  40. <text class="list_item">地址<text class="list_item_text">{{item.address}}</text></text>
  41. <text class="list_item">完成日期<text class="list_item_text">{{item.finishTime}}</text></text>
  42. </view>
  43. <view class="list_button">
  44. <view class="button_group">
  45. <view class="button_item" @click="signTask(item)">签收</view>
  46. <view class="button_item" @click="startTask(item)">开始质控</view>
  47. </view>
  48. </view>
  49. </uni-card>
  50. </view>
  51. <!-- 签收任务/开始质控对话框 -->
  52. <uni-popup ref="operatorDialog" type="dialog">
  53. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  54. </uni-popup>
  55. </view>
  56. </template>
  57. <script setup>
  58. import http from '@/utils/request';
  59. import { ref,reactive } from "vue";
  60. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  61. const pageData=reactive({
  62. // 任务编号
  63. taskId:'',
  64. headImg:'/static/logo.png',
  65. userName:'王军',
  66. taskNum:2,
  67. taskList:[],
  68. // 对话框
  69. popupMessage:{
  70. // 标题
  71. title:'',
  72. // 提示内容
  73. showMessage:''
  74. }
  75. })
  76. const eyeIcon=reactive({
  77. nowIcon:'',
  78. showIcon:'/static/whiteDisplay.png',
  79. hideIcon:'/static/whiteHide.png'
  80. })
  81. const showIcon=reactive({
  82. nowIcon:'',
  83. showIcon:'/static/blackDisplay.png',
  84. hideIcon:'/static/blackHide.png'
  85. })
  86. const statusIcon=reactive({
  87. daiIcon:'/static/dai_icon.png',
  88. wanIcon:'/static/wan_icon.png',
  89. zhiIcon:'/static/zhi_icon.png'
  90. })
  91. // 签收接口输入参数
  92. const signFormData=reactive({
  93. // 任务id
  94. id:''
  95. })
  96. // 开始质控接口输入参数
  97. const startFormData=reactive({
  98. // 任务id
  99. id:''
  100. })
  101. // 定义签收任务/开始质控对话框
  102. const operatorDialog=ref()
  103. // 定义质控提醒对话框
  104. const remindDialog=ref()
  105. // 签收任务/开始质控对话框确定事件
  106. const operatorDialogConfirm=()=>{
  107. if(pageData.popupMessage.title=='开始质控'){
  108. startFormData.id = pageData.taskId
  109. getStartTask()
  110. }else{
  111. signFormData.id=pageData.taskId
  112. getSignTask()
  113. }
  114. operatorDialog._value.close()
  115. }
  116. // 签收任务/开始质控对话框取消事件
  117. const operatorDialogClose=()=>{
  118. operatorDialog._value.close()
  119. }
  120. // 签收接口
  121. const getSignTask=()=>{
  122. http.get("app-api/index/qs",signFormData).then(res=>{
  123. console.log(res)
  124. if(res==true){
  125. uni.showToast({
  126. title:'签收成功',
  127. icon:'success'
  128. })
  129. }else{
  130. uni.showToast({
  131. title:'签收失败',
  132. icon:'error'
  133. })
  134. }
  135. })
  136. }
  137. // 开始质控接口
  138. const getStartTask=()=>{
  139. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  140. console.log(res)
  141. if(res==true){
  142. uni.navigateTo({
  143. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  144. })
  145. }else{
  146. // 提示-只有组长能够开始质控
  147. uni.showModal({
  148. title: '提示',
  149. content: '只有组长能够开始质控',
  150. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  151. showCancel: false,//没有取消按钮的弹框
  152. buttonText: '确定',
  153. success: function (res) {
  154. console.log(res)
  155. }
  156. })
  157. }
  158. })
  159. }
  160. // 切换显示与隐藏
  161. const changeState=(type)=>{
  162. if(type=='header'){
  163. console.log("头部切换")
  164. if(eyeIcon.nowIcon==eyeIcon.hideIcon){
  165. eyeIcon.nowIcon=eyeIcon.showIcon
  166. }else{
  167. eyeIcon.nowIcon=eyeIcon.hideIcon
  168. }
  169. }else if(type=='list'){
  170. console.log("列表切换")
  171. if(showIcon.nowIcon==showIcon.hideIcon){
  172. showIcon.nowIcon=showIcon.showIcon
  173. }else{
  174. showIcon.nowIcon=showIcon.hideIcon
  175. }
  176. }
  177. }
  178. // 跳转到任务详情
  179. const toDetail=()=>{
  180. console.log("跳转到任务详情")
  181. uni.switchTab({
  182. url:'/pages/ypczk/zkTask/zkTaskList'
  183. })
  184. }
  185. // 签收
  186. const signTask=(e)=>{
  187. console.log("签收")
  188. pageData.taskId=e.id
  189. operatorDialog._value.open()
  190. pageData.popupMessage.title='签收'
  191. pageData.popupMessage.showMessage='是否确认签收任务?'
  192. }
  193. // 开始质控
  194. const startTask=(e)=>{
  195. console.log("开始质控")
  196. pageData.taskId=e.id
  197. operatorDialog._value.open()
  198. pageData.popupMessage.title='开始质控'
  199. pageData.popupMessage.showMessage='是否确认开始质控任务?'
  200. }
  201. onPullDownRefresh(()=>{
  202. console.log("下拉刷新")
  203. setTimeout(uni.stopPullDownRefresh(),2000)
  204. })
  205. // 获取任务列表
  206. const getTaskData=()=>{
  207. http.get("app-api/index/findList").then(res=>{
  208. console.log(res)
  209. pageData.taskList=res.data
  210. pageData.taskList.forEach(item=>{
  211. if(item.wcrq1!=null && item.wcrq2!=null){
  212. item.finishTime=item.wcrq1 +' ~ '+item.wcrq2
  213. }
  214. if(item.status=='7003'){
  215. item.taskStatusIcon=statusIcon.daiIcon
  216. }else if(item.status=='7004'){
  217. item.taskStatusIcon=statusIcon.wanIcon
  218. }else{
  219. item.taskStatusIcon=statusIcon.zhiIcon
  220. }
  221. })
  222. console.log(pageData.taskList)
  223. })
  224. }
  225. onShow(()=>{
  226. eyeIcon.nowIcon=eyeIcon.hideIcon
  227. showIcon.nowIcon=showIcon.hideIcon
  228. getTaskData()
  229. })
  230. </script>
  231. <style lang="scss" scoped>
  232. @import 'index.scss';
  233. </style>