feat: 表格 添加 copy功能
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
:height="mainTableHeight"
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@copy="copy"
|
||||
@edit="edit"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
|
||||
@@ -57,7 +57,8 @@ export default {
|
||||
obj: {
|
||||
type: Object
|
||||
},
|
||||
detail: Boolean
|
||||
detail: Boolean,
|
||||
copyFlag: Boolean
|
||||
},
|
||||
mixins: [editRigthBox],
|
||||
data () {
|
||||
@@ -94,6 +95,10 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.getMenus().then(() => {
|
||||
console.log(this.copyFlag)
|
||||
if (this.copyFlag) {
|
||||
this.editRole.id = ''
|
||||
}
|
||||
if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) {
|
||||
this.$refs.menuTree.setCheckedKeys(this.selectedIds, true)
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<!-- <el-dropdown-item v-has="'asset_label_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>-->
|
||||
<el-dropdown-item v-has="'asset_label_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'asset_label_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-has="'agent_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'agent_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-has="'dc_add'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item :command="['delete', scope.row]" v-has="'dc_delete'"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-has="'dc_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'dc_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<!-- <el-dropdown-item :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>-->
|
||||
<el-dropdown-item v-has="'model_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'model_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'panel_chart_edit'" :command="['sync', scope.row]"><i class="nz-icon nz-icon-sync"></i><span class="operation-dropdown-text">{{$t('overall.syncChart')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-has="'role_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'role_delete'" :command="['delete', scope.row]" :disabled="isBuiltIn(scope.row)"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-has="'user_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'user_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'user_delete'" :command="['delete', scope.row]" :disabled="scope.row.id === 1"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'user_edit'" :command="['reset_mfa', scope.row]"><i class="nz-icon nz-icon-zhongzhi2FA"></i><span class="operation-dropdown-text">{{$t('config.user.resetMfa')}}</span></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@selectionChange="selectionChange"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@selectionChange="selectionChange"
|
||||
@@ -246,6 +247,15 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
copy (u) {
|
||||
this.object = { ...u, name: u.name + '-copy', id: '' }
|
||||
if (this.object.name.length > 64) {
|
||||
const length = this.object.name.length - 64
|
||||
console.log(length, this.object.name.length, u.name.length)
|
||||
this.object.name = u.name.substring(0, u.name.length - length) + '-copy'
|
||||
}
|
||||
this.rightBox.metaShow = true
|
||||
},
|
||||
closeRightBox (refresh) {
|
||||
this.rightBox.metaShow = false
|
||||
this.rightBox.groupShow = false
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@selectionChange="selectionChange"
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@sync="chartBySync"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:height="mainTableHeight"
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@copy="copy"
|
||||
@edit="edit"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@@ -37,7 +38,7 @@
|
||||
</template>
|
||||
</nz-data-list>
|
||||
<transition name="right-box">
|
||||
<role-box v-if="rightBox.show" :obj="object" @close="closeRightBox"></role-box>
|
||||
<role-box v-if="rightBox.show" :copyFlag="copyFlag" :obj="object" @close="closeRightBox"></role-box>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
@@ -64,6 +65,7 @@ export default {
|
||||
blankObject: { // 空白对象
|
||||
name: ''
|
||||
},
|
||||
copyFlag: false,
|
||||
searchMsg: { // 给搜索框子组件传递的信息
|
||||
zheze_none: true,
|
||||
searchLabelList: [{
|
||||
@@ -77,9 +79,22 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
edit (row) {
|
||||
edit (row, copyFlag) {
|
||||
this.object = { ...row }
|
||||
if (copyFlag) {
|
||||
this.object.name = this.object.name + '-copy'
|
||||
if (this.object.name.length > 64) {
|
||||
const length = this.object.name.length - 64
|
||||
console.log(length, this.object.name.length, row.name.length)
|
||||
this.object.name = row.name.substring(0, row.name.length - length) + '-copy'
|
||||
}
|
||||
}
|
||||
this.rightBox.show = true
|
||||
},
|
||||
copy (u) {
|
||||
this.edit(u, true)
|
||||
this.copyFlag = true
|
||||
console.log(this.copyFlag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:height="mainTableHeight"
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@copy="copy"
|
||||
@reset_mfa="resetMfa"
|
||||
@edit="edit"
|
||||
@orderBy="tableDataSort"
|
||||
@@ -105,7 +106,7 @@ export default {
|
||||
this.getTableData()
|
||||
})
|
||||
},
|
||||
edit (u) {
|
||||
edit (u, copyFlag) {
|
||||
this.$get(`${this.url}/${u.id}`).then(response => {
|
||||
const user = response.user
|
||||
if (response.code === 200) {
|
||||
@@ -119,10 +120,22 @@ export default {
|
||||
if (!this.object.mfaLevel) {
|
||||
this.object.mfaLevel = 0
|
||||
}
|
||||
if (copyFlag) {
|
||||
this.object.id = ''
|
||||
this.object.name = this.object.name + '-copy'
|
||||
if (this.object.name.length > 64) {
|
||||
const length = this.object.name.length - 64
|
||||
console.log(length, this.object.name.length, u.name.length)
|
||||
this.object.name = u.name.substring(0, u.name.length - length) + '-copy'
|
||||
}
|
||||
}
|
||||
this.rightBox.show = true
|
||||
}
|
||||
})
|
||||
},
|
||||
copy (u) {
|
||||
this.edit(u, true)
|
||||
},
|
||||
resetMfa (row) {
|
||||
MessageBox.confirm(i18n.t('tip.resetMfa'), {
|
||||
confirmButtonText: i18n.t('tip.yes'),
|
||||
|
||||
Reference in New Issue
Block a user