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.

495 lines
15 KiB

3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
  1. <template>
  2. <div class="box">
  3. <div style="position: relative">
  4. <div class="contenttitle">
  5. 权限管理 /
  6. <span class="contenttitleBold"
  7. >科室设置</span
  8. >
  9. </div>
  10. <div style="display: block; margin-top: 7px; margin-right: 110px">
  11. <div style=" background-color: #fff; border-radius: 8px;padding:15px">
  12. <el-table
  13. :data="natureoptions"
  14. :height="
  15. window.pageHeight < 600 ? 450 : window.pageHeight - 130
  16. "
  17. row-key="id"
  18. default-expand-all
  19. :tree-props="{children: 'treeChildren', hasChildren: 'hasChildren'}"
  20. highlight-current-row
  21. @row-click="treeclick"
  22. >
  23. <el-table-column prop="displayName" label="名称">
  24. <template slot-scope="scope">
  25. <span>
  26. <span class="treeicons">
  27. <!-- <i
  28. class="el-icon-document-remove"
  29. v-if="data.parentId == null"
  30. ></i> -->
  31. <img style="width:20px;height:20px;vertical-align: sub;" src="@/assets/images/order.png"
  32. v-if="!scope.row.parentId" />
  33. </span>
  34. <span :class="!scope.row.parentId ? 'maxtitle' : 'mintitle'">{{ scope.row.displayName }}</span>
  35. </span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="id" label="编码"></el-table-column>
  39. </el-table>
  40. </div>
  41. </div>
  42. <!-- 按钮区域 -->
  43. <div style="margin-left: 10px;margin-top: 3%;position: absolute;top: 0;right: 0;">
  44. <!-- <el-button type="" @click="addll" class="commonbutton">新增</el-button> -->
  45. <div
  46. v-if="natureoptions.length == '0' ? true : false"
  47. style="margin-bottom: 10px"
  48. >
  49. <el-button
  50. type=""
  51. class="commonbutton"
  52. @click="append"
  53. >添加组织</el-button
  54. >
  55. </div>
  56. <div>
  57. <el-button type="" @click="addorginiztiom" :disabled="isshow" class="commonbutton"
  58. >新增同级</el-button
  59. >
  60. </div>
  61. <div style="margin-top: 10px">
  62. <el-button type="" @click="append" :disabled="isshow" class="commonbutton"
  63. >新增子级</el-button
  64. >
  65. </div>
  66. <div style="margin-top: 10px">
  67. <el-button type="" @click="rena" :disabled="isshow" class="commonbutton"
  68. >编辑</el-button
  69. >
  70. </div>
  71. <div style="margin-top: 10px">
  72. <el-button type="" @click="deleates" :disabled="isshow" class="deleteButton"
  73. >删除</el-button
  74. >
  75. </div>
  76. </div>
  77. <!-- 新增组织弹框 -->
  78. <el-dialog
  79. :title="title == 2 ? '修改组织' : '新增组织'"
  80. :visible.sync="dialogVisible"
  81. width="800px"
  82. @close="closethiebox"
  83. :close-on-click-modal="false"
  84. class="el-dialog__title"
  85. >
  86. <!--
  87. <div v-if="title == 2">
  88. 当前选中的科室<span
  89. style="margin-left: 20px; font-size: 18px; margin-top: -20px"
  90. >{{ departmentnames }}</span
  91. >
  92. </div>
  93. -->
  94. <div v-if="title == 2">
  95. <span>上级部门</span>
  96. <el-cascader
  97. v-model="departmentname"
  98. ref="depref"
  99. @change="cascaderchang"
  100. :show-all-levels="false"
  101. :options="selecttable"
  102. :props="{
  103. checkStrictly: true,
  104. expandTrigger: 'hover',
  105. children: 'treeChildren',
  106. label: 'displayName',
  107. value: 'id',
  108. }"
  109. clearable
  110. size="small"
  111. ></el-cascader>
  112. <!-- <el-tree
  113. :data="title == 1 ? treedata : selecttable"
  114. :props="defaultProp"
  115. @node-click="treeclick"
  116. >
  117. </el-tree> -->
  118. </div>
  119. <el-row>
  120. <el-col :span="8" style="line-height: 40px">
  121. 是否为体检中心
  122. <el-checkbox
  123. v-model="isPeis"
  124. :checked="isPeis"
  125. @change="checkboxchange"
  126. ></el-checkbox>
  127. <!-- <el-radio-group v-model="form.isPeis">
  128. <el-radio label="Y"></el-radio>
  129. <el-radio label="N"></el-radio>
  130. </el-radio-group> -->
  131. <!-- <el-radio v-model="form.isPeis" label="Y"></el-radio>
  132. <el-radio v-model="form.isPeis" label="N"></el-radio> -->
  133. </el-col>
  134. <el-col :span="12">
  135. <el-form :model="form" ref="ruleForm" :rules="rules">
  136. <el-form-item label="名称" label-width="80px" prop="displayName">
  137. <el-input v-model="form.displayName" ref="refinput" size="small"></el-input>
  138. </el-form-item>
  139. </el-form>
  140. </el-col>
  141. </el-row>
  142. <span slot="footer" class="dialog-footer">
  143. <el-button @click="dialogVisible = false" class="difference"> </el-button>
  144. <el-button
  145. type="primary"
  146. @click="organizationtreeaddoredit"
  147. class="commonbutton"
  148. > </el-button
  149. >
  150. </span>
  151. </el-dialog>
  152. </div>
  153. </div>
  154. </template>
  155. <script>
  156. import { mapState } from "vuex";
  157. import {
  158. organizationtree,
  159. organizationcaeatre,
  160. deleteschema,
  161. modifyedit,
  162. } from "../../request/ruquset";
  163. import { postapi, putapi, getapi } from "@/api/api";
  164. import { tcdate, } from "../../utlis/proFunc";
  165. export default {
  166. data() {
  167. return {
  168. showcheckbox: false,
  169. isPeis: true,
  170. defaultKeys: [],
  171. selecttable: [], //科室的选择选中
  172. form: {
  173. parentId: "",
  174. displayName: "",
  175. isPeis: "N",
  176. departmentname: "",
  177. },
  178. title: 1,
  179. dialogVisible: false,
  180. natureoptions: [],
  181. defaultProp: {
  182. children: "treeChildren",
  183. label: "displayName",
  184. value: "displayName",
  185. },
  186. defaultProps: {
  187. children: "treeChildren",
  188. label: "displayName",
  189. },
  190. checked: false,
  191. parent: 1,
  192. treedata: [],
  193. departmentname: "", //科室名称
  194. departmentnames: "",
  195. row:{},
  196. isshow:true,
  197. rules: {
  198. displayName: [
  199. { required: true, message: "请输入名称", trigger: "blur" },
  200. ]
  201. },
  202. };
  203. },
  204. mounted() {
  205. this.getonorganization();
  206. },
  207. computed: {
  208. ...mapState(["window"]),
  209. },
  210. methods: {
  211. checkboxchange(v) {
  212. if (v == true) {
  213. this.form.isPeis = "Y";
  214. } else {
  215. this.form.isPeis = "N";
  216. }
  217. },
  218. cascaderchang(v) {
  219. this.departmentnames = v[v.length - 1];
  220. // window.sessionStorage.setItem("departmentname", v[v.length - 1]);
  221. // console.log(v[v.length-1]);
  222. // v.forEach((item) => {
  223. // this.departmentname = item;
  224. // });
  225. // let a=this.depref.value.togglePoppervisible()
  226. // console.log(a);
  227. },
  228. //选中的组织
  229. // treeclick(data) {
  230. // this.departmentname = data.displayName;
  231. // console.log(data);
  232. // },
  233. //close弹框关闭事件
  234. closethiebox() {
  235. this.departmentname = "";
  236. },
  237. //关闭弹框
  238. closethebulletbox() {
  239. this.dialogVisible = false;
  240. this.form = {};
  241. // this.form.isPeis = "N";
  242. },
  243. //确定新增或者编辑
  244. organizationtreeaddoredit() {
  245. this.$refs.ruleForm.validate((v) => {
  246. if (v) {
  247. if (this.title == 1) {
  248. if (this.form.parentId == "") {
  249. postapi("/api/app/organization-units/creatre", {
  250. displayName: this.form.displayName,
  251. isPeis: this.form.isPeis,
  252. }).then((res) => {
  253. if (res.code != -1) {
  254. this.dialogVisible = false;
  255. this.form.displayName = "";
  256. this.getonorganization();
  257. //this.$message.success('新增成功')
  258. this.isshow=true
  259. }
  260. });
  261. } else {
  262. postapi("/api/app/organization-units/creatre", {
  263. displayName: this.form.displayName,
  264. isPeis: this.form.isPeis,
  265. parentId: this.form.parentId,
  266. }).then((res) => {
  267. if (res.code != -1) {
  268. this.dialogVisible = false;
  269. this.form.displayName = "";
  270. this.getonorganization();
  271. //this.$message.success('新增成功')
  272. this.isshow=true
  273. }
  274. });
  275. }
  276. } else if (this.title == 2) {
  277. putapi(
  278. `/api/app/organization-units?Id=${this.form.id}&DisplayName=${this.form.displayName}&IsPeis=${this.form.isPeis}`
  279. ).then((res) => {
  280. if (res.code != -1) {
  281. this.dialogVisible = false;
  282. this.getonorganization();
  283. //this.$message.success('编辑成功')
  284. this.isshow=true
  285. }
  286. });
  287. } else if (this.title == 3) {
  288. postapi("/api/app/organization-units/creatre", {
  289. displayName: this.form.displayName,
  290. isPeis: this.form.isPeis,
  291. parentId: this.form.parentId,
  292. }).then((res) => {
  293. if(res.code!=-1){
  294. this.dialogVisible = false;
  295. // this.form = {};
  296. this.form.displayName = "";
  297. // this.form.isPeis = "N";
  298. this.getonorganization();
  299. //this.$message.success('新增成功')
  300. this.isshow=true
  301. }
  302. });
  303. }
  304. }
  305. })
  306. },
  307. check(data) {
  308. window.sessionStorage.setItem("dataidkes", data.id);
  309. // this.$refs.tree.getCheckedKeys()
  310. },
  311. treeclick(row) {
  312. this.row=row
  313. this.isshow=false
  314. },
  315. getonorganization() {
  316. organizationtree().then((res) => {
  317. if(res.code!=-1){
  318. this.natureoptions = res.data;
  319. }
  320. });
  321. },
  322. //添加父级组织
  323. addorginiztiom(node, data) {
  324. this.form=this.$options.data().form
  325. // Object.assign(this.$data.form, this.$options.data().form);
  326. this.form.parentId=this.row.parentId
  327. this.dialogVisible = true;
  328. this.title = 1;
  329. if (this.$refs.ruleForm !== undefined) {
  330. this.$refs.ruleForm.resetFields();
  331. }
  332. this.$nextTick(() => {
  333. this.$refs.refinput.focus();
  334. });
  335. },
  336. //新增组织组织
  337. append() {
  338. // this.form.displayName = "";
  339. this.title = 3;
  340. // if (this.title == 3) {
  341. // this.dialogVisible = true;
  342. // this.form.parentId = data.id;
  343. // console.log(this.form.parentId);
  344. // console.log(this.form);
  345. // }
  346. // Object.assign(this.$data.form, this.$options.data().form);
  347. this.form=this.$options.data().form
  348. if (this.title == 3) {
  349. this.form.parentId = this.row.id;
  350. this.dialogVisible = true;
  351. }
  352. if (this.$refs.ruleForm !== undefined) {
  353. this.$refs.ruleForm.resetFields();
  354. }
  355. this.$nextTick(() => {
  356. this.$refs.refinput.focus();
  357. });
  358. },
  359. //删除组织
  360. deleates() {
  361. let id=this.row.id
  362. this.$confirm("是否确定删除, 是否继续?", "提示", {
  363. confirmButtonText: "确定",
  364. cancelButtonText: "取消",
  365. type: "warning",
  366. cancelButtonClass:"difference",
  367. confirmButtonClass:"commonbutton"
  368. }).then((res) => {
  369. deleteschema(id).then((res) => {
  370. if (res.code != -1) {
  371. this.getonorganization();
  372. this.isshow=true
  373. //this.$message.success('删除成功')
  374. }
  375. });
  376. });
  377. },
  378. //编辑组织这里
  379. rena() {
  380. if (this.row.parentId == null) {
  381. this.isPeis = true;
  382. } else {
  383. this.isPeis = false;
  384. }
  385. let a = this.row.parentId;
  386. if (a == undefined) {
  387. this.departmentname = "已是最上级";
  388. } else {
  389. this.departmentname = a;
  390. }
  391. // this.departmentname = a;
  392. // this.departmentname = window.sessionStorage.getItem("departmentname");
  393. this.dialogVisible = true;
  394. this.title = 2;
  395. // this.selecttable.push(data);
  396. this.showcheckbox = true;
  397. this.form = this.row;
  398. this.form.isPeis = "N";
  399. this.isPeis = false;
  400. if (this.$refs.ruleForm !== undefined) {
  401. this.$refs.ruleForm.resetFields();
  402. }
  403. //体检中心
  404. getapi(`/api/app/organization-units?Id=${this.row.id}`).then((res) => {
  405. if(res.code!=-1){
  406. this.form=res.data
  407. if (res.data.isPeis == "Y") {
  408. this.isPeis = true;
  409. }
  410. }
  411. // console.log(res,'查询');
  412. });
  413. getapi(
  414. `/api/app/organizationunit/getbycodeparent?medicalCenterId=${this.row.id}`
  415. ).then((res) => {
  416. if(res.code!=-1){
  417. this.selecttable = res.data;
  418. tcdate(this.selecttable)
  419. }
  420. });
  421. // getapi(`/api/app/organization-units?Id=${data.id}`).then((res) => {
  422. // this.form = res.data;
  423. // console.log(res);
  424. // });
  425. // this.form = data;
  426. // console.log(this.form);
  427. // console.log(data);
  428. // this.$prompt("组织名称", "修改组织", {
  429. // confirmButtonText: "确定",
  430. // cancelButtonText: "取消",
  431. // // inputPattern: /^[\u4e00-\u9fa5]{0,}$/, //匹配全中文
  432. // // inputErrorMessage: "请输入中文", //不符合正则匹配的提示语句
  433. // }).then(({ value }) => {
  434. // console.log(value);
  435. // modifyedit(data.id, value).then((res) => {
  436. // this.getonorganization();
  437. // // console.log(res)
  438. // console.log("修改成功");
  439. // });
  440. // });
  441. },
  442. },
  443. };
  444. </script>
  445. <style scoped>
  446. @import "../../assets/css/global_button.css";
  447. @import "../../assets/css/global_dialog.css";
  448. @import "../../assets/css/global_table.css";
  449. @import "../../assets/css/global_form.css";
  450. @import "../../assets/css/global_input.css";
  451. @import "../../assets/css/global.css";
  452. .box {
  453. display: flex;
  454. flex-direction: column;
  455. }
  456. .layeredleftright {
  457. width: 100%;
  458. display: flex;
  459. flex-direction: column;
  460. }
  461. :deep .el-form-item {
  462. margin-bottom: 14px;
  463. }
  464. /* el-dialog的头部样式 */
  465. :deep .el-dialog__header {
  466. padding: 11px 20px 11px;
  467. }
  468. /* el-dialog的主体样式 */
  469. :deep .el-dialog__body {
  470. padding: 0px 20px 0px;
  471. }
  472. /* el-divider样式 */
  473. :deep .el-divider--horizontal {
  474. margin: 0px 0 12px;
  475. }
  476. /* el-dialog的底部样式 */
  477. :deep .el-dialog__footer {
  478. padding: 0px 20px 14px;
  479. }
  480. :deep .el-table tr{
  481. height: 35px;
  482. }
  483. </style>