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.

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