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.

219 lines
6.5 KiB

1 year ago
  1. <template>
  2. <div>
  3. <div>
  4. <div class="contenttitle">
  5. 明细记录
  6. </div>
  7. <!--公共表分类信息-->
  8. <div style="display: flex; font-size: 14px">
  9. <div :style="'display: block;width:' + (window.pageWidth - window.pageMarginWidth - 110 - 5) + 'px;'">
  10. <el-table id="thirdMedicalCenterBookingDate" :data="thirdMedicalCenterBookingDate"
  11. ref="thirdMedicalCenterBookingDate" row-key="id" border :height="`${tableHeight}px`" size="small"
  12. highlight-current-row :row-class-name="handleRowClassName">
  13. <el-table-column type="index" label="序号" width="50" align="center" />
  14. <el-table-column label="体检中心" prop="thirdMedicalCenterId" min-width="200" align="center" />
  15. <el-table-column prop="bookingDate" label="可约日期" min-width="130" align="center" />
  16. </el-table>
  17. </div>
  18. <!--按钮-->
  19. <div style="display: block; margin-left: 5px">
  20. <div style="margin-top: 5px">
  21. <el-button class="commonbutton" @click="btnSetBookDate">设置预约日期</el-button>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. <!-- 新增或者编辑弹框 -->
  27. <el-dialog title="设置可预约日期" :close-on-click-modal="false" :visible.sync="setting" width="240px"
  28. @close="close_setting">
  29. <div>
  30. <el-table :data="form.bookingDates" border height="480px" size="small" highlight-current-row
  31. :row-class-name="handleRowClassName" row-key="id">
  32. <el-table-column label="可约日期" min-width="150" align="center">
  33. <template slot-scope="scope">
  34. <el-date-picker v-model="scope.row.bookingDate" type="date" placeholder="可约日期" size="small"
  35. value-format="yyyy-MM-dd" style="width: 150px;" />
  36. </template>
  37. </el-table-column>
  38. <el-table-column fixed="right" label="操作" width="60" align="center">
  39. <template slot-scope="scope">
  40. <i class="el-icon-delete" @click="form.bookingDates.splice(scope.$index, 1)"
  41. style="font-size: 24px;color: red;cursor:pointer;"></i>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <div>
  46. <el-button class="commonbutton" @click="form.bookingDates.push({ id: Math.random(), bookingDate: '' })">新增</el-button>
  47. <el-button class="commonbutton" @click="btnSubmit">确定</el-button>
  48. </div>
  49. </div>
  50. </el-dialog>
  51. <!-- -->
  52. </div>
  53. </template>
  54. <script>
  55. import moment from "moment";
  56. import Sortable from "sortablejs";
  57. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  58. import { mapState } from "vuex";
  59. import {
  60. getPagePriv,
  61. checkPagePriv,
  62. dddw,
  63. deepCopy,
  64. objCopy,
  65. arrayExistObj,
  66. } from "../../utlis/proFunc";
  67. export default {
  68. components: {
  69. },
  70. data() {
  71. return {
  72. pagePriv: {
  73. routeUrlorPageName: "commonTable", //当前页面归属路由或归属页面权限名称
  74. privs: [], // 页面权限
  75. },
  76. thirdMedicalCenterBookingDate: [], // 公共表
  77. setting: false,
  78. form: {
  79. thirdMedicalCenterId: "",
  80. bookingDates: []
  81. }
  82. };
  83. },
  84. computed: {
  85. ...mapState(["pickerOptions", "personnelUnit", "window", "dict", "dialogWin", "dataTransOpts"]),
  86. tableHeight() {
  87. let h = this.window.pageHeight < 600 ? 600 : this.window.pageHeight
  88. return h - this.window.pageHeaderHeight - this.window.cardHeaderHeight - this.window.pageMarginHeight - 360
  89. },
  90. },
  91. created() {
  92. //获取用户当前页面的权限
  93. let userPriv = window.sessionStorage.getItem("userPriv");
  94. if (userPriv)
  95. this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName));
  96. // 清除当前选中的分组ID
  97. this.dataTransOpts.tableS.third_medical_center_booking_date.id = ''
  98. },
  99. mounted() {
  100. //获取初始数据(单位、适用性别)
  101. this.dictInit();
  102. },
  103. methods: {
  104. moment,
  105. checkPagePriv,
  106. dddw,
  107. deepCopy,
  108. getList(body) {
  109. // body = {
  110. // "thirdMedicalCenterId": "string",
  111. // "keyWord": "string"
  112. // }
  113. this.thirdMedicalCenterBookingDate = []
  114. if (!body.thirdMedicalCenterId) return
  115. postapi('/api/app/ThirdMedicalCenter/GetThirdMedicalCenterBookingDateList', body).then(res => {
  116. if (res.code > -1) {
  117. this.thirdMedicalCenterBookingDate = res.data
  118. }
  119. })
  120. },
  121. btnSubmit() {
  122. let body = {
  123. thirdMedicalCenterId: this.form.thirdMedicalCenterId,
  124. bookingDates: []
  125. }
  126. this.form.bookingDates.forEach(e => {
  127. if (e.bookingDate) body.bookingDates.push(e.bookingDate)
  128. });
  129. postapi('/api/app/ThirdMedicalCenter/CreateThirdMedicalCenterBookingDate', body)
  130. .then(res => {
  131. if (res.code > -1) {
  132. this.setting = false
  133. }
  134. })
  135. },
  136. close_setting() {
  137. this.getList({ thirdMedicalCenterId: this.dataTransOpts.tableS.third_medical_center.id })
  138. },
  139. //选中颜色
  140. handleRowClassName({ row, rowIndex }) {
  141. // highLightBg 为 'selected'的高亮
  142. //console.log(rowIndex, row)
  143. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  144. if (row.choosed) {
  145. return "current-row";
  146. } else {
  147. return "";
  148. }
  149. },
  150. //获取初始数据
  151. dictInit() {
  152. },
  153. btnSetBookDate() {
  154. if (!this.dataTransOpts.tableS.third_medical_center.id) {
  155. this.$message.warning({ showClose: true, message: '未选择体检中心' })
  156. return
  157. }
  158. this.form.thirdMedicalCenterId = this.dataTransOpts.tableS.third_medical_center.id
  159. this.form.bookingDates = deepCopy(this.thirdMedicalCenterBookingDate)
  160. this.setting = true
  161. }
  162. },
  163. //监听事件
  164. watch: {
  165. // 刷新公共表数据
  166. "dataTransOpts.refresh.third_medical_center_booking_date.M": {
  167. // immediate:true,
  168. handler(newVal, oldVal) {
  169. console.log(`watch 公共表分类 newVal:${newVal} oldVal:${oldVal} thirdMedicalCenterId: ${this.dataTransOpts.tableS.third_medical_center.id}`);
  170. if (newVal != oldVal) this.getList({ thirdMedicalCenterId: this.dataTransOpts.tableS.third_medical_center.id });
  171. }
  172. },
  173. },
  174. };
  175. </script>
  176. <style scoped>
  177. @import "../../assets/css/global_button.css";
  178. @import "../../assets/css/global_dialog.css";
  179. @import "../../assets/css/global_table.css";
  180. @import "../../assets/css/global_form.css";
  181. @import "../../assets/css/global_input.css";
  182. @import "../../assets/css/global.css";
  183. .btnClass {
  184. width: 100px;
  185. margin-bottom: 5px;
  186. }
  187. </style>