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.

975 lines
34 KiB

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>
  3. <!--组件主体-->
  4. <div style="display: flex">
  5. <div :style="'width:' + (window.pageWidth - 200 - 145) + 'px;'" @contextmenu.prevent="onContextmenu">
  6. <div>
  7. <el-table @body-scrolling="load" :data="tableData" border
  8. :height="window.pageHeight < 600 ? 248 : Math.floor(((window.pageHeight - 250) * 2) / 3)"
  9. highlight-current-row @row-click="rowClick" @row-dblclick="rowDblclick" size="small" row-key="id"
  10. @selection-change="handleSelectionChange" ref="info" id="info"
  11. :row-class-name="handleRowClassName">
  12. <!-- 取消勾选改为选中
  13. <el-table-column type="selection" width="40" show-overflow-tooltip/>
  14. :height="window.pageHeight < 600 ? 202 : Math.floor(((window.pageHeight - 302) * 2) / 3)"
  15. -->
  16. <el-table-column v-for="(item, index) in headerCols" :key="`col_${index}`"
  17. :min-width="dropCol[index].minWidth" :align="dropCol[index].align" :label="item.label"
  18. :prop="dropCol[index].prop" :sortable="dropCol[index].prop == 'sn' ? false : true">
  19. <template slot-scope="scope">
  20. <div v-if="dropCol[index].prop == 'sn'">
  21. {{ scope.$index + 1 }}
  22. </div>
  23. <div v-else-if="dropCol[index].prop == 'completeFlag'">
  24. {{ dddw(dict.completeFlag, "id", scope.row.completeFlag, "displayName") }}
  25. </div>
  26. <div v-else-if="dropCol[index].prop == 'guidePrintTimes'">
  27. <i class="el-icon-printer" v-if="scope.row.guidePrintTimes > 0" style="font-size: 20px; color: green" />
  28. </div>
  29. <div v-else-if="dropCol[index].prop == 'isLock'
  30. || dropCol[index].prop == 'isVip'
  31. || dropCol[index].prop == 'isUpload'
  32. ">
  33. {{ scope.row[dropCol[index].prop] == "Y" ? "是" : "否" }}
  34. </div>
  35. <div v-else-if="dropCol[index].prop == 'customerOrgParentName'">
  36. {{ scope.row.customerOrgParentName
  37. ? scope.row.customerOrgParentName
  38. : scope.row.customerOrgName }}
  39. </div>
  40. <div v-else-if="dropCol[index].prop == 'sexId'">
  41. {{ dddw(dict.sex, "id", scope.row[dropCol[index].prop], "displayName") }}
  42. </div>
  43. <div v-else-if="dropCol[index].prop == 'groupPack'">
  44. <div
  45. v-if="scope.row.medicalPackageId !== dict.personOrgId && scope.row.customerOrgId === dict.personOrgId">
  46. {{ dddw(dict.medicalPackage, "id", scope.row.medicalPackageId, "displayName") }}
  47. </div>
  48. <div
  49. v-if="scope.row.medicalPackageId !== dict.personOrgId && scope.row.customerOrgId !== dict.personOrgId">
  50. {{ dddw(dict.customerOrgGroupAll, "id", scope.row.customerOrgGroupId, "displayName") }}
  51. </div>
  52. </div>
  53. <div v-else-if="dropCol[index].prop == 'nationId'">
  54. {{ dddw(dict.nation, "id", scope.row[dropCol[index].prop], "displayName") }}
  55. </div>
  56. <div v-else-if="dropCol[index].prop == 'birthDate'
  57. || dropCol[index].prop == 'creationTime'">
  58. {{ scope.row[dropCol[index].prop] ? moment(scope.row[dropCol[index].prop]).format('yyyy-MM-DD') : '' }}
  59. </div>
  60. <div v-else-if="dropCol[index].prop == 'maritalStatusId'">
  61. {{ dddw(dict.maritalStatus, "id", scope.row[dropCol[index].prop], "displayName") }}
  62. </div>
  63. <div v-else-if="dropCol[index].prop == 'medicalTypeId'">
  64. {{ dddw(dict.medicalType, "id", scope.row[dropCol[index].prop], "displayName") }}
  65. </div>
  66. <div v-else-if="dropCol[index].prop == 'personnelTypeId'">
  67. {{ dddw(dict.personnelType, "id", scope.row[dropCol[index].prop], "displayName") }}
  68. </div>
  69. <div v-else>
  70. {{ scope.row[dropCol[index].prop] }}
  71. </div>
  72. </template>
  73. </el-table-column>
  74. <!--
  75. "sexHormoneTermId": "00000000-0000-0000-0000-000000000000",
  76. "interposeMeasure": null,
  77. "medicalConclusionId": "00000000-0000-0000-0000-000000000000",
  78. "reportPrintTimes": 0,
  79. "isMedicalStart": "N",
  80. "medicalStartDate": "6/28/2023",
  81. "isRecoverGuide": "N",
  82. "summaryDate": "",
  83. "summaryDoctor": null,
  84. "isAudit": "N",
  85. "auditDoctor": null,
  86. "auditDate": "",
  87. "isNameHide": "N",
  88. "isPhoneFollow": "N",
  89. "thirdInfo": null,
  90. "guidePrintTimes": null,
  91. "remark": null,
  92. "medicalCenterId": "00000000-0000-0000-0000-000000000000",
  93. "customerOrgRegisterId": "00000000-0000-0000-0000-000000000000",
  94. "lastModifierName": "",
  95. "lastModificationTime": null,
  96. "lastModifierId": null,
  97. "creatorId": null,
  98. "id": "3a0c196d-a6d0-37fe-5c32-4806bdc4530f"
  99. -->
  100. </el-table>
  101. <div style="display: flex;justify-content:space-between;">
  102. <div></div>
  103. <div>
  104. <span style="font-size:12px;">{{ loadOpts.totalCount }} 条记录当前显示{{ tableData.length }}
  105. </span>
  106. </div>
  107. </div>
  108. </div>
  109. <!-- 给合项目 基本信息 -->
  110. <el-tabs v-model="tabChoosed" style="margin-top: -22px;">
  111. <!-- 给合项目 -->
  112. <el-tab-pane label="预览" name="1">
  113. <PatientRegisterAsbItem />
  114. </el-tab-pane>
  115. </el-tabs>
  116. </div>
  117. <div style="margin-left: 10px;">
  118. <div v-show="checkPagePriv(pagePriv.privs, '全选')" class="listBtn">
  119. <el-button type="success" class="commonbutton" @click="btnChooseAll(1)">全选</el-button>
  120. </div>
  121. <div v-show="checkPagePriv(pagePriv.privs, '取消全选')" class="listBtn">
  122. <el-button type="success" class="commonbutton" @click="btnChooseAll(0)">取消全选</el-button>
  123. </div>
  124. <div v-show="checkPagePriv(pagePriv.privs, '预览设置')" class="listBtn">
  125. <el-button type="primary" class="commonbutton" @click="btnPrintPre">预览设置</el-button>
  126. </div>
  127. <div v-show="checkPagePriv(pagePriv.privs, '打印')" class="listBtn">
  128. <el-button type="danger" class="commonbutton" @click="btnPrint">打印</el-button>
  129. </div>
  130. <div v-show="checkPagePriv(pagePriv.privs, '发送申请')" class="listBtn">
  131. <el-button type="" class="commonbutton" @click="btnSendLis">发送申请</el-button>
  132. </div>
  133. <div v-show="checkPagePriv(pagePriv.privs, '撤消申请')" class="listBtn">
  134. <el-button type="" class="commonbutton" @click="btnUndoLis">撤消申请</el-button>
  135. </div>
  136. </div>
  137. </div>
  138. <!--组件弹窗-->
  139. <div>
  140. <!-- 通用进度条 -->
  141. <el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="600px" height="400" :show-close="false"
  142. :close-on-click-modal="false" :append-to-body="true">
  143. <ElProgressOCX />
  144. </el-dialog>
  145. </div>
  146. </div>
  147. </template>
  148. <script>
  149. import moment from "moment";
  150. import { mapState, mapActions } from "vuex";
  151. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  152. import Sortable from "sortablejs";
  153. import FileSaver from 'file-saver';
  154. import html2canvas from 'html2canvas';
  155. import {
  156. getPagePriv, checkPagePriv,
  157. dddw,
  158. objCopy,
  159. arrayReduce,
  160. arrayExistObj,
  161. deepCopy,
  162. } from "../../utlis/proFunc";
  163. import ElProgressOCX from "../../components/report/ElProgressOCX.vue";
  164. export default {
  165. components: {
  166. ElProgressOCX,
  167. },
  168. data() {
  169. return {
  170. pagePriv: {
  171. routeUrlorPageName: 'patientLis', //当前页面归属路由或归属页面权限名称
  172. privs: [] // 页面权限
  173. },
  174. peisid: null,
  175. startPoint: -1, // 多选起点 -1 表示选择
  176. endPoint: -1, // 多选终点 -1 表示未选择
  177. tableData: [], //表格数据
  178. tableDataCurrentRow: {}, // 当前被选中的行
  179. multipleSelection: [], //选中的数据列表
  180. tabChoosed: "1",
  181. rClickRow: null, //右击的行
  182. rClickColumn: null, //右击的列(预留)
  183. //动态列
  184. headerCols: [],
  185. //拖动列
  186. dropCol: [
  187. { label: "序号", prop: "sn", minWidth: 40, align: "center" },
  188. { label: "体检进度", prop: "completeFlag", minWidth: 80, align: "center" },
  189. { label: "打印", prop: "guidePrintTimes", minWidth: 55, align: "center" },
  190. { label: "锁住", prop: "isLock", minWidth: 55, align: "center" },
  191. { label: "单位", prop: "customerOrgParentName", minWidth: 180, align: "center" },
  192. { label: "部门", prop: "customerOrgName", minWidth: 120, align: "center" },
  193. { label: "姓名", prop: "patientName", minWidth: 80, align: "center" },
  194. { label: "性别", prop: "sexId", minWidth: 55, align: "center" },
  195. { label: "年龄", prop: "age", minWidth: 55, align: "center" },
  196. { label: "颜色", prop: "lisrequest", minWidth: 120, align: "center" },
  197. { label: "容器", prop: "lisrequest", minWidth: 120, align: "center" },
  198. { label: "项目分组", prop: "lisrequest", minWidth: 120, align: "center" },
  199. { label: "申请项目", prop: "lisrequest", minWidth: 120, align: "center" },
  200. { label: "检验码号", prop: "lisrequest", minWidth: 120, align: "center" },
  201. { label: "人员条码号", prop: "patientRegisterNo", minWidth: 150, align: "center" },
  202. { label: "档案号", prop: "patientNo", minWidth: 100, align: "center" },
  203. { label: "体检次数", prop: "medicalTimes", minWidth: 80, align: "center" },
  204. { label: "分组/套餐", prop: "groupPack", minWidth: 150, align: "center" },
  205. { label: "民族", prop: "nationId", minWidth: 55, align: "center" },
  206. { label: "身份证", prop: "idNo", minWidth: 150, align: "center" },
  207. { label: "出生日期", prop: "birthDate", minWidth: 80, align: "center" },
  208. { label: "邮箱", prop: "email", minWidth: 150, align: "center" },
  209. { label: "手机", prop: "mobileTelephone", minWidth: 100, align: "center" },
  210. { label: "电话", prop: "telephone", minWidth: 100, align: "center" },
  211. { label: "地址", prop: "address", minWidth: 300, align: "" },
  212. { label: "体检卡号", prop: "medicalCardNo", minWidth: 80, align: "center" },
  213. { label: "工卡号", prop: "jobCardNo", minWidth: 80, align: "center" },
  214. { label: "婚姻状况", prop: "maritalStatusId", minWidth: 80, align: "center" },
  215. { label: "体检类别", prop: "medicalTypeId", minWidth: 80, align: "center" },
  216. { label: "人员类别", prop: "personnelTypeId", minWidth: 80, align: "center" },
  217. { label: "职务", prop: "jobPost", minWidth: 80, align: "center" },
  218. { label: "职称", prop: "jobTitle", minWidth: 80, align: "center" },
  219. { label: "介绍人", prop: "salesman", minWidth: 80, align: "center" },
  220. { label: "是否VIP", prop: "isVip", minWidth: 80, align: "center" },
  221. { label: "登记人", prop: "creatorName", minWidth: 80, align: "center" },
  222. { label: "登记日期", prop: "creationTime", minWidth: 80, align: "center" },
  223. { label: "是否上传", prop: "isUpload", minWidth: 80, align: "center" },
  224. ],
  225. dom: null, //用于滚动加载数据
  226. lazyLoading: false, //是否懒加载中
  227. loadOpts: {
  228. totalCount: 0,
  229. skipCount: 0,
  230. maxResultCount: 100,
  231. },
  232. loadOptsInit: {},
  233. oneClick: 0, // 1 表示行单击一次
  234. DbClick: 0, // 1 表示行有单击第二次
  235. };
  236. },
  237. created() {
  238. //获取用户当前页面的权限
  239. let userPriv = window.sessionStorage.getItem('userPriv')
  240. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  241. this.loadOptsInit = Object.assign({}, this.loadOpts)
  242. },
  243. //挂载完成
  244. mounted() {
  245. // 初始化可以拖动的列
  246. this.headerCols = deepCopy(this.dropCol)
  247. this.dropCol = this.columnDrop(this.dropCol);
  248. this.$nextTick(() => {
  249. this.scrollFull()
  250. })
  251. },
  252. computed: {
  253. ...mapState([
  254. "window",
  255. "dataTransOpts",
  256. "dialogWin",
  257. "dict",
  258. "elProgress",
  259. "patientRegister",
  260. "customerOrg",
  261. ]),
  262. },
  263. methods: {
  264. ...mapActions(["getCustomerOrgGroup", "getPatientRegisterAbs"]),
  265. moment, dddw, deepCopy, checkPagePriv,
  266. // 扩展定义表格行样式
  267. handleRowClassName({ row, rowIndex }) {
  268. // highLightBg 为 'selected'的高亮
  269. //console.log(rowIndex, row)
  270. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  271. if (row.choosed) {
  272. return "current-row";
  273. } else {
  274. return "";
  275. }
  276. },
  277. // 全选 取消全选
  278. btnChooseAll(type){
  279. if(type == 1){
  280. // 全选
  281. }else{
  282. }
  283. },
  284. // 行选择
  285. rowSelected(rows) {
  286. rows.forEach((e) => {
  287. this.$refs["info"].toggleRowSelection(e, true);
  288. });
  289. },
  290. refFuncSetData(item, v) {
  291. setData(this, item, v)
  292. },
  293. handleSelectionChange(rows) {
  294. //this.multipleSelection = rows;
  295. //console.log('this.multipleSelection',this.multipleSelection)
  296. rows.forEach((item) => {
  297. item.highLightBg = "selected";
  298. });
  299. // 取消全选
  300. if (!rows.length) {
  301. this.tableData.forEach((item) => {
  302. item.highLightBg = "";
  303. });
  304. }
  305. this.multipleSelection = JSON.parse(JSON.stringify(rows));
  306. },
  307. //点击体检次数行
  308. rowClick(row) {
  309. if (this.oneClick == 0) {
  310. this.oneClick = 1;
  311. } else {
  312. this.DbClick = 1;
  313. }
  314. //双击事件
  315. if (this.DbClick == 1) { //第一次点击的节点和第二次点击的节点id相同
  316. this.rowClickRetrieve(row)
  317. return;
  318. }
  319. setTimeout(() => { //300ms内没有第二次点击,执行单击事件
  320. if (this.oneClick == 1 && this.DbClick == 0) this.rowClickRetrieve(row)
  321. }, 300)
  322. },
  323. rowClickRetrieve(row) {
  324. this.oneClick = 0;
  325. this.DbClick = 0;
  326. // 按住了shift键
  327. if (this.window.shift) {
  328. //清除所有选择
  329. this.tableData.forEach((e, index) => {
  330. e.choosed = false;
  331. e.index = index;
  332. });
  333. if (this.startPoint == -1) {
  334. this.tableData[row.index].choosed = true;
  335. this.startPoint = row.index;
  336. } else {
  337. if (this.startPoint > row.index) {
  338. for (let i = row.index; i <= this.startPoint; i++) {
  339. this.tableData[i].choosed = true;
  340. }
  341. } else if (this.startPoint <= row.index) {
  342. for (let i = this.startPoint; i <= row.index; i++) {
  343. this.tableData[i].choosed = true;
  344. }
  345. }
  346. }
  347. } else if (this.window.ctrl) { // 按住了ctrl 键
  348. this.tableData[row.index].choosed = true;
  349. if (this.startPoint == -1) {
  350. this.startPoint = row.index;
  351. }
  352. } else {
  353. // 未按住了ctrl 、shift 键
  354. //清除所有选择
  355. console.log("清除所有选择");
  356. this.tableData.forEach((e, index) => {
  357. e.choosed = false;
  358. e.index = index;
  359. });
  360. console.log(this.tableData, row.index);
  361. console.log(this.tableData[row.index].choosed);
  362. this.tableData[row.index].choosed = true;
  363. this.startPoint = row.index;
  364. }
  365. //选中了多个点编辑时,排序最前的作为当前选中的
  366. console.log('row.index <= this.startPoint', row.index, this.startPoint)
  367. let lfind = -1
  368. for (let i = 0; i < this.tableData.length; i++) {
  369. if (this.tableData[i].choosed) {
  370. lfind = i
  371. break
  372. }
  373. }
  374. if (lfind > -1) {
  375. // 弹出编辑框,只有在编辑框显示时,才去触发获取数据
  376. this.dataTransOpts.tableS.patient_register.id = this.tableData[lfind].id
  377. this.tableDataCurrentRow = deepCopy(this.tableData[lfind])
  378. this.dataTransOpts.refresh.register_check_asbitem.M++ //触发所选组合项目刷新
  379. }
  380. },
  381. // 双击
  382. rowDblclick(row) {
  383. this.rowClick(row)
  384. this.btnEdit()
  385. },
  386. //查询
  387. async Query() {
  388. // 查询时,清掉明细数据 (滚动时不清)
  389. this.dataTransOpts.tableS.patient_register.id = ''
  390. this.tableDataCurrentRow = {} // 清除选择
  391. this.tableData = []
  392. setTimeout(() => {
  393. this.dataTransOpts.refresh.register_check_asbitem.M++ //触发所选组合项目刷新
  394. }, 10);
  395. this.loadOpts = Object.assign(this.loadOpts, this.loadOptsInit)
  396. await this.getPrList()
  397. },
  398. //数据量多时,滚动加载
  399. async load() {
  400. this.loadOpts.skipCount++
  401. await this.getPrList()
  402. },
  403. // 获取列表数据
  404. async getPrList() {
  405. if (this.loadOpts.skipCount != 0 && this.loadOpts.skipCount * this.loadOpts.maxResultCount >= this.loadOpts.totalCount) return
  406. console.log('getPrList', this.loadOpts)
  407. let body = {
  408. skipCount: this.loadOpts.skipCount,
  409. maxResultCount: this.loadOpts.maxResultCount
  410. };
  411. console.log(`this.patientRegister.query`, this.patientRegister.query);
  412. if (this.patientRegister.query.customerOrgFlag) {
  413. // if (this.patientRegister.query.CustomerOrgParentId) {
  414. // body.customerOrgId = this.patientRegister.query.CustomerOrgParentId;
  415. // } else {
  416. // if (this.patientRegister.query.customerOrgId)
  417. // body.customerOrgId = this.patientRegister.query.customerOrgId;
  418. // }
  419. if (this.patientRegister.query.customerOrgId) body.customerOrgId = this.patientRegister.query.customerOrgId;
  420. if (this.patientRegister.query.customerOrgId
  421. && this.patientRegister.query.customerOrgId != this.dict.personOrgId
  422. && this.patientRegister.query.customerOrgRegister.id) {
  423. body.customerOrgRegisterId = this.patientRegister.query.customerOrgRegister.id
  424. }
  425. }
  426. if (this.patientRegister.query.sex)
  427. body.sexId = this.patientRegister.query.sex;
  428. if (this.patientRegister.query.patientName)
  429. body.patientName = this.patientRegister.query.patientName;
  430. if (this.patientRegister.query.completeFlag)
  431. body.completeFlag = this.patientRegister.query.completeFlag;
  432. //StartDate EndDate
  433. if (
  434. this.patientRegister.query.startDate &&
  435. this.patientRegister.query.endDate
  436. ) {
  437. body.startDate = moment(this.patientRegister.query.startDate).format(
  438. "yyyy-MM-DD"
  439. );
  440. body.endDate = moment(this.patientRegister.query.endDate).format(
  441. "yyyy-MM-DD"
  442. );
  443. if (body.startDate > body.endDate) {
  444. this.$message.warning("起始日期不能大于截止日期,数据校验不通过!");
  445. return;
  446. }
  447. }
  448. if (this.patientRegister.query.phone)
  449. body.phone = this.patientRegister.query.phone;
  450. if (this.patientRegister.query.idCardNo)
  451. body = { idNo: this.patientRegister.query.idCardNo };
  452. if (this.patientRegister.query.patientNo)
  453. body = { patientNo: this.patientRegister.query.patientNo };
  454. if (this.patientRegister.query.patientRegisterNo)
  455. body = {
  456. patientRegisterNo: this.patientRegister.query.patientRegisterNo,
  457. };
  458. console.log("/api/app/patientregister/getlistinfilter", body);
  459. postapi("/api/app/patientregister/getlistinfilter", body)
  460. .then(res => {
  461. if (res.code != -1) {
  462. // 刷新最大记录数
  463. this.loadOpts.totalCount = res.data.totalCount
  464. let curLoad = res.data.items
  465. let oldCount = 0
  466. if (body.skipCount == 0) { //查询
  467. this.tableData = [];
  468. } else {
  469. // 懒加载 ,原数据集不用清空
  470. oldCount = this.tableData.length
  471. }
  472. curLoad.forEach((e, index) => {
  473. this.tableData.push(Object.assign({ index: Number(oldCount) + Number(index), choosed: false }, e))
  474. })
  475. //如果 有选中 记录,则刷新其对应的组合项目
  476. if (this.dataTransOpts.tableS.patient_register.id) {
  477. this.dataTransOpts.refresh.register_check_asbitem.M++
  478. }
  479. }
  480. })
  481. },
  482. //滚动加载数据
  483. scrollFull() {
  484. this.dom = this.$refs['info'].bodyWrapper
  485. console.log('this.dom', this.dom)
  486. this.dom.addEventListener('scroll', async () => {
  487. // console.log('scrollTop',this.dom.scrollTop,'clientHeight',this.dom.clientHeight,'scrollHeight',this.dom.scrollHeight);
  488. if (this.dom.scrollTop + this.dom.clientHeight + 20 > this.dom.scrollHeight && !this.lazyLoading) {
  489. // 获取到的不是全部数据 当滚动到底部
  490. console.log('scrollTop', this.dom.scrollTop, 'clientHeight', this.dom.clientHeight, 'scrollHeight', this.dom.scrollHeight);
  491. if ((Number(this.loadOpts.skipCount) + 1) * Number(this.loadOpts.maxResultCount) >= Number(this.loadOpts.totalCount)) {
  492. this.lazyLoading = false
  493. } else {
  494. this.lazyLoading = true
  495. await this.load()
  496. this.lazyLoading = false
  497. // this.dom.scrollTop = this.dom.scrollTop - 100
  498. }
  499. }
  500. })
  501. },
  502. // 预览设置
  503. btnPrintPre(){
  504. },
  505. // 打印
  506. btnPrint(){
  507. },
  508. // 发送检验申请
  509. btnSendLis(){
  510. console.log('btnSendLis')
  511. },
  512. // 撤消检验申请
  513. btnUndoLis(){
  514. console.log('btnUndoLis')
  515. },
  516. //检验申请
  517. async lisRequest(prId) {
  518. let isPrintLisRequest = false;
  519. let res = null;
  520. if (prId.length < 1) {
  521. this.$message.info("人员信息尚未保存,不可执行此操作!");
  522. return;
  523. }
  524. try {
  525. res = await postapi(
  526. `/api/app/lisrequest/setlisrequest?PatientRegisterId=${prId}`
  527. );
  528. console.log(
  529. `/api/app/lisrequest/setlisrequest?PatientRegisterId=${prId}`,
  530. res
  531. );
  532. } catch (error) {
  533. return;
  534. }
  535. if (res.code != -1) {
  536. this.$message.info("发送检验申请成功!");
  537. isPrintLisRequest = true;
  538. }
  539. //重复申请,重打
  540. if (res.code == -1 && res.message.indexOf("已申请") > -1) {
  541. isPrintLisRequest = true;
  542. }
  543. if (!isPrintLisRequest) return;
  544. try {
  545. await this.$confirm("是否打印检验申请单?", "提示", {
  546. confirmButtonText: "是",
  547. cancelButtonText: "否",
  548. type: "info",
  549. showClose: false,
  550. closeOnClickModal: false,
  551. closeOnPressEscape: false,
  552. });
  553. } catch (error) {
  554. return;
  555. }
  556. //打印检验申请单
  557. this.lisPrint(prId, "0003", false);
  558. },
  559. //检验条码打印
  560. lisPrint(prId, ReportCode, isPreview) {
  561. if (!this.$peisAPI) {
  562. this.$message.info("此功能,需要在壳客户端才可运行!");
  563. return;
  564. }
  565. let token = window.sessionStorage.getItem("token");
  566. let user = window.sessionStorage.getItem("user");
  567. let toOutShell = {
  568. ReportCode,
  569. token,
  570. preViewCanPrint: "N",
  571. Parameters: [
  572. { Name: "printer", Value: user },
  573. { Name: "hisLog", Value: "pic/hisLog.jpg" },
  574. ],
  575. BusinessCode:prId
  576. };
  577. if (isPreview) {
  578. /*
  579. postapi(
  580. `/api/app/printreport/getlisrequestreport?PatientRegisterId=${prId}`
  581. )
  582. .then((res) => {
  583. if (res.code != -1) {
  584. toOutShell.ReportTable = { lisRequest: res.data };
  585. console.log(
  586. "JSON.stringify(toOutShell)",
  587. JSON.stringify(toOutShell)
  588. );
  589. return this.$peisAPI.printPre(JSON.stringify(toOutShell));
  590. }
  591. })
  592. .catch((err) => {
  593. this.$message.warning(err);
  594. });
  595. */
  596. this.$peisAPI.printPre(JSON.stringify(toOutShell))
  597. .then(res => {
  598. if (JSON.parse(res).code < 0) {
  599. this.$message.warning({ showClose: true, message: JSON.parse(res).message });
  600. }
  601. })
  602. .catch((err) => {
  603. console.log('打印检验条码错误', err)
  604. this.$message.warning({ showClose: true, message: `${err}` });
  605. });
  606. } else {
  607. /*
  608. postapi(
  609. `/api/app/printreport/getlisrequestreport?PatientRegisterId=${prId}`
  610. )
  611. .then((res) => {
  612. if (res.code != -1) {
  613. toOutShell.ReportTable = { lisRequest: res.data };
  614. console.log(
  615. "JSON.stringify(toOutShell)",
  616. JSON.stringify(toOutShell)
  617. );
  618. return this.$peisAPI.print(JSON.stringify(toOutShell));
  619. }
  620. })
  621. .then((res) => {
  622. //console.log("res", res);
  623. if (JSON.parse(res).code >= 0) {
  624. //更新打印状态 /api/app/lisrequest/updatelisrequestisprint
  625. // {
  626. // "operateType": 0, 操作类型(1.按PatientRegisterId 2.按LisRequestId)
  627. // "patientRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  628. // "lisRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  629. // }
  630. return postapi("/api/app/lisrequest/updatelisrequestisprint", {
  631. operateType: 1,
  632. patientRegisterId: prId,
  633. });
  634. }
  635. })
  636. .catch((err) => {
  637. this.$message.warning(err);
  638. });
  639. */
  640. this.$peisAPI.print(JSON.stringify(toOutShell))
  641. .then(res => {
  642. if (JSON.parse(res).code < 0) {
  643. this.$message.warning({ showClose: true, message: JSON.parse(res).message });
  644. }else{
  645. return postapi("/api/app/lisrequest/updatelisrequestisprint", {
  646. operateType: 1,
  647. patientRegisterId: prId,
  648. });
  649. }
  650. })
  651. .then(res => {
  652. if(res && res.code < 0){
  653. this.$message.error({ showClose: true, message: `${res.message}` });
  654. }
  655. })
  656. .catch((err) => {
  657. console.log('打印检验条码错误', err)
  658. this.$message.error({ showClose: true, message: `${err}` });
  659. });
  660. }
  661. },
  662. //pacs条码打印
  663. pacsPrint(prId, ReportCode, isPreview) {
  664. if (!this.$peisAPI) {
  665. this.$message.info("此功能,需要在壳客户端才可运行!");
  666. return;
  667. }
  668. let token = window.sessionStorage.getItem("token");
  669. let user = window.sessionStorage.getItem("user");
  670. let toOutShell = {
  671. ReportCode,
  672. token,
  673. preViewCanPrint: "Y",
  674. Parameters: [
  675. { Name: "printer", Value: user },
  676. { Name: "hisLog", Value: "pic/hisLog.jpg" },
  677. ],
  678. BusinessCode:prId
  679. };
  680. if (isPreview) {
  681. /*
  682. postapi(
  683. `/api/app/printreport/getpacsnoreport?PatientRegisterId=${prId}`
  684. )
  685. .then((res) => {
  686. if (res.code != -1) {
  687. toOutShell.ReportTable = { lisRequest: res.data };
  688. console.log(
  689. "JSON.stringify(toOutShell)",
  690. JSON.stringify(toOutShell)
  691. );
  692. return this.$peisAPI.printPre(JSON.stringify(toOutShell));
  693. }
  694. })
  695. .catch((err) => {
  696. this.$message.warning(err);
  697. });
  698. */
  699. this.$peisAPI.printPre(JSON.stringify(toOutShell))
  700. .then(res => {
  701. if (JSON.parse(res).code < 0) {
  702. this.$message.warning({ showClose: true, message: JSON.parse(res).message });
  703. }
  704. })
  705. .catch((err) => {
  706. console.log('打印pacs条码错误', err)
  707. this.$message.warning({ showClose: true, message: `${err}` });
  708. });
  709. } else {
  710. /*
  711. postapi(
  712. `/api/app/printreport/getpacsnoreport?PatientRegisterId=${prId}`
  713. )
  714. .then((res) => {
  715. if (res.code != -1) {
  716. toOutShell.ReportTable = { lisRequest: res.data };
  717. console.log(
  718. "JSON.stringify(toOutShell)",
  719. JSON.stringify(toOutShell)
  720. );
  721. return this.$peisAPI.print(JSON.stringify(toOutShell));
  722. }
  723. })
  724. .then((res) => {
  725. if (JSON.parse(res).code >= 0) {
  726. //更新打印状态 /api/app/lisrequest/updatelisrequestisprint
  727. // {
  728. // "operateType": 0, 操作类型(1.按PatientRegisterId 2.按LisRequestId)
  729. // "patientRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  730. // "lisRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  731. // }
  732. return postapi("/api/app/lisrequest/updatelisrequestisprint", {
  733. operateType: 1,
  734. patientRegisterId: prId,
  735. });
  736. }
  737. })
  738. .catch((err) => {
  739. this.$message.warning(err);
  740. });
  741. */
  742. this.$peisAPI.print(JSON.stringify(toOutShell))
  743. .then(res => {
  744. if (JSON.parse(res).code < 0) {
  745. this.$message.warning({ showClose: true, message: JSON.parse(res).message });
  746. }else{
  747. return postapi("/api/app/lisrequest/updatelisrequestisprint", {
  748. operateType: 1,
  749. patientRegisterId: prId,
  750. });
  751. }
  752. })
  753. .then(res => {
  754. if(res && res.code < 0){
  755. this.$message.error({ showClose: true, message: `${res.message}` });
  756. }
  757. })
  758. .catch((err) => {
  759. console.log('打印pacs条码错误', err)
  760. this.$message.error({ showClose: true, message: `${err}` });
  761. });
  762. }
  763. },
  764. columnDrop(dropCol) {
  765. //获取dom节点
  766. const wrapperTr = document.querySelector(".el-table__header-wrapper tr");
  767. Sortable.create(wrapperTr, {
  768. animation: 180,
  769. delay: 0,
  770. // 元素被选中
  771. onChoose: function (/**Event*/ evt) {
  772. //console.log('onChoose',evt,evt.oldIndex)
  773. evt.oldIndex; // element index within parent
  774. },
  775. // 元素未被选中的时候(从选中到未选中)
  776. onUnchoose: function (/**Event*/ evt) {
  777. // same properties as onEnd
  778. },
  779. // 开始拖拽的时候
  780. onStart: function (/**Event*/ evt) {
  781. //console.log('onStart',evt,evt.oldIndex)
  782. evt.oldIndex; // element index within parent
  783. },
  784. onEnd: (evt) => {
  785. const oldItem = dropCol[evt.oldIndex]; // dropCol[evt.oldIndex - 1];
  786. if (oldItem) {
  787. dropCol.splice(evt.oldIndex, 1);
  788. dropCol.splice(evt.newIndex, 0, oldItem);
  789. }
  790. //console.log(this.headerCols, oldItem, dropCol);
  791. },
  792. });
  793. return dropCol;
  794. },
  795. //通用导出
  796. btnExport(elId) {
  797. // 获取HTML元素(表格)
  798. // let table = document.getElementById(elId); //.cloneNode(true)
  799. this.$nextTick(() => {
  800. let refsTable = this.$refs[elId] //.cloneNode(true) true
  801. let table = document.getElementById(elId)
  802. console.log('table,refsTable', table, refsTable)
  803. let tableData = table.innerHTML
  804. let fileName = moment(new Date()).format('yyyyMMDDHHmmss')
  805. let blob = new Blob([tableData], { type: "text/plain;charset=utf-8" });
  806. FileSaver.saveAs(blob, fileName + '.xls');
  807. // 导出图片
  808. // 使用html2canvas将HTML元素转换为画布
  809. // let cloneTable = table.cloneNode(true) //[elId]
  810. html2canvas(table).then(canvas => {
  811. // 创建一个a元素用于下载
  812. const link = document.createElement('a');
  813. link.href = canvas.toDataURL('image/jpeg');
  814. link.download = fileName + '.jpg';
  815. document.body.appendChild(link);
  816. link.click();
  817. //document.body.removeChild(link);
  818. // // 创建一个PDF对象
  819. // var pdf = new jsPDF();
  820. // // 设置PDF的尺寸
  821. // pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0, canvas.width, canvas.height);
  822. // // 导出PDF
  823. // pdf.save('员工信息表.pdf');
  824. });
  825. })
  826. },
  827. },
  828. //监听事件
  829. watch: {
  830. "patientRegister.query.customerOrgId": {
  831. // immediate: true, // 立即执行
  832. // deep: true, // 深度监听复杂类型内变化
  833. handler(newVal, oldVal) {
  834. //console.log('watch:patientRegister.query.customerOrgId:',newVal,oldVal)
  835. // 单位变化时,清除当前列表信息
  836. if (newVal && newVal != oldVal) {
  837. this.tableData = []
  838. this.dataTransOpts.tableM.register_check_asbitem = []
  839. }
  840. }
  841. },
  842. //触发查询事件
  843. "patientRegister.query.times"(newVal, oldVal) {
  844. if (newVal != oldVal) {
  845. //alert('触发查询事件')
  846. this.Query();
  847. }
  848. },
  849. //新增后,触发赋值
  850. // "patientRegister.patientRegisterRd.id"(newVal, oldVal) {
  851. // if (newVal != oldVal) {
  852. // //console.log('patientRegister.patientRegisterRd.customerOrgId',this.patientRegister.patientRegisterRd.customerOrgId)
  853. // objCopy(this.patientRegister.patientRegisterRd, this.form);
  854. // }
  855. // },
  856. },
  857. };
  858. </script>
  859. <style scoped>
  860. @import "../../assets/css/global_input.css";
  861. @import "../../assets/css/global_table.css";
  862. @import "../../assets/css/global.css";
  863. .box {
  864. display: flex;
  865. }
  866. .listBtn {
  867. margin-top: 5px;
  868. text-align: center;
  869. }
  870. .btnClass {
  871. width: 100px;
  872. }
  873. </style>