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.

1072 lines
32 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
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>
  3. <el-card>
  4. <div slot="header">诊断模板</div>
  5. <div style="display: flex">
  6. <div>
  7. <div
  8. :style="
  9. 'width:' +
  10. (window.pageWidth < 750 ? 595 : window.pageWidth - 45 - 110) +
  11. 'px;'
  12. "
  13. >
  14. <el-table
  15. :data="tableData"
  16. row-key="id"
  17. width="100%"
  18. border
  19. height="240px"
  20. class="el-table__body-wrapper tbody"
  21. border:stripe="true"
  22. @row-click="rowick"
  23. ref="info"
  24. highlight-current-row
  25. >
  26. <el-table-column prop="id" label="编号" width="300">
  27. </el-table-column>
  28. <el-table-column prop="displayName" label="名称">
  29. </el-table-column>
  30. <el-table-column prop="creatorName" label="创建者">
  31. </el-table-column>
  32. <el-table-column prop="creationTime" label="创建时间" width="180">
  33. <template slot-scope="scope">
  34. {{ scope.row.creationTime | dateFormat }}
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="lastModifierName" label="修改者">
  38. </el-table-column>
  39. <el-table-column
  40. prop="lastModificationTime"
  41. label="修改时间"
  42. width="180"
  43. >
  44. <template slot-scope="scope">
  45. {{ scope.row.lastModificationTime | dateFormat }}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="操作" width="">
  49. <template>
  50. <el-tag
  51. class="move"
  52. style="
  53. cursor: move;
  54. margin-left: 15px;
  55. background-color: rgb(245, 245, 245);
  56. border: none;
  57. "
  58. draggable="true"
  59. >
  60. <i
  61. class="el-icon-d-caret"
  62. style="
  63. width: 1rem;
  64. height: 1rem;
  65. color: rgb(113, 113, 113);
  66. "
  67. ></i>
  68. </el-tag>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </div>
  73. <div style="display: flex; margin-top: 5px">
  74. <div
  75. :style="
  76. 'width:' +
  77. (window.pageWidth < 750
  78. ? 0
  79. : Math.round((window.pageWidth - 750) / 2)) +
  80. 'px;'
  81. "
  82. ></div>
  83. <!--未选诊断模块-->
  84. <div style="width: 235px">
  85. <div>
  86. <span style="padding-right: 5px">项目类别</span>
  87. <el-cascader
  88. :options="dict.itemTypeTree"
  89. v-model="itemTypeIds"
  90. style="margin-left: 3px; width: 160px"
  91. :props="{
  92. checkStrictly: true,
  93. expandTrigger: 'hover',
  94. ...customerOrg.treeprops,
  95. }"
  96. :show-all-levels="false"
  97. clearable
  98. filterable
  99. @change="getAsbItemByItemType"
  100. size="small"
  101. >
  102. </el-cascader>
  103. </div>
  104. <div class="box">
  105. <el-table
  106. :data="dict.asbItem"
  107. width="160"
  108. border
  109. :height="
  110. window.pageHeight < 600
  111. ? 165
  112. : window.pageHeight - 150 - 240 - 45
  113. "
  114. highlight-current-row
  115. @row-dblclick="dbClickChoosedAsb"
  116. @selection-change="handleSelectionChange"
  117. :row-class-name="handleRowClassName"
  118. @row-click="chooseAsbItem"
  119. >
  120. <el-table-column prop="displayName" label="未选诊断" />
  121. </el-table>
  122. </div>
  123. </div>
  124. <!--中间操作按钮-->
  125. <div style="display: block; margin: 40px 10px 0 10px">
  126. <div>
  127. <el-button
  128. class="btnClass"
  129. @click="addAbs(asbItemChoosed, 'choosed')"
  130. >添加 <i class="el-icon-arrow-right"></i
  131. ></el-button>
  132. </div>
  133. <div>
  134. <el-button
  135. class="btnClass"
  136. @click="addAbs(asbItemChoosed, 'all')"
  137. >全部添加</el-button
  138. >
  139. </div>
  140. <div>
  141. <el-button
  142. class="btnClass"
  143. @click="delAbs(patientRegisterAbsChoosed, 'choosed')"
  144. >移除 <i class="el-icon-arrow-left"></i
  145. ></el-button>
  146. </div>
  147. <div>
  148. <el-button
  149. class="btnClass"
  150. @click="delAbs(patientRegisterAbsChoosed, 'all')"
  151. >全部移除</el-button
  152. >
  153. </div>
  154. </div>
  155. <!-- 已选诊断模块 -->
  156. <div style="width: 235px">
  157. <div>
  158. <span style="padding-right: 5px">快速选择</span>
  159. <el-select
  160. v-model="asbItemId"
  161. placeholder="快速选择诊断"
  162. size="small"
  163. filterable
  164. default-first-option
  165. :filter-method="filterMethod"
  166. clearable
  167. @clear="quickAsb = deepCopy(dict.asbItemQuick)"
  168. @change="quickChoosedAsb"
  169. ref="quickAsbOCX"
  170. style="margin-left: 3px; width: 160px"
  171. >
  172. <el-option
  173. v-for="item in quickAsb"
  174. :key="item.id"
  175. :value="item.id"
  176. :label="item.displayName"
  177. />
  178. </el-select>
  179. </div>
  180. <div class="box">
  181. <el-table
  182. :data="sampleGroupAsbitems"
  183. width="160"
  184. border
  185. :height="
  186. window.pageHeight < 600
  187. ? 165
  188. : window.pageHeight - 150 - 240 - 45
  189. "
  190. @selection-change="selecteditems"
  191. highlight-current-row
  192. :row-class-name="handleRowClassName"
  193. @row-dblclick="removeAbs"
  194. @row-click="removeAsbItem"
  195. >
  196. <el-table-column prop="displayName" label="已选诊断" />
  197. </el-table>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <!-- 按钮区域 -->
  203. <div style="margin-left: 10px">
  204. <div>
  205. <el-button @click="btnAdd" class="btnClass">新增</el-button>
  206. </div>
  207. <div>
  208. <el-button @click="btnEdit" class="btnClass">编辑</el-button>
  209. </div>
  210. <div>
  211. <el-button @click="btnDel" class="btnClass">删除</el-button>
  212. </div>
  213. <div>
  214. <el-button @click="btnSetTop" class="btnClass">置顶</el-button>
  215. </div>
  216. <div>
  217. <el-button @click="btnSetButtom" class="btnClass">置底</el-button>
  218. </div>
  219. <div>
  220. <el-button :disabled="isshow" @click="btnSaveSort" class="btnClass"
  221. >排序</el-button
  222. >
  223. </div>
  224. <div style="margin-top: 100px">
  225. <el-button @click="saveAsb" class="btnClass">确定项目</el-button>
  226. </div>
  227. </div>
  228. </div>
  229. </el-card>
  230. <!-- 新增弹框 -->
  231. <el-dialog
  232. :title="title == 1 ? '新增' : '修改'"
  233. :visible.sync="dialogVisible"
  234. width="520px"
  235. :close-on-click-modal="false"
  236. @close="closeDialog"
  237. >
  238. <el-form ref="form" :model="form" label-width="80px" :rules="rules">
  239. <el-row>
  240. <el-col :span="24">
  241. <el-form-item label="名称" prop="displayName">
  242. <el-input
  243. ref="refinput"
  244. v-model="form.displayName"
  245. style="width: 100%"
  246. ></el-input> </el-form-item
  247. ></el-col>
  248. </el-row>
  249. <el-row>
  250. <el-col :span="12">
  251. <el-form-item label="创建者">
  252. <el-input v-model="form.creatorName" disabled></el-input>
  253. </el-form-item>
  254. </el-col>
  255. <el-col :span="12">
  256. <el-form-item label="创建时间">
  257. <el-input :value="form.creationTime" disabled></el-input>
  258. </el-form-item>
  259. </el-col>
  260. </el-row>
  261. <el-row>
  262. <el-col :span="12">
  263. <el-form-item label="修改者">
  264. <el-input v-model="form.lastModifierName" disabled></el-input>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="12">
  268. <el-form-item label="修改时间">
  269. <el-input :value="form.lastModificationTime" disabled></el-input>
  270. </el-form-item>
  271. </el-col>
  272. </el-row>
  273. </el-form>
  274. <span slot="footer" class="dialog-footer">
  275. <el-button @click="dialogVisible = false"> </el-button>
  276. <el-button type="primary" @click="onSubmit"> </el-button>
  277. </span>
  278. </el-dialog>
  279. </div>
  280. </template>
  281. <script>
  282. import Sortable from "sortablejs";
  283. import {
  284. groupinglist,
  285. samplegroup,
  286. samplegropid,
  287. barcodeediting,
  288. barcodedeleteid,
  289. barcodedetopbottom,
  290. barcodedraganddrop,
  291. projectlist,
  292. itemtypeid,
  293. sampleasbitemid,
  294. asbitmfilte,
  295. } from "@/request/commonapi";
  296. import { specimenlist, containerlist } from "@/request/systemapi";
  297. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  298. import { mapState } from "vuex";
  299. import {
  300. arrayExistObj,
  301. tcdate,
  302. arrayFilter,
  303. arrayReduce,
  304. deepCopy,
  305. dddw,
  306. objCopy,
  307. } from "../../utlis/proFunc";
  308. export default {
  309. data() {
  310. return {
  311. itemTypeIds: [], //项目类别
  312. asbItemId: "", //当前快速选到的给合项目ID
  313. quickAsb: [], //过滤显示的诊断
  314. rules: {
  315. displayName: [
  316. { required: true, message: "请输入名称", trigger: "blur" },
  317. ],
  318. },
  319. isdislob: true,
  320. filetelists: [],
  321. flitvalues: [],
  322. checked: [],
  323. tableHeight: window.innerHeight - 500, //表格动态高度
  324. screenHeight: window.innerHeight, //内容区域高度
  325. isshow: true,
  326. form: {
  327. displayName: "",
  328. },
  329. dialogVisible: false,
  330. title: 1,
  331. loading: false,
  332. pages: {
  333. SkipCount: 0,
  334. MaxResultCount: 100,
  335. Sorting: "displayOrder desc",
  336. },
  337. tableData: [],
  338. initTableData: [],
  339. projectid: [],
  340. sampleGroupAsbitems: [], //右侧数据
  341. num: "",
  342. nums: "",
  343. values: "",
  344. rightobj: {},
  345. leftobj: {},
  346. ischank: 1,
  347. filete: {
  348. Filter: "",
  349. },
  350. ary1: [],
  351. ary2: [],
  352. sdate: [],
  353. curRow: {},
  354. };
  355. },
  356. created() {
  357. this.dictInit();
  358. this.getlist();
  359. this.posjectlist();
  360. },
  361. mounted() {
  362. this.rowDrop();
  363. },
  364. watch: {
  365. // 监听screenHeight从而改变table的高度
  366. // screenHeight(val) {
  367. // this.screenHeight = val;
  368. // this.tableHeight = this.screenHeight - 220;
  369. // },
  370. },
  371. computed: {
  372. ...mapState(["window", "dict", "customerOrg"]),
  373. },
  374. methods: {
  375. //初始数据
  376. dictInit() {
  377. //体检类别 树结构
  378. getapi("/api/app/item-type/by-code-all").then((res) => {
  379. if (res.code != -1) {
  380. this.dict.itemTypeTree = res.data;
  381. tcdate(this.dict.itemTypeTree);
  382. }
  383. });
  384. //获取所有诊断
  385. postapi("/api/app/diagnosis/getlistinsuggestion").then((res) => {
  386. if (res.code != -1) {
  387. this.dict.asbItemAll = res.data;
  388. this.dict.asbItemAll.forEach((e) => {
  389. e.choosed = false;
  390. });
  391. this.dict.asbItem = deepCopy(this.dict.asbItemAll);
  392. this.dict.asbItemQuick = deepCopy(res.data);
  393. this.quickAsb = deepCopy(res.data);
  394. }
  395. });
  396. },
  397. handleRowClassName({ row, rowIndex }) {
  398. // highLightBg 为 'selected'的高亮
  399. //console.log(rowIndex, row)
  400. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  401. if (row.choosed) {
  402. return "current-row";
  403. } else {
  404. return "";
  405. }
  406. },
  407. //项目类别过滤 诊断,未过滤已选择的诊断
  408. getAsbItemByItemTypeAll() {
  409. //console.log('getAsbItemByItemType', typeof this.itemTypeIds, this.itemTypeIds)
  410. let lv = "";
  411. if (typeof this.itemTypeIds === "object") {
  412. lv = this.itemTypeIds[this.itemTypeIds.length - 1];
  413. }
  414. if (lv) {
  415. this.dict.asbItem = arrayFilter(this.dict.asbItemAll, "itemTypeId", lv);
  416. } else {
  417. this.dict.asbItem = deepCopy(this.dict.asbItemAll);
  418. }
  419. //console.log('lv,this.dict.asbItem', lv, this.dict.asbItem)
  420. this.dict.asbItemQuick = deepCopy(this.dict.asbItemAll);
  421. },
  422. //按项目类别显示诊断,并过滤已选择的诊断
  423. getAsbItemByItemType() {
  424. this.getAsbItemByItemTypeAll();
  425. //刷新显示 未选诊断
  426. arrayReduce(this.dict.asbItem, [...this.sampleGroupAsbitems], "id=id");
  427. arrayReduce(
  428. this.dict.asbItemQuick,
  429. [...this.sampleGroupAsbitems],
  430. "id=id"
  431. );
  432. this.quickAsb = deepCopy(this.dict.asbItemQuick);
  433. },
  434. //快速选择诊断时,调整可按拼间简码及简称查找
  435. filterMethod(keyWords) {
  436. //console.log('filterMethod',this.dict.asbItemQuick)
  437. if (keyWords) {
  438. this.quickAsb = [];
  439. console.log(this.dict.asbItemQuick);
  440. this.dict.asbItemQuick.forEach((item) => {
  441. if (
  442. item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) >
  443. -1 ||
  444. item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > -1
  445. ) {
  446. this.quickAsb.push(item);
  447. }
  448. });
  449. } else {
  450. this.quickAsb = deepCopy(this.dict.asbItemQuick);
  451. }
  452. },
  453. // 添加诊断
  454. ///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6'
  455. async addAbs(asbItemChoosed, oprType) {
  456. // console.log('this.customerOrgGroup',this.customerOrgGroup)
  457. // console.log('asbItemChoosed', asbItemChoosed)
  458. if (!this.form.id) {
  459. this.$message.warning("请先选中条码分组");
  460. return;
  461. }
  462. let message = [];
  463. let checked = true;
  464. let lfind = -1;
  465. //oprType 不传值时,兼容勾选方式
  466. //勾选时不需要此操作 start
  467. if (oprType && oprType == "all") {
  468. asbItemChoosed = deepCopy(this.dict.asbItem);
  469. } else if (oprType && oprType == "choosed") {
  470. asbItemChoosed = [];
  471. this.dict.asbItem.forEach((e) => {
  472. if (e.choosed) {
  473. asbItemChoosed.push(e);
  474. e.choosed = false;
  475. }
  476. });
  477. }
  478. //勾选时不需要此操作 end
  479. if (asbItemChoosed.length < 1) {
  480. this.$message.warning("请选择要添加的诊断");
  481. return;
  482. }
  483. // 去掉重复的项目
  484. arrayReduce(asbItemChoosed, this.sampleGroupAsbitems, "id=id");
  485. /*
  486. for (let i = asbItemChoosed.length - 1; i > - 1; i--) {
  487. if (this.customerOrgGroup.forSexId == 'A') break //未选性别时,无需判断诊断性别限制
  488. if (asbItemChoosed[i].forSexId == 'A' || asbItemChoosed[i].forSexId == 'U') continue
  489. if (asbItemChoosed[i].forSexId != this.customerOrgGroup.forSexId) {
  490. message.push(asbItemChoosed[i].displayName) //.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`)
  491. checked = false
  492. asbItemChoosed.splice(i,1)
  493. }
  494. }
  495. //console.log(222,checked)
  496. if (!checked) this.$message.warning(`所选项目【${JSON.stringify(message)}】不适合当前人员性别`)
  497. */
  498. asbItemChoosed.forEach((e) => {
  499. this.sampleGroupAsbitems.push(deepCopy(e));
  500. });
  501. //刷新
  502. this.getAsbItemByItemType();
  503. },
  504. //双击选择诊断
  505. dbClickChoosedAsb(row) {
  506. this.addAbs([row]);
  507. },
  508. //快速选择诊断
  509. quickChoosedAsb(v) {
  510. //远程查询时,设置了 value-key 也不管用,只能取到value console.log('quickChoosedAsb',v)
  511. let lfind = -1;
  512. if (v) {
  513. lfind = arrayExistObj(this.dict.asbItemQuick, "id", v);
  514. if (lfind > -1) {
  515. this.addAbs([this.dict.asbItemQuick[lfind]]);
  516. }
  517. }
  518. this.$nextTick(() => {
  519. this.$refs["quickAsbOCX"].blur(); //total asbItemId
  520. this.asbItemId = "";
  521. this.quickAsb = deepCopy(this.dict.asbItemQuick);
  522. this.$refs["quickAsbOCX"].focus(); //total asbItemId
  523. });
  524. },
  525. //选择 未选的诊断
  526. chooseAsbItem(row) {
  527. this.dict.asbItem.forEach((e, index) => {
  528. e.index = index;
  529. return e;
  530. });
  531. // 按住了shift键
  532. if (this.window.shift) {
  533. //清除所有选择
  534. this.dict.asbItem.forEach((e) => {
  535. e.choosed = false;
  536. return e;
  537. });
  538. if (this.startPoint == -1) {
  539. this.dict.asbItem[row.index].choosed = true;
  540. this.startPoint = row.index;
  541. return;
  542. }
  543. if (this.startPoint > row.index) {
  544. for (let i = row.index; i <= this.startPoint; i++) {
  545. this.dict.asbItem[i].choosed = true;
  546. }
  547. } else if (this.startPoint <= row.index) {
  548. for (let i = this.startPoint; i <= row.index; i++) {
  549. this.dict.asbItem[i].choosed = true;
  550. }
  551. }
  552. return;
  553. }
  554. // 按住了ctrl 键
  555. if (this.window.ctrl) {
  556. console.log("this.window.ctrl", this.window.ctrl, this.dict.asbItem);
  557. this.dict.asbItem[row.index].choosed = true;
  558. this.startPoint = row.index;
  559. return;
  560. }
  561. // 未按住了ctrl 、shift 键
  562. //清除所有选择
  563. //console.log('清除所有选择')
  564. this.dict.asbItem.forEach((e) => {
  565. e.choosed = false;
  566. return e;
  567. });
  568. this.dict.asbItem[row.index].choosed = true;
  569. this.startPoint = row.index;
  570. },
  571. //删除 人员已选中的诊断
  572. ///api/app/register-asbitem/many?RegisterAsbitemIds=3fa85f64-5717-4562-b3fc-2c963f66afa6
  573. delAbs(absForDel, oprType) {
  574. if (!this.form.id) {
  575. this.$message.warning("请先选中单位分组");
  576. return;
  577. }
  578. let lfind = -1;
  579. //勾选时不需要此操作 start
  580. if (oprType && oprType == "all") {
  581. absForDel = deepCopy(this.sampleGroupAsbitems);
  582. } else if (oprType && oprType == "choosed") {
  583. absForDel = [];
  584. this.sampleGroupAsbitems.forEach((e) => {
  585. if (e.choosed) {
  586. absForDel.push(deepCopy(e));
  587. e.choosed = false;
  588. }
  589. });
  590. }
  591. //勾选时不需要此操作 end
  592. if (absForDel.length < 1) {
  593. this.$message.warning("请选择要移除的诊断");
  594. return;
  595. }
  596. for (let i = 0; i < absForDel.length; i++) {
  597. lfind = arrayExistObj(this.sampleGroupAsbitems, "id", absForDel[i].id);
  598. if (lfind > -1) this.sampleGroupAsbitems.splice(lfind, 1);
  599. absForDel.splice(i, 1);
  600. i--;
  601. continue;
  602. }
  603. //刷新
  604. this.getAsbItemByItemType();
  605. },
  606. //双击删除已选项目
  607. removeAbs(row) {
  608. this.delAbs([row]);
  609. },
  610. //选择 已选的诊断
  611. removeAsbItem(row) {
  612. this.sampleGroupAsbitems.forEach((e, index) => {
  613. e.index = index;
  614. return e;
  615. });
  616. // 按住了shift键
  617. if (this.window.shift) {
  618. //清除所有选择
  619. this.sampleGroupAsbitems.forEach((e) => {
  620. e.choosed = false;
  621. return e;
  622. });
  623. if (this.PstartPoint == -1) {
  624. this.sampleGroupAsbitems[row.index].choosed = true;
  625. this.PstartPoint = row.index;
  626. return;
  627. }
  628. if (this.PstartPoint > row.index) {
  629. for (let i = row.index; i <= this.PstartPoint; i++) {
  630. this.sampleGroupAsbitems[i].choosed = true;
  631. }
  632. } else if (this.PstartPoint <= row.index) {
  633. for (let i = this.PstartPoint; i <= row.index; i++) {
  634. this.sampleGroupAsbitems[i].choosed = true;
  635. }
  636. }
  637. return;
  638. }
  639. // 按住了ctrl 键
  640. if (this.window.ctrl) {
  641. console.log(
  642. "this.window.ctrl",
  643. this.window.ctrl,
  644. this.sampleGroupAsbitems
  645. );
  646. this.sampleGroupAsbitems[row.index].choosed = true;
  647. this.PstartPoint = row.index;
  648. return;
  649. }
  650. // 未按住了ctrl 、shift 键
  651. //清除所有选择
  652. //console.log('清除所有选择')
  653. this.sampleGroupAsbitems.forEach((e) => {
  654. e.choosed = false;
  655. return e;
  656. });
  657. this.sampleGroupAsbitems[row.index].choosed = true;
  658. this.PstartPoint = row.index;
  659. },
  660. selectchange(v) {
  661. console.log(v);
  662. this.sampleGroupAsbitems.push({ displayName: v.displayName });
  663. // console.log(v);
  664. },
  665. saveAsb() {
  666. if (!this.form.id) {
  667. this.$message.warning("请选择要操作的模板!");
  668. return;
  669. }
  670. let details = [];
  671. let diagnosisTemplateId = this.form.id;
  672. this.sampleGroupAsbitems.forEach((e) => {
  673. details.push({
  674. diagnosisTemplateId,
  675. diagnosisId: e.id,
  676. });
  677. });
  678. let body = { diagnosisTemplateId, details };
  679. postapi(
  680. "/api/app/diagnosistemplatedetail/creatediagnosistemplatedetailmany",
  681. body
  682. ).then((res) => {
  683. if (res.code != -1) {
  684. this.$message.success("操作成功!");
  685. }
  686. });
  687. },
  688. //右侧勾选按钮
  689. selecteditems(val) {
  690. this.rightselctedata = val;
  691. console.log(this.rightselctedata);
  692. },
  693. // 左侧未选
  694. handleSelectionChange(val) {
  695. // this.selecteddata = val;
  696. this.unselecteddata = val;
  697. console.log(this.unselecteddata);
  698. },
  699. clickPaixu(item, index) {
  700. console.log(item);
  701. this.rightobj = item;
  702. // let arr = [];
  703. // arr.push({ itemId: this.rightobj.id });
  704. // this.allid.forEach((item) => {
  705. // if (item.id == arr[id]) {
  706. // return;
  707. // } else {
  708. // this.allid.push({ id: arr[id] });
  709. // }
  710. // });
  711. console.log(this.allid);
  712. this.ischank = 2;
  713. this.num = index;
  714. this.isdislob = false;
  715. },
  716. // 获取项目类别接口
  717. posjectlist() {
  718. projectlist().then((res) => {
  719. console.log(res);
  720. this.projectid = res.data;
  721. });
  722. },
  723. handlechang(value, direction, movedkeys) {
  724. console.log(value);
  725. console.log(direction);
  726. console.log(movedkeys);
  727. },
  728. //取消按钮
  729. cancellation() {
  730. this.$message.info("取消操作");
  731. this.isshow = true;
  732. this.getlist();
  733. },
  734. //确定排序
  735. btnSaveSort() {
  736. const result = [];
  737. this.tableData.forEach((item, index) => {
  738. // index 从0开始的, 你的displayOrder从大到小排
  739. console.log(item.id);
  740. // const currentDisplayOrder = this.tableData.length -1
  741. const currentDisplayOrder = this.initTableData[index].displayOrder;
  742. if (item.displayOrder != currentDisplayOrder) {
  743. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  744. result.push({ id: item.id, displayOrder: currentDisplayOrder });
  745. }
  746. });
  747. // console.log('btnSaveSort', result);
  748. putapi("/api/app/diagnosistemplate/updatesortmany", {
  749. itemList: result,
  750. }).then((res) => {
  751. if (res.code != -1) {
  752. this.$message.success("操作成功");
  753. this.isshow = true;
  754. this.getlist();
  755. }
  756. });
  757. },
  758. //初始化
  759. rowDrop() {
  760. this.$nextTick(() => {
  761. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  762. const _this = this;
  763. Sortable.create(tbody, {
  764. handle: ".move",
  765. animation: 300,
  766. onChoose({ oldIndex }) {
  767. _this.$refs["info"].setCurrentRow(_this.tableData[oldIndex]);
  768. _this.rowick(_this.tableData[oldIndex]);
  769. },
  770. // 指定父元素下可被拖拽的子元素
  771. // draggable: ".module-manager .el-table__row",
  772. onEnd({ newIndex, oldIndex }) {
  773. // console.log(arr);
  774. _this.isshow = false;
  775. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  776. _this.tableData.splice(newIndex, 0, currRow);
  777. _this.tableData.map((item, index) => {
  778. if (index == newIndex && index == oldIndex) {
  779. // console.log(item, "新数据");
  780. } else if (index == oldIndex) {
  781. } else if (index == newIndex) {
  782. }
  783. });
  784. console.log(_this.tableData.map((item) => item.displayOrder));
  785. },
  786. });
  787. });
  788. },
  789. //置底
  790. btnSetButtom() {
  791. this.form = { ...this.curRow };
  792. if (this.form.id == undefined) {
  793. this.$message.warning("请选择操作的数据");
  794. } else {
  795. putapi(
  796. `/api/app/diagnosistemplate/updatemanysort?id=${
  797. this.form.id
  798. }&SortType=${2}`
  799. ).then((res) => {
  800. if (res.code != -1) {
  801. this.getlist();
  802. this.$message.success("操作成功");
  803. }
  804. });
  805. }
  806. },
  807. //置顶
  808. btnSetTop() {
  809. this.form = { ...this.curRow };
  810. if (this.form.id == undefined) {
  811. this.$message.warning("请选择操作的数据");
  812. } else {
  813. putapi(
  814. `/api/app/diagnosistemplate/updatemanysort?id=${
  815. this.form.id
  816. }&SortType=${1}`
  817. ).then((res) => {
  818. if (res.code != -1) {
  819. this.$message.success("操作成功");
  820. this.getlist();
  821. }
  822. });
  823. }
  824. },
  825. //删除
  826. btnDel() {
  827. this.form = { ...this.curRow };
  828. if (this.form.id == undefined) {
  829. this.$message.warning("请选择操作的数据");
  830. } else {
  831. this.$confirm("是否确认删除, 是否继续?", "提示", {
  832. confirmButtonText: "确定",
  833. cancelButtonText: "取消",
  834. type: "warning",
  835. }).then(() => {
  836. deletapi(`/api/app/diagnosis-template/${this.form.id}`).then(
  837. (res) => {
  838. console.log(res);
  839. if (res.code == 0) {
  840. this.$message.success("删除成功");
  841. this.getlist();
  842. }
  843. }
  844. );
  845. });
  846. // barcodedeleteid(this.form.id).then((res) => {
  847. // console.log(res);
  848. // this.$message.success("删除成功");
  849. // this.getlist();
  850. // });
  851. }
  852. },
  853. //编辑弹框
  854. btnEdit() {
  855. this.form = { ...this.curRow };
  856. if (this.form.id == undefined) {
  857. this.$message.warning("请选择操作的数据");
  858. } else {
  859. this.dialogVisible = true;
  860. this.title = 2;
  861. if (this.$refs.form !== undefined) {
  862. this.$refs.form.resetFields();
  863. }
  864. // //获取标本类型id
  865. // specimenlist(this.pages).then((res) => {
  866. // this.sampleTypeId = res.data.items;
  867. // });
  868. // // 获取标本容器Id
  869. // containerlist(this.pages).then((res) => {
  870. // this.sampleContainerId = res.data.items;
  871. // });
  872. // samplegropid(this.form.id).then((res) => {
  873. // this.form = res.data;
  874. // });
  875. }
  876. },
  877. //确定新增或者编辑
  878. onSubmit() {
  879. this.$refs.form.validate((v) => {
  880. if (v) {
  881. if (this.title == 1) {
  882. postapi("/api/app/diagnosis-template", this.form).then((res) => {
  883. if (res.code != -1) {
  884. this.$message.success("新增成功");
  885. // this.getlist(); 改为局部刷新
  886. this.form.id = res.data.id;
  887. this.tableData.push(deepCopy(res.data));
  888. this.dialogVisible = false;
  889. }
  890. });
  891. } else if (this.title == 2) {
  892. putapi(
  893. `/api/app/diagnosis-template/${this.form.id}`,
  894. this.form
  895. ).then((res) => {
  896. if (res.code != -1) {
  897. this.$message.success("修改成功");
  898. // this.getlist(); 改为局部刷新
  899. this.dialogVisible = false;
  900. }
  901. });
  902. }
  903. }
  904. });
  905. },
  906. closeDialog() {
  907. if (!this.form.id) return;
  908. let currentRow = {};
  909. let lfind = arrayExistObj(this.tableData, "id", this.form.id);
  910. if (lfind > -1) {
  911. objCopy(this.form, this.tableData[lfind]);
  912. currentRow = this.tableData[lfind];
  913. } else {
  914. currentRow = deepCopy(this.form);
  915. lfind = this.tableData.length;
  916. this.tableData.push(currentRow);
  917. }
  918. if (lfind > -1) {
  919. this.$nextTick(() => {
  920. this.$refs["info"].setCurrentRow(currentRow);
  921. this.rowick(currentRow);
  922. });
  923. }
  924. },
  925. //新增弹框
  926. btnAdd() {
  927. this.dialogVisible = true;
  928. this.title = 1;
  929. this.form = this.$options.data().form;
  930. this.$nextTick(() => {
  931. this.$refs.refinput.focus();
  932. });
  933. // //获取标本类型id
  934. // specimenlist(this.pages).then((res) => {
  935. // this.sampleTypeId = res.data.items;
  936. // console.log(res);
  937. // });
  938. // // 获取标本容器Id
  939. // containerlist(this.pages).then((res) => {
  940. // this.sampleContainerId = res.data.items;
  941. // console.log(res, "11111");
  942. // });
  943. },
  944. //点击条码分组记录
  945. rowick(row) {
  946. this.curRow = deepCopy(row);
  947. this.form = deepCopy(row);
  948. // samplegropid(row.id).then((res) => {
  949. // this.curRow = { ...res.data };
  950. // this.form = res.data;
  951. // });
  952. postapi(
  953. "/api/app/diagnosistemplatedetail/getdiagnosistemplateindiagnosis",
  954. {
  955. diagnosisTemplateId: this.form.id,
  956. }
  957. ).then((res) => {
  958. if (res.code != -1) {
  959. this.sampleGroupAsbitems = res.data;
  960. this.getAsbItemByItemType();
  961. }
  962. });
  963. },
  964. getlist() {
  965. this.loading = true;
  966. getapi("/api/app/diagnosis-template/in-filter", this.pages).then(
  967. (res) => {
  968. this.loading = false;
  969. this.tableData = res.data.items;
  970. this.initTableData = [...res.data.items];
  971. console.log(res);
  972. }
  973. );
  974. },
  975. //ary1 需要追加的数据 ary2目标数组
  976. updatedate() {
  977. this.ary1.forEach((item) => {
  978. let iscz = false;
  979. this.ary2.forEach((item2) => {
  980. if (item2.id == item.id) {
  981. iscz = true;
  982. }
  983. });
  984. if (!iscz) {
  985. console.log(item.id);
  986. this.ary2.push(item);
  987. // this.allid.push({ id: item.id });
  988. }
  989. });
  990. },
  991. },
  992. };
  993. </script>
  994. <style scoped>
  995. @import "../../assets/css/global_button.css";
  996. @import "../../assets/css/global_card.css";
  997. @import "../../assets/css/global_dialog.css";
  998. @import "../../assets/css/global_form.css";
  999. @import "../../assets/css/global_input.css";
  1000. @import "../../assets/css/global_table.css";
  1001. @import "../../assets/css/global.css";
  1002. .box {
  1003. margin-top: 5px;
  1004. border: 1px solid #000;
  1005. }
  1006. .btnClass {
  1007. width: 100px;
  1008. margin-bottom: 5px;
  1009. }
  1010. </style>