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