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.

409 lines
14 KiB

3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 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
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
3 years ago
2 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
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 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
2 years ago
3 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
2 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 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
3 years ago
2 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
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
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 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
2 years ago
3 years ago
3 years ago
2 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 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
  1. <template>
  2. <div class="" style="width: 100%;display: flex;margin-top: 15px;">
  3. <div style="width: 90%">
  4. <el-table :data="tableData" style="width: 100%" class="el-table__body-wrapper tbody"
  5. :height="window.pageHeight < 600 ? 260 : window.pageHeight - 340" @row-click="rowick" highlight-current-row>
  6. <el-table-column prop="forSexId" label="性别">
  7. <template slot-scope="scope">
  8. <div>
  9. {{ ldddw(forSexId, "id", scope.row.forSexId, "displayName") }}
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column prop="ageLowerLimit" label="年龄上限" />
  14. <el-table-column prop="ageUpperLimit" label="年龄下限" />
  15. <el-table-column prop="referenceRangeValue" label="参考范围" />
  16. <el-table-column prop="随访范围" label="随访范围" />
  17. <el-table-column prop="criticalRangeValue" label="危急范围" />
  18. <el-table-column prop="lowerDiagnosisId" label="偏低诊断">
  19. <template slot-scope="scope">
  20. <div>
  21. {{
  22. ldddw(
  23. diagnosis,
  24. "id",
  25. scope.row.lowerDiagnosisId,
  26. "displayName"
  27. )
  28. }}
  29. </div>
  30. </template>
  31. </el-table-column>
  32. <el-table-column prop="upperDiagnosisId" label="偏高诊断">
  33. <template slot-scope="scope">
  34. <div>
  35. {{
  36. ldddw(
  37. diagnosis,
  38. "id",
  39. scope.row.upperDiagnosisId,
  40. "displayName"
  41. )
  42. }}
  43. </div>
  44. </template>
  45. </el-table-column>
  46. <!-- <el-table-column label="操作">
  47. <template>
  48. <el-tag
  49. class="move"
  50. style="cursor: move; margin-left: 15px"
  51. draggable="true"
  52. >
  53. <i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i>
  54. </el-tag>
  55. </template>
  56. </el-table-column> -->
  57. </el-table>
  58. </div>
  59. <!-- 按钮区域 -->
  60. <div style="margin-left: 10px;" class="editButton">
  61. <div>
  62. <el-button type="" @click="add" class="commonbutton">新增</el-button>
  63. </div>
  64. <div style="margin-top: 5px;">
  65. <el-button type="" @click="edit" class="commonbutton">编辑</el-button>
  66. </div>
  67. <div style="margin-top: 5px;">
  68. <el-button type="" @click="del" class="deleteButton">删除</el-button>
  69. </div>
  70. </div>
  71. <!-- 新增或者编辑弹框 -->
  72. <el-dialog :title="id ? '编辑' : '新增'" :visible.sync="dialogVisible" width="70%" :append-to-body="true">
  73. <el-form ref="form" :model="form" label-width="100px" :rules="rules">
  74. <el-row>
  75. <el-col :span="8">
  76. <el-form-item label="性别" prop="forSexId">
  77. <el-select v-model="form.forSexId" placeholder="请选择" size="small">
  78. <el-option v-for="item in forSexId" :key="item.id" :label="item.displayName" :value="item.id">
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="8">
  84. <el-form-item label="年龄下限" prop="ageLowerLimit">
  85. <el-input v-model="form.ageLowerLimit" style="width: 100%" size="small"></el-input> </el-form-item></el-col>
  86. <el-col :span="8">
  87. <el-form-item label="年龄上限" prop="ageUpperLimit">
  88. <el-input v-model="form.ageUpperLimit" style="width: 85%" size="small"></el-input> </el-form-item></el-col>
  89. <el-col :span="8">
  90. <el-form-item label="参考范围" prop="referenceRangeValue">
  91. <el-input v-model="form.referenceRangeValue" style="width: 85%" size="small"></el-input>
  92. </el-form-item></el-col>
  93. <el-col :span="8">
  94. <el-form-item label="警告范围" prop="">
  95. <el-input v-model="form.criticalRangeValue" style="width: 100%" size="small"></el-input>
  96. </el-form-item></el-col>
  97. <el-col :span="8">
  98. <el-form-item label="偏低诊断" prop="">
  99. <el-select v-model="form.lowerDiagnosisId" placeholder="请选择" filterable :filter-method="remoteMethods"
  100. default-first-option clearable @change="quckEditdigoisce" size="small">
  101. <el-option v-for="item in diagnosis" :key="item.id" :label="item.displayName" :value="item.id">
  102. </el-option>
  103. </el-select> </el-form-item></el-col>
  104. <el-col :span="8">
  105. <el-form-item label="偏高诊断" prop="">
  106. <el-select v-model="form.upperDiagnosisId" placeholder="请选择" filterable :filter-method="remoteMethodes"
  107. default-first-option clearable @change="quckEditdigoisces" size="small">
  108. <el-option v-for="item in diagnosies" :key="item.id" :label="item.displayName" :value="item.id">
  109. </el-option>
  110. </el-select> </el-form-item></el-col>
  111. </el-row>
  112. </el-form>
  113. <span slot="footer" class="dialog-footer">
  114. <el-button @click="dialogVisible = false, id = curRowes.id" class="difference"> </el-button>
  115. <el-button type="primary" @click="onsbmint" class="commonbutton"> </el-button>
  116. </span>
  117. </el-dialog>
  118. </div>
  119. </template>
  120. <script>
  121. import { mapState } from "vuex";
  122. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  123. import { examinationgender } from "@/request/systemapi";
  124. import { dddw } from "../../utlis/proFunc";
  125. // import
  126. export default {
  127. props: ["itemId", "ReferenceRangeTypeFlag"],
  128. data() {
  129. return {
  130. rules: {
  131. itemId: [{ required: true, message: "请选择项目", trigger: "blur" }],
  132. forSexId: [{ required: true, message: "请选择性别", trigger: "blur" }],
  133. ageLowerLimit: [
  134. { required: true, message: "请输入年龄下限", trigger: "blur" },
  135. ],
  136. ageUpperLimit: [
  137. { required: true, message: "请输入年龄上限", trigger: "blur" },
  138. ],
  139. referenceRangeValue: [
  140. { required: true, message: "请输入参考范围", trigger: "blur" },
  141. ],
  142. criticalRangeValue: [
  143. { required: true, message: "请输入临界范围", trigger: "blur" },
  144. ],
  145. lowerDiagnosisId: [
  146. { required: true, message: "请选择偏低诊断", trigger: "blur" },
  147. ],
  148. upperDiagnosisId: [
  149. { required: true, message: "请选择偏高诊断", trigger: "blur" },
  150. ],
  151. },
  152. pages: {
  153. SkipCount: 0,
  154. MaxResultCount: 100,
  155. // Sorting: "displayOrder desc",
  156. },
  157. dialogVisible: false,
  158. form: {
  159. itemId: "",
  160. forSexId: "",
  161. ageLowerLimit: "",
  162. ageUpperLimit: "",
  163. referenceRangeValue: "",
  164. criticalRangeValue: "",
  165. lowerDiagnosisId: "",
  166. upperDiagnosisId: "",
  167. referenceRangeTypeFlag: "1",
  168. },
  169. id: "", //新增/编辑 或删除的记录 id
  170. forSexId: [], //性别
  171. diagnosis: [], //偏低诊断
  172. diagnosies: [],//偏高诊断
  173. tableData: [],
  174. curRowes: {},
  175. diagnosisId: ""
  176. };
  177. },
  178. created() { },
  179. mounted() {
  180. this.addtoedit();
  181. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  182. },
  183. computed: {
  184. ...mapState(["itemSet", "window"]),
  185. },
  186. methods: {
  187. getlist(itemId, ReferenceRangeTypeFlag) {
  188. getapi(
  189. `/api/app/reference-range/in-type/${itemId}?ReferenceRangeTypeFlag=${ReferenceRangeTypeFlag}`
  190. ).then((res) => {
  191. this.tableData = res.data;
  192. });
  193. },
  194. remoteMethods(keyWords) {
  195. if (keyWords) {
  196. this.diagnosis = [];
  197. this.diagnosisId.forEach(item => {
  198. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  199. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  200. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  201. ) {
  202. this.diagnosis.push(item);
  203. }
  204. });
  205. } else {
  206. this.quckeDitd = deepCopy(this.diagnosis);
  207. }
  208. },
  209. remoteMethodes(keyWords) {
  210. if (keyWords) {
  211. this.diagnosies = [];
  212. this.diagnosisId.forEach(item => {
  213. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  214. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  215. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  216. ) {
  217. this.diagnosies.push(item);
  218. }
  219. });
  220. } else {
  221. this.quckeDitd = deepCopy(this.diagnosies);
  222. }
  223. },
  224. rowick(row) {
  225. this.curRowes = row;
  226. this.id = row.id;
  227. // getapi(`/api/app/reference-range/${row.id}`).then((res) => {
  228. // this.curRowes = res.data;
  229. // this.id = res.data.id;
  230. // });
  231. },
  232. quckEditdigoisce(e) {
  233. if (!e) {
  234. this.remoteMethods()
  235. }
  236. },
  237. quckEditdigoisces(e) {
  238. if (!e) {
  239. this.remoteMethodes()
  240. }
  241. },
  242. //ldddw(forSexId, 'id', scope.row.forSexId, 'displayName')
  243. ldddw(arrayData, key, value, display) {
  244. return dddw(arrayData, key, value, display);
  245. },
  246. // 新增或者编辑需要的类别
  247. addtoedit() {
  248. //适用性别
  249. getapi("/api/app/for-sex").then((res) => {
  250. this.forSexId = res.data;
  251. });
  252. //诊断
  253. postapi("/api/app/Diagnosis/GetSimpleList").then((res) => {
  254. this.diagnosis = res.data;
  255. this.diagnosies = res.data
  256. this.diagnosisId = res.data
  257. });
  258. },
  259. add() {
  260. this.addtoedit()
  261. this.id = "";
  262. this.dialogVisible = true;
  263. if (this.$refs.form !== undefined) {
  264. this.$refs.form.resetFields()
  265. }
  266. Object.assign(this.$data.form, this.$options.data().form)
  267. this.form = {
  268. itemId: this.itemId,
  269. referenceRangeTypeFlag: this.ReferenceRangeTypeFlag,
  270. forSexId: "A",
  271. ageLowerLimit: "0",
  272. ageUpperLimit: "200",
  273. };
  274. },
  275. //编辑弹框
  276. edit() {
  277. if (!this.id) {
  278. this.$message.warning({ showClose: true, message: "请先选中要编辑的记录" });
  279. return;
  280. }
  281. this.dialogVisible = true;
  282. if (this.$refs.form !== undefined) {
  283. this.$refs.form.resetFields()
  284. }
  285. this.form = { ...this.curRowes }
  286. this.addtoedit()
  287. },
  288. del() {
  289. //console.log("删除操作");
  290. if (!this.id) {
  291. this.$message.warning({ showClose: true, message: "请先选中要删除的记录" });
  292. return;
  293. }
  294. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  295. confirmButtonText: "确定",
  296. cancelButtonText: "取消",
  297. type: "warning",
  298. cancelButtonClass: "difference",
  299. confirmButtonClass: "commonbutton"
  300. })
  301. .then(() => {
  302. return deletapi(`/api/app/reference-range/${this.id}`, this.form);
  303. })
  304. .then((res) => {
  305. if (res.code != -1) {
  306. console.log("删除成功");
  307. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  308. this.id = "";
  309. }
  310. })
  311. .catch(() => {
  312. this.$message.info({ showClose: true, message: "已取消删除" });
  313. });
  314. },
  315. confirmationRequest() {
  316. if (!this.id) {
  317. postapi("/api/app/reference-range", this.form).then((res) => {
  318. if (res.code != -1) {
  319. console.log("新增成功");
  320. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  321. this.id = this.curRowes.id;
  322. this.dialogVisible = false
  323. }
  324. });
  325. } else {
  326. putapi(`/api/app/reference-range/${this.id}`, this.form).then(
  327. (res) => {
  328. if (res.code != -1) {
  329. console.log("修改成功");
  330. this.dialogVisible = false
  331. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  332. }
  333. }
  334. );
  335. }
  336. },
  337. //确定新增或者编辑
  338. onsbmint() {
  339. this.$refs["form"].validate((v) => {
  340. let that = this
  341. if (v) {
  342. that.confirmationRequest()
  343. // if(that.form.referenceRangeValue.includes('-')){
  344. // let before=/^\d+\.?\d?$/.test(that.form.referenceRangeValue.match(/(\S*)-/)[1])
  345. // let after=/^\d+\.?\d?$/.test(that.form.referenceRangeValue.match(/-(\S*)/)[1])
  346. // if(before && after){
  347. // if(that.form.criticalRangeValue!="" && that.form.criticalRangeValue!=undefined){
  348. // if(that.form.criticalRangeValue.includes('-')){
  349. // let criticalBefore=/^\d+\.?\d?$/.test(that.form.criticalRangeValue.match(/(\S*)-/)[1])
  350. // let criticalAfter=/^\d+\.?\d?$/.test(that.form.criticalRangeValue.match(/-(\S*)/)[1])
  351. // if(criticalBefore && criticalAfter){
  352. // that.confirmationRequest()
  353. // }else{
  354. // return that.$message.warning("警告范围值-符号前后必须是数字");
  355. // }
  356. // }else{
  357. // return that.$message.warning("警告范围值必须以-符号隔开");
  358. // }
  359. // }else{
  360. // that.confirmationRequest()
  361. // }
  362. // }else{
  363. // return that.$message.warning("参考范围值-符号前后必须是数字");
  364. // }
  365. // }else{
  366. // return that.$message.warning("参考范围值必须以-符号隔开");
  367. // }
  368. }
  369. });
  370. },
  371. },
  372. //监听事件
  373. watch: {
  374. //itemId','ReferenceRangeTypeFlag'
  375. itemId(newVal, oldVal) {
  376. if (newVal != oldVal && newVal != "") {
  377. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  378. }
  379. },
  380. ReferenceRangeTypeFlag(newVal, oldVal) {
  381. if (newVal != oldVal && newVal != "") {
  382. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  383. }
  384. },
  385. },
  386. };
  387. </script>
  388. <style scoped>
  389. /* .box {
  390. display: flex;
  391. margin-top: 15px;
  392. } */
  393. /* :deep .editButton .el-button{
  394. width: 100%;
  395. } */
  396. /* :deep .el-form-item {
  397. margin-bottom: 14px;
  398. } */
  399. </style>