diff --git a/src/views/diagnosis/diagnosis.vue b/src/views/diagnosis/diagnosis.vue
index 6a4b882..50ff39d 100644
--- a/src/views/diagnosis/diagnosis.vue
+++ b/src/views/diagnosis/diagnosis.vue
@@ -21,9 +21,9 @@
-
+ highlight-current-row @row-click="rowClick" size="small" ref="elTable">
查询
- 新增
+ 新增
- 编辑
+ 编辑
- 删除
+ 删除
- 保存排序
+ 保存排序
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/diagnosis/diagnosisSug.vue b/src/views/diagnosis/diagnosisSug.vue
index f3e4890..4392d96 100644
--- a/src/views/diagnosis/diagnosisSug.vue
+++ b/src/views/diagnosis/diagnosisSug.vue
@@ -1,10 +1,10 @@
-
-
+
+
+
+
+
+
+
+
- 新增
+ 新增
- 删除
+ 删除
- 保存
+ 保存建议
@@ -35,15 +42,15 @@ import { mapState } from "vuex";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import Sortable from "sortablejs";
-import { deepCopy,dddw } from '@/utlis/proFunc';
+import { deepCopy,dddw, arrayExistObj } from '@/utlis/proFunc';
export default {
components: {
- },
- props:["formDiagnosis"],
+ },
+ props:["formDiagnosis","refreshSugs"],
data() {
return {
tableData:[], //建议列表
@@ -57,8 +64,7 @@ export default {
//挂载完成
mounted() {
- this.btnQuery();
-
+ this.rowDrop('elTableDiagnosisSug')
},
computed: {
@@ -72,15 +78,87 @@ export default {
this.tableData = deepCopy(this.formDiagnosis.suggestions)
},
- //供树节点组件调用,更新当前所选的项目类别
- refreshItemTypeId(itemTypeId){
- this.query.itemTypeId = itemTypeId
+ //拖拽
+ rowDrop(elId) {
+ this.$nextTick(() => {
+ let el = document.querySelector(`#${elId} tbody`);
+ //console.log('tbody', el)
+ let that = this;
+ Sortable.create(el, {
+ handle: ".move", // 选中class='move'的元素按住,方可拖动
+ animation: 150, // ms, number 单位:ms,定义排序动画的时间
+ //拖拽结束
+ onEnd({ newIndex, oldIndex }) {
+ let currRow = that.tableData.splice(oldIndex, 1)[0];
+ that.tableData.splice(newIndex, 0, currRow);
+ },
+ });
+ });
},
+
rowClick(row){
- this.curRow = row
+ this.curRow = Object.assign({},row)
+ },
+
+ btnAdd(){
+ if(!this.formDiagnosis.id){
+ this.$message.warning("请先选择诊断记录!")
+ return
+ }
+ let rd = {
+ id:Math.random(),
+ suggestionContent:''
+ }
+ this.tableData.push(rd)
+ },
+
+ btnSave(){
+ if(!this.formDiagnosis.id){
+ this.$message.warning("请先选择诊断记录!")
+ return
+ }
+
+ let diagnosisId = this.formDiagnosis.id
+ let details = []
+
+ this.tableData.forEach(e =>{
+ if(e.suggestionContent){
+ details.push({diagnosisId,suggestionContent:e.suggestionContent})
+ }
+ })
+ let body = {diagnosisId,details}
+
+ postapi('/api/app/suggestion/createsuggestionmany',body).then(res =>{
+ if(res.code != -1){
+ this.$message.success("操作成功!")
+ //更新明细诊断父组件的建议
+ this.refreshSugs(this.tableData)
+ }
+ })
+
},
+ btnDel(){
+ if(!this.formDiagnosis.id || !this.curRow.id){
+ this.$message.warning("请先选中要删除的记录!")
+ return
+ }
+
+ this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
+ confirmButtonText: "是",
+ cancelButtonText: "否",
+ type: "warning",
+ }).then(() => {
+ let lfind = arrayExistObj(this.tableData,'id',this.curRow.id)
+ if(lfind > -1) this.tableData.splice(lfind,1)
+ }).catch((err) => {
+ if (err == "cancel") {
+ this.$message.info("已取消操作");
+ }
+ });
+ }
+
},
watch: {