文章管理模块——排序优化
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/medical/MedicalApi.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/medical/MedicalApi.kt
index 45dbe3c..c9e9dcf 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/medical/MedicalApi.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/medical/MedicalApi.kt
@@ -520,9 +520,9 @@
logger.error { "查询用户[${user.userid}]银行卡失败:${bankCardResponse.retmsg}" }
return JsonResult.error("签约失败:查询用户银行卡失败")
}
- return JsonResult.ok().put("name", DataUtil.nameDesensitization(person.name))
- ?.put("idno", DataUtil.desensitization(person.idno, 3, 4))
- ?.put("bankcardno", DataUtil.desensitization(bankCardResponse.card.cardno, 4, 4))
+ return JsonResult.ok().put("name", person.name)
+ ?.put("idno", person.idno)
+ ?.put("bankcardno", bankCardResponse.card.cardno)
} catch (e: Exception) {
logger.error("系统异常", e)
if (e is MedicineException) {
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/PortalApi.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/PortalApi.kt
index a8745f8..f1cb43d 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/PortalApi.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/PortalApi.kt
@@ -406,6 +406,18 @@
}
}
+ @RequestMapping("/article/update/{articleno}",method=[RequestMethod.POST])
+ fun updateArticleByArticleno(@PathVariable(value= "articleno") articleno: String,
+ @RequestParam(value ="ordernum") ordernum: Int): JsonResult?{
+ return try{
+ articleService.updateArticleByArticleno(articleno,ordernum)
+ JsonResult.ok()
+ } catch (e:Exception){
+ logger.error { e.message }
+ JsonResult.error("保存失败,请重试!")
+ }
+ }
+
@RequestMapping(value = ["/article/delete/{articleno}"], method = [RequestMethod.POST])
fun deleteArticle(@PathVariable(value = "articleno") articleno: String): JsonResult? {
return try {
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/ArticleService.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/ArticleService.kt
index d4ed8d9..599dd31 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/ArticleService.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/ArticleService.kt
@@ -31,4 +31,6 @@
fun getMobileArticle(articleno:String):TBArticle
@Transactional
fun addArticleHits(article:TBArticle):TBArticle
+ @Transactional
+ fun updateArticleByArticleno(articleno:String,ordernum:Int):TBArticle
}
\ No newline at end of file
diff --git a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/ArticleServiceImpl.kt b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/ArticleServiceImpl.kt
index b7cec80..3081d3c 100644
--- a/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/ArticleServiceImpl.kt
+++ b/backend/src/main/kotlin/com/supwisdom/dlpay/portal/service/Impl/ArticleServiceImpl.kt
@@ -25,14 +25,19 @@
class ArticleServiceImpl : ArticleService {
@Autowired
lateinit var systemUtilService: SystemUtilService
+
@Autowired
lateinit var articleDao: ArticleDao
+
@Autowired
lateinit var businessparaDao: BusinessparaDao
+
@Autowired
lateinit var articleAuthDao: ArticleAuthDao
+
@Autowired
lateinit var columnDao: ColumnDao
+
@Autowired
lateinit var operatorDetailService: OperatorDetailService
@@ -181,4 +186,12 @@
article.hits += 1
return articleDao.save(article)
}
+
+ override fun updateArticleByArticleno(articleno: String, ordernum: Int): TBArticle {
+ val article = articleDao.findByArticlenoAndIsdelete(articleno, PortalConstant.NO)
+ ?: throw RuntimeException("编号为:[${articleno}]的文章未找到")
+ article.ordernum = ordernum
+ articleDao.save(article)
+ return article
+ }
}
\ No newline at end of file
diff --git a/frontend/src/api/article.js b/frontend/src/api/article.js
index 8ccf51f..a31d0db 100644
--- a/frontend/src/api/article.js
+++ b/frontend/src/api/article.js
@@ -111,3 +111,12 @@
data
})
}
+
+export function updateArticleByArticleno(articleno, ordernum) {
+ return request({
+ url: '/article/update/' + articleno,
+ method: 'post',
+ params: ordernum
+ })
+}
+
diff --git a/frontend/src/views/article/list.vue b/frontend/src/views/article/list.vue
index 56bc174..841edb2 100644
--- a/frontend/src/views/article/list.vue
+++ b/frontend/src/views/article/list.vue
@@ -122,7 +122,14 @@
</el-table-column>
<el-table-column label="排序" width="80" align="center">
<template slot-scope="{ row }">
- <span>{{ row.ordernum }}</span>
+ <el-input
+ v-if="row.edit"
+ ref="cxk"
+ v-model="row.ordernum"
+ class="edit-ordernum-input"
+ @blur="onOrdernumChanged(row)"
+ />
+ <div v-else style="width:100%;height:100%;cursor: pointer;" @click="editOrderNum(row)">{{ row.ordernum }}</div>
</template>
</el-table-column>
<el-table-column width="100px" label="是否展示" align="center">
@@ -223,6 +230,7 @@
deleteArticle,
switchDisplay,
withdrawArticle,
+ updateArticleByArticleno,
} from "@/api/article";
import { getAllColumn } from "@/api/column";
import Pagination from "@/components/Pagination"; // Secondary package based on el-pagination
@@ -257,6 +265,7 @@
pagesize: 10,
},
columnList: [],
+ currentordernum: "",
saveDate: null,
releaseDate: null,
statusOptions: [
@@ -390,6 +399,47 @@
}
return moment(date).format("YYYY-MM-DD HH:mm:ss");
},
+ editOrderNum(row) {
+ this.$set(row, 'edit', true)
+ this.currentordernum = row.ordernum
+ this.$nextTick(() => {
+ this.$refs.cxk.focus();
+ });
+ },
+ onOrdernumChanged(row) {
+ if (row.ordernum === this.currentordernum) {
+ this.$set(row, 'edit', false)
+ return;
+ }
+ var re = /^[1-9-]\d*$/;
+ if (!re.test(row.ordernum)) {
+ this.$message({
+ message: "请输入有效的数字",
+ type: "error",
+ })
+ row.ordernum = this.currentordernum;
+ this.$set(row, 'edit', false)
+ return
+ } else {
+ updateArticleByArticleno(row.articleno, { ordernum: row.ordernum })
+ .then(() => {
+ this.$message({
+ message: "保存成功",
+ type: "success",
+ });
+ this.$set(row, "edit", false)
+ this.handleFilter()
+ })
+ .catch((error) => {
+ this.$message({
+ message: error.msg || "保存异常",
+ type: "error",
+ });
+ this.$set(row, "edit", false)
+ this.handleFilter()
+ });
+ }
+ },
switchDisplay(row) {
switchDisplay(row.articleno, { value: row.isdisplay === "1" ? "0" : "1" })
@@ -462,13 +512,11 @@
};
</script>
-<style scoped>
-.edit-input {
- padding-right: 100px;
-}
-.cancel-btn {
- position: absolute;
- right: 15px;
- top: 10px;
+<style>
+.edit-ordernum-input
+.el-input__inner {
+ text-align: center;
+ padding-left: 10px;
+ padding-right: 10px;
}
</style>