zkTaskList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="zkTaskList" ref="zktaskList">
  3. <custom-tabs type="zkTaskListViewRef" :value="pageInfo.current" :fixed="true" :activeTextStyle="{color:'rgba(190, 163, 117, 1)'}" :activeLineStyle="{'background-color':'rgba(190, 163, 117, 1)',height:'6rpx'}" @change="changeIndex">
  4. <!-- 所有 -->
  5. <custom-tab-pane label="所有" name="zkTaskListViewRef_1">
  6. <ZkTaskListView ref="zkTaskListViewRef_1" style="height: 100%;"></ZkTaskListView>
  7. </custom-tab-pane>
  8. <!-- 待质控 -->
  9. <custom-tab-pane label="待质控" name="zkTaskListViewRef_2">
  10. <ZkTaskListView ref="zkTaskListViewRef_2" state="7002" style="height: 100%;"></ZkTaskListView>
  11. </custom-tab-pane>
  12. <!-- 质控中 -->
  13. <custom-tab-pane label="质控中" name="zkTaskListViewRef_3">
  14. <ZkTaskListView ref="zkTaskListViewRef_3" state="7003" style="height: 100%;"></ZkTaskListView>
  15. </custom-tab-pane>
  16. <!-- 完成 -->
  17. <custom-tab-pane label="完成" name="zkTaskListViewRef_4">
  18. <ZkTaskListView ref="zkTaskListViewRef_4" state="7004,7007,7008,7009,7010" finishFlag="1" style="height: 100%;"></ZkTaskListView>
  19. </custom-tab-pane>
  20. </custom-tabs>
  21. <!-- 签收任务/开始质控对话框 -->
  22. <uni-popup ref="operatorDialog" type="dialog">
  23. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageInfo.popupMessage.title" :content="pageInfo.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  24. </uni-popup>
  25. </view>
  26. </template>
  27. <script setup>
  28. import http from '@/utils/request';
  29. import {ystabbar} from '@/pages/index/tabShow.js'
  30. import {ref,reactive,getCurrentInstance, computed, nextTick,watch} from "vue";
  31. import {onLoad,onShow,onReady,onUnload,onPageScroll,onReachBottom,onPullDownRefresh} from "@dcloudio/uni-app";
  32. import ZkTaskListView from "./zkTaskListView.vue"
  33. const zkTaskListViewRef_1 = ref(null)
  34. const pageInfo = reactive({
  35. current:-1,
  36. detailStatus: '',
  37. // 任务编号
  38. taskId:'',
  39. isKszk:'',
  40. // 对话框
  41. popupMessage:{
  42. // 标题
  43. title:'',
  44. // 提示内容
  45. showMessage:''
  46. }
  47. });
  48. const {proxy} = getCurrentInstance()
  49. const showIcon = reactive({
  50. nowIcon: '',
  51. showIcon: '/static/blackDisplay.png',
  52. hideIcon: '/static/blackHide.png'
  53. })
  54. const statusIcon = reactive({
  55. daiIcon: '/static/dai_icon.png',
  56. wanIcon: '/static/wan_icon.png',
  57. zhiIcon: '/static/zhi_icon.png'
  58. })
  59. // 切换显示与隐藏
  60. const changeState = (type) => {
  61. if (type == 'header') {
  62. console.log("头部切换")
  63. if (eyeIcon.nowIcon == eyeIcon.hideIcon) {
  64. eyeIcon.nowIcon = eyeIcon.showIcon
  65. } else {
  66. eyeIcon.nowIcon = eyeIcon.hideIcon
  67. }
  68. } else if (type == 'list') {
  69. console.log("列表切换")
  70. if (showIcon.nowIcon == showIcon.hideIcon) {
  71. showIcon.nowIcon = showIcon.showIcon
  72. } else {
  73. showIcon.nowIcon = showIcon.hideIcon
  74. }
  75. }
  76. }
  77. // 定义签收任务/开始质控对话框
  78. const operatorDialog=ref(null)
  79. // 签收任务/开始质控对话框确定事件
  80. const operatorDialogConfirm=()=>{
  81. if(pageInfo.popupMessage.title=='开始质控'){
  82. getStartTask()
  83. }else{
  84. getSignTask()
  85. }
  86. operatorDialog._value.close()
  87. }
  88. // 签收任务/开始质控对话框取消事件
  89. const operatorDialogClose=()=>{
  90. operatorDialog._value.close()
  91. }
  92. // 签收接口输入参数
  93. const signFormData=reactive({
  94. // 任务id
  95. taskId:''
  96. })
  97. // 开始质控接口输入参数
  98. const startFormData=reactive({
  99. // 任务id
  100. taskId:''
  101. })
  102. // 签收接口
  103. const getSignTask=()=>{
  104. http.get("app-api/index/qs",signFormData).then(res=>{
  105. if(res==true){
  106. uni.showToast({
  107. title:'签收成功',
  108. icon:'success'
  109. })
  110. }else{
  111. uni.showToast({
  112. title:'重复签收',
  113. icon:'error'
  114. })
  115. }
  116. })
  117. }
  118. // 开始质控接口
  119. const getStartTask=()=>{
  120. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  121. // 1表示开始质控,-1表示不是组长不能质控,其他表示开始质控失败
  122. if(res==1){
  123. uni.navigateTo({
  124. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
  125. })
  126. }else if(res=-1){
  127. // 提示-只有组长能够开始质控
  128. uni.showModal({
  129. title: '提示',
  130. content: '只有组长能够开始质控',
  131. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  132. showCancel: false,//没有取消按钮的弹框
  133. buttonText: '确定'
  134. })
  135. }else{
  136. uni.showToast({
  137. title: '开始质控失败',
  138. icon:'none'
  139. });
  140. }
  141. })
  142. }
  143. const IndexName = ref("zkTaskListViewRef_1")
  144. const changeIndex=(e)=>{
  145. console.log('change-----------')
  146. IndexName.value = e.name
  147. pageInfo.current = e.value
  148. if(taskListRef()){
  149. taskListRef().fetch()
  150. }
  151. }
  152. const taskListRef = ()=>{
  153. const taskList = proxy.$refs[IndexName.value]
  154. return taskList
  155. }
  156. // 页面滚动触发事件
  157. onPageScroll((detail) => {
  158. //页面滚动事件
  159. uni.pageScrollTo({
  160. scrollTop: detail.scrollTop,
  161. duration: 0
  162. })
  163. })
  164. // 上拉加载
  165. onReachBottom(() => {
  166. taskListRef().reachBottom()
  167. })
  168. //下拉刷新
  169. onPullDownRefresh(() => {
  170. taskListRef().pullDownRefresh()
  171. })
  172. // 获取待质控数量
  173. const getZkNumber=()=>{
  174. http.get("app-api/index/getZkNumber").then(res=>{
  175. if(res==0){
  176. uni.removeTabBarBadge({
  177. index:1
  178. })
  179. }else{
  180. uni.setTabBarBadge({
  181. index:1,
  182. text:res.toString()
  183. })
  184. }
  185. })
  186. }
  187. onReady(()=>{
  188. ystabbar()
  189. getZkNumber()
  190. nextTick(()=>{
  191. pageInfo.current = 0
  192. })
  193. uni.$off("signTask")
  194. uni.$off("startTask")
  195. uni.$on("signTask",(e)=>{
  196. signFormData.taskId=e.id
  197. pageInfo.taskId=e.id
  198. operatorDialog._value.open();
  199. pageInfo.popupMessage.title='签收'
  200. pageInfo.popupMessage.showMessage='是否确认签收任务?'
  201. })
  202. uni.$on("startTask",(e)=>{
  203. startFormData.taskId=e.id
  204. pageInfo.taskId=e.id
  205. if(e.isKszk==false){
  206. operatorDialog._value.open()
  207. pageInfo.popupMessage.title='开始质控'
  208. pageInfo.popupMessage.showMessage='是否确认开始质控任务?'
  209. }else{
  210. uni.navigateTo({
  211. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
  212. })
  213. }
  214. })
  215. uni.$off("finishTask")
  216. uni.$on("finishTask",()=>{
  217. pageInfo.current=4
  218. })
  219. })
  220. </script>
  221. <style lang="scss" scoped>
  222. @import 'indexList.scss';
  223. </style>