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.

484 lines
15 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
  1. <template>
  2. <div class="box">
  3. <div style="width: 95%">
  4. <el-card>
  5. <el-table
  6. :data="tableData"
  7. style="width: 100%"
  8. row-key="id"
  9. class="el-table__body-wrapper tbody"
  10. @row-click="rowclick"
  11. highlight-current-row
  12. >
  13. <el-table-column prop="id" label="编号" width="300">
  14. </el-table-column>
  15. <el-table-column
  16. prop="referenceRangeValue"
  17. label="参考范围"
  18. width="130"
  19. >
  20. </el-table-column>
  21. <el-table-column prop="creatorName" label="创建者" width="150">
  22. </el-table-column>
  23. <el-table-column prop="creationTime" label="创建时间" width="200">
  24. <template slot-scope="scope">
  25. {{ scope.row.creationTime | dateFormat }}
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="lastModifierName" label="修改者" width="">
  29. </el-table-column>
  30. <el-table-column
  31. prop="lastModificationTime"
  32. label="修改时间"
  33. width="200"
  34. >
  35. <template slot-scope="scope">
  36. {{ scope.row.lastModificationTime | dateFormat }}
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="操作" width="">
  40. <template>
  41. <el-tag
  42. class="move"
  43. style="cursor: move; margin-left: 15px"
  44. draggable="true"
  45. >
  46. <i
  47. class="el-icon-d-caret"
  48. style="width: 1rem; height: 1rem"
  49. ></i>
  50. </el-tag>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <!-- <comp-table
  55. :tableData="tableData"
  56. :tableHeader="tableHeader"
  57. @clickevents="rowclick"
  58. ref="singleTable"
  59. >
  60. </comp-table> -->
  61. </el-card>
  62. <!-- 弹框 -->
  63. <el-dialog
  64. :title="title == 1 ? '新增' : '编辑'"
  65. :visible.sync="dialogVisible"
  66. width="75%"
  67. >
  68. <el-form ref="form" :model="form" label-width="80px" :rules="rules">
  69. <el-row>
  70. <el-col :span="8">
  71. <el-form-item label="项目编号" prop="itemId">
  72. <el-select v-model="form.itemId" placeholder="请选择">
  73. <el-option
  74. v-for="item in itemId"
  75. :key="item.id"
  76. :label="item.displayName"
  77. :value="item.id"
  78. >
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="8">
  84. <el-form-item
  85. label="性激素期限"
  86. prop="sexHormoneTermId"
  87. label-width="100px"
  88. >
  89. <el-select v-model="form.sexHormoneTermId" placeholder="请选择">
  90. <el-option
  91. v-for="item in sexHormoneTermId"
  92. :key="item.id"
  93. :label="item.displayName"
  94. :value="item.id"
  95. >
  96. </el-option>
  97. </el-select>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="8">
  101. <el-form-item label="年龄下限" prop="ageLowerLimit">
  102. <el-input
  103. v-model="form.ageLowerLimit"
  104. style="width: 80%"
  105. ></el-input>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="8">
  109. <el-form-item label="年龄上限" prop="ageUpperLimit">
  110. <el-input
  111. v-model="form.ageUpperLimit"
  112. style="width: 80%"
  113. ></el-input>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="8">
  117. <el-form-item label="参考范围" prop="referenceRangeValue">
  118. <el-input
  119. v-model="form.referenceRangeValue"
  120. style="width: 80%"
  121. ></el-input>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="8">
  125. <el-form-item
  126. label="危急值参考"
  127. prop="criticalRangeValue"
  128. label-width="100px"
  129. >
  130. <el-input
  131. v-model="form.criticalRangeValue"
  132. style="width: 80%"
  133. ></el-input>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="8">
  137. <el-form-item label="下限诊断" prop="lowerDiagnosisId">
  138. <el-select v-model="form.lowerDiagnosisId" placeholder="请选择">
  139. <el-option
  140. v-for="item in lowerDiagnosisId"
  141. :key="item.id"
  142. :label="item.displayName"
  143. :value="item.id"
  144. >
  145. </el-option>
  146. </el-select>
  147. </el-form-item>
  148. </el-col>
  149. <el-col :span="8">
  150. <el-form-item label="上限诊断" prop="upperDiagnosisId">
  151. <el-select v-model="form.upperDiagnosisId" placeholder="请选择">
  152. <el-option
  153. v-for="item in upperDiagnosisId"
  154. :key="item.id"
  155. :label="item.displayName"
  156. :value="item.id"
  157. >
  158. </el-option>
  159. </el-select>
  160. </el-form-item>
  161. </el-col>
  162. </el-row>
  163. </el-form>
  164. <span slot="footer" class="dialog-footer">
  165. <el-button @click="dialogVisible = false"> </el-button>
  166. <el-button type="primary" @click="onsbmit"> </el-button>
  167. </span>
  168. </el-dialog>
  169. <!-- -->
  170. </div>
  171. <!-- 按钮区域 -->
  172. <div style="margin-left: 10px; margin-top: 5%">
  173. <el-button type="primary" @click="add">新增</el-button>
  174. <el-button
  175. type="primary"
  176. @click="editpopup"
  177. style="margin-left: 0; margin-top: 10px"
  178. >编辑</el-button
  179. >
  180. <div style="margin-top: 10px">
  181. <el-button type="danger" @click="delets">删除</el-button>
  182. </div>
  183. <!-- <div style="margin-top: 10px">
  184. <el-button type="primary" @click="topping">置顶</el-button>
  185. </div> -->
  186. <!-- <div style="margin-top: 10px">
  187. <el-button type="primary" @click="toppings">置底</el-button>
  188. </div> -->
  189. <!-- <div style="margin-top: 10px">
  190. <el-button type="primary" :disabled="isshow" @click="assertion"
  191. >排序</el-button
  192. >
  193. </div>
  194. <div style="margin-top: 5px">
  195. <el-button type="primary" :disabled="isshow" @click="cancellation"
  196. >取消</el-button
  197. >
  198. </div> -->
  199. </div>
  200. </div>
  201. </template>
  202. <script>
  203. import { rowDrop } from "@/components/publicjs/public";
  204. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  205. import { getporjectlists } from "@/request/commonapi";
  206. import compTable from "@/components/compTable.vue";
  207. import Sortable from "sortablejs";
  208. export default {
  209. components: { compTable },
  210. data() {
  211. return {
  212. sexHormoneTermId: [],
  213. filetelists: [],
  214. flitvalues: [],
  215. projectid: [],
  216. values: [],
  217. isshow: true,
  218. rules: {
  219. itemId: [
  220. { required: true, message: "请选择项目编号", trigger: "change" },
  221. ],
  222. sexHormoneTermId: [
  223. { required: true, message: "请选择性激素期限ID", trigger: "change" },
  224. ],
  225. ageLowerLimit: [
  226. { required: true, message: "请输入年龄下限", trigger: "blur" },
  227. ],
  228. ageUpperLimit: [
  229. { required: true, message: "请输入年龄上限", trigger: "blur" },
  230. ],
  231. referenceRangeValue: [
  232. { required: true, message: "请输入参考范围", trigger: "blur" },
  233. ],
  234. criticalRangeValue: [
  235. { required: true, message: "请输入危急值参考", trigger: "blur" },
  236. ],
  237. lowerDiagnosisId: [
  238. { required: true, message: "请选择下限诊断", trigger: "change" },
  239. ],
  240. upperDiagnosisId: [
  241. { required: true, message: "请选择上限诊断", trigger: "change" },
  242. ],
  243. },
  244. form: {
  245. itemId: "",
  246. sexHormoneTermId: "",
  247. ageLowerLimit: "",
  248. ageUpperLimit: "",
  249. referenceRangeValue: "",
  250. criticalRangeValue: "",
  251. lowerDiagnosisId: "",
  252. upperDiagnosisId: "",
  253. },
  254. lowerDiagnosisId: [],
  255. upperDiagnosisId: [],
  256. sexHormoneTermId: [],
  257. isActive: [
  258. {
  259. value: "N",
  260. label: "否",
  261. },
  262. {
  263. value: "Y",
  264. label: "是",
  265. },
  266. ], //启用标志
  267. itemId: [],
  268. dialogVisible: false,
  269. title: 1,
  270. pages: {
  271. SkipCount: 0,
  272. MaxResultCount: 100,
  273. },
  274. tableData: [],
  275. initTableData: [],
  276. tableHeader: [
  277. // 表头信息,可根据minWidth修改宽度
  278. { prop: "id", label: "编号", minWidth: "150px" },
  279. { prop: `creatorName`, label: "创建者" },
  280. { prop: `creationTime`, label: "创建时间" },
  281. { prop: `lastModifierName`, label: "修改者" },
  282. { prop: `lastModificationTime`, label: "创建时间" },
  283. { prop: "result", label: "结果" },
  284. ],
  285. };
  286. },
  287. created() {
  288. this.getlist();
  289. },
  290. mounted() {
  291. this.rowDrop();
  292. },
  293. methods: {
  294. //取消排序
  295. cancellation() {
  296. this.$message.info("取消操作");
  297. this.isshow = true;
  298. this.getlist();
  299. },
  300. //确定排序
  301. assertion() {
  302. const result = [];
  303. this.tableData.forEach((item, index) => {
  304. // index 从0开始的, 你的displayOrder从大到小排
  305. console.log(item.id);
  306. // const currentDisplayOrder = this.tableData.length -1
  307. const currentDisplayOrder = this.initTableData[index].displayOrder;
  308. if (item.displayOrder != currentDisplayOrder) {
  309. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  310. result.push({ id: item.id, displayOrder: currentDisplayOrder });
  311. }
  312. });
  313. putapi("/api/app/medicalpackage/updatesortmany", {
  314. itemList: result,
  315. }).then((res) => {
  316. this.$message.success("操作成功");
  317. this.isshow = true;
  318. this.getlist();
  319. });
  320. },
  321. //初始化
  322. rowDrop() {
  323. this.$nextTick(() => {
  324. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  325. const _this = this;
  326. Sortable.create(tbody, {
  327. handle: ".move",
  328. animation: 300,
  329. onEnd({ newIndex, oldIndex }) {
  330. _this.isshow = false;
  331. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  332. _this.tableData.splice(newIndex, 0, currRow);
  333. _this.tableData.map((item, index) => {
  334. if (index == newIndex && index == oldIndex) {
  335. // console.log(item, "新数据");
  336. } else if (index == oldIndex) {
  337. } else if (index == newIndex) {
  338. }
  339. });
  340. console.log(_this.tableData.map((item) => item.displayOrder));
  341. },
  342. });
  343. });
  344. },
  345. toppings() {
  346. if (this.form.id == undefined) {
  347. this.$message.warning("请选择操作的数据");
  348. } else {
  349. putapi(
  350. `/api/app/medicalpackage/updatemanysort?id=${
  351. this.form.id
  352. }&SortType=${2}`
  353. ).then((res) => {
  354. this.$message.success("操作成功");
  355. this.getlist();
  356. });
  357. }
  358. },
  359. topping() {
  360. if (this.form.id == undefined) {
  361. this.$message.warning("请选择操作的数据");
  362. } else {
  363. putapi(
  364. `/api/app/medicalpackage/updatemanysort?id=${
  365. this.form.id
  366. }&SortType=${1}`
  367. ).then((res) => {
  368. this.$message.success("操作成功");
  369. this.getlist();
  370. });
  371. }
  372. },
  373. //删除
  374. delets(row) {
  375. if (this.form.id == undefined) {
  376. this.$message.warning("请选择删除的数据");
  377. } else {
  378. this.$confirm("是否确认删除,是否继续?", "提示", {
  379. confirmButtonText: "确定",
  380. cancelButtonText: "取消",
  381. type: "warning",
  382. })
  383. .then(() => {
  384. deletapi(
  385. `/api/app/sex-hormone-reference-range/${this.form.id}`
  386. ).then((res) => {
  387. this.$message.success("删除成功");
  388. this.getlist();
  389. });
  390. })
  391. .catch(() => {});
  392. }
  393. },
  394. //编辑弹框
  395. editpopup() {
  396. if (this.form.id == undefined) {
  397. this.$message.warning("请点击选择操作的数据");
  398. } else {
  399. this.dialogVisible = true;
  400. this.title = 2;
  401. this.addtoedit();
  402. getapi(`/api/app/sex-hormone-reference-range/${this.form.id}`).then(
  403. (res) => {
  404. this.form = res.data;
  405. console.log(res);
  406. }
  407. );
  408. }
  409. },
  410. //确定新增或者编辑
  411. onsbmit() {
  412. this.$refs.form.validate((v) => {
  413. if (v) {
  414. if (this.title == 1) {
  415. postapi("/api/app/sex-hormone-reference-range", this.form).then(
  416. (res) => {
  417. this.$message.success("新增成功");
  418. this.getlist();
  419. this.dialogVisible = false;
  420. }
  421. );
  422. } else if (this.title == 2) {
  423. putapi(
  424. `/api/app/sex-hormone-reference-range/${this.form.id}`,
  425. this.form
  426. ).then((res) => {
  427. this.$message.success("修改成功");
  428. this.getlist();
  429. this.dialogVisible = false;
  430. });
  431. }
  432. }
  433. });
  434. },
  435. rowclick(val) {
  436. getapi(`/api/app/sex-hormone-reference-range/${val.id}`).then((res) => {
  437. this.form = res.data;
  438. console.log(res);
  439. });
  440. },
  441. handleRowClick(Row) {
  442. console.log(Row);
  443. console.log("1");
  444. },
  445. // 新增或者编辑需要的类别
  446. addtoedit() {
  447. getapi("/api/app/item/in-filter").then((res) => {
  448. this.itemId = res.data.items;
  449. });
  450. postapi("/api/app/diagnosis/getlistinfilter").then((res) => {
  451. this.lowerDiagnosisId = res.data.items;
  452. this.upperDiagnosisId = res.data.items;
  453. });
  454. getapi("/api/app/sex-hormone-term/in-filter").then((res) => {
  455. this.sexHormoneTermId = res.data.items;
  456. console.log(res, "rr");
  457. });
  458. },
  459. //新增弹框
  460. add() {
  461. this.addtoedit();
  462. this.dialogVisible = true;
  463. this.title = 1;
  464. this.form = {};
  465. },
  466. getlist() {
  467. getapi("/api/app/sex-hormone-reference-range", this.pages).then((res) => {
  468. console.log(res);
  469. this.tableData = res.data.items;
  470. this.initTableData = [...res.data.items];
  471. });
  472. let that = this;
  473. },
  474. },
  475. };
  476. </script>
  477. <style scoped>
  478. .box {
  479. display: flex;
  480. }
  481. </style>