leaderIndex.vue 6.6 KB

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