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.

716 lines
22 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
  1. <template>
  2. <div class="box">
  3. <div style="width: 95%">
  4. <el-card class="elcard" style="border-radius: 15px">
  5. <div class="publiccss">诊断</div>
  6. <el-table
  7. :data="tableData"
  8. style="width: 100%; margin-top: 20px"
  9. row-key="id"
  10. class="el-table__body-wrapper tbody"
  11. @row-click="rowick"
  12. highlight-current-row
  13. >
  14. <el-table-column prop="id" label="编号" width="300">
  15. </el-table-column>
  16. <el-table-column prop="displayName" label="名称" width="">
  17. </el-table-column>
  18. <el-table-column prop="creatorName" label="创建者" width="">
  19. </el-table-column>
  20. <el-table-column prop="creationTime" label="创建时间" width="200">
  21. <template slot-scope="scope">
  22. {{ scope.row.creationTime | dateFormat }}
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="lastModifierName" label="修改者" width="">
  26. </el-table-column>
  27. <el-table-column
  28. prop="lastModificationTime"
  29. label="修改时间"
  30. width="200"
  31. >
  32. <template slot-scope="scope">
  33. {{ scope.row.lastModificationTime | dateFormat }}
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="操作" width="">
  37. <template>
  38. <el-tag
  39. class="move"
  40. style="cursor: move; margin-left: 15px;background-color: rgb(245, 245, 245);border:none"
  41. draggable="true"
  42. >
  43. <i
  44. class="el-icon-d-caret"
  45. style="width: 1rem; height: 1rem;color: rgb(113, 113, 113)"
  46. ></i>
  47. </el-tag>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <!-- -->
  52. <!-- <span style="margin-top: 10px; padding: 5px; margin-left: 28.5%"
  53. >项目类别</span
  54. >
  55. <el-select
  56. v-model="values"
  57. placeholder="请选择"
  58. @change="ischangs"
  59. style="margin-top: 5px"
  60. >
  61. <el-option
  62. v-for="item in projectid"
  63. :key="item.id"
  64. :label="item.displayName"
  65. :value="item.id"
  66. >
  67. </el-option>
  68. </el-select> -->
  69. <!-- <span style="margin-left: 10%; padding: 5px">搜索选择</span>
  70. <el-select
  71. filterable
  72. v-model="flitvalues"
  73. placeholder="请选择"
  74. style="margin-top: 5px"
  75. >
  76. <el-option
  77. v-for="item in filetelists"
  78. :key="item.id"
  79. :label="item.displayName"
  80. :value="item.id"
  81. >
  82. </el-option>
  83. </el-select> -->
  84. <!-- <div class="mainbox">
  85. <div class="mainleftbox">
  86. <div class="weixuan">未选项目</div>
  87. <div
  88. v-for="(item, index) in leftdata"
  89. :key="index"
  90. @click="clickPaixu(item, index)"
  91. @dblclick="shuanji(item, index)"
  92. :class="num === index ? 'activetext' : ''"
  93. style=""
  94. >
  95. <div>{{ item.displayName }}</div>
  96. </div>
  97. </div>
  98. <div class="Selectbutton">
  99. <div style="margin-top: 10px">
  100. <el-button @click="addall"
  101. >全添加<i class="el-icon-caret-right"></i
  102. ><i class="el-icon-caret-right"></i
  103. ></el-button>
  104. </div>
  105. <div style="margin-top: 10px">
  106. <el-button @click="addobj" style="width: 111px"
  107. >添加<i class="el-icon-caret-right"></i>
  108. </el-button>
  109. </div>
  110. <div style="margin-top: 10px">
  111. <el-button @click="removeright" style="width: 111px"
  112. >移去<i class="el-icon-caret-left"></i>
  113. </el-button>
  114. </div>
  115. <div style="margin-top: 10px">
  116. <el-button @click="allclear"
  117. >全移去<i class="el-icon-caret-left"></i
  118. ><i class="el-icon-caret-left"></i>
  119. </el-button>
  120. </div>
  121. </div>
  122. <div class="mainleftbox">
  123. <div class="weixuan">已选项目</div>
  124. <div
  125. v-for="(item, index) in rightdata"
  126. :key="index"
  127. @click="rightindex(item, index)"
  128. @dblclick="rightdelite(item, index)"
  129. :class="nums === index ? 'activetext' : ''"
  130. >
  131. <div>{{ item.displayName }}</div>
  132. </div>
  133. </div>
  134. </div> -->
  135. <!-- <div class="confirmcancellation">
  136. <el-button :disabled="isdislob" @click="Onsubmit">确定</el-button>
  137. <el-button :disabled="isdislob">取消</el-button>
  138. </div> -->
  139. </el-card>
  140. <el-dialog
  141. :title="title == 1 ? '新增' : '编辑'"
  142. :visible.sync="dialogVisible"
  143. width="75%"
  144. :close-on-click-modal="false"
  145. >
  146. <el-form ref="form" :model="form" label-width="100px" :rules="rules">
  147. <el-row>
  148. <el-col :span="8">
  149. <el-form-item label="名称" prop="displayName">
  150. <el-input
  151. ref="refinput"
  152. v-model="form.displayName"
  153. style="width: 100%"
  154. ></el-input> </el-form-item
  155. ></el-col>
  156. <el-col :span="8">
  157. <el-form-item label="项目类别" prop="itemTypeId">
  158. <el-select v-model="form.itemTypeId" placeholder="请选择">
  159. <el-option
  160. v-for="item in itemTypeId"
  161. :key="item.id"
  162. :label="item.displayName"
  163. :value="item.id"
  164. >
  165. </el-option> </el-select></el-form-item
  166. ></el-col>
  167. <el-col :span="8">
  168. <el-form-item label="是疾病" prop="isIll">
  169. <el-select v-model="form.isIll" placeholder="请选择">
  170. <el-option
  171. v-for="item in isIll"
  172. :key="item.value"
  173. :label="item.label"
  174. :value="item.value"
  175. >
  176. </el-option>
  177. </el-select> </el-form-item
  178. ></el-col>
  179. <el-col :span="8">
  180. <el-form-item label="建议名称" prop="suggestionName">
  181. <el-input
  182. v-model="form.suggestionName"
  183. style="width: 100%"
  184. ></el-input>
  185. </el-form-item>
  186. </el-col>
  187. <el-col :span="8">
  188. <el-form-item label="是总检模板" prop="isSummaryTemplate">
  189. <el-select
  190. v-model="form.isSummaryTemplate"
  191. placeholder="请选择"
  192. >
  193. <el-option
  194. v-for="item in isSummaryTemplate"
  195. :key="item.value"
  196. :label="item.label"
  197. :value="item.value"
  198. >
  199. </el-option>
  200. </el-select>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="8">
  204. <el-form-item label="适用性别" prop="forSexId">
  205. <el-select v-model="form.forSexId" placeholder="请选择">
  206. <el-option
  207. v-for="item in forSexId"
  208. :key="item.id"
  209. :label="item.displayName"
  210. :value="item.id"
  211. >
  212. </el-option>
  213. </el-select> </el-form-item
  214. ></el-col>
  215. <el-col :span="8">
  216. <el-form-item label="诊断级别" prop="diagnosisLevelId">
  217. <el-select v-model="form.diagnosisLevelId" placeholder="请选择">
  218. <el-option
  219. v-for="item in diagnosisLevelId"
  220. :key="item.id"
  221. :label="item.displayName"
  222. :value="item.id"
  223. >
  224. </el-option>
  225. </el-select> </el-form-item
  226. ></el-col>
  227. </el-row>
  228. </el-form>
  229. <span slot="footer" class="dialog-footer">
  230. <el-button @click="dialogVisible = false"> </el-button>
  231. <el-button type="primary" @click="onsbmint"> </el-button>
  232. </span>
  233. </el-dialog>
  234. </div>
  235. <!-- 按钮区域 -->
  236. <div style="margin-left: 10px; margin-top: 5%">
  237. <el-button type="" @click="add" class="commonbutton">新增</el-button>
  238. <div style="margin-top: 10px">
  239. <el-button type="" @click="edit" class="commonbutton">编辑</el-button>
  240. </div>
  241. <div style="margin-top: 10px">
  242. <el-button type="" @click="delets" class="commonbutton">删除</el-button>
  243. </div>
  244. <div style="margin-top: 10px">
  245. <el-button type="" @click="topping" class="commonbutton"
  246. >置顶</el-button
  247. >
  248. </div>
  249. <div style="margin-top: 10px">
  250. <el-button type="" @click="toppings" class="commonbutton"
  251. >置底</el-button
  252. >
  253. </div>
  254. <div style="margin-top: 10px">
  255. <el-button
  256. type=""
  257. :disabled="isshow"
  258. @click="assertion"
  259. class="commonbutton"
  260. >排序</el-button
  261. >
  262. </div>
  263. <div style="margin-top: 10px">
  264. <el-button
  265. type=""
  266. :disabled="isshow"
  267. @click="cancellation"
  268. class="commonbutton"
  269. >取消</el-button
  270. >
  271. </div>
  272. </div>
  273. </div>
  274. </template>
  275. <script>
  276. import Sortable from "sortablejs";
  277. import { postapi, getapi, putapi, deletapi } from "@/api/api";
  278. import { projectlist } from "@/request/commonapi";
  279. import { examinationgender, diagsislist } from "@/request/systemapi";
  280. export default {
  281. data() {
  282. return {
  283. num: 0,
  284. rightdata: [], //右侧数据
  285. leftdata: [], //左侧数据
  286. projectid: [],
  287. filetelists: [],
  288. flitvalues: [],
  289. values: "",
  290. isshow: true,
  291. isdislob: true,
  292. rules: {
  293. displayName: [
  294. { required: true, message: "请输入名称", trigger: "blur" },
  295. ],
  296. itemTypeId: [
  297. { required: true, message: "请选择项目类别", trigger: "blur" },
  298. ],
  299. suggestionName: [
  300. { required: true, message: "请输入建议名称", trigger: "blur" },
  301. ],
  302. isIll: [{ required: true, message: "请选择是疾病", trigger: "blur" }],
  303. isSummaryTemplate: [
  304. { required: true, message: "请选择是总检模板", trigger: "blur" },
  305. ],
  306. forSexId: [
  307. { required: true, message: "请选择适用性别", trigger: "blur" },
  308. ],
  309. diagnosisLevelId: [
  310. { required: true, message: "请选择诊断级别", trigger: "blur" },
  311. ],
  312. },
  313. pages: {
  314. Filter: "",
  315. SkipCount: 0,
  316. MaxResultCount: 100,
  317. Sorting: "displayOrder desc",
  318. },
  319. tableData: [],
  320. initTableData: [],
  321. dialogVisible: false,
  322. title: 1,
  323. form: {
  324. displayName: "",
  325. itemTypeId: "",
  326. suggestionName: "",
  327. isIll: "",
  328. isSummaryTemplate: "",
  329. forSexId: "",
  330. diagnosisLevelId: "",
  331. },
  332. isIll: [
  333. {
  334. value: "Y",
  335. label: "是",
  336. },
  337. {
  338. value: "N",
  339. label: "否",
  340. },
  341. ], //是疾病
  342. isSummaryTemplate: [
  343. {
  344. value: "Y",
  345. label: "是",
  346. },
  347. {
  348. value: "N",
  349. label: "否",
  350. },
  351. ], //是总监模板
  352. itemTypeId: [], //项目类别
  353. forSexId: [], //性别
  354. diagnosisLevelId: [], //诊断级别
  355. ary1: [],
  356. ary2: [],
  357. nums: 0,
  358. curRow: {},
  359. };
  360. },
  361. created() {
  362. this.getlist();
  363. this.gitprojectcategory();
  364. },
  365. mounted() {
  366. this.rowDrop();
  367. },
  368. methods: {
  369. Onsubmit() {
  370. let sampleGroupId = this.form.id;
  371. console.log(this.form.id);
  372. console.log(this.rightdata);
  373. let sdate = [];
  374. this.rightdata.forEach((element) => {
  375. let sss = { sampleGroupId: sampleGroupId, asbitemId: element.id };
  376. sdate.push(sss);
  377. });
  378. this.leftdata.forEach((element) => {
  379. let sss = { sampleGroupId: sampleGroupId, asbitemId: element.id };
  380. sdate.push(sss);
  381. });
  382. console.log(sdate);
  383. if (sampleGroupId == undefined) {
  384. this.$message.warning("请选择列表");
  385. } else {
  386. postapi("/api/app/item-template-detail/many", sdate).then((res) => {
  387. this.$message.success("操作成功");
  388. this.isdislob = true;
  389. });
  390. }
  391. },
  392. //q全移去
  393. allclear() {
  394. this.isdislob = false;
  395. if (this.rightdata.length > 0) {
  396. this.ary1 = this.rightdata;
  397. this.ary2 = this.leftdata;
  398. this.updatedate();
  399. this.rightdata = [];
  400. }
  401. },
  402. //右移动
  403. removeright() {
  404. this.isdislob = false;
  405. if (this.rightdata.length > 0) {
  406. this.rightdata.splice(this.num, 1);
  407. this.leftdata.push(this.leftobj);
  408. this.isdislob = true;
  409. this.updatedate();
  410. }
  411. },
  412. //左侧添加按钮
  413. addobj() {
  414. this.isdislob = false;
  415. if (this.leftdata.length > 0) {
  416. this.leftdata.splice(this.num, 1);
  417. this.rightdata.push(this.rightobj);
  418. }
  419. },
  420. //全添加
  421. addall() {
  422. this.isdislob = false;
  423. if (this.leftdata.length > 0) {
  424. this.ary1 = this.leftdata;
  425. this.ary2 = this.rightdata;
  426. this.updatedate();
  427. this.leftdata = [];
  428. }
  429. },
  430. //左侧双击事件
  431. shuanji(item, index) {
  432. this.isdislob = false;
  433. console.log(item);
  434. this.leftdata.splice(index, 1);
  435. this.rightdata.push(item);
  436. },
  437. clickPaixu(item, index) {
  438. this.rightobj = item;
  439. this.num = index;
  440. console.log(this.num);
  441. },
  442. //获取项目类别 3a0b0b10-719f-5824-6956-8cb70f204013
  443. gitprojectcategory() {
  444. getapi("/api/app/item-type/by-code-all").then((res) => {
  445. this.projectid = res.data;
  446. });
  447. },
  448. //ary1 需要追加的数据 ary2目标数组
  449. updatedate() {
  450. this.ary1.forEach((item) => {
  451. let iscz = false;
  452. this.ary2.forEach((item2) => {
  453. if (item2.id == item.id) {
  454. iscz = true;
  455. }
  456. });
  457. if (!iscz) {
  458. console.log(item.id);
  459. this.ary2.push(item);
  460. // this.allid.push({ id: item.id });
  461. }
  462. });
  463. },
  464. //项目类别选择
  465. ischangs(v) {
  466. console.log(v);
  467. getapi(`/api/app/diagnosis/in-item-type/${v}`).then((res) => {
  468. console.log(res);
  469. this.leftdata = res.data;
  470. });
  471. },
  472. //取消排序
  473. cancellation() {
  474. this.$message.info("取消操作");
  475. this.isshow = true;
  476. this.getlist();
  477. },
  478. //确定排序
  479. assertion() {
  480. const result = [];
  481. this.tableData.forEach((item, index) => {
  482. // index 从0开始的, 你的displayOrder从大到小排
  483. console.log(item.id);
  484. // const currentDisplayOrder = this.tableData.length -1
  485. const currentDisplayOrder = this.initTableData[index].displayOrder;
  486. if (item.displayOrder != currentDisplayOrder) {
  487. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  488. result.push({ id: item.id, displayOrder: currentDisplayOrder });
  489. }
  490. });
  491. putapi("/api/app/diagnosis/updatesortmany", { itemList: result }).then(
  492. (res) => {
  493. this.$message.success("操作成功");
  494. this.isshow = true;
  495. this.getlist();
  496. }
  497. );
  498. },
  499. //初始化
  500. rowDrop() {
  501. this.$nextTick(() => {
  502. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  503. const _this = this;
  504. Sortable.create(tbody, {
  505. handle: ".move",
  506. animation: 300,
  507. // 指定父元素下可被拖拽的子元素
  508. // draggable: ".module-manager .el-table__row",
  509. onEnd({ newIndex, oldIndex }) {
  510. // console.log(arr);
  511. _this.isshow = false;
  512. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  513. _this.tableData.splice(newIndex, 0, currRow);
  514. _this.tableData.map((item, index) => {
  515. if (index == newIndex && index == oldIndex) {
  516. // console.log(item, "新数据");
  517. } else if (index == oldIndex) {
  518. } else if (index == newIndex) {
  519. }
  520. });
  521. console.log(_this.tableData.map((item) => item.displayOrder));
  522. },
  523. });
  524. });
  525. },
  526. toppings() {
  527. this.form = { ...this.curRow };
  528. if (this.form.id == undefined) {
  529. this.$message.warning("请选择操作的数据");
  530. } else {
  531. putapi(
  532. `/api/app/diagnosis/updatemanysort?id=${this.form.id}&SortType=${2}`
  533. ).then((res) => {
  534. this.$message.success("操作成功");
  535. this.getlist();
  536. });
  537. }
  538. },
  539. topping() {
  540. this.form = { ...this.curRow };
  541. if (this.form.id == undefined) {
  542. this.$message.warning("请选择操作的数据");
  543. } else {
  544. putapi(
  545. `/api/app/diagnosis/updatemanysort?id=${this.form.id}&SortType=${1}`
  546. ).then((res) => {
  547. this.$message.success("操作成功");
  548. this.getlist();
  549. });
  550. }
  551. },
  552. //删除
  553. delets(row) {
  554. this.form = { ...this.curRow };
  555. if (this.form.id == undefined) {
  556. this.$message.warning("请选择删除的数据");
  557. } else {
  558. this.$confirm("是否确认删除,是否继续?", "提示", {
  559. confirmButtonText: "确定",
  560. cancelButtonText: "取消",
  561. type: "warning",
  562. })
  563. .then(() => {
  564. deletapi(`/api/app/diagnosis/${this.form.id}`).then((res) => {
  565. if (res.code == 0) {
  566. this.$message.success("删除成功");
  567. this.getlist();
  568. }
  569. });
  570. })
  571. .catch(() => {
  572. this.$message.info("已取消操作");
  573. });
  574. }
  575. },
  576. //编辑弹框
  577. edit(row) {
  578. this.form = { ...this.curRow };
  579. if (this.form.id == undefined) {
  580. this.$message.warning("请选择操作的数据");
  581. } else {
  582. //项目类别
  583. projectlist().then((res) => {
  584. this.itemTypeId = res.data;
  585. });
  586. //适用性别
  587. getapi("/api/app/for-sex").then((res) => {
  588. this.forSexId = res.data;
  589. });
  590. // examinationgender().then((res) => {
  591. // this.forSexId = res.data;
  592. // });
  593. //诊断级别
  594. diagsislist().then((res) => {
  595. this.diagnosisLevelId = res.data.items;
  596. });
  597. this.title = 2;
  598. this.dialogVisible = true;
  599. }
  600. },
  601. //确定新增或者编辑
  602. onsbmint() {
  603. this.$refs.form.validate((v) => {
  604. if (v) {
  605. if (this.title == 1) {
  606. postapi("/api/app/diagnosis", this.form).then((res) => {
  607. this.$message.success("新增成功");
  608. this.getlist();
  609. this.dialogVisible = false;
  610. });
  611. } else if (this.title == 2) {
  612. putapi(`/api/app/diagnosis/${this.form.id}`, this.form).then(
  613. (res) => {
  614. this.$message.success("修改成功");
  615. this.getlist();
  616. this.dialogVisible = false;
  617. }
  618. );
  619. }
  620. }
  621. });
  622. // postapi('/api/app/diagnosis',this)
  623. },
  624. //新增弹框
  625. add() {
  626. this.dialogVisible = true;
  627. this.title = 1;
  628. this.form = {};
  629. this.$nextTick(() => {
  630. this.$refs.refinput.focus();
  631. });
  632. //项目类别
  633. projectlist().then((res) => {
  634. this.itemTypeId = res.data;
  635. });
  636. //适用性别
  637. getapi("/api/app/for-sex").then((res) => {
  638. this.forSexId = res.data;
  639. console.log("适用性别", res);
  640. });
  641. // examinationgender().then((res) => {
  642. // this.forSexId = res.data;
  643. // console.log(res, "性别");
  644. // });
  645. //诊断级别
  646. diagsislist().then((res) => {
  647. this.diagnosisLevelId = res.data.items;
  648. });
  649. },
  650. rowick(row) {
  651. getapi(`/api/app/diagnosis/${row.id}`).then((res) => {
  652. // this.form = res.data;
  653. this.curRow = { ...res.data };
  654. });
  655. getapi(
  656. `/api/app/item-template-detail/item-template-in-item?ItemTemplateId=${row.id}`
  657. ).then((res) => {
  658. console.log(res);
  659. let dq = res.data;
  660. if (dq.length > 0) {
  661. this.rightdata = [];
  662. dq.forEach((element) => {
  663. let bb = { displayName: element.displayName, id: element.id };
  664. this.rightdata.push(bb);
  665. });
  666. }
  667. });
  668. console.log(row);
  669. },
  670. getlist() {
  671. postapi("/api/app/diagnosis/getlistinfilter", this.pages).then((res) => {
  672. this.initTableData = [...res.data.items];
  673. this.tableData = res.data.items;
  674. console.log(res);
  675. });
  676. },
  677. },
  678. };
  679. </script>
  680. <style scoped>
  681. ::v-deep .el-table__header th {
  682. /* font-size: px; */
  683. background-color: rgb(245, 245, 245); /* 设置表头背景颜色 */
  684. color: rgb(113, 113, 113); /* 设置表头文字颜色 */
  685. }
  686. .confirmcancellation {
  687. margin-left: 45%;
  688. }
  689. .Selectbutton {
  690. margin-left: 3%;
  691. }
  692. .activetext {
  693. background: rgb(185, 203, 235);
  694. }
  695. .weixuan {
  696. text-align: center;
  697. line-height: 20px;
  698. background: rgb(185, 203, 235);
  699. }
  700. .mainleftbox {
  701. width: 200px;
  702. height: 240px;
  703. border: 1px solid #ccc;
  704. margin-left: 6%;
  705. }
  706. .mainbox {
  707. display: flex;
  708. justify-content: center;
  709. margin-top: 20px;
  710. }
  711. .box {
  712. display: flex;
  713. }
  714. </style>