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.

556 lines
17 KiB

2 years ago
  1. <template>
  2. <div class="box">
  3. <div style="position: relative">
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 常用设置 /
  7. <span class="contenttitleBold">字段对照接口</span>
  8. </div>
  9. <!-- <div class="seachinput">
  10. <el-select
  11. v-model="department"
  12. placeholder="请搜索"
  13. filterable
  14. :filter-method="remoteMethodes"
  15. default-first-option
  16. @change="quckDepartments"
  17. clearable
  18. size="small"
  19. >
  20. <el-option
  21. v-for="item in quckDepartment"
  22. :key="item.id"
  23. :label="item.displayName"
  24. :value="item.id"
  25. >
  26. </el-option>
  27. </el-select>
  28. </div> -->
  29. </div>
  30. <div style="display: block; margin-top: 7px; margin-right: 110px">
  31. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  32. <div id="printTest">
  33. <el-table
  34. :data="tableData"
  35. row-key="id"
  36. class="el-table__body-wrapper tbody"
  37. @row-click="rowick"
  38. highlight-current-row
  39. :height="window.pageHeight < 600 ? 480 : window.pageHeight - 130"
  40. ref="tableData"
  41. tooltip-effect="light"
  42. >
  43. <el-table-column prop="id" label="编号" width="300">
  44. </el-table-column>
  45. <el-table-column prop="displayName" label="名称" width="">
  46. </el-table-column>
  47. <el-table-column prop="parmValue" label="配置参数" width="" show-overflow-tooltip>
  48. </el-table-column>
  49. <el-table-column prop="creatorName" label="创建者" width="">
  50. </el-table-column>
  51. <el-table-column prop="lastModifierName" label="修改者" width="">
  52. </el-table-column>
  53. <!-- <el-table-column prop="simpleCode" label="简称" width="180">
  54. </el-table-column> -->
  55. <el-table-column prop="creationTime" label="创建时间" width="200">
  56. <template slot-scope="scope">
  57. {{ scope.row.creationTime | dateFormat }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. prop="lastModificationTime"
  62. label="修改时间"
  63. width="200"
  64. >
  65. <template slot-scope="scope">
  66. {{ scope.row.lastModificationTime | dateFormat }}
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="操作" width="" align="center">
  70. <template>
  71. <el-tag
  72. class="move"
  73. style="
  74. cursor: move;
  75. background-color: rgb(245, 245, 245);
  76. border: none;
  77. "
  78. draggable="true"
  79. >
  80. <i
  81. class="el-icon-d-caret"
  82. style="
  83. width: 1rem;
  84. height: 1rem;
  85. color: rgb(113, 113, 113);
  86. "
  87. ></i>
  88. </el-tag>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. </div>
  93. </div>
  94. </div>
  95. <!-- 按钮区域 -->
  96. <div
  97. style="
  98. margin-left: 10px;
  99. margin-top: 3%;
  100. position: absolute;
  101. top: 0;
  102. right: 0;
  103. "
  104. >
  105. <el-button type="" @click="add" class="commonbutton">新增</el-button>
  106. <div style="margin-top: 10px">
  107. <el-button type="" @click="edlits" class="commonbutton"
  108. >编辑</el-button
  109. >
  110. </div>
  111. <div style="margin-top: 10px">
  112. <el-button type="" @click="deleteid" class="deleteButton"
  113. >删除</el-button
  114. >
  115. </div>
  116. <div style="margin-top: 10px">
  117. <el-button type="" @click="topping" class="commonbutton"
  118. >置顶</el-button
  119. >
  120. </div>
  121. <div style="margin-top: 10px">
  122. <el-button type="" @click="toppings" class="commonbutton"
  123. >置底</el-button
  124. >
  125. </div>
  126. <div style="margin-top: 10px">
  127. <el-button
  128. type=""
  129. :disabled="isshow"
  130. @click="assertion"
  131. class="commonbutton"
  132. >排序</el-button
  133. >
  134. </div>
  135. <div style="margin-top: 10px">
  136. <el-button
  137. type=""
  138. :disabled="isshow"
  139. @click="cancellation"
  140. class="commonbutton"
  141. >取消</el-button
  142. >
  143. </div>
  144. </div>
  145. <!-- <div class="cancelorconfirm"></div> -->
  146. <!-- 新增或者编辑弹框 -->
  147. <el-dialog
  148. :title="title == 1 ? '新增' : '修改'"
  149. :visible.sync="dialogVisible"
  150. width="90%"
  151. :close-on-click-modal="false"
  152. fullscreen
  153. >
  154. <el-form ref="form" :model="form" label-width="80px">
  155. <el-row>
  156. <el-col :span="12">
  157. <el-form-item label="编号">
  158. <el-input
  159. v-model="form.id"
  160. style="width: 65%"
  161. disabled
  162. size="small"
  163. ></el-input>
  164. </el-form-item>
  165. </el-col>
  166. <el-col :span="12">
  167. <el-form-item label="名称">
  168. <el-input
  169. ref="refinput"
  170. v-model="form.displayName"
  171. style="width: 65%"
  172. size="small"
  173. ></el-input>
  174. </el-form-item>
  175. </el-col>
  176. </el-row>
  177. <el-row>
  178. <el-col :span="24">
  179. <el-form-item label="配置参数">
  180. <!-- <el-input
  181. v-model="form.parmValue"
  182. size="small"
  183. ></el-input> -->
  184. <el-input
  185. type="textarea"
  186. v-model="form.parmValue"
  187. :autosize="{ minRows: 23, maxRows: 23 }"
  188. ></el-input>
  189. </el-form-item>
  190. </el-col>
  191. </el-row>
  192. <el-row>
  193. <el-divider></el-divider>
  194. <el-col :span="4" style="margin-left: 15px">
  195. <el-form-item label="创建者">
  196. <el-input
  197. v-model="form.creatorName"
  198. disabled
  199. size="small"
  200. ></el-input>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="6">
  204. <el-form-item label="创建时间">
  205. <el-input
  206. :value="form.creationTime | dateFormat"
  207. disabled
  208. size="small"
  209. ></el-input>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="4">
  213. <el-form-item label="修改者">
  214. <el-input
  215. v-model="form.lastModifierName"
  216. disabled
  217. size="small"
  218. ></el-input>
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="6">
  222. <el-form-item label="修改时间">
  223. <el-input
  224. style="width: 85%"
  225. :value="form.lastModificationTime | dateFormat"
  226. disabled
  227. size="small"
  228. ></el-input>
  229. </el-form-item>
  230. </el-col>
  231. </el-row>
  232. </el-form>
  233. <span slot="footer" class="dialog-footer">
  234. <el-button @click="dialogVisible = false" class="difference"
  235. > </el-button
  236. >
  237. <el-button type="primary" @click="addoredit" class="commonbutton"
  238. > </el-button
  239. >
  240. </span>
  241. </el-dialog>
  242. </div>
  243. </div>
  244. </template>
  245. <script>
  246. import Sortable from "sortablejs";
  247. import { mapState } from "vuex";
  248. import {
  249. examinationlist,
  250. newphysical,
  251. listsid,
  252. Modifiers,
  253. deletecol,
  254. medicaltopbottom,
  255. examinationdragging,
  256. } from "../../request/systemapi";
  257. import { postapi, putapi } from "@/api/api";
  258. export default {
  259. data() {
  260. return {
  261. isshow: true,
  262. dialogVisible: false,
  263. title: 1,
  264. form: {
  265. displayName: "",
  266. parmValue: "",
  267. },
  268. tableData: [],
  269. initTableData: [],
  270. curRow: {},
  271. department: "",
  272. quckDepartment: [],
  273. };
  274. },
  275. created() {
  276. this.getlist();
  277. },
  278. mounted() {
  279. this.rowDrop();
  280. },
  281. computed: {
  282. ...mapState(["window"]),
  283. },
  284. methods: {
  285. //点击列表通过id查询
  286. rowick(row) {
  287. this.curRow = { ...row };
  288. // listsid(row.id).then((res) => {
  289. // if(res.code!=-1){
  290. // this.curRow = { ...res.data };
  291. // }
  292. // // this.form = res.data;
  293. // });
  294. },
  295. remoteMethodes(keyWords) {
  296. if (keyWords) {
  297. this.quckDepartment = [];
  298. this.initTableData.forEach((item) => {
  299. if (
  300. item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) >
  301. -1 ||
  302. item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > -1
  303. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  304. ) {
  305. this.quckDepartment.push(item);
  306. }
  307. });
  308. } else {
  309. this.quckDepartment = [...this.initTableData];
  310. }
  311. },
  312. quckDepartments(e) {
  313. if (e) {
  314. this.tableData.forEach((item, index) => {
  315. if (e == item.id) {
  316. this.$refs["tableData"].setCurrentRow(item);
  317. this.rowick(item);
  318. this.searchup(item, index);
  319. }
  320. });
  321. } else {
  322. this.remoteMethodes();
  323. }
  324. },
  325. searchup(data, index) {
  326. // if (index > 3) {
  327. const targetTop = this.$refs["tableData"].$el
  328. .querySelectorAll(".el-table__body tr")
  329. [index - 1].getBoundingClientRect().top;
  330. const containerTop = this.$refs["tableData"].$el
  331. .querySelector(".el-table__body")
  332. .getBoundingClientRect().top;
  333. const scrollParent = this.$refs["tableData"].$el.querySelector(
  334. ".el-table__body-wrapper"
  335. );
  336. scrollParent.scrollTop = targetTop - containerTop;
  337. // }
  338. },
  339. cancellation() {
  340. this.$message.info("取消操作");
  341. this.isshow = true;
  342. this.getlist();
  343. },
  344. //确定排序
  345. assertion() {
  346. const result = [];
  347. this.tableData.forEach((item, index) => {
  348. // index 从0开始的, 你的displayOrder从大到小排
  349. // const currentDisplayOrder = this.tableData.length -1
  350. // const currentDisplayOrder = this.initTableData[index].displayOrder;
  351. // if (item.displayOrder != currentDisplayOrder) {
  352. // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置
  353. result.push({ id: item.id, displayOrder: index + 1 });
  354. // }
  355. });
  356. postapi("/api/app/ColumnReference/UpdateSortMany",{ itemList: result }).then((res) => {
  357. if (res.code != -1) {
  358. this.getlist();
  359. this.isshow = true;
  360. this.$message.success("操作成功");
  361. }
  362. });
  363. },
  364. //初始化
  365. rowDrop() {
  366. this.$nextTick(() => {
  367. const tbody = document.querySelector(".el-table__body-wrapper tbody");
  368. const _this = this;
  369. Sortable.create(tbody, {
  370. handle: ".move",
  371. animation: 300,
  372. // 指定父元素下可被拖拽的子元素
  373. // draggable: ".module-manager .el-table__row",
  374. onChoose({ oldIndex }) {
  375. _this.$refs["tableData"].setCurrentRow(_this.tableData[oldIndex]);
  376. _this.rowick(_this.tableData[oldIndex]);
  377. },
  378. onEnd({ newIndex, oldIndex }) {
  379. // console.log(arr);
  380. _this.isshow = false;
  381. const currRow = _this.tableData.splice(oldIndex, 1)[0];
  382. _this.tableData.splice(newIndex, 0, currRow);
  383. _this.tableData.map((item, index) => {
  384. if (index == newIndex && index == oldIndex) {
  385. // console.log(item, "新数据");
  386. } else if (index == oldIndex) {
  387. } else if (index == newIndex) {
  388. }
  389. });
  390. },
  391. });
  392. });
  393. },
  394. //置底置顶
  395. topping() {
  396. this.form = { ...this.curRow };
  397. if (this.form.id == undefined) {
  398. this.$message.warning("请选择操作的数据");
  399. } else {
  400. postapi(`/api/app/ColumnReference/UpdateManySort?id=${this.form.id}&SortType=1`).then((res) => {
  401. if (res.code != -1) {
  402. this.getlist();
  403. this.$message.success("操作成功");
  404. }
  405. });
  406. }
  407. },
  408. toppings() {
  409. this.form = { ...this.curRow };
  410. if (this.form.id == undefined) {
  411. this.$message.warning("请选择操作的数据");
  412. } else {
  413. postapi(`/api/app/ColumnReference/UpdateManySort?id=${this.form.id}&SortType=2`).then((res) => {
  414. if (res.code != -1) {
  415. this.getlist();
  416. this.$message.success("操作成功");
  417. }
  418. });
  419. }
  420. },
  421. //删除
  422. deleteid(row) {
  423. this.form = { ...this.curRow };
  424. if (this.form.id == undefined) {
  425. this.$message.warning("请选择删除的数据");
  426. } else {
  427. this.$confirm("是否确认删除,是否继续", "提示", {
  428. confirmButtonText: "确定",
  429. cancelButtonText: "取消",
  430. type: "warning",
  431. cancelButtonClass: "difference",
  432. confirmButtonClass: "commonbutton",
  433. })
  434. .then(() => {
  435. postapi(`/api/app/ColumnReference/Delete/?id=${this.form.id}`).then((res) => {
  436. if (res.code != -1) {
  437. this.curRow = this.$options.data().curRow;
  438. this.getlist();
  439. this.$message.success("删除成功");
  440. }
  441. });
  442. })
  443. .catch(() => {});
  444. // deletecol(this.form.id).then((res) => {
  445. // console.log("删除成功");
  446. // this.getlist();
  447. // });
  448. }
  449. },
  450. //edlits编辑弹框
  451. edlits(row) {
  452. this.form = { ...this.curRow };
  453. if (this.form.id == undefined) {
  454. this.$message.warning("请选择操作的数据");
  455. } else {
  456. this.title = 2;
  457. this.dialogVisible = true;
  458. postapi(`/api/app/ColumnReference/Get/?id=${this.form.id}`).then((res) => {
  459. if (res.code != -1) {
  460. this.form = res.data;
  461. }
  462. });
  463. }
  464. },
  465. //确定新增或者修改
  466. addoredit() {
  467. if (this.form.displayName == undefined || this.form.displayName == "") {
  468. this.$message.warning("请输入名称");
  469. } else {
  470. if (this.title == 1) {
  471. postapi("/api/app/ColumnReference/Create", {
  472. displayName: this.form.displayName,
  473. parmValue: this.form.parmValue,
  474. }).then((res) => {
  475. if (res.code != -1) {
  476. this.getlist();
  477. this.dialogVisible = false;
  478. this.$message.success("新增成功");
  479. }
  480. });
  481. } else if (this.title == 2) {
  482. postapi("/api/app/ColumnReference/Update", {
  483. id: this.form.id,
  484. displayName: this.form.displayName,
  485. parmValue: this.form.parmValue,
  486. }).then((res) => {
  487. if (res.code != -1) {
  488. this.getlist();
  489. this.dialogVisible = false;
  490. this.$message.success("修改成功");
  491. }
  492. });
  493. }
  494. }
  495. },
  496. //新增弹框
  497. add() {
  498. this.dialogVisible = true;
  499. this.title = 1;
  500. this.form = this.$options.data().form;
  501. this.$nextTick(() => {
  502. this.$refs.refinput.focus();
  503. });
  504. },
  505. //
  506. getlist() {
  507. postapi("/api/app/ColumnReference/GetList").then((res) => {
  508. if (res.code != -1) {
  509. this.initTableData = [...res.data];
  510. this.tableData = res.data;
  511. // this.quckDepartment=[...res.data.items]
  512. }
  513. });
  514. },
  515. },
  516. };
  517. </script>
  518. <style scoped>
  519. @import "../../assets/css/global_button.css";
  520. @import "../../assets/css/global_dialog.css";
  521. @import "../../assets/css/global_table.css";
  522. @import "../../assets/css/global_form.css";
  523. @import "../../assets/css/global_input.css";
  524. @import "../../assets/css/global.css";
  525. .box {
  526. display: flex;
  527. flex-direction: column;
  528. }
  529. :deep .el-form-item {
  530. margin-bottom: 14px;
  531. }
  532. /* el-dialog的头部样式 */
  533. :deep .el-dialog__header {
  534. padding: 11px 20px 11px;
  535. }
  536. /* el-dialog的主体样式 */
  537. :deep .el-dialog__body {
  538. padding: 0px 20px 0px;
  539. }
  540. /* el-divider样式 */
  541. :deep .el-divider--horizontal {
  542. margin: 0px 0 12px;
  543. }
  544. /* el-dialog的底部样式 */
  545. :deep .el-dialog__footer {
  546. padding: 0px 20px 14px;
  547. }
  548. .seachinput {
  549. width: 250px;
  550. margin-right: 110px;
  551. }
  552. :deep .seachinput .el-select {
  553. width: 100%;
  554. }
  555. </style>