zkTaskListView.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="view_container leaderIndex">
  3. <!-- 列表 -->
  4. <view>
  5. <uni-card v-for="(item,index) in pageData.taskList" padding="0" spacing="0" class="leaderIndex_list">
  6. <view class="list_title">
  7. <image :src="item.taskStatusIcon" class="statusIcon"></image>
  8. <view>{{item.name}}</view>
  9. <image :src="showIcon.nowIcon" class="showIcon" @click="changeState('list')"></image>
  10. </view>
  11. <view class="list_content">
  12. <view class="list_item">任务编号</view>
  13. <view class="list_item_text">{{item.id}}</view>
  14. </view>
  15. <view class="list_content">
  16. <view class="list_item">组长</view>
  17. <view class="list_item_text">{{item.zzName}}</view>
  18. </view>
  19. <view class="list_content">
  20. <view class="list_item">待质控代煎企业</view>
  21. <view class="list_item_text">{{item.bzkOrgName}}</view>
  22. </view>
  23. <view class="list_content">
  24. <view class="list_item">地址</view>
  25. <view class="list_item_text">{{item.address}}</view>
  26. </view>
  27. <view class="list_content">
  28. <view class="list_item">完成日期</view>
  29. <view class="list_item_text">{{item.finishTime}}</view>
  30. </view>
  31. <view class="button_group">
  32. <view class="button_sign" @click="signTask(item)">签收</view>
  33. <view class="button_start" @click="startTask(item)">开始质控</view>
  34. </view>
  35. </uni-card>
  36. </view>
  37. <!-- 签收任务/开始质控对话框 -->
  38. <uni-popup ref="operatorDialog" type="dialog">
  39. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageInfo.popupMessage.title" :content="pageInfo.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  40. </uni-popup>
  41. <view>
  42. <uni-load-more :status="loadingData.status" :contentText="loadingData.contentText"></uni-load-more>
  43. </view>
  44. </view>
  45. </template>
  46. <script setup>
  47. import http from '@/utils/request';
  48. import {ref,onMounted,reactive} from "vue";
  49. import {onLoad,onShow,onUnload,onPageScroll} from "@dcloudio/uni-app";
  50. const props = defineProps({
  51. //接受父组件参数,当前要接质控任务状态
  52. state: String,
  53. });
  54. const loadingData = reactive({
  55. // 加载true,到底false
  56. reload: false,
  57. status: 'more',
  58. contentText: {
  59. contentdown: '上拉加载更多',
  60. contentrefresh: '加载中',
  61. contentnomore: '已经全部加载完毕'
  62. }
  63. })
  64. const formData = reactive({
  65. pageSize: 10,
  66. pageNum: 1,
  67. status:props.state
  68. })
  69. const pageInfo = reactive({
  70. // 判断列表是否为空
  71. isEmpty: true,
  72. total: 0,
  73. value: 0,
  74. activeIndex: 0,
  75. detailStatus: '',
  76. // 对话框
  77. popupMessage:{
  78. // 标题
  79. title:'',
  80. // 提示内容
  81. showMessage:''
  82. }
  83. });
  84. const pageData = reactive({
  85. headImg: '/static/logo.png',
  86. userName: '王军',
  87. taskNum: 2,
  88. taskList: [],
  89. // 任务编号
  90. taskId:'',
  91. })
  92. // 签收接口输入参数
  93. const signFormData=reactive({
  94. // 任务id
  95. id:''
  96. })
  97. // 开始质控接口输入参数
  98. const startFormData=reactive({
  99. // 任务id
  100. id:''
  101. })
  102. const eyeIcon = reactive({
  103. nowIcon: '',
  104. showIcon: '/static/whiteDisplay.png',
  105. hideIcon: '/static/whiteHide.png'
  106. })
  107. const showIcon = reactive({
  108. nowIcon: '',
  109. showIcon: '/static/blackDisplay.png',
  110. hideIcon: '/static/blackHide.png'
  111. })
  112. const statusIcon = reactive({
  113. daiIcon: '/static/dai_icon.png',
  114. wanIcon: '/static/wan_icon.png',
  115. zhiIcon: '/static/zhi_icon.png'
  116. })
  117. // 切换显示与隐藏
  118. const changeState = (type) => {
  119. if (type == 'header') {
  120. console.log("头部切换")
  121. if (eyeIcon.nowIcon == eyeIcon.hideIcon) {
  122. eyeIcon.nowIcon = eyeIcon.showIcon
  123. } else {
  124. eyeIcon.nowIcon = eyeIcon.hideIcon
  125. }
  126. } else if (type == 'list') {
  127. console.log("列表切换")
  128. if (showIcon.nowIcon == showIcon.hideIcon) {
  129. showIcon.nowIcon = showIcon.showIcon
  130. } else {
  131. showIcon.nowIcon = showIcon.hideIcon
  132. }
  133. }
  134. }
  135. // 定义签收任务/开始质控对话框
  136. const operatorDialog=ref(null)
  137. // 签收任务/开始质控对话框确定事件
  138. const operatorDialogConfirm=()=>{
  139. if(pageInfo.popupMessage.title=='开始质控'){
  140. startFormData.id = pageData.taskId
  141. getStartTask()
  142. }else{
  143. signFormData.id=pageData.taskId
  144. getSignTask()
  145. }
  146. operatorDialog._value.close()
  147. }
  148. // 签收任务/开始质控对话框取消事件
  149. const operatorDialogClose=()=>{
  150. operatorDialog._value.close()
  151. }
  152. // 签收接口
  153. const getSignTask=()=>{
  154. http.get("app-api/index/qs",signFormData).then(res=>{
  155. console.log(res)
  156. if(res==true){
  157. uni.showToast({
  158. title:'签收成功',
  159. icon:'success'
  160. })
  161. }else{
  162. uni.showToast({
  163. title:'签收失败',
  164. icon:'error'
  165. })
  166. }
  167. })
  168. }
  169. // 开始质控接口
  170. const getStartTask=()=>{
  171. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  172. console.log(res)
  173. if(res==true){
  174. uni.navigateTo({
  175. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
  176. })
  177. }else{
  178. // 提示-只有组长能够开始质控
  179. uni.showModal({
  180. title: '提示',
  181. content: '只有组长能够开始质控',
  182. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  183. showCancel: false,//没有取消按钮的弹框
  184. buttonText: '确定',
  185. success: function (res) {
  186. console.log(res)
  187. }
  188. })
  189. }
  190. })
  191. }
  192. // 签收
  193. const signTask=(e)=>{
  194. console.log("签收")
  195. pageData.taskId=e.id
  196. operatorDialog._value.open()
  197. pageInfo.popupMessage.title='签收'
  198. pageInfo.popupMessage.showMessage='是否确认签收任务?'
  199. }
  200. // 开始质控
  201. const startTask=(e)=>{
  202. console.log("开始质控")
  203. pageData.taskId=e.id
  204. operatorDialog._value.open()
  205. pageInfo.popupMessage.title='开始质控'
  206. pageInfo.popupMessage.showMessage='是否确认开始质控任务?'
  207. }
  208. const getTaskData = () => {
  209. console.log("getTaskData");
  210. http.get("app-api/zkzy/findZkzyList",formData).then(res => {
  211. console.log(res)
  212. pageData.taskList = pageData.taskList.concat(res.data)
  213. pageData.taskList.forEach(item => {
  214. if (item.wcrq1 != null && item.wcrq2 != null) {
  215. item.finishTime = item.wcrq1 + ' ~ ' + item.wcrq2
  216. }
  217. if (item.status == '7003') {
  218. item.taskStatusIcon = statusIcon.daiIcon
  219. } else if (item.status == '7004') {
  220. item.taskStatusIcon = statusIcon.wanIcon
  221. } else {
  222. item.taskStatusIcon = statusIcon.zhiIcon
  223. }
  224. })
  225. if (formData.pageSize > res.data.length) {
  226. loadingData.reload = false
  227. loadingData.status = 'noMore'
  228. uni.stopPullDownRefresh();
  229. } else {
  230. loadingData.status = 'more'
  231. loadingData.reload = true
  232. }
  233. setTimeout(function() {
  234. uni.stopPullDownRefresh();
  235. }, 1000);
  236. })
  237. }
  238. // 上拉加载
  239. const reachBottom = ()=>{
  240. console.log("上拉加载");
  241. if (loadingData.reload) {
  242. formData.pageNum++;
  243. loadingData.status = 'loading'
  244. getTaskData();
  245. }
  246. }
  247. const propsState = ref("")
  248. onShow(() => {
  249. eyeIcon.nowIcon = eyeIcon.hideIcon
  250. showIcon.nowIcon = showIcon.hideIcon
  251. formData.pageNum = 1;
  252. loadingData.reload = true
  253. propsState.value = props.state
  254. // getTaskData();
  255. })
  256. //下拉刷新
  257. const pullDownRefresh = () => {
  258. console.log("下拉刷新");
  259. formData.pageNum = 1;
  260. loadingData.reload = true
  261. pageData.taskList = []
  262. getTaskData();
  263. }
  264. const fetch = ()=>{
  265. console.log(pageData.taskList);
  266. if(pageData.taskList == null || pageData.taskList.length == 0){
  267. pullDownRefresh()
  268. }
  269. }
  270. // 页面滚动触发事件
  271. onPageScroll((detail) => {
  272. //页面滚动事件
  273. uni.pageScrollTo({
  274. scrollTop: detail.scrollTop,
  275. duration: 0
  276. })
  277. })
  278. defineExpose({reachBottom,pullDownRefresh,fetch})
  279. </script>
  280. <style lang="scss" scoped>
  281. @import 'indexList.scss';
  282. .yui-tabs {
  283. position: relative;
  284. }
  285. ::v-deep.uni-view.yui-tabs__wrap {
  286. margin-top: 25px !important;
  287. }
  288. .yui-tabs__wrap {
  289. top: 50px !important;
  290. }
  291. </style>