You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

456 lines
15 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div style="display: flex;">
  3. <div>
  4. <div v-show="checkPagePriv(pagePriv.privs, '采图')">
  5. <el-button type="primary" class="btnClass" @click="btnGetPic" :disabled="doctorBtnDisabled('btnGetPic')"
  6. size="small">采图</el-button>
  7. </div>
  8. <div v-show="checkPagePriv(pagePriv.privs, '导图')">
  9. <el-button type="primary" class="btnClass" @click="btnExpPic" :disabled="doctorBtnDisabled('btnExpPic')"
  10. size="small">导图</el-button>
  11. </div>
  12. <div v-show="checkPagePriv(pagePriv.privs, '裁图')">
  13. <el-button type="primary" class="btnClass" @click="btnCutPic" :disabled="doctorBtnDisabled('btnCutPic')"
  14. size="small">裁图</el-button>
  15. </div>
  16. <div v-show="checkPagePriv(pagePriv.privs, '保存')">
  17. <el-button type="primary" class="btnClass" @click="btnSavePic" :disabled="doctorBtnDisabled('btnSavePic')"
  18. size="small">保存</el-button>
  19. </div>
  20. </div>
  21. <!-- -->
  22. <div :style="`overflow-x: scroll;width:${Math.floor((window.pageWidth - 200 - 110 - 15 - 4))}px;`">
  23. <div style="display: flex;">
  24. <div class="demo-image__preview" v-for="(item, index) in checkPictures" :key="item.id"
  25. style="display: inline-block; padding: 0 0 0 2px">
  26. <div style="
  27. position: relative;
  28. font-size: 24px;
  29. margin: -6px 0 0 55px;
  30. height: 30px;
  31. z-index: 2;
  32. ">
  33. <el-tooltip content="删除该图" placement="bottom" effect="light">
  34. <i class="el-icon-close" @click="btnDelImage(index)" v-show="!doctorBtnDisabled('btnDelImage')"
  35. style="color: red; cursor: pointer"></i>
  36. </el-tooltip>
  37. </div>
  38. <div style="margin-top: -25px">
  39. <el-image style="width: 80px; height: 80px; border-radius: 5px" :src="imageFilePlus(item.pictureFilename)"
  40. :preview-src-list="previewSrcList(checkPictures, item)">
  41. </el-image>
  42. </div>
  43. <div style="display: flex">
  44. <div style="margin: -6px 0 0 1px">
  45. <el-checkbox v-model="item.isPrintTrans" @change="btnSavePic"
  46. :disabled="doctorBtnDisabled('btnSavePic')"></el-checkbox>
  47. </div>
  48. <div style="font-size: 12px; margin: -2px 0 0 1px">打印</div>
  49. <div style="font-size: 15px; margin: -5px 0 0 2px">
  50. <el-tooltip content="保存后,图片将按序号从小到大排序" placement="bottom" effect="light">
  51. <input placeholder="排序" v-model="item.displayOrder" @onkeyup="validateInteger(e, index)"
  52. style="width: 30px" :disabled="doctorBtnDisabled('btnSavePic')" />
  53. </el-tooltip>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <el-dialog title="图片上传" :visible.sync="dialogCheckPictureUpload" :close-on-click-modal="false" width="800px"
  60. @close="getCheckPictures(doctorCheck.RegisterCheckId)">
  61. <CheckPictureUpload :registerCheckId="doctorCheck.RegisterCheckId" :uploadSeq="uploadSeq"
  62. :closePicUpload="closePicUpload" />
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import moment from "moment";
  68. import { mapState } from "vuex";
  69. import { Loading } from "element-ui";
  70. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  71. import { getPagePriv, checkPagePriv, deepCopy, arrayExistObj } from "../../utlis/proFunc";
  72. import CheckPictureUpload from "./CheckPictureUpload.vue";
  73. export default {
  74. components: {
  75. CheckPictureUpload,
  76. },
  77. props: ["doctorBtnDisabled"],
  78. data() {
  79. return {
  80. sysConfig: {}, //
  81. pagePriv: {
  82. routeUrlorPageName: 'doctorCheck', //当前页面归属路由或归属页面权限名称
  83. privs: [] // 页面权限
  84. },
  85. checkPictures: [
  86. // {
  87. // id: "1",
  88. // registerCheckId: "registerCheckId",
  89. // isPrint: "Y",
  90. // isPrintTrans: true,
  91. // pictureFilename:
  92. // "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
  93. // },
  94. // {
  95. // id: "2",
  96. // registerCheckId: "registerCheckId",
  97. // isPrint: "Y",
  98. // isPrintTrans: true,
  99. // pictureFilename:
  100. // "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
  101. // },
  102. ],
  103. //图片上传
  104. dialogCheckPictureUpload: false,
  105. uploadSeq: 0, //第几次点图片上传,每点一次清空前次所选图片
  106. };
  107. },
  108. created() {
  109. //获取用户当前页面的权限
  110. let userPriv = window.sessionStorage.getItem('userPriv')
  111. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  112. this.sysConfig = JSON.parse(window.sessionStorage.getItem('sysConfig'))
  113. console.log('this.sysConfig checkPictures', this.sysConfig)
  114. },
  115. //挂载完成
  116. mounted() {
  117. this.getCheckPictures(this.dataTransOpts.tableS.register_check.id);
  118. },
  119. computed: {
  120. ...mapState([
  121. "window",
  122. "dict",
  123. "dataTransOpts",
  124. "doctorCheck",
  125. "patientRegister",
  126. "customerOrg",
  127. ]),
  128. lmoment(date, forMat) {
  129. return moment(new Date(date)).format(forMat);
  130. },
  131. },
  132. methods: {
  133. checkPagePriv,
  134. // 根据checkId获取图片列表信息
  135. getCheckPictures(registerCheckId) {
  136. this.checkPictures = [];
  137. if (!registerCheckId) {
  138. return;
  139. }
  140. // {
  141. // "registerCheckId": "3a0f6a3c-88a5-d5f7-d59b-ef3b3807490b",
  142. // "pictureFilename": "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
  143. // "isPrint": "N",
  144. // "displayOrder": 1,
  145. // "creatorName": "admin",
  146. // "lastModifierName": "admin",
  147. // "lastModificationTime": "2023-12-15T15:24:08",
  148. // "lastModifierId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  149. // "creationTime": "2023-12-15T15:24:06",
  150. // "creatorId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  151. // "id": "3a0f6a3c-88a5-d5f7-d59b-ef3b38074901"
  152. // }
  153. getapi(
  154. `/api/app/registercheckpicture/getregistercheckpictureinregistercheckid?RegisterCheckId=${registerCheckId}`
  155. ).then((res) => {
  156. if (res.code > -1) {
  157. this.checkPictures = res.data
  158. this.checkPictures.forEach(e => {
  159. e.isPrintTrans = e.isPrint == "Y" ? true : false
  160. });
  161. }
  162. });
  163. },
  164. // 生成 图片预览列表
  165. previewSrcList(oriList, curImag) {
  166. let srcList = []
  167. let image = curImag.pictureFilename.indexOf('http') > -1
  168. ? curImag.pictureFilename
  169. : this.sysConfig.apiurl + curImag.pictureFilename;
  170. srcList.push(image)
  171. let lfind = arrayExistObj(oriList, 'id', curImag.id)
  172. if (lfind > -1) {
  173. for (let i = lfind + 1; i < oriList.length; i++) {
  174. let e = oriList[i];
  175. image = this.imageFilePlus(e.pictureFilename)
  176. srcList.push(image)
  177. }
  178. for (let index = 0; index < lfind; index++) {
  179. let e = oriList[index];
  180. image = this.imageFilePlus(e.pictureFilename)
  181. srcList.push(image)
  182. }
  183. }
  184. return srcList
  185. },
  186. // 图片文件补全路径
  187. imageFilePlus(fileName) {
  188. if (fileName.indexOf('base64') > -1 || fileName.indexOf('http') > -1) {
  189. return fileName
  190. } else {
  191. return this.sysConfig.apiurl + fileName
  192. }
  193. },
  194. // 采图
  195. btnGetPic() {
  196. if (!this.doctorCheck.RegisterCheckId) {
  197. this.$message.warning({ showClose: true, message: "未选中组合项目!" });
  198. return;
  199. }
  200. if (!this.$peisAPI) {
  201. this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" })
  202. return
  203. }
  204. let toOutShell = {
  205. barCode: this.doctorCheck.checkRequestNo,
  206. patientName: this.dataTransOpts.tableS.patient_register.patientName,
  207. sexName: this.dataTransOpts.tableS.patient_register.sexName,
  208. age: (this.dataTransOpts.tableS.patient_register.age || '') + '',
  209. asbitemName: this.doctorCheck.asbitemName
  210. }
  211. // console.log('this.$peisAPI.imageAcquisition', JSON.stringify(toOutShell))
  212. let loading = Loading.service({
  213. lock: true,
  214. text: "正在加载中,请稍后",
  215. spinner: "el-icon-loading",
  216. background: "rgba(0, 0, 0, 0)",
  217. customClass: "boxStyle"
  218. });
  219. this.$peisAPI.imageAcquisition(JSON.stringify(toOutShell))
  220. .then(async (res) => {
  221. let lres = JSON.parse(res)
  222. // console.log('this.$peisAPI.imageAcquisition',lres)
  223. if (lres.code > -1) {
  224. for (let i = 0; i < lres.data.length; i++) {
  225. let item = lres.data[i];
  226. // FilePath:
  227. // Image
  228. // ImageFormat
  229. let baseHead = 'data:image/jpeg;base64,'
  230. switch (item.ImageFormat) {
  231. case 'png':
  232. case 'bmp':
  233. baseHead = `data:image/${item.ImageFormat};base64,`
  234. break;
  235. default:
  236. break;
  237. }
  238. this.checkPictures.push({ pictureFilename: baseHead + item.Image })
  239. let fileName = item.FilePath
  240. let dotIndex = fileName.lastIndexOf('\\');
  241. if (dotIndex > -1) fileName = fileName.substring(dotIndex, fileName.length);
  242. let body = {
  243. registerCheckId: this.dataTransOpts.tableS.register_check.id,
  244. pictureBaseStrs: [{
  245. fileName,
  246. localPathName: item.FilePath,
  247. pictureBaseStr: baseHead + item.Image
  248. }]
  249. }
  250. try {
  251. await postapi('/api/app/RegisterCheckPicture/InstrumentMapping', body)
  252. } catch (error) {
  253. console.log('btnGetPic err',error)
  254. }
  255. }
  256. this.getCheckPictures(this.dataTransOpts.tableS.register_check.id)
  257. }
  258. }).catch(err => {
  259. this.$message.error(err)
  260. }).finally(() => {
  261. loading.close()
  262. });
  263. },
  264. //导图(上传图片)
  265. btnExpPic() {
  266. if (!this.doctorCheck.RegisterCheckId) {
  267. this.$message.warning({ showClose: true, message: "未选中组合项目!" });
  268. return;
  269. }
  270. this.uploadSeq++;
  271. this.dialogCheckPictureUpload = true;
  272. },
  273. // 裁图/修图/ dicom 查看图
  274. btnCutPic() {
  275. if (this.checkPictures.length == 0) {
  276. this.$message.warning({ showClose: true, message: "暂无可裁图片!" });
  277. return;
  278. }
  279. if (!this.$peisAPI) {
  280. this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" })
  281. return
  282. }
  283. let token = window.sessionStorage.getItem("token");
  284. let toOutShell = {
  285. images:this.checkPictures,
  286. token,
  287. };
  288. this.$peisAPI.imageCut(JSON.stringify(toOutShell))
  289. .then(res => {
  290. let lres = JSON.parse(res)
  291. if (lres.code > -1) {
  292. this.getCheckPictures(this.dataTransOpts.tableS.register_check.id);
  293. }else{
  294. console.log('裁图失败',lres.message)
  295. }
  296. })
  297. .catch(err => {
  298. console.log('裁图失败',err)
  299. })
  300. },
  301. //关闭上传图片窗口
  302. closePicUpload() {
  303. this.dialogCheckPictureUpload = false;
  304. },
  305. btnSavePic() {
  306. if (!this.doctorCheck.RegisterCheckId) {
  307. this.$message.warning({ showClose: true, message: "未选中组合项目!" });
  308. return;
  309. }
  310. let body = [];
  311. // [
  312. // {
  313. // "registerCheckPictureId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", // 新增无需传此值
  314. // "registerCheckId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  315. // "pictureFilename": "string",
  316. // "isPrint": "string",
  317. // "displayOrder": 0
  318. // }
  319. // ]
  320. if (this.checkPictures.length == 0) {
  321. this.$message.warning({ showClose: true, message: "没有可保存的图片数据!" });
  322. return;
  323. }
  324. let checkPictures = deepCopy(this.checkPictures);
  325. checkPictures.sort((a, b) => {
  326. let seq1 = 0;
  327. let seq2 = 0;
  328. try {
  329. seq1 = parseInt(a.displayOrder);
  330. } catch (error) {
  331. seq1 = 0;
  332. }
  333. try {
  334. seq2 = parseInt(b.displayOrder);
  335. } catch (error) {
  336. seq2 = 0;
  337. }
  338. return seq1 - seq2;
  339. });
  340. checkPictures.forEach((e) => {
  341. let item = {
  342. registerCheckId: e.registerCheckId,
  343. pictureFilename: e.pictureFilename,
  344. };
  345. if (e.id) item.registerCheckPictureId = e.id;
  346. if (e.isPrintTrans) {
  347. item.isPrint = "Y";
  348. } else {
  349. item.isPrint = "N";
  350. }
  351. body.push(item);
  352. });
  353. postapi("/api/app/registercheckpicture/UpdateRegisterCheckPictureStatusMany", body)
  354. .then((res) => {
  355. if (res.code > -1) {
  356. this.getCheckPictures(checkPictures[0].registerCheckId);
  357. }
  358. });
  359. },
  360. // 删除图片
  361. btnDelImage(index) {
  362. let body = [this.checkPictures[index].id];
  363. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  364. confirmButtonText: "是",
  365. cancelButtonText: "否",
  366. type: "warning",
  367. })
  368. .then(() => {
  369. return postapi(`/api/app/registercheckpicture/deleteregistercheckpicturemany`, body);
  370. })
  371. .then((res) => {
  372. if (res && res.code > -1) {
  373. this.checkPictures.splice(index, 1);
  374. }
  375. })
  376. .catch((err) => {
  377. if (err == "cancel") {
  378. this.$message.info({ showClose: true, message: "已取消" });
  379. }
  380. });
  381. },
  382. validateInteger(e, index) {
  383. var regex = /^[0-9]*$/;
  384. console.log(e, index);
  385. if (!regex.test(e.value)) {
  386. // 如果输入不满足整数条件,则清除输入框内容
  387. e.value = "";
  388. }
  389. },
  390. },
  391. //监听事件
  392. watch: {
  393. //检查项目未切换换时 也可以强制刷新数据
  394. "dataTransOpts.refresh.register_check_item.M": {
  395. // immediate: true,
  396. handler(newVal, oldVal) {
  397. console.log(`watch 检查图片 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.dataTransOpts.tableS.register_check.id}`);
  398. if (newVal != oldVal) this.getCheckPictures(this.dataTransOpts.tableS.register_check.id);
  399. }
  400. },
  401. },
  402. };
  403. </script>
  404. <style scoped>
  405. .query {
  406. margin-left: 10px;
  407. margin-right: 2px;
  408. padding: 1px 1px;
  409. }
  410. .btnClass {
  411. margin: 2px 2px 0;
  412. height: 26px;
  413. min-width: 40px;
  414. padding: 5px 5px;
  415. /*原始 默认值 10px 10px */
  416. }
  417. /* 强制出现滚动条 */
  418. ::-webkit-scrollbar {
  419. height: 0.5rem;
  420. }
  421. ::-webkit-scrollbar-thumb {
  422. background-color: #ccc;
  423. border-radius: 0.25rem;
  424. }
  425. </style>