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.

302 lines
9.5 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
  1. <template>
  2. <div class="box">
  3. <div class="middlebox">
  4. <div class="contenttitle">
  5. 常用设置 /
  6. <span class="contenttitleBold">系统参数</span>
  7. </div>
  8. </div>
  9. <div style="display: flex;margin-top: 7px;">
  10. <div :style="'width: 208px;overflow: scroll;height:' +
  11. (window.pageHeight < 600 ? 480 : window.pageHeight - 100) +
  12. 'px;background-color: #fff; border-radius: 8px'
  13. ">
  14. <div style="margin-top: 10px">
  15. <el-tree :data="sysParmTypesTree" :props="treeProps" highlight-current @node-click="nodeClick">
  16. <span class="custom-tree-node" slot-scope="{ node, data }">
  17. <div>
  18. <span class="treeicons">
  19. <!-- <i
  20. class="el-icon-document-remove"
  21. v-if="data.parentId == null"
  22. ></i> -->
  23. <img style="width:20px;height:20px;vertical-align: sub;" src="@/assets/images/order.png"
  24. v-if="data.parentId == null" />
  25. </span>
  26. <span :class="data.parentId == null ? 'maxtitle' : 'mintitle'">{{ node.label }}</span>
  27. </div>
  28. </span>
  29. </el-tree>
  30. </div>
  31. </div>
  32. <div :style="'margin-left: 15px;width:' + (window.pageWidth - 200 - 45) + 'px;'">
  33. <div>
  34. <el-table :data="sysParms" :height="window.pageHeight < 600 ? 418 : window.pageHeight - 162" size="small"
  35. :span-method="spanMethod" highlight-current-row border style="border-radius: 8px;">
  36. <el-table-column prop="sysParmId" label="参数ID" min-width="150" />
  37. <el-table-column prop="displayName" label="参数名称" min-width="150" />
  38. <el-table-column prop="medicalCenterId" label="体检中心" min-width="100">
  39. <template slot-scope="scope">
  40. <!--
  41. <el-select
  42. v-model="scope.row.medicalCenterId"
  43. placeholder="请选择体检中心"
  44. filterable
  45. size="small"
  46. >
  47. <el-option
  48. v-for="item in organization"
  49. :key="item.id"
  50. :label="item.displayName"
  51. :value="item.id"
  52. >
  53. </el-option>
  54. </el-select>
  55. -->
  56. <div>{{ dddw(organization, 'id', scope.row.medicalCenterId, 'displayName') }}</div>
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="sysParmValueName" label="参数值" min-width="80">
  60. <template slot-scope="scope">
  61. <el-input type="textarea" v-model="scope.row.sysParmValueName" :autosize="{ minRows: 1, maxRows: 100 }"
  62. maxlength="100" size="small" />
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="valueRemark" label="备注" min-width="150">
  66. <template slot-scope="scope">
  67. <el-input type="textarea" v-model="scope.row.valueRemark" :autosize="{ minRows: 1, maxRows: 100 }"
  68. maxlength="500" size="small" />
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="remark" label="参数说明" min-width="150" />
  72. </el-table>
  73. </div>
  74. <div style="margin-top:15px; display: flex;justify-content:space-between;">
  75. <!--
  76. <div>
  77. <span>体检中心</span>
  78. <el-select
  79. v-model="organizationId"
  80. placeholder="请选择体检中心"
  81. style="margin-left: 15px"
  82. filterable
  83. size="small"
  84. @change="changeOrganization"
  85. >
  86. <el-option
  87. v-for="item in organization"
  88. :key="item.id"
  89. :label="item.displayName"
  90. :value="item.id"
  91. >
  92. </el-option>
  93. </el-select>
  94. </div>
  95. -->
  96. <div></div>
  97. <div>
  98. <el-button type="success" @click="btnSave" class="commonbutton">保存</el-button>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import { mapState } from "vuex";
  107. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  108. import { tcdate, objCopy, dddw } from "../../utlis/proFunc";
  109. export default {
  110. components: {},
  111. data() {
  112. return {
  113. sysParmTypesTree: [], //参数类别树
  114. treeProps: {
  115. label: "displayName",
  116. value: "id",
  117. children: "treeChildren",
  118. },
  119. organization: [], //体检中心
  120. organizationId: "00000000-0000-0000-0000-000000000000",
  121. sysParmTypeId: "",
  122. spanRow: [],
  123. sysParms: [], //系统参数列表
  124. };
  125. },
  126. created() { },
  127. //挂载完成
  128. mounted() {
  129. this.getSysParmTypesTree();
  130. this.getOraniztion();
  131. },
  132. computed: {
  133. ...mapState(["window", "dict"]),
  134. },
  135. methods: {
  136. dddw,
  137. //获取组织体检中心数据
  138. getOraniztion() {
  139. getapi("/api/app/organization-units/organization-unit-by-is-peis").then(
  140. (res) => {
  141. if (res.code != -1) {
  142. this.organization = [
  143. {
  144. displayName: "公共参数",
  145. id: "00000000-0000-0000-0000-000000000000",
  146. },
  147. ...res.data,
  148. ];
  149. }
  150. }
  151. );
  152. },
  153. //获取系统参数类别树数据
  154. getSysParmTypesTree() {
  155. getapi("/api/app/sysparmtype/treelist").then((res) => {
  156. if (res.code != -1) {
  157. this.sysParmTypesTree = res.data;
  158. //console.log("res.data", res.data);
  159. tcdate(this.sysParmTypesTree);
  160. }
  161. });
  162. },
  163. nodeClick(data, node, self) {
  164. this.sysParmTypeId = data.id;
  165. this.getSysParms();
  166. },
  167. changeOrganization(v) {
  168. this.organizationId = v;
  169. this.getSysParms();
  170. },
  171. getSysParms() {
  172. let url = `/api/app/sysparm/getlistinsysparmvaluename?SysParmTypeId=${this.sysParmTypeId}`;
  173. if (this.organizationId) {
  174. url += `&medicalCenterId=${this.organizationId}`;
  175. }
  176. getapi(`${url}`).then((res) => {
  177. if (res.code != -1) {
  178. this.sysParms = res.data;
  179. this.spanRow = this.parseSpanRow(this.sysParms, 'sysParmId')
  180. }
  181. });
  182. },
  183. //行合并
  184. spanMethod({ row, column, rowIndex, columnIndex }) {
  185. if (columnIndex == 0 || columnIndex == 1 || columnIndex == 5) {
  186. for (let i = 0; i < this.spanRow.length; i++) {
  187. if (rowIndex == this.spanRow[i].startRow) {
  188. return {
  189. rowspan: Number(this.spanRow[i].endRow - this.spanRow[i].startRow) + 1,
  190. colspan: 1
  191. };
  192. } else if (this.spanRow[i].startRow < rowIndex && rowIndex <= this.spanRow[i].endRow) {
  193. return {
  194. rowspan: 0,
  195. colspan: 0
  196. }
  197. }
  198. }
  199. }
  200. // if (columnIndex == 3) {
  201. // for (let i = 0; i < this.spanRow.length; i++) {
  202. // if (rowIndex == this.spanRow[i].startRow) {
  203. // return {
  204. // rowspan: Number(this.spanRow[i].endRow - this.spanRow[i].startRow) + 1,
  205. // colspan: 1
  206. // };
  207. // }
  208. // }
  209. // }
  210. // if (columnIndex == 4) {
  211. // for (let i = 0; i < this.spanRow.length; i++) {
  212. // if (rowIndex == this.spanRow[i].startRow) {
  213. // return {
  214. // rowspan: Number(this.spanRow[i].endRow - this.spanRow[i].startRow) + 1,
  215. // colspan: 1
  216. // };
  217. // } else if (this.spanRow[i].startRow < rowIndex && rowIndex <= this.spanRow[i].endRow) {
  218. // return {
  219. // rowspan: 0,
  220. // colspan: 0
  221. // }
  222. // }
  223. // }
  224. // }
  225. },
  226. //分析合并的行数据
  227. parseSpanRow(arrayData, key) {
  228. let spanRow = [];
  229. let preVal = '', curVal = '';
  230. let startRow = 0;
  231. for (let i = 0; i < arrayData.length; i++) {
  232. if (i == 0) {
  233. preVal = arrayData[i][key];
  234. curVal = arrayData[i][key];
  235. } else {
  236. curVal = arrayData[i][key];
  237. if (preVal !== curVal) {
  238. if (startRow !== i - 1) spanRow.push({ startRow, endRow: i - 1 });
  239. startRow = i;
  240. preVal = arrayData[i][key];
  241. }
  242. if (i == arrayData.length - 1 && preVal === curVal) {
  243. spanRow.push({ startRow, endRow: i });
  244. }
  245. }
  246. }
  247. return spanRow
  248. },
  249. btnSave() {
  250. let body = {
  251. sysParmTypeId: this.sysParmTypeId,
  252. details: []
  253. }
  254. if (this.sysParms.length < 1) return;
  255. this.sysParms.forEach((item) => {
  256. body.details.push({
  257. sysParmId: item.sysParmId,
  258. medicalCenterId: item.medicalCenterId,
  259. parmValue: item.sysParmValueName,
  260. remark: item.valueRemark,
  261. });
  262. });
  263. postapi("/api/app/sysparmvalue/updatesysparmvaluemany", body).then(
  264. (res) => {
  265. if (res.code != -1) {
  266. this.$message.success('操作成功!')
  267. }
  268. }
  269. );
  270. },
  271. },
  272. };
  273. </script>
  274. <style scoped>
  275. @import "../../assets/css/global_button.css";
  276. @import '../../assets/css/global_card.css';
  277. @import '../../assets/css/global_input.css';
  278. @import '../../assets/css/global_table.css';
  279. @import '../../assets/css/global.css';
  280. .box {
  281. display: flex;
  282. flex-direction: column;
  283. }
  284. </style>