说明:1、英语单词模块根据id查询原先抽屉个修改公用一个查询,现已抽离开
This commit is contained in:
parent
72f17b5dd7
commit
460f7c242f
|
|
@ -17,6 +17,14 @@ export function getWord(id) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getWordRPC(id) {
|
||||
return request({
|
||||
url: '/english/word/rpc/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增英语单词
|
||||
export function addWord(data) {
|
||||
return request({
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@
|
|||
/>
|
||||
|
||||
<!-- 修改英语单词对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body >
|
||||
<el-form ref="formEdit" :model="form" :rules="rulesEdit" label-width="80px">
|
||||
<el-form-item label="英语单词" prop="englishWord">
|
||||
<el-input v-model="form.englishWord" placeholder="请输入英语单词"/>
|
||||
|
|
@ -189,7 +189,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<div slot="footer" class="dialog-footer" v-loading="loadingEdit">
|
||||
<el-button type="primary" @click="submitFormEdit">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listWord, getWord, delWord, addWord, updateWord} from "@/api/business/english/word";
|
||||
import {listWord, getWord, delWord, addWord, updateWord,getWordRPC} from "@/api/business/english/word";
|
||||
|
||||
export default {
|
||||
name: "Word",
|
||||
|
|
@ -271,6 +271,7 @@ export default {
|
|||
drawer: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
loadingEdit: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
|
|
@ -343,7 +344,7 @@ export default {
|
|||
//根据id查询放入抽屉
|
||||
findById(id) {
|
||||
this.loadingC = true;
|
||||
getWord(id).then(res => {
|
||||
getWordRPC(id).then(res => {
|
||||
this.form = res.data
|
||||
this.loadingC = false
|
||||
})
|
||||
|
|
@ -435,8 +436,10 @@ export default {
|
|||
this.$refs["formEdit"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
this.loadingEdit= true
|
||||
updateWord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.loadingEdit= false
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,6 +43,25 @@ public class EnglishWordController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取英语单词详细信息RPC
|
||||
*/
|
||||
@RequiresPermissions("english:word:query")
|
||||
@GetMapping(value = "/rpc/{id}")
|
||||
public AjaxResult getInfoRPC(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(englishWordService.selectEnglishWordToRPC(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英语单词详细信息
|
||||
*/
|
||||
@RequiresPermissions("english:word:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(englishWordService.selectById(id));
|
||||
}
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
|
|
@ -68,14 +87,7 @@ public class EnglishWordController extends BaseController {
|
|||
util.exportExcel(response, list, "英语单词数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英语单词详细信息
|
||||
*/
|
||||
@RequiresPermissions("english:word:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(englishWordService.selectEnglishWordById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
|
|
|
|||
|
|
@ -18,15 +18,18 @@ public interface IEnglishWordService {
|
|||
*/
|
||||
List<EnglishWord> getEnglishWordByCollect();
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
/**
|
||||
* 查询英语单词
|
||||
*
|
||||
* @param id 英语单词主键
|
||||
* @return 英语单词
|
||||
*/
|
||||
public EnglishWord selectEnglishWordById(Long id);
|
||||
public EnglishWord selectEnglishWordToRPC(Long id);
|
||||
|
||||
EnglishWord selectById(Long id);
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询英语单词列表
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
|||
* @return 英语单词
|
||||
*/
|
||||
@Override
|
||||
public EnglishWord selectEnglishWordById(Long id) {
|
||||
public EnglishWord selectEnglishWordToRPC(Long id) {
|
||||
EnglishWord englishWord = englishWordMapper.selectById(id);
|
||||
Optional.ofNullable(englishWord).orElseThrow(() -> new BusinessException("数据丢失了~~~~"));
|
||||
//每次调用查看次数+1
|
||||
|
|
@ -81,6 +81,11 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
|||
return englishWord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnglishWord selectById(Long id) {
|
||||
return englishWordMapper.selectEnglishWordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增英语单词
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue