HealthTracking.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="physical">
  3. <!-- 底部数据 -->
  4. <div class="data-show">
  5. <div style="margin-bottom:10px;" class="flex flex-row-between flex-col-center">
  6. <div>
  7. <el-button style="width:80px;" type="warning" size="mini" @click="back()">返回</el-button>
  8. </div>
  9. <div style="font-size:16px;font-weight:600;">健康跟踪记录</div>
  10. <div>
  11. <el-button style="width:80px;" type="primary" size="mini" @click="openPopup">新增</el-button>
  12. </div>
  13. </div>
  14. <div class="today-table">
  15. <el-table :data="tableData" stripe style="width: 100%" border height="100%">
  16. <!-- <el-table-column type="selection" width="55">
  17. </el-table-column>-->
  18. <el-table-column prop="id" label="序号" width="50" align="center"></el-table-column>
  19. <el-table-column prop="createTime" label="记录时间" width="150" align="center"></el-table-column>
  20. <el-table-column prop="recorder" label="记录人" width="100" align="center"></el-table-column>
  21. <el-table-column prop="content" label="记录内容" align="center">
  22. <template slot-scope="scope">
  23. <div class="ellipsis-line1">{{scope.row.content}}</div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="操作" align="center" width="100">
  27. <template slot-scope="scope">
  28. <el-button size="mini" type="primary" @click="find(scope)">查看</el-button>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. </div>
  33. <div class="flex-vertical-center-r today-page">
  34. <el-pagination
  35. background
  36. layout=" prev, pager, next, jumper, total"
  37. :total="total"
  38. :page-size="limit"
  39. @current-change="sizeC($event)"
  40. ></el-pagination>
  41. </div>
  42. </div>
  43. <!-- 跟踪记录 添加 -->
  44. <popup
  45. :showDialog.sync="showPopup"
  46. width="40%"
  47. :showBtns="false"
  48. title="健康跟踪记录"
  49. :showBody="false"
  50. distanceTop="10vh"
  51. >
  52. <template slot="body">
  53. <div>
  54. <el-input
  55. :disabled="isDisable"
  56. v-model="content"
  57. type="textarea"
  58. placeholder="请输入健康跟踪内容"
  59. :autosize="{ minRows: 5, maxRows: 20}"
  60. ></el-input>
  61. </div>
  62. <div
  63. class="flex flex-col-center flex-row-center"
  64. style="margin-top:10px;"
  65. v-if="!isDisable"
  66. >
  67. <el-button size="small" type="primary" @click="sureSubmit">确定</el-button>
  68. <el-button size="small" @click="canclePopup">取消</el-button>
  69. </div>
  70. </template>
  71. </popup>
  72. </div>
  73. </template>
  74. <script>
  75. import popup from "@/components/Propup";
  76. import { getHealthTrack, addHealthTrack } from "@/api/diagnosis.js";
  77. export default {
  78. components: {
  79. popup
  80. },
  81. data() {
  82. return {
  83. search_name: "",
  84. page: 1,
  85. limit: 10,
  86. total: 0,
  87. tableData: [],
  88. content: "",
  89. showPopup: false,
  90. isDisable: false
  91. };
  92. },
  93. created() {
  94. this.getHealthTrack();
  95. },
  96. methods: {
  97. canclePopup() {
  98. this.showPopup = false;
  99. this.content = "";
  100. this.isDisable = false;
  101. },
  102. openPopup() {
  103. this.showPopup = true;
  104. this.content = "";
  105. this.isDisable = false;
  106. },
  107. find(scope) {
  108. this.showPopup = true;
  109. this.content = scope.row.content;
  110. this.isDisable = true;
  111. },
  112. // 返回按钮点击
  113. back() {
  114. // this.$router.push({
  115. // path: '/index/physical'
  116. // })
  117. this.$router.back();
  118. },
  119. sizeC(e) {
  120. this.page = e;
  121. this.getHealthTrack();
  122. },
  123. sureSubmit() {
  124. if (!this.content) {
  125. this.$message.error("内容不能为空");
  126. return;
  127. }
  128. this.addHealthTrack(this.$route.query.pid);
  129. },
  130. // 获取列表
  131. async getHealthTrack() {
  132. let res = await getHealthTrack({
  133. dentificationId: this.$route.query.pid,
  134. page: this.page,
  135. limit: this.limit
  136. });
  137. if (res.ResultCode == 0) {
  138. this.tableData = res.Data.Items;
  139. this.total = res.Data.TotalRecordCount;
  140. this.tableData.filter((item, index) => {
  141. if (this.page > 1) {
  142. return (item.id = (this.page - 1) * 10 + (index + 1));
  143. } else {
  144. return (item.id = index + 1);
  145. }
  146. });
  147. }
  148. },
  149. // 添加 记录
  150. async addHealthTrack(id) {
  151. let res = await addHealthTrack({
  152. dentificationId: id,
  153. content: this.content
  154. }).catch(err => {});
  155. if (res.ResultCode == 0) {
  156. this.$message({
  157. type: "success",
  158. message: "新增成功",
  159. showClose: true
  160. });
  161. this.canclePopup();
  162. this.getHealthTrack();
  163. }
  164. }
  165. }
  166. };
  167. </script>
  168. <style lang="scss" scoped>
  169. @import "../../style/common.scss";
  170. @import "../../style/base.scss";
  171. .data-show {
  172. margin-top: 5px;
  173. padding: 10px;
  174. background: #ffffff;
  175. border-radius: 5px;
  176. height: 77vh;
  177. .btns {
  178. margin-bottom: 30px;
  179. div {
  180. width: 74px;
  181. height: 36px;
  182. background: #9F643A;
  183. border-radius: 4px;
  184. font-size: 14px;
  185. font-family: PingFang SC;
  186. font-weight: 400;
  187. color: #ffffff;
  188. cursor: pointer;
  189. }
  190. .bg-yellow {
  191. background: #ffae45;
  192. margin-left: 20px;
  193. }
  194. }
  195. .today-table {
  196. height: 82%;
  197. .operation {
  198. div {
  199. width: 60px;
  200. height: 24px;
  201. background: #9F643A;
  202. border-radius: 2px;
  203. cursor: pointer;
  204. font-size: 14px;
  205. font-family: PingFang SC;
  206. font-weight: 400;
  207. color: #ffffff;
  208. }
  209. .bg-yellow {
  210. background: #ffae45;
  211. margin-left: 15px;
  212. }
  213. }
  214. }
  215. }
  216. .table::v-deep .el-table .cell {
  217. text-align: center;
  218. }
  219. </style>
  220. <style lang="scss" scoped>
  221. @media screen and (min-width: 1681px) and (max-width: 1920px) {
  222. .data-show {
  223. height: 85vh;
  224. .today-table {
  225. height: 90%;
  226. }
  227. }
  228. .today-table::v-deep .el-table td {
  229. padding: 18px 0;
  230. }
  231. .today-table::v-deep .el-table th {
  232. padding: 18px 0;
  233. }
  234. }
  235. @media screen and (min-width: 1601px) and (max-width: 1680px) {
  236. .data-show {
  237. height: 85vh;
  238. .today-table {
  239. height: 90%;
  240. }
  241. }
  242. .today-table::v-deep .el-table td {
  243. padding: 16px 0;
  244. }
  245. .today-table::v-deep .el-table th {
  246. padding: 16px 0;
  247. }
  248. .today-table::v-deep .el-table td {
  249. padding: 16px 0;
  250. }
  251. .today-table::v-deep .el-table th {
  252. padding: 18px 0;
  253. }
  254. }
  255. @media screen and (min-width: 1361px) and (max-width: 1600px) {
  256. .data-show {
  257. height: 78vh;
  258. .today-table {
  259. height: 85%;
  260. }
  261. }
  262. .today-table::v-deep .el-table td {
  263. padding: 5px 0;
  264. }
  265. .today-table::v-deep .el-table th {
  266. padding: 5px 0;
  267. }
  268. }
  269. @media screen and(min-width:1281px) and (max-width: 1360px) {
  270. .data-show {
  271. height: 78vh;
  272. .today-table {
  273. height: 85%;
  274. }
  275. }
  276. .today-table::v-deep .el-table td {
  277. padding: 5px 0;
  278. }
  279. .today-table::v-deep .el-table th {
  280. padding: 5px 0;
  281. }
  282. }
  283. </style>