From 8a980bd32dc2dc70f90447eb6ba293a06a2d881c Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期二, 28 十一月 2023 18:11:36 +0800 Subject: [PATCH] 提交信息 --- src/components/SFtable/index.vue | 215 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 123 insertions(+), 92 deletions(-) diff --git a/src/components/SFtable/index.vue b/src/components/SFtable/index.vue index feb19b5..2fdf215 100644 --- a/src/components/SFtable/index.vue +++ b/src/components/SFtable/index.vue @@ -1,100 +1,131 @@ <!-- 琛ㄦ牸缁勪欢灏佽 --> <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 + :data="currentList" + @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" type="selection" width="50" align="center" /> + <el-table-column label="搴忓彿" align="center" key="id" prop="id" /> + <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 type="index" :index="indexMethod" label="搴忓彿" width="80"> - </el-table-column> - <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="鎿嶄綔" 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 {}; + </el-table-column> + <el-table-column + label="鎿嶄綔" + 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('handleUpdate', scope.row)" + ><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)" + ><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"; +export default { + data() { + return { + ids: [], + }; + }, + 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, + }, + controlxz: { + type: Boolean, + default: true, + }, + multiplechoice:{ + type: Boolean, + default: true, + } + + }, + created() {}, + + 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 cellValue; - }, + return "鎵嬪姩"; + } + if (column.property === "createTime") { + return dayjs(cellValue).format("YYYY.MM.DD HH:mm:ss"); + } + 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> - \ No newline at end of file + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + $emit("handleSelectionChange", selection); + }, + }, +}; +</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> -- Gitblit v1.9.3