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.

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