| @ -0,0 +1,101 @@ | |||
| <template> | |||
| <div class="jcb-table-container"> | |||
| <CustomTable :ref="`tableRef`" :columns="jcbColumns" :formData="formData" :prefixKey="prefixKey" | |||
| class="jcb-table" | |||
| operationWidth = "120px" | |||
| @clickable="handleClickable" | |||
| @clickButton = "handleClickButton" | |||
| fieldItemLabel="template.common.operationSteps" :showOperation="templateFillType === 'preFill'"> | |||
| <template slot="operation" slot-scope="{ row, rowIndex, columns }"> | |||
| <TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow"> | |||
| </TableOpertaionDelete> | |||
| </template> | |||
| </CustomTable> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import CustomTable from '../CustomTable.vue'; | |||
| import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue" | |||
| export default { | |||
| inject: ['templateFillType'], | |||
| components: { | |||
| CustomTable, | |||
| TableOpertaionDelete, | |||
| }, | |||
| name: 'JcbComp', | |||
| props: { | |||
| formData: { | |||
| type: Object, | |||
| default: () => { }, | |||
| }, | |||
| prefixKey: { | |||
| type: String, | |||
| default: '', | |||
| }, | |||
| }, | |||
| computed: { | |||
| jcbColumns() { | |||
| return [ | |||
| { | |||
| label: '处理批', | |||
| prop: 'clp', | |||
| width: '200px', | |||
| bodyType:"clickable", | |||
| bodyKey:"clpClick", | |||
| bodyFillType:"preFill", | |||
| }, | |||
| { | |||
| label: '时间', | |||
| prop: 'time', | |||
| width: '200px', | |||
| bodyType:"input", | |||
| bodyDisabled:true, | |||
| bodyFillType:"preFill", | |||
| bodySubType:"button", | |||
| bodySubButtonName:"取出", | |||
| bodySubKey:"timeClick", | |||
| bodySubFillType:"preFill", | |||
| }, | |||
| ] | |||
| }, | |||
| }, | |||
| methods: { | |||
| // 删除表格行 | |||
| deleteRow(rowIndex) { | |||
| const tableRef = this.$refs['tableRef']; | |||
| if (tableRef) { | |||
| tableRef.deleteRow(rowIndex); | |||
| } | |||
| }, | |||
| // 点击事件 | |||
| handleClickable(col, rowIndex, row) { | |||
| console.log(col, rowIndex, row,"rowIndex") | |||
| if (col.bodyKey === 'clpClick') { | |||
| console.log(col, rowIndex, row,"rowIndex") | |||
| // this.$refs['tableRef'].updateDataSourceByRowIndex(rowIndex, { clp: row.clp + '1' }) | |||
| } | |||
| }, | |||
| // 点击按钮事件 | |||
| handleClickButton(col, rowIndex, row) { | |||
| console.log(col, rowIndex, row,"rowIndex") | |||
| if (col.bodySubKey === 'timeClick') { | |||
| console.log(col, rowIndex, row,"rowIndex") | |||
| // this.$refs['tableRef'].updateDataSourceByRowIndex(rowIndex, { time: row.time + '1' }) | |||
| } | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="scss"> | |||
| .jcb-table-container{ | |||
| width: 600px; | |||
| } | |||
| .jcb-table{ | |||
| .custom-table-wrapper{ | |||
| margin-top: 0; | |||
| } | |||
| } | |||
| </style> | |||