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.

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