|  |  | 
 |  |  | <!-- 表格组件封装 --> | 
 |  |  | <template> | 
 |  |  |     <el-table | 
 |  |  |       :data="currentList" | 
 |  |  |       style="width: 1158px" | 
 |  |  |       :header-cell-style="{ | 
 |  |  |         background: '#f3f6fb', | 
 |  |  |         color: '#666', | 
 |  |  |         height: '42px', | 
 |  |  |         'font-weight': 400, | 
 |  |  |       }" | 
 |  |  |       :highlight-current-row="true" | 
 |  |  |       empty-text="暂无数据" | 
 |  |  |     > | 
 |  |  |       <el-table-column type="index" :index="indexMethod" label="序号" width="80"> | 
 |  |  |   <el-table | 
 |  |  |     ref="multipleTableson" | 
 |  |  |     :height="heights" | 
 |  |  |     :data=" | 
 |  |  |       currentList.filter( | 
 |  |  |         (data) => | 
 |  |  |           !search || data.name.toLowerCase().includes(search.toLowerCase()) | 
 |  |  |       ) | 
 |  |  |     " | 
 |  |  |     @selection-change="handleSelectionChange" | 
 |  |  |     :header-cell-style="{ | 
 |  |  |       background: '#f3f6fb', | 
 |  |  |       color: '#666', | 
 |  |  |       height: '42px', | 
 |  |  |       'font-weight': 400, | 
 |  |  |     }" | 
 |  |  |     :highlight-current-row="true" | 
 |  |  |     empty-text="暂无数据" | 
 |  |  |   > | 
 |  |  |     <el-table-column | 
 |  |  |       v-if="multiplechoice" | 
 |  |  |       fixed="left" | 
 |  |  |       type="selection" | 
 |  |  |       width="50" | 
 |  |  |       align="center" | 
 |  |  |     /> | 
 |  |  |     <el-table-column | 
 |  |  |       v-if="serialnumber" | 
 |  |  |       label="序号" | 
 |  |  |       align="center" | 
 |  |  |       key="id" | 
 |  |  |       prop="id" | 
 |  |  |     /> | 
 |  |  |     <div v-for="(item, index) in tableLabel"> | 
 |  |  |       <el-table-column | 
 |  |  |         v-if="item.label == '出院日期'" | 
 |  |  |         :key="index" | 
 |  |  |         :prop="item.prop" | 
 |  |  |         :width="item.width" | 
 |  |  |         :label="item.label" | 
 |  |  |         :formatter="formatData" | 
 |  |  |       > | 
 |  |  |         <template slot-scope="scope"> | 
 |  |  |           <span>{{ formatTime(scope.row.endtime) }}</span> | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |       <el-table-column | 
 |  |  |         v-for="(item, index) in tableLabel" | 
 |  |  |         v-if="item.label == '性别'" | 
 |  |  |         :key="index" | 
 |  |  |         :prop="item.prop" | 
 |  |  |         :width="item.width" | 
 |  |  |         :label="item.label" | 
 |  |  |         :formatter="formatData" | 
 |  |  |       > | 
 |  |  |         <template slot-scope="scope"> | 
 |  |  |           <span>{{ scope.row.sex == 1 ? "男" : "女" }}</span> | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |  | 
 |  |  |       <el-table-column | 
 |  |  |         v-if="item.label != '性别' && item.label != '出院日期'" | 
 |  |  |         :key="index" | 
 |  |  |         :prop="item.prop" | 
 |  |  |         :width="item.width" | 
 |  |  | 
 |  |  |         :formatter="formatData" | 
 |  |  |       > | 
 |  |  |       </el-table-column> | 
 |  |  |       <el-table-column label="操作" width="100"> | 
 |  |  |         <template slot-scope="scope"> | 
 |  |  |           <el-button type="text" @click.native="$emit('details', scope.row)" | 
 |  |  |             >查看详情</el-button | 
 |  |  |           > | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |     </el-table> | 
 |  |  |   </template> | 
 |  |  |    | 
 |  |  |   <script> | 
 |  |  |   import dayjs from "dayjs"; | 
 |  |  |   export default { | 
 |  |  |     data() { | 
 |  |  |       return {}; | 
 |  |  |     </div> | 
 |  |  |     <!-- <el-table-column | 
 |  |  |       v-for="(item, index) in tableLabel" | 
 |  |  |       :key="index" | 
 |  |  |       :prop="item.prop" | 
 |  |  |       :width="item.width" | 
 |  |  |       :label="item.label" | 
 |  |  |       :formatter="formatData" | 
 |  |  |     > | 
 |  |  |     </el-table-column> --> | 
 |  |  |     <!-- <el-table-column | 
 |  |  |       label="是否可用" | 
 |  |  |       align="center" | 
 |  |  |       key="isavailable" | 
 |  |  |       prop="isavailable" | 
 |  |  |       width="120" | 
 |  |  |     > | 
 |  |  |       <template slot-scope="scope"> | 
 |  |  |         <dict-tag :options="qyoptions" :value="scope.row.usestate" /> | 
 |  |  |       </template> | 
 |  |  |     </el-table-column> --> | 
 |  |  |     <el-table-column | 
 |  |  |       v-if="center && !searchTrue" | 
 |  |  |       label="操作" | 
 |  |  |       fixed="right" | 
 |  |  |       align="center" | 
 |  |  |       width="120" | 
 |  |  |       class-name="small-padding fixed-width" | 
 |  |  |     > | 
 |  |  |       <template slot-scope="scope"> | 
 |  |  |         <el-button | 
 |  |  |           v-if="controlxz" | 
 |  |  |           size="medium" | 
 |  |  |           type="text" | 
 |  |  |           @click.native="$emit('selectfn', scope.row, typeinfo)" | 
 |  |  |           ><span class="button-zx" | 
 |  |  |             ><i class="el-icon-s-promotion"></i>选择</span | 
 |  |  |           ></el-button | 
 |  |  |         > | 
 |  |  |         <el-button | 
 |  |  |           v-if="controlsc" | 
 |  |  |           size="medium" | 
 |  |  |           type="text" | 
 |  |  |           @click.native="$emit('details', scope.row, typeinfo)" | 
 |  |  |           ><span style="color: red" | 
 |  |  |             ><i class="el-icon-delete"></i>删除</span | 
 |  |  |           ></el-button | 
 |  |  |         > | 
 |  |  |       </template> | 
 |  |  |     </el-table-column> | 
 |  |  |     <el-table-column | 
 |  |  |       v-if="center && searchTrue" | 
 |  |  |       label="操作" | 
 |  |  |       fixed="right" | 
 |  |  |       align="right" | 
 |  |  |       width="200" | 
 |  |  |       class-name="small-padding fixed-width" | 
 |  |  |     > | 
 |  |  |       <template slot="header" slot-scope="scope"> | 
 |  |  |         <el-input v-model="search" size="mini" placeholder="输入患者名称搜索" /> | 
 |  |  |       </template> | 
 |  |  |       <template slot-scope="scope"> | 
 |  |  |         <el-button | 
 |  |  |           v-if="controlxz" | 
 |  |  |           size="medium" | 
 |  |  |           type="text" | 
 |  |  |           @click.native="$emit('selectfn', scope.row, typeinfo)" | 
 |  |  |           ><span class="button-zx" | 
 |  |  |             ><i class="el-icon-s-promotion"></i>选择</span | 
 |  |  |           ></el-button | 
 |  |  |         > | 
 |  |  |         <el-button | 
 |  |  |           v-if="controlsc" | 
 |  |  |           size="medium" | 
 |  |  |           type="text" | 
 |  |  |           @click.native="$emit('details', scope.row, typeinfo)" | 
 |  |  |           ><span style="color: red" | 
 |  |  |             ><i class="el-icon-delete"></i>删除</span | 
 |  |  |           ></el-button | 
 |  |  |         > | 
 |  |  |       </template> | 
 |  |  |     </el-table-column> | 
 |  |  |   </el-table> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  | import dayjs from "dayjs"; | 
 |  |  | import store from "@/store"; | 
 |  |  | export default { | 
 |  |  |   data() { | 
 |  |  |     return { | 
 |  |  |       ids: [], | 
 |  |  |       mode: [], | 
 |  |  |       languagelist: [], | 
 |  |  |       editabshape: [], | 
 |  |  |       qyoptions: [], | 
 |  |  |       precedencetype: [], | 
 |  |  |       search: "", | 
 |  |  |     }; | 
 |  |  |   }, | 
 |  |  |   props: { | 
 |  |  |     currentList: { | 
 |  |  |       type: Array, | 
 |  |  |       required: true, | 
 |  |  |     }, | 
 |  |  |     props: { | 
 |  |  |       currentList: { | 
 |  |  |         type: Array, | 
 |  |  |         required: true, | 
 |  |  |       }, | 
 |  |  |       tableLabel: { | 
 |  |  |         type: Array, | 
 |  |  |         default: () => [], | 
 |  |  |       }, | 
 |  |  |       currentIndex: { | 
 |  |  |         type: Number, | 
 |  |  |         required: true, | 
 |  |  |       }, | 
 |  |  |     tableLabel: { | 
 |  |  |       type: Array, | 
 |  |  |       default: () => [], | 
 |  |  |     }, | 
 |  |  |     created() {}, | 
 |  |  |    | 
 |  |  |     methods: { | 
 |  |  |       indexMethod(index) { | 
 |  |  |         return parseInt(this.currentIndex) - 9 + index; | 
 |  |  |       }, | 
 |  |  |     controlsc: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: true, | 
 |  |  |     }, | 
 |  |  |     center: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: true, | 
 |  |  |     }, | 
 |  |  |     controlxz: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: true, | 
 |  |  |     }, | 
 |  |  |     multiplechoice: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: true, | 
 |  |  |     }, | 
 |  |  |     serialnumber: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: true, | 
 |  |  |     }, | 
 |  |  |     // 1模板列表 2选中患者 3患者列表 | 
 |  |  |     typeinfo: { | 
 |  |  |       type: Number, | 
 |  |  |       default: 1, | 
 |  |  |     }, | 
 |  |  |     heights: { | 
 |  |  |       type: Number, | 
 |  |  |       default: 600, | 
 |  |  |     }, | 
 |  |  |     searchTrue: { | 
 |  |  |       type: Boolean, | 
 |  |  |       default: false, | 
 |  |  |     }, | 
 |  |  |   }, | 
 |  |  |   created() { | 
 |  |  |     this.mode = store.getters.mode; | 
 |  |  |     this.languagelist = store.getters.languagelist; | 
 |  |  |     this.qyoptions = store.getters.usable; | 
 |  |  |     this.precedencetype = store.getters.precedencetype; | 
 |  |  |     this.editabshape = store.getters.editabshape; | 
 |  |  |   }, | 
 |  |  |  | 
 |  |  |   methods: { | 
 |  |  |     //   数据过滤 | 
 |  |  |       formatData(row, column, cellValue) { | 
 |  |  |         if (column.property === "createType") { | 
 |  |  |           if (cellValue === 1) { | 
 |  |  |             return "自动"; | 
 |  |  |           } | 
 |  |  |           return "手动"; | 
 |  |  |     formatData(row, column, cellValue) { | 
 |  |  |       if (column.property === "createType") { | 
 |  |  |         if (cellValue === 1) { | 
 |  |  |           return "自动"; | 
 |  |  |         } | 
 |  |  |         if (column.property === "createTime") { | 
 |  |  |           return dayjs(cellValue).format("YYYY.MM.DD HH:mm:ss"); | 
 |  |  |         return "手动"; | 
 |  |  |       } | 
 |  |  |       if ( | 
 |  |  |         column.property === "createTime" || | 
 |  |  |         column.property === "inhosptime" | 
 |  |  |       ) { | 
 |  |  |         if (cellValue === null) { | 
 |  |  |           return ""; | 
 |  |  |         } | 
 |  |  |         return cellValue; | 
 |  |  |       }, | 
 |  |  |         return dayjs(cellValue).format("YYYY-MM-DD "); | 
 |  |  |       } | 
 |  |  |       return cellValue; | 
 |  |  |     }, | 
 |  |  |   }; | 
 |  |  |   </script> | 
 |  |  |    | 
 |  |  |   <style lang="scss"> | 
 |  |  |   .el-table td, | 
 |  |  |   .el-table th.is-leaf { | 
 |  |  |     border-bottom: unset; | 
 |  |  |   } | 
 |  |  |   .el-table td, | 
 |  |  |   .el-table th { | 
 |  |  |     padding: 5px 0; | 
 |  |  |   } | 
 |  |  |   .el-table thead { | 
 |  |  |     font-weight: 400; | 
 |  |  |     color: #666; | 
 |  |  |   } | 
 |  |  |   .dialog-footer { | 
 |  |  |     width: 100%; | 
 |  |  |     padding: 10px 20px 20px; | 
 |  |  |     text-align: center !important; | 
 |  |  |     -webkit-box-sizing: border-box; | 
 |  |  |     box-sizing: border-box; | 
 |  |  |   } | 
 |  |  |   </style> | 
 |  |  |    | 
 |  |  |     // 多选框选中数据 | 
 |  |  |     handleSelectionChange(selection) { | 
 |  |  |       console.log(selection); | 
 |  |  |  | 
 |  |  |       this.$emit("handleSelectionChange", selection); | 
 |  |  |     }, | 
 |  |  |     toggleRowSelection(row, selected) { | 
 |  |  |       this.$refs.multipleTableson.toggleRowSelection(row, selected); | 
 |  |  |     }, | 
 |  |  |     clearSelection() { | 
 |  |  |       // 在这里编写清除选择的逻辑 | 
 |  |  |       this.$refs.multipleTableson.clearSelection(); | 
 |  |  |     }, | 
 |  |  |   }, | 
 |  |  | }; | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style lang="scss"> | 
 |  |  | .el-table td, | 
 |  |  | .el-table th.is-leaf { | 
 |  |  |   border-bottom: unset; | 
 |  |  | } | 
 |  |  | .el-table td, | 
 |  |  | .el-table th { | 
 |  |  |   padding: 5px 0; | 
 |  |  | } | 
 |  |  | .el-table thead { | 
 |  |  |   font-weight: 400; | 
 |  |  |   color: #666; | 
 |  |  | } | 
 |  |  | .dialog-footer { | 
 |  |  |   width: 100%; | 
 |  |  |   padding: 10px 20px 20px; | 
 |  |  |   text-align: center !important; | 
 |  |  |   -webkit-box-sizing: border-box; | 
 |  |  |   box-sizing: border-box; | 
 |  |  | } | 
 |  |  | </style> |