leaderIndex.vue 6.5 KB

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