zkTask.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="qualitycontrolTask">
  3. <!-- 飞行质控任务 -->
  4. <view class="flightTask">
  5. <uni-card>
  6. <uni-section :title="pageData.taskList.name" type="line">
  7. <!-- <template v-slot:right>
  8. <image style="width: 50rpx; height: 50rpx;" :src="showIcon.nowIcon" @click="changeState()">
  9. </image>
  10. </template> -->
  11. </uni-section>
  12. <view class="flightTask_list">
  13. <view class="flightTask_title">
  14. <view class="flightTask_text">被质控代煎企业</view>
  15. <view class="flightTask_righttext">{{pageData.taskList.bzkOrgName}}</view>
  16. </view>
  17. <view class="flightTask_title">
  18. <view class="flightTask_text">组长</view>
  19. <view class="flightTask_righttext">{{pageData.taskList.zzName}}</view>
  20. </view>
  21. <view class="flightTask_title">
  22. <view class="flightTask_text">组员</view>
  23. <view class="flightTask_righttext">{{pageData.taskList.zyNames}}</view>
  24. </view>
  25. <view class="flightTask_title">
  26. <view class="flightTask_text">地址</view>
  27. <view class="flightTask_righttext">{{pageData.taskList.address}}</view>
  28. </view>
  29. <view class="flightTask_title">
  30. <view class="flightTask_text">总数量:</view>
  31. <view class="flightTask_righttext">
  32. {{pageData.taskList.totalWcCount+'/'+pageData.taskList.totalCyCount}}</view>
  33. </view>
  34. <view class="flightTask_title">
  35. <view class="flightTask_text">代煎完成数量:</view>
  36. <view class="flightTask_righttext">
  37. {{pageData.taskList.djWcCount+'/'+pageData.taskList.djCyCount}}</view>
  38. </view>
  39. <view class="flightTask_title">
  40. <view class="flightTask_text">代配完成数量:</view>
  41. <view class="flightTask_righttext">
  42. {{pageData.taskList.dpWcCount+'/'+pageData.taskList.dpCyCount}}</view>
  43. </view>
  44. </view>
  45. </uni-card>
  46. </view>
  47. <!-- 代配作业质控 -->
  48. <view class="dp_or_dj_Task">
  49. <uni-card>
  50. <uni-section title="代配作业质控" type="line">
  51. <template v-slot:right>
  52. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.dpbhg}}</view>
  53. </view>
  54. </template>
  55. </uni-section>
  56. <view>
  57. <button class="button" @click="addTask('dp')"> + 新增</button>
  58. </view>
  59. <uni-table class="dp_table">
  60. <!-- 表头行 -->
  61. <uni-tr>
  62. <uni-th align="center" width="150rpx">处方编号</uni-th>
  63. <uni-th align="center" width="150rpx">贴数(贴)</uni-th>
  64. <uni-th align="center" width="150rpx">平均误差(%)</uni-th>
  65. <uni-th align="center" width="150rpx">操作人</uni-th>
  66. </uni-tr>
  67. <!-- 表格数据行 -->
  68. <uni-tr v-for="(item, index) in pageData.dpList" :key="index">
  69. <uni-td align="center">{{item.cfbh}}</uni-td>
  70. <uni-td align="center">{{item.ts}}</uni-td>
  71. <uni-td align="center">{{item.wc}}</uni-td>
  72. <uni-td align="center">{{item.creatorName}}</uni-td>
  73. </uni-tr>
  74. </uni-table>
  75. <view class="see_more" @click="seeMore('dp')">
  76. <text>查看更多</text>
  77. <uni-icons type="right"></uni-icons>
  78. </view>
  79. </uni-card>
  80. </view>
  81. <!-- 代煎作业质控 -->
  82. <view class="dp_or_dj_Task">
  83. <uni-card>
  84. <uni-section title="代煎作业质控" type="line">
  85. <!-- <template v-slot:right>
  86. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.djbhg}}</view></view>
  87. </template> -->
  88. </uni-section>
  89. <view>
  90. <button class="button" @click="addTask('dj')"> + 新增</button>
  91. </view>
  92. <uni-table class="dp_table">
  93. <!-- 表头行 -->
  94. <uni-tr>
  95. <uni-th align="center" width="150rpx">处方编号</uni-th>
  96. <uni-th align="center" width="150rpx">贴数(贴)</uni-th>
  97. <uni-th align="center" width="150rpx">不合格项</uni-th>
  98. <uni-th align="center" width="150rpx">操作人</uni-th>
  99. </uni-tr>
  100. <!-- 表格数据行 -->
  101. <uni-tr v-for="(item, index) in pageData.djList" :key="index">
  102. <uni-td align="center">{{item.cfbh}}</uni-td>
  103. <uni-td align="center">{{item.ts}}</uni-td>
  104. <uni-td align="center">{{item.bhgx}}</uni-td>
  105. <uni-td align="center">{{item.creatorName}}</uni-td>
  106. </uni-tr>
  107. </uni-table>
  108. <view class="see_more" @click="seeMore('dj')">
  109. <text>查看更多</text>
  110. <uni-icons type="right"></uni-icons>
  111. </view>
  112. </uni-card>
  113. </view>
  114. <!-- 代煎企业作业环境质控 -->
  115. <view class="djqyhj_Task">
  116. <uni-card>
  117. <uni-section title="代煎企业作业环境质控" type="line">
  118. <template v-slot:right>
  119. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.hjzkbhg}}</view>
  120. </view>
  121. </template>
  122. </uni-section>
  123. <view class="image_upload">
  124. <uni-file-picker readonly :modelValue="pageData.imageList" file-mediatype="image">
  125. </uni-file-picker>
  126. </view>
  127. <view class="see_more" @click="seeMore('djqyhj')">
  128. <text>新增</text>
  129. <uni-icons type="right"></uni-icons>
  130. </view>
  131. </uni-card>
  132. </view>
  133. <!-- 完成质控 -->
  134. <view class="finish_button" v-if="pageData.finishStatus">
  135. <button class="button" @click="finishTask()">完成质控</button>
  136. </view>
  137. <!-- 完成质控弹出框 -->
  138. <uni-popup ref="operatorDialog" type="dialog">
  139. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  140. </uni-popup>
  141. </view>
  142. </template>
  143. <script setup>
  144. import {reactive,ref} from "vue";
  145. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  146. import http from '@/utils/request';
  147. import {uploadImageModelValue} from '@/pages/controls/image/OssService';
  148. const pageData = reactive({
  149. detailList: {},
  150. // 质控任务
  151. taskList: {},
  152. // 代配
  153. dpList: {},
  154. // 代煎
  155. djList: {},
  156. // 图片列表
  157. imageList: [],
  158. // 质控状态
  159. taskStatus: '',
  160. // 质控完成状态
  161. finishStatus: true,
  162. // 环境质控完成状态
  163. hjzkFinishStatus: '',
  164. // 对话框
  165. popupMessage:{
  166. // 标题
  167. title:'完成质控',
  168. // 提示内容
  169. showMessage:'是否确认完成质控任务'
  170. }
  171. })
  172. // 显示与隐藏突变
  173. const showIcon = reactive({
  174. nowIcon: '',
  175. showIcon: '/static/blackDisplay.png',
  176. hideIcon: '/static/blackHide.png'
  177. })
  178. // 查询质控作业--根据Id 和 完成质控 入参
  179. const zkzyData = reactive({
  180. id: ''
  181. })
  182. // 切换显示状态
  183. const changeState = () => {
  184. if (showIcon.nowIcon == showIcon.showIcon) {
  185. showIcon.nowIcon = showIcon.hideIcon
  186. } else {
  187. showIcon.nowIcon = showIcon.showIcon
  188. }
  189. }
  190. // 新增代配/代煎质控
  191. const addTask = (type) => {
  192. if (type == 'dp') {
  193. // 新增代配
  194. pageData.taskStatus = 'dp'
  195. } else if (type == 'dj') {
  196. // 新增代煎
  197. pageData.taskStatus = 'dj'
  198. }
  199. uni.navigateTo({
  200. url: '/pages/ypczk/zkTask/choosePrescription?taskStatus=' + pageData.taskStatus
  201. })
  202. }
  203. // 查看更多
  204. const seeMore = (type) => {
  205. let jumpUrl = ''
  206. console.log(JSON.stringify(pageData));
  207. if (type == 'dp') {
  208. // 代配跳转
  209. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  210. } else if (type == 'dj') {
  211. // 代煎跳转
  212. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  213. } else if (type == 'djqyhj') {
  214. // 环境质控跳转
  215. jumpUrl = '/pages/ypczk/zkTask/djhjTask'
  216. }
  217. uni.navigateTo({
  218. url: jumpUrl
  219. })
  220. }
  221. const operatorDialog=ref(null)
  222. const operatorDialogConfirm=()=>{
  223. uni.showLoading({
  224. title: '',
  225. mask: true
  226. });
  227. http.get("app-api/zkzy/finish", zkzyData).then(res => {
  228. uni.hideLoading()
  229. if (res != null) {
  230. operatorDialog.value.close()
  231. uni.navigateBack({
  232. delta: 1,
  233. success: () => {
  234. uni.$emit("finishTask")
  235. }
  236. });
  237. }
  238. })
  239. }
  240. const operatorDialogClose=()=>{
  241. operatorDialog.value.close()
  242. }
  243. // 完成质控
  244. const finishTask = () => {
  245. operatorDialog.value.open()
  246. }
  247. // 查询质控作业--根据Id
  248. const getZkData = () => {
  249. uni.showLoading({
  250. title: '',
  251. mask: true
  252. });
  253. http.get("app-api/zkzy/findZkzyById", zkzyData).then(res => {
  254. uni.hideLoading()
  255. pageData.detailList = res
  256. pageData.taskList = res.task
  257. pageData.djList = res.djCfDetail.slice(0, 3)
  258. pageData.dpList = res.dpCfDetail.slice(0, 3)
  259. pageData.hjzkFinishStatus = res.hjzkStatus
  260. pageData.detailList.dpbhg = dpbhgNumber(res.dpCfDetail)
  261. // 获取图片
  262. if (pageData.detailList.hjzkImgUrl != null && pageData.detailList.hjzkImgUrl != '') {
  263. pageData.imageList = showImage(pageData.detailList.hjzkImgUrl)
  264. }
  265. isfinishAllTask(res.task)
  266. })
  267. }
  268. // 代配不合格数
  269. const dpbhgNumber = (data) => {
  270. let number = 0
  271. data.forEach(item => {
  272. if (item.cfbhg == 1 || item.mxbhg > 0) {
  273. number++;
  274. }
  275. })
  276. return number
  277. }
  278. // 显示图片
  279. const showImage = (id) => {
  280. return uploadImageModelValue(id)
  281. }
  282. // 判断当前用户是否为组员(组员为true)
  283. const isZy = () => {
  284. try {
  285. const value = uni.getStorageSync("userInfo")
  286. if (pageData.taskList.zyIds.indexOf(value.id) != -1) {
  287. return true
  288. } else {
  289. return false
  290. }
  291. } catch (e) {
  292. //TODO handle the exception
  293. }
  294. }
  295. // 是否可以完成质控
  296. const isfinishAllTask = (e) => {
  297. // 总数量、代煎完成数量、代配完成数量不达标
  298. // 是否组员
  299. if (e.djWcCount >= e.djCyCount && e.dpWcCount >= e.dpCyCount && e.totalWcCount >= e.totalCyCount &&
  300. pageData.hjzkFinishStatus == '2' && pageData.imageList.length != 0 && pageData.imageList!=null && !isZy()) {
  301. pageData.finishStatus = true
  302. } else {
  303. pageData.finishStatus = false
  304. }
  305. }
  306. // 存入taskData(taskId)
  307. const setTaskId = () => {
  308. uni.setStorageSync("saveTaskId", {
  309. taskId: zkzyData.id
  310. })
  311. }
  312. onLoad((data) => {
  313. if (data != null) {
  314. zkzyData.id = data.taskId
  315. }
  316. setTaskId()
  317. })
  318. onShow(() => {
  319. showIcon.nowIcon = showIcon.hideIcon
  320. getZkData()
  321. })
  322. </script>
  323. <style lang="scss" scoped>
  324. @import './index.scss'
  325. </style>