zkTask.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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.yncfbh}}</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-th align="center" width="150rpx">操作人</uni-th>
  100. </uni-tr>
  101. <!-- 表格数据行 -->
  102. <uni-tr v-for="(item, index) in pageData.djList" :key="index">
  103. <uni-td align="center">{{item.yncfbh}}</uni-td>
  104. <uni-td align="center">{{item.ts}}</uni-td>
  105. <uni-td align="center" :style="changeColor(item.bhgx,'red')">{{item.bhgx}}</uni-td>
  106. <uni-td align="center" :style="changeColor(item.djCount,'blue')">{{item.djCount}}</uni-td>
  107. <uni-td align="center">{{item.creatorName}}</uni-td>
  108. </uni-tr>
  109. </uni-table>
  110. <view class="see_more" @click="seeMore('dj')">
  111. <text>查看更多</text>
  112. <uni-icons type="right"></uni-icons>
  113. </view>
  114. </uni-card>
  115. </view>
  116. <!-- 代煎企业作业环境质控 -->
  117. <view class="djqyhj_Task">
  118. <uni-card>
  119. <uni-section title="代煎企业作业环境质控" type="line">
  120. <template v-slot:right>
  121. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.hjzkbhg}}</view>
  122. </view>
  123. </template>
  124. </uni-section>
  125. <view class="image_upload">
  126. <uni-file-picker readonly :modelValue="pageData.imageList" file-mediatype="image">
  127. </uni-file-picker>
  128. </view>
  129. <view class="see_more" @click="seeMore('djqyhj')">
  130. <text>新增</text>
  131. <uni-icons type="right"></uni-icons>
  132. </view>
  133. </uni-card>
  134. </view>
  135. <!-- 完成质控 -->
  136. <view class="finish_button" v-if="pageData.finishStatus">
  137. <button class="button" @click="finishTask()">完成质控</button>
  138. </view>
  139. <!-- 完成质控弹出框 -->
  140. <uni-popup ref="operatorDialog" type="dialog">
  141. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  142. </uni-popup>
  143. </view>
  144. </template>
  145. <script setup>
  146. import {reactive,ref} from "vue";
  147. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  148. import http from '@/utils/request';
  149. import {uploadImageModelValue} from '@/pages/controls/image/OssService';
  150. import { UrlPath } from "@/utils/commonuni"
  151. const pageData = reactive({
  152. detailList: {},
  153. // 质控任务
  154. taskList: {},
  155. // 代配
  156. dpList: {},
  157. // 代煎
  158. djList: {},
  159. // 图片列表
  160. imageList: [],
  161. // 质控状态
  162. taskStatus: '',
  163. // 质控完成状态
  164. finishStatus: true,
  165. // 环境质控完成状态
  166. hjzkFinishStatus: '',
  167. // 对话框
  168. popupMessage:{
  169. // 标题
  170. title:'完成质控',
  171. // 提示内容
  172. showMessage:'是否确认完成质控任务'
  173. }
  174. })
  175. // 显示与隐藏突变
  176. const showIcon = reactive({
  177. nowIcon: '',
  178. showIcon: '/static/blackDisplay.png',
  179. hideIcon: '/static/blackHide.png'
  180. })
  181. // 查询质控作业--根据Id 和 完成质控 入参
  182. const zkzyData = reactive({
  183. id: ''
  184. })
  185. // 切换显示状态
  186. const changeState = () => {
  187. if (showIcon.nowIcon == showIcon.showIcon) {
  188. showIcon.nowIcon = showIcon.hideIcon
  189. } else {
  190. showIcon.nowIcon = showIcon.showIcon
  191. }
  192. }
  193. // 新增代配/代煎质控
  194. const addTask = (type) => {
  195. if (type == 'dp') {
  196. // 新增代配
  197. pageData.taskStatus = 'dp'
  198. } else if (type == 'dj') {
  199. // 新增代煎
  200. pageData.taskStatus = 'dj'
  201. }
  202. uni.navigateTo({
  203. url: '/pages/ypczk/zkTask/choosePrescription?taskStatus=' + pageData.taskStatus
  204. })
  205. }
  206. // 查看更多
  207. const seeMore = (type) => {
  208. let jumpUrl = ''
  209. // console.log(JSON.stringify(pageData));
  210. if (type == 'dp') {
  211. // 代配跳转
  212. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  213. } else if (type == 'dj') {
  214. // 代煎跳转
  215. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  216. } else if (type == 'djqyhj') {
  217. // 环境质控跳转
  218. jumpUrl = '/pages/ypczk/zkTask/djhjTask'
  219. }
  220. uni.navigateTo({
  221. url: jumpUrl
  222. })
  223. }
  224. const operatorDialog=ref(null)
  225. const operatorDialogConfirm=()=>{
  226. uni.showLoading({
  227. title: '',
  228. mask: true
  229. });
  230. http.get("app-api/zkzy/finish", zkzyData).then(res => {
  231. uni.hideLoading()
  232. if (res != null) {
  233. operatorDialog.value.close()
  234. uni.navigateBack({
  235. delta: 1,
  236. success: () => {
  237. uni.$emit("finishTask")
  238. }
  239. });
  240. }
  241. })
  242. }
  243. const operatorDialogClose=()=>{
  244. operatorDialog.value.close()
  245. }
  246. // 完成质控
  247. const finishTask = () => {
  248. operatorDialog.value.open()
  249. }
  250. // 查询质控作业--根据Id
  251. const getZkData = () => {
  252. uni.showLoading({
  253. title: '',
  254. mask: true
  255. });
  256. http.get("app-api/zkzy/findZkzyById", zkzyData).then(res => {
  257. uni.hideLoading()
  258. pageData.detailList = res
  259. pageData.taskList = res.task
  260. pageData.djList = res.djCfDetail.slice(0, 3)
  261. pageData.dpList = res.dpCfDetail.slice(0, 3)
  262. pageData.hjzkFinishStatus = res.hjzkStatus
  263. pageData.detailList.dpbhg = dpbhgNumber(res.dpCfDetail)
  264. // 获取图片
  265. if (pageData.detailList.hjzkImgUrl != null && pageData.detailList.hjzkImgUrl != '') {
  266. pageData.imageList = showImage(pageData.detailList.hjzkImgUrl)
  267. }
  268. isfinishAllTask(res.task)
  269. })
  270. }
  271. // 代配不合格数
  272. const dpbhgNumber = (data) => {
  273. let number = 0
  274. data.forEach(item => {
  275. if (item.cfbhg == 1 || item.mxbhg > 0) {
  276. number++;
  277. }
  278. })
  279. return number
  280. }
  281. // 显示图片
  282. const showImage = (urlStr) => {
  283. const filesArray = urlStr.split(',');
  284. const rawPrefix = UrlPath.getBaseUrl()
  285. const prefix = rawPrefix.replace(/\/+$/, '');
  286. const result = filesArray.map(url => {
  287. return prefix + url;
  288. });
  289. return result;
  290. }
  291. // 判断当前用户是否为组员(组员为true)
  292. const isZy = () => {
  293. try {
  294. const value = uni.getStorageSync("userInfo")
  295. if (pageData.taskList.zyIds.indexOf(value.id) != -1) {
  296. return true
  297. } else {
  298. return false
  299. }
  300. } catch (e) {
  301. //TODO handle the exception
  302. }
  303. }
  304. // 是否可以完成质控
  305. const isfinishAllTask = (e) => {
  306. // 总数量、代煎完成数量、代配完成数量不达标
  307. // 是否组员
  308. if (e.djWcCount >= e.djCyCount && e.dpWcCount >= e.dpCyCount && e.totalWcCount >= e.totalCyCount &&
  309. pageData.hjzkFinishStatus == '2' && pageData.imageList.length != 0 && pageData.imageList!=null && !isZy()) {
  310. pageData.finishStatus = true
  311. } else {
  312. pageData.finishStatus = false
  313. }
  314. }
  315. // 存入taskData(taskId)
  316. const setTaskId = () => {
  317. uni.setStorageSync("saveTaskId", {
  318. taskId: zkzyData.id
  319. })
  320. }
  321. const changeColor = (name,color) => {
  322. // 根据状态值返回不同的样式对象
  323. return {
  324. color: name > 0 ? color : 'black'
  325. };
  326. }
  327. onLoad((data) => {
  328. if (data != null) {
  329. zkzyData.id = data.taskId
  330. }
  331. setTaskId()
  332. })
  333. onShow(() => {
  334. showIcon.nowIcon = showIcon.hideIcon
  335. getZkData()
  336. })
  337. </script>
  338. <style lang="scss" scoped>
  339. @import './index.scss'
  340. </style>