diff --git a/src/api/request.js b/src/api/request.js
index 9232717..84a5cf8 100644
--- a/src/api/request.js
+++ b/src/api/request.js
@@ -13,20 +13,41 @@ const instance = axios.create({
withCredentials: true, // 允许跨域
});
let loading = null
- //请求拦截
+let needLoadingRequestCount = 0
+
+function startLoading() {
+ loading = Loading.service({
+ lock: true,
+ text: "正在加载中,请稍后",
+ spinner: "el-icon-loading",
+ background: "rgba(0, 0, 0, 0)",
+ customClass: "boxStyle"
+ });
+}
+
+function endLoading() {
+ loading.close()
+}
+export function showFullScreenLoading() {
+ if (needLoadingRequestCount === 0) {
+ startLoading()
+ }
+ needLoadingRequestCount++
+}
+export function tryHideFullScreenLoading() {
+ if (needLoadingRequestCount <= 0) return
+ needLoadingRequestCount--
+ if (needLoadingRequestCount === 0) {
+ endLoading()
+ }
+}
+//请求拦截
instance.interceptors.request.use(
async function(config) {
- loading = Loading.service({
- lock: true,
- text: "正在加载中,请稍后",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0)",
- customClass: "boxStyle"
- });
//console.log('old token:',window.sessionStorage.getItem("token"))
//console.log('old expires_in',window.sessionStorage.getItem("expires_in"))
await yztoken();
-
+ showFullScreenLoading()
let token = window.sessionStorage.getItem("token");
let tokentype = window.sessionStorage.getItem("tokentype");
@@ -43,8 +64,8 @@ instance.interceptors.request.use(
//响应拦截
instance.interceptors.response.use(
(res) => {
- loading.close();
- // console.log(res);
+ tryHideFullScreenLoading()
+ // console.log(res);
if (res.data.code < 0) {
Message.error({ showClose: true, message: res.data.message });
}
@@ -60,7 +81,7 @@ instance.interceptors.response.use(
// console.log('token失效返回登录');
// }
// console.log(err);
- loading.close();
+ tryHideFullScreenLoading()
return Promise.reject(err);
}
// function (response) {
diff --git a/src/views/common-settings/ItemType.vue b/src/views/common-settings/ItemType.vue
index 6f29905..791e0a7 100644
--- a/src/views/common-settings/ItemType.vue
+++ b/src/views/common-settings/ItemType.vue
@@ -6,137 +6,252 @@
项目类别
-
+
-
-
-
-
+
+
+
+
-
+
- {{ scope.row.displayName }}
-
-
-
-
-
-
-
-
-
-
-
+ {{ scope.row.displayName }}
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- 新增项目类别
-
-
- 新增同级
-
-
- 新增子级
-
-
- 编辑
-
-
- 删除
-
+
+
+
+
+ 新增项目类别
+
+
+ 新增同级
+
+
+ 新增子级
+
+
+ 编辑
+
+
+ 删除
+
-
+
上级部门
-
+ }"
+ clearable
+ size="small"
+ >
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
@@ -220,23 +335,24 @@ export default {
tableHeight: window.innerHeight - 180, //表格动态高度
screenHeight: window.innerHeight, //内容区域高度
form: {
- id:'',
+ id: "",
displayName: "",
parentId: "",
isMergeAsbitem: "N",
checkTypeFlag: "",
guidTypeId: "",
medicalReportTypeId: "",
- isWrap: 'N', // 是否换行
- lineModeFlagBox: false, // 是否换行box
+ isWrap: "N", // 是否换行
+ lineModeFlagBox: false, // 是否换行box
},
value: "", //指引类别选择的数据
dialogVisible: false,
guideoptions: [],
row: {},
isshow: true,
- activeRows:[],
- message:true
+ activeRows: [],
+ message: true,
+ tableKey:''
};
},
created() {
@@ -249,43 +365,57 @@ export default {
...mapState(["window"]),
},
methods: {
-
cascaderchang(v) {
this.departmentname = v[v.length - 1];
},
-
- treeToTable (tree, arr = []){
- tree.map((item,index) => {
+
+ treeToTable(tree, level, arr = []) {
+ tree.map((item, index) => {
+ this.$set(item, "level", level);
arr.push(item);
- if (item.treeChildren && item.treeChildren!=[]) {
- arr.push(...this.treeToTable(item.treeChildren));
- }
- });
- // 返回结果
- return arr;
-},
-flatToTree(flatData, idProp, parentIdProp) {
- const treeData = []
- const idMap = {}
+ if (item.treeChildren && item.treeChildren != []) {
+ arr.push(...this.treeToTable(item.treeChildren, level + 1));
+ }
+ });
+ // 返回结果
+ return arr;
+ },
+ flatToTree(flatData, idProp, parentIdProp) {
+ const treeData = [];
+ const idMap = {};
- // 将所有节点存储到 idMap 中,方便快速查找节点
- for (const node of flatData) {
- idMap[node[idProp]] = node
- node.treeChildren = []
- }
+ // 将所有节点存储到 idMap 中,方便快速查找节点
+ for (const node of flatData) {
+ idMap[node[idProp]] = node;
+ node.treeChildren = [];
+ }
- // 遍历所有节点,将它们添加到树形结构中
- for (const node of flatData) {
- const parent = idMap[node[parentIdProp]]
- if (parent) {
- parent.treeChildren.push(node)
- } else {
- treeData.push(node)
- }
- }
+ // 遍历所有节点,将它们添加到树形结构中
+ for (const node of flatData) {
+ const parent = idMap[node[parentIdProp]];
+ if (parent) {
+ parent.treeChildren.push(node);
+ } else {
+ treeData.push(node);
+ }
+ }
- return treeData
-},
+ return treeData;
+ },
+ screenData(tree,row,increase,arr = []){
+ if(increase){
+ arr.push(row)
+ }
+ tree.map((item,index)=>{
+ if(item.parentId===row.id){
+ arr.push(item)
+ if(item.treeChildren && item.treeChildren != []){
+ arr.push(...this.screenData(item.treeChildren,item));
+ }
+ }
+ })
+ return arr;
+ },
//初始化
rowDrop() {
this.$nextTick(() => {
@@ -294,41 +424,78 @@ flatToTree(flatData, idProp, parentIdProp) {
Sortable.create(tbody, {
handle: ".move",
animation: 300,
- // onStart: () => { // 开始拖拽前把树形结构数据扁平化
- // _this.activeRows = _this.treeToTable(_this.tableData) // 把树形的结构转为列表再进行拖拽
- // },
- onMove({ dragged, related }){
- const oldRow = _this.activeRows[dragged.rowIndex]
- const newRow = _this.activeRows[related.rowIndex]
- if (oldRow.parentId !== newRow.parentId) {
- if(_this.message){
- _this.$message.warning("不允许跨父级拖拽")
- _this.message=false
+ // onStart: () => { // 开始拖拽前把树形结构数据扁平化
+ // _this.activeRows = _this.treeToTable(_this.tableData) // 把树形的结构转为列表再进行拖拽
+ // },
+ onMove({ dragged, related }) {
+ // if(dragged.rowIndex {
+ // _this.$refs['tableData'].setCurrentRow(_this.activeRows[oldIndex]);
+ // // _this.treeclick(_this.activeRows[oldIndex])
+ // })
+ },
onEnd({ newIndex, oldIndex }) {
+ _this.message = true;
+ const oldRow = _this.activeRows[oldIndex] // 移动的那个元素
+ const newRow = _this.activeRows[newIndex] // 新的元素
+ if (oldIndex === newIndex || oldRow.parentId !== newRow.parentId || oldRow.level != newRow.level) return
+ if (oldIndex !== newIndex || oldRow.level === newRow.level || oldRow.parentId === newRow.parentId) {
+ let oldRowSuffixData=_this.screenData(_this.activeRows,oldRow,true)
+ let newRowSuffixData=_this.screenData(_this.activeRows,newRow,true)
+ const targetRows = _this.activeRows.splice(oldIndex, oldRowSuffixData.length)
+ if (oldIndex > newIndex) {
+ _this.activeRows.splice(newIndex, 0, ...targetRows)
+ } else if (oldIndex < newIndex) {
+ _this.activeRows.splice(newIndex + newRowSuffixData.length - oldRowSuffixData.length, 0, ...targetRows)
+ }
+ let data = _this.flatToTree(
+ _this.activeRows,
+ "id",
+ "parentId"
+ );
+ _this.$set(_this,'tableData',data)
_this.isshow = false;
- _this.message=true
- const currRow = _this.activeRows.splice(oldIndex, 1)[0];
- _this.activeRows.splice(newIndex, 0, currRow);
- _this.tableData=_this.flatToTree(_this.activeRows,'id','parentId')
+ let beforeScrollTop = _this.$refs.tableData.$el.querySelector('div.el-table__body-wrapper').scrollTop
+ _this.tableKey = new Date().getTime()
_this.$nextTick(() => {
- _this.$refs['tableData'].setCurrentRow(_this.activeRows[newIndex]);
- _this.treeclick(_this.activeRows[newIndex])
- })
- },
- });
+ _this.$refs.tableData.doLayout()
+ _this.$refs["tableData"].setCurrentRow(
+ oldRow
+ );
+ _this.treeclick(oldRow);
+ setTimeout(() => {
+ _this.$refs.tableData.$el.querySelector('div.el-table__body-wrapper').scrollTop = beforeScrollTop
+ }, 0)
+ _this.rowDrop()
+ });
+ }
+ }
+ })
});
},
//编辑弹框
rena() {
- let id = this.row.id
+ let id = this.row.id;
let a = this.row.parentId;
this.departmentname = a;
this.title = 2;
@@ -348,7 +515,7 @@ flatToTree(flatData, idProp, parentIdProp) {
});
projecttype(id).then((res) => {
if (res.code != -1) {
- objCopy(res.data,this.form)
+ objCopy(res.data, this.form);
}
});
// getapi(`/api/app/item/in-item-type/${data.id}`).then((res) => {
@@ -366,26 +533,27 @@ flatToTree(flatData, idProp, parentIdProp) {
},
// 删除
deleates() {
- let id = this.row.id
+ let id = this.row.id;
this.$confirm("是否删除, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
cancelButtonClass: "difference",
- confirmButtonClass: "commonbutton"
- }).then(() => {
- projecteditid(id).then((res) => {
- if (res.code != -1) {
- this.$message.success("删除成功");
- this.row=this.$options.data().row
- this.getlist();
- this.isshow = true
- }
- });
+ confirmButtonClass: "commonbutton",
})
+ .then(() => {
+ projecteditid(id).then((res) => {
+ if (res.code != -1) {
+ this.$message.success("删除成功");
+ this.row = this.$options.data().row;
+ this.getlist();
+ this.isshow = true;
+ }
+ });
+ })
.catch(() => {
this.$message("取消成功");
- })
+ });
},
append() {
// this.form = {};
@@ -393,7 +561,7 @@ flatToTree(flatData, idProp, parentIdProp) {
// this.form.parentId = data.id;
// }
// Object.assign(this.$data.form, this.$options.data().form);
- this.form=this.$options.data().form
+ this.form = this.$options.data().form;
this.form.parentId = this.row.id;
this.dialogVisible = true;
if (this.$refs.ruleForm !== undefined) {
@@ -418,8 +586,8 @@ flatToTree(flatData, idProp, parentIdProp) {
// this.form = {};
// this.form.parentId = data.parentId;
// Object.assign(this.$data.form, this.$options.data().form);
- this.form=this.$options.data().form
- this.form.parentId = this.row.parentId
+ this.form = this.$options.data().form;
+ this.form.parentId = this.row.parentId;
this.dialogVisible = true;
this.title = 1;
if (this.$refs.ruleForm !== undefined) {
@@ -451,13 +619,13 @@ flatToTree(flatData, idProp, parentIdProp) {
checkTypeFlag: this.form.checkTypeFlag,
guidTypeId: this.form.guidTypeId,
medicalReportTypeId: this.form.medicalReportTypeId,
- isWrap: this.form.isWrap
+ isWrap: this.form.isWrap,
}).then((res) => {
if (res.code != -1) {
this.$message.success("新增成功");
this.getlist();
this.dialogVisible = false;
- this.isshow = true
+ this.isshow = true;
}
});
} else {
@@ -468,13 +636,13 @@ flatToTree(flatData, idProp, parentIdProp) {
checkTypeFlag: this.form.checkTypeFlag,
guidTypeId: this.form.guidTypeId,
medicalReportTypeId: this.form.medicalReportTypeId,
- isWrap: this.form.isWrap
+ isWrap: this.form.isWrap,
}).then((res) => {
if (res.code != -1) {
this.$message.success("新增成功");
this.getlist();
this.dialogVisible = false;
- this.isshow = true
+ this.isshow = true;
}
});
}
@@ -488,13 +656,13 @@ flatToTree(flatData, idProp, parentIdProp) {
checkTypeFlag: this.form.checkTypeFlag,
guidTypeId: this.form.guidTypeId,
medicalReportTypeId: this.form.medicalReportTypeId,
- isWrap: this.form.isWrap
+ isWrap: this.form.isWrap,
}).then((res) => {
if (res.code != -1) {
this.$message.success("修改成功");
this.getlist();
this.dialogVisible = false;
- this.isshow = true
+ this.isshow = true;
}
});
}
@@ -503,14 +671,14 @@ flatToTree(flatData, idProp, parentIdProp) {
},
// 点击获取每一列
treeclick(row) {
- this.row = {...row}
- this.isshow = false
+ this.row = { ...row };
+ this.isshow = false;
},
getlist() {
projectlist(this.pages).then((res) => {
if (res.code != -1) {
this.tableData = [...res.data];
- this.activeRows=this.treeToTable(this.tableData)
+ this.activeRows = this.treeToTable(this.tableData, 1);
}
});
},
@@ -559,7 +727,7 @@ flatToTree(flatData, idProp, parentIdProp) {
:deep .el-dialog__footer {
padding: 0px 20px 14px;
}
-:deep .el-table tr{
+:deep .el-table tr {
height: 35px;
}
diff --git a/src/views/common-settings/SampleGroup.vue b/src/views/common-settings/SampleGroup.vue
index 9b298e6..4f0e7f9 100644
--- a/src/views/common-settings/SampleGroup.vue
+++ b/src/views/common-settings/SampleGroup.vue
@@ -799,13 +799,13 @@ export default {
// draggable: ".module-manager .el-table__row",
onChoose({ oldIndex }) {
_this.$refs["info"].setCurrentRow(_this.tableData[oldIndex]);
- _this.rowick(_this.tableData[oldIndex],false);
},
onEnd({ newIndex, oldIndex }) {
// console.log(arr);
_this.isshow = false;
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
+ _this.rowick(_this.tableData[newIndex]);
_this.tableData.map((item, index) => {
if (index == newIndex && index == oldIndex) {
// console.log(item, "新数据");
@@ -981,7 +981,7 @@ export default {
},
//点击条码分组记录
- rowick(row,el) {
+ rowick(row) {
this.curRow = deepCopy(row)
this.form = deepCopy(row)
@@ -991,14 +991,12 @@ export default {
// this.form = res.data;
// });
- if(el){
getapi(`/api/app/sample-group-detail/sample-group-in-asbitem?SampleGroupId=${row.id}`).then( res =>{
if(res.code != -1){
this.sampleGroupAsbitems = res.data
this.getAsbItemByItemType()
}
})
- }
},
getSummaries(param){
diff --git a/src/views/common-settings/medicalPackage.vue b/src/views/common-settings/medicalPackage.vue
index 92c643f..81ed25e 100644
--- a/src/views/common-settings/medicalPackage.vue
+++ b/src/views/common-settings/medicalPackage.vue
@@ -255,11 +255,15 @@ export default {
Sortable.create(el, {
handle: ".move",
animation: 300,
+ onChoose({ oldIndex }) {
+ that.$refs["medicalPackages"].setCurrentRow(that.medicalPackages[oldIndex]);
+ },
//拖拽结束
onEnd({ newIndex, oldIndex }) {
that.isDrag = true;
const currRow = that.medicalPackages.splice(oldIndex, 1)[0];
that.medicalPackages.splice(newIndex, 0, currRow);
+ that.rowClick(that.medicalPackages[newIndex]);
},
});
});
diff --git a/src/views/fee-settings/Asbitem.vue b/src/views/fee-settings/Asbitem.vue
index d3a9237..3cc6df9 100644
--- a/src/views/fee-settings/Asbitem.vue
+++ b/src/views/fee-settings/Asbitem.vue
@@ -1949,12 +1949,12 @@ export default {
animation: 300,
onChoose({ oldIndex }) {
_this.$refs["tableData"].setCurrentRow(_this.tableData[oldIndex]);
- _this.rowick(_this.tableData[oldIndex]);
},
onEnd({ newIndex, oldIndex }) {
_this.isshow = false;
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
+ _this.rowick(_this.tableData[newIndex]);
_this.tableData.map((item, index) => {
if (index == newIndex && index == oldIndex) {
} else if (index == oldIndex) {
diff --git a/src/views/fee-settings/DiagnosisTemplate.vue b/src/views/fee-settings/DiagnosisTemplate.vue
index 7d15d02..91f11ec 100644
--- a/src/views/fee-settings/DiagnosisTemplate.vue
+++ b/src/views/fee-settings/DiagnosisTemplate.vue
@@ -801,7 +801,6 @@ export default {
animation: 300,
onChoose({ oldIndex }) {
_this.$refs["info"].setCurrentRow(_this.tableData[oldIndex]);
- _this.rowick(_this.tableData[oldIndex],false);
},
// 指定父元素下可被拖拽的子元素
// draggable: ".module-manager .el-table__row",
@@ -810,6 +809,7 @@ export default {
_this.isshow = false;
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
+ _this.rowick(_this.tableData[newIndex]);
_this.tableData.map((item, index) => {
if (index == newIndex && index == oldIndex) {
// console.log(item, "新数据");
@@ -985,7 +985,7 @@ export default {
},
//点击条码分组记录
- rowick(row,el) {
+ rowick(row) {
this.curRow = deepCopy(row);
this.form = deepCopy(row);
@@ -994,7 +994,6 @@ export default {
// this.form = res.data;
// });
- if(el){
postapi(
"/api/app/diagnosistemplatedetail/getdiagnosistemplateindiagnosis",
{
@@ -1006,7 +1005,6 @@ export default {
this.getAsbItemByItemType();
}
});
- }
},
getSummaries(param){
const { columns, data } = param;
diff --git a/src/views/fee-settings/Item.vue b/src/views/fee-settings/Item.vue
index 1f26f7d..7cf7843 100644
--- a/src/views/fee-settings/Item.vue
+++ b/src/views/fee-settings/Item.vue
@@ -2621,8 +2621,6 @@ export default {
} else if (index == newIndex) {
}
});
- console.log(_this.tableData.map((item) => item.displayOrder));
- console.log(_this.initTableData.map((item) => item.displayOrder));
},
});
});
diff --git a/src/views/fee-settings/ItemTemplate.vue b/src/views/fee-settings/ItemTemplate.vue
index 38f6ea4..72dd347 100644
--- a/src/views/fee-settings/ItemTemplate.vue
+++ b/src/views/fee-settings/ItemTemplate.vue
@@ -806,7 +806,6 @@ export default {
animation: 300,
onChoose({ oldIndex }) {
_this.$refs["info"].setCurrentRow(_this.tableData[oldIndex]);
- _this.rowick(_this.tableData[oldIndex],false);
},
// 指定父元素下可被拖拽的子元素
// draggable: ".module-manager .el-table__row",
@@ -815,6 +814,7 @@ export default {
_this.isshow = false;
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
+ _this.rowick(_this.tableData[newIndex]);
_this.tableData.map((item, index) => {
if (index == newIndex && index == oldIndex) {
// console.log(item, "新数据");
@@ -987,7 +987,7 @@ export default {
},
//点击条码分组记录
- rowick(row,el) {
+ rowick(row) {
this.curRow = deepCopy(row);
this.form = deepCopy(row);
@@ -996,7 +996,6 @@ export default {
// this.form = res.data;
// });
- if(el){
postapi("/api/app/itemtemplatedetail/getitemtemplateinitem", {
ItemTemplateId: this.form.id,
}).then((res) => {
@@ -1005,7 +1004,6 @@ export default {
this.getAsbItemByItemType();
}
});
- }
},
getSummaries(param){
const { columns, data } = param;