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.

236 lines
6.9 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
  1. <template>
  2. <div style="display: flex;">
  3. <div>
  4. <div>
  5. <el-button type="primary" class="btnClass" @click="btnGetPic" size="small">采图</el-button>
  6. </div>
  7. <div>
  8. <el-button type="primary" class="btnClass" @click="btnExpPic" size="small">导图</el-button>
  9. </div>
  10. <div>
  11. <el-button type="primary" class="btnClass" @click="btnSavePic" size="small">保存</el-button>
  12. </div>
  13. </div>
  14. <div class="demo-image__preview" v-for="(item,index) in checkPictures" :key="item.id" style="padding: 0 0 0 2px;">
  15. <div style="position: relative;font-size:24px;margin: -6px 0 0 55px;z-index:2;">
  16. <el-tooltip content="删除该图" placement="bottom" effect="light">
  17. <i class="el-icon-close" @click="btnDelImage(index)"
  18. style="color: red;cursor:pointer;"></i>
  19. </el-tooltip>
  20. </div>
  21. <div style="margin-top: -25px;">
  22. <el-image
  23. style="width: 80px; height: 80px;border-radius:5px;"
  24. :src="item.pictureFilename"
  25. :preview-src-list="[item.pictureFilename]">
  26. </el-image>
  27. </div>
  28. <div style="display: flex;">
  29. <div style="margin: -6px 0 0 1px;">
  30. <el-checkbox v-model="item.isPrintTrans"></el-checkbox>
  31. </div>
  32. <div style="font-size:12px;margin: -2px 0 0 1px;">打印</div>
  33. <div style="font-size:15px;margin: -5px 0 0 2px;">
  34. <el-tooltip content="保存后,图片将按序号从小到大排序" placement="bottom" effect="light">
  35. <input placeholder="排序" v-model="item.displayOrder" @onkeyup="validateInteger(e,index)"
  36. style="width: 35px" />
  37. </el-tooltip>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import moment from "moment";
  45. import { mapState } from "vuex";
  46. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  47. import { deepCopy } from '@/utlis/proFunc';
  48. export default {
  49. components: {},
  50. data() {
  51. return {
  52. checkPictures:[{
  53. id:'1',
  54. registerCheckId:'registerCheckId',
  55. isPrint:'Y',
  56. isPrintTrans:true,
  57. pictureFilename:'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg'
  58. },{
  59. id:'2',
  60. registerCheckId:'registerCheckId',
  61. isPrint:'Y',
  62. isPrintTrans:true,
  63. pictureFilename:'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
  64. }],
  65. };
  66. },
  67. created() {},
  68. //挂载完成
  69. mounted() {},
  70. computed: {
  71. ...mapState(["dict", "doctorCheck","patientRegister", "customerOrg"]),
  72. lmoment(date, forMat) {
  73. return moment(new Date(date)).format(forMat);
  74. },
  75. },
  76. methods: {
  77. // 根据checkId获取图片列表信息
  78. getCheckPictures(registerCheckId){
  79. this.checkPictures = []
  80. if(!registerCheckId){
  81. return
  82. }
  83. // {
  84. // "registerCheckId": "3a0f6a3c-88a5-d5f7-d59b-ef3b3807490b",
  85. // "pictureFilename": "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
  86. // "isPrint": "N",
  87. // "displayOrder": 1,
  88. // "creatorName": "admin",
  89. // "lastModifierName": "admin",
  90. // "lastModificationTime": "2023-12-15T15:24:08",
  91. // "lastModifierId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  92. // "creationTime": "2023-12-15T15:24:06",
  93. // "creatorId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  94. // "id": "3a0f6a3c-88a5-d5f7-d59b-ef3b38074901"
  95. // }
  96. getapi(`/api/app/registercheckpicture/getregistercheckpictureinregistercheckid?RegisterCheckId=${registerCheckId}`)
  97. .then(res =>{
  98. if(res.code != -1){
  99. res.data.forEach(e => {
  100. this.checkPictures.push(Object.assign({isPrintTrans:e.isPrint == 'Y' ? true:false},e))
  101. });
  102. }
  103. })
  104. },
  105. btnGetPic(){
  106. console.log('采图,开发中……')
  107. },
  108. btnExpPic(){
  109. console.log('导图,开发中……')
  110. },
  111. btnSavePic(){
  112. let body = []
  113. // [
  114. // {
  115. // "registerCheckPictureId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", // 新增无需传此值
  116. // "registerCheckId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  117. // "pictureFilename": "string",
  118. // "isPrint": "string",
  119. // "displayOrder": 0
  120. // }
  121. // ]
  122. if(this.checkPictures.length == 0){
  123. this.$message.warning("没有可保存的图片数据!")
  124. return
  125. }
  126. let checkPictures = deepCopy(this.checkPictures)
  127. checkPictures.sort((a,b) =>{
  128. let seq1 = 0
  129. let seq2 = 0
  130. try {
  131. seq1 = parseInt(a.displayOrder)
  132. } catch (error) {
  133. seq1 = 0
  134. }
  135. try {
  136. seq2 = parseInt(b.displayOrder)
  137. } catch (error) {
  138. seq2 = 0
  139. }
  140. return seq1 - seq2
  141. })
  142. checkPictures.forEach(e => {
  143. let item = {
  144. registerCheckId:e.registerCheckId,
  145. pictureFilename:e.pictureFilename
  146. }
  147. if(e.id) item.registerCheckPictureId = e.id
  148. if(e.isPrintTrans){
  149. item.isPrint = 'Y'
  150. }else{
  151. item.isPrint = 'N'
  152. }
  153. body.push(item);
  154. });
  155. postapi('/api/app/registercheckpicture/createregistercheckpicturemany',body)
  156. .then(res =>{
  157. if(res.code != -1){
  158. this.$message.success("操作成功!")
  159. this.getCheckPictures(checkPictures[0].registerCheckId);
  160. }
  161. })
  162. },
  163. // 删除图片
  164. btnDelImage(index){
  165. let body = [this.checkPictures[index].id]
  166. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  167. confirmButtonText: "是",
  168. cancelButtonText: "否",
  169. type: "warning",
  170. }).then(() => {
  171. return postapi(`/api/app/registercheckpicture/deleteregistercheckpicturemany`, body)
  172. }).then((res) => {
  173. if(res.code != -1){
  174. this.$message.success("操作成功!")
  175. this.checkPictures.splice(index,1)
  176. }
  177. }).catch((err) => {
  178. if (err == "cancel") {
  179. this.$message.info("已取消");
  180. }
  181. });
  182. },
  183. validateInteger(e,index){
  184. var regex = /^[0-9]*$/;
  185. console.log(e,index)
  186. if (!regex.test(e.value)) {
  187. // 如果输入不满足整数条件,则清除输入框内容
  188. e.value = "";
  189. }
  190. }
  191. },
  192. //监听事件
  193. watch: {
  194. //体检人员切换
  195. "doctorCheck.RegisterCheckId":{
  196. immediate:true,
  197. handler(newVal, oldVal) {
  198. console.log("watch:doctorCheck.RegisterCheckId:", newVal, " oldVal:", oldVal);
  199. this.getCheckPictures(newVal)
  200. }
  201. },
  202. }
  203. };
  204. </script>
  205. <style scoped>
  206. .query {
  207. margin-left: 10px;
  208. margin-right: 2px;
  209. padding: 1px 1px;
  210. }
  211. .btnClass{
  212. margin: 2px 2px 0;
  213. height: 26px;
  214. min-width: 40px;
  215. padding: 5px 5px; /*原始 默认值 10px 10px */
  216. }
  217. </style>