reviewIndicators.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <!-- 发病时间页面 -->
  3. <div class="box">
  4. <el-row :gutter="16">
  5. <!-- 左侧菜单 -->
  6. <el-col :span="8">
  7. <div class="box_wrapper" :style="{ height: boxWrapperHeight }">
  8. <el-input placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
  9. <el-tree
  10. class="filter-tree"
  11. node-key="id"
  12. highlight-current
  13. :data="menus"
  14. :props="defaultProps"
  15. :filter-node-method="filterNode"
  16. ref="tree"
  17. @node-click="handleNodeClick"
  18. :current-node-key="ruleId"
  19. :default-expanded-keys="[ruleId]"
  20. ></el-tree>
  21. </div>
  22. </el-col>
  23. <!-- 右侧列表 -->
  24. <el-col :span="16">
  25. <div class="box_wrapper" :style="{ height: boxWrapperHeight }">
  26. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  27. <el-form-item label="查询时间">
  28. <el-date-picker
  29. v-model="formInline.year"
  30. :clearable="false"
  31. type="year"
  32. :picker-options="pickerOptions"
  33. format="yyyy年"
  34. value-format="yyyy"
  35. placeholder="选择年份"
  36. ></el-date-picker>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button type="primary" @click="onSearch">查询</el-button>
  40. </el-form-item>
  41. <el-form-item style="float: right">
  42. <el-button v-if="$route.query.type === 'children'" @click="onBack">返回</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <el-table :data="tableData" style="width: 100%">
  46. <el-table-column prop="name" label="名称" show-overflow-tooltip></el-table-column>
  47. <el-table-column prop="time" label="日期" width="200"></el-table-column>
  48. <el-table-column prop="res" label="数据" width="200">
  49. <template slot-scope="scope">
  50. <span class="link" :class="{ pointer: scope.row.source !== '人工录入' }" @click="toCaseIndexPage(scope.row)">{{ scope.row.res }}%</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="" label="来源" width="200">
  54. <template slot-scope="scope">
  55. <span :class="{ green: scope.row.source === '人工录入' }">{{ scope.row.source }}</span>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. </div>
  63. </template>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. menus: [
  69. {
  70. id: 60,
  71. name: '指标一,脑梗发病时间',
  72. },
  73. {
  74. id: 61,
  75. name: '指标二,心肌梗死发病时间',
  76. },
  77. ],
  78. formInline: {
  79. year: '',
  80. },
  81. tableData: [],
  82. filterText: '',
  83. defaultProps: {
  84. children: 'children',
  85. label: 'name',
  86. },
  87. ruleId: 60,
  88. ruleName: '脑梗发病时间',
  89. time: new Date(),
  90. pickerOptions: {
  91. disabledDate(time) {
  92. const date = new Date();
  93. const year = date.getFullYear();
  94. const timeYear = time.getFullYear();
  95. return year < timeYear;
  96. },
  97. },
  98. };
  99. },
  100. created() {
  101. // 获取当前时间
  102. this.formInline.year = new Date().getFullYear().toString();
  103. this.getList();
  104. },
  105. computed: {
  106. // 判断是取分子还是分母
  107. judgeNum() {
  108. const str = `${this.ruleId}`;
  109. const length = str.length;
  110. const lastNum = str[length - 1];
  111. if (Number(lastNum) > 1) {
  112. // 分母
  113. return 'denominator';
  114. } else {
  115. // 分子
  116. return 'numerator';
  117. }
  118. },
  119. menuList() {
  120. if (this.$route.path === '/embedIndex-home') {
  121. return this.menus2;
  122. } else {
  123. return this.$route.query.type === 'children' ? this.cMenus : this.menus;
  124. }
  125. },
  126. judgeEdit() {
  127. return this.greenColorMenus.includes(this.ruleId) && !!this.tableData.length;
  128. },
  129. boxWrapperHeight() {
  130. return this.$route.path === '/embedIndex-home' ? '815px' : '885px';
  131. },
  132. },
  133. watch: {
  134. filterText(val) {
  135. // 树上面的筛选
  136. this.$refs.tree.filter(val);
  137. },
  138. },
  139. methods: {
  140. // 返回
  141. onBack() {
  142. this.$router.go(-1);
  143. },
  144. // 病案指标列表跳转
  145. toCaseIndexPage(row) {
  146. const { time, source } = row;
  147. if (source === '人工录入') {
  148. return;
  149. }
  150. let path;
  151. if (this.$route.path === '/embedIndex-home') {
  152. path = '/embedIndex-caseIndexList';
  153. } else {
  154. path = '/reviewIndicatorsList';
  155. }
  156. this.$router.push({ path, query: { year: this.formInline.year, time, ruleId: Number(`${this.ruleId}`.slice(0, 2)), type: this.judgeNum } });
  157. },
  158. // 菜单筛选
  159. filterNode(value, data) {
  160. if (!value) return true;
  161. return data.name.indexOf(value) !== -1;
  162. },
  163. handleNodeClick(data) {
  164. const { id, name } = data;
  165. this.ruleId = id;
  166. if (id == 60) {
  167. this.ruleName = '脑梗发病时间';
  168. }
  169. if (id == 61) {
  170. this.ruleName = '心肌梗死发病时间';
  171. }
  172. this.getList();
  173. console.log('vvvvvv');
  174. console.log(name);
  175. // if (id > 10 && this.formInline.year) {
  176. // this.getList();
  177. // }
  178. },
  179. // 获取右侧列表数据
  180. getList() {
  181. const { year } = this.formInline;
  182. const params = {
  183. start_time: `${year}0101`,
  184. end_time: `${year}1231`,
  185. year,
  186. type: Number(this.ruleId),
  187. };
  188. // if (this.ruleId < 100) {
  189. // params.request_source = 1;
  190. // } else {
  191. // params.request_source = this.judgeNum === 'denominator' ? 2 : 3;
  192. // }
  193. params.request_source = 1;
  194. this.$axios2.post('/get_assessment_indicators', params).then(res => {
  195. if (Array.isArray(res.data)) {
  196. res.data.map(item => {
  197. item.name = this.ruleName;
  198. item.ruleId = this.ruleId;
  199. });
  200. this.tableData = res.data;
  201. } else {
  202. this.tableData = [];
  203. }
  204. });
  205. },
  206. // 查询
  207. onSearch() {
  208. const { year } = this.formInline;
  209. console.log(year);
  210. if (!year) {
  211. this.$message.error('请选择查询时间');
  212. return;
  213. }
  214. if (!this.ruleId) {
  215. this.$message.error('请选择查询指标');
  216. return;
  217. }
  218. this.getList();
  219. },
  220. },
  221. };
  222. </script>
  223. <style lang="scss" scoped>
  224. .table_edit {
  225. margin-left: 10px;
  226. cursor: pointer;
  227. &:hover {
  228. opacity: 0.6;
  229. }
  230. }
  231. .link {
  232. font-weight: 600;
  233. color: #409eff;
  234. }
  235. .pointer {
  236. cursor: pointer;
  237. }
  238. .box {
  239. padding: 16px;
  240. .box_wrapper {
  241. padding: 16px;
  242. background: #fff;
  243. border-radius: 5px;
  244. overflow-x: hidden;
  245. overflow-y: auto;
  246. }
  247. }
  248. .filter-tree {
  249. margin-top: 16px;
  250. ::v-deep .el-tree-node__content {
  251. height: 36px;
  252. line-height: 36px;
  253. }
  254. }
  255. ::v-deep.el-table .el-table__header tr th {
  256. background: #f1f6ff;
  257. color: #13171e;
  258. border-bottom: 0px;
  259. }
  260. ::v-deep.el-table .el-table__row td {
  261. color: #7e8bab;
  262. border-bottom: 1px solid #f4f4f4;
  263. }
  264. ::v-deep.el-table .el-table__header tr th:first-child {
  265. border-radius: 5px 0px 0px 5px;
  266. }
  267. ::v-deep.el-table .el-table__header tr th:nth-child(3) {
  268. border-radius: 0px 5px 5px 0px;
  269. }
  270. .green {
  271. color: #67c23a;
  272. }
  273. </style>