提交 7e9ff278 authored 作者: 王诒正's avatar 王诒正

特征选项新增复制功能

上级 5d6d94af
......@@ -8,6 +8,14 @@ export function createCharacteristic2(data) {
return httpRequest.post('/api/opera/v2/training/characteristic', data, { headers })
}
// 拷贝选中的特征模板
export function createCharacteristic2Copy(id, data) {
var headers = {
'Content-Type': 'application/json'
}
return httpRequest.post(`/api/opera/v2/training/${id}/characteristic-copy`, data, { headers })
}
// 特征详情
export function characteristic2(id, params = {}) {
var headers = {
......
......@@ -73,6 +73,7 @@
<template slot-scope="scope">
<el-select size="mini" :value="opera" @change="operation" placeholder="请选择">
<el-option :value="{ tag: 'edit', row: scope.row }" label="编辑"></el-option>
<el-option :value="{ tag: 'copy', row: scope.row }" label="复制"></el-option>
<el-option :value="{ tag: 'delete', row: scope.row }" label="删除"></el-option>
</el-select>
</template>
......@@ -302,6 +303,33 @@
</div>
</el-dialog>
</div>
<div>
<el-dialog center :title="copyTitle" :visible.sync="copyDialogTableVisible">
<el-form size="mini" :model="copyForm">
<el-form-item label="案例:" :label-width="formLabelWidth">
<el-select
v-model="copyForm.case2_id"
filterable
remote
reserve-keyword
placeholder="请输入案例名称"
:remote-method="remoteMethod"
:loading="caseLoading">
<el-option
v-for="casesItem in cases"
:key="casesItem.value"
:label="casesItem.name"
:value="casesItem.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="copyDialogTableVisible = false">取 消</el-button>
<el-button size="mini" type="primary" @click="copyData">确 定</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
......@@ -312,6 +340,12 @@ export default {
name: 'index',
data() {
return {
copyDialogTableVisible: false,
copyTitle: '复制',
copyId: '',
copyForm: {
case2_id: ''
},
searchCaseName: '',
currentPage: 1,
totalPage: 0,
......@@ -412,6 +446,11 @@ export default {
switch (opera.tag) {
case 'detail':
break
case 'copy':
this.copyDialogTableVisible = true
this.copyTitle = opera.row.case.name
this.copyId = opera.row.id + ''
break
case 'edit':
this.$router.push({ path: '/training/characteristics/update', query: { id: opera.row.id } })
break
......@@ -420,6 +459,28 @@ export default {
break
}
},
copyData() {
if (!this.copyId) {
this.$message.warning('请刷新页面重试...')
return false
}
this.copyForm.case2_id = this.copyForm.case2_id + ''
characteristicsApi.createCharacteristic2Copy(this.copyId, this.copyForm).then(res => {
if (res.code === 0) {
this.$message.success('复制成功')
this.copyDialogTableVisible = false
this.copyForm.case2_id = ''
this.$router.push('/training/characteristics/update?id=' + res.data.id)
return true
} else {
this.copyForm.case2_id = ''
this.$message.error(res.message)
return false
}
})
this.copyDialogTableVisible = false
return true
},
handleDelete(id) {
this.$confirm('确认删除?', '提示').then(_ => {
const rLoading = this.openLoading('.table-list')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论