罗斌杰 1 year ago
parent
commit
39ad0cec80
  1. 10
      src/request/commonapi.js
  2. 12
      src/router/index.js
  3. 686
      src/views/fee-settings/CriticalValue.vue
  4. 603
      src/views/fee-settings/CriticalValueCategory.vue

10
src/request/commonapi.js

@ -85,6 +85,14 @@ export const paymentdraganddrop = (data) => {
data,
});
};
//危急值类别列表获取
export const criticalFollowValueType = (data) => {
return request({
url: "/api/app/CriticalFollowValueType/GetByCodeAll",
method: "post",
params: data,
});
};
//项目类别列表获取
export const projectlist = (data) => {
return request({
@ -212,7 +220,7 @@ export const itemtypeid = (ItemTypeId) => {
return request({
url: '/api/app/asbitem/getasbitemlist',
method: "post",
data:{itemTypeId:ItemTypeId}
data: { itemTypeId: ItemTypeId }
});
};
//条码分组标码分组包含的项目

12
src/router/index.js

@ -242,6 +242,18 @@ const routes = [{
component: () =>
import ("../components/room/room.vue"),
},
{
path: "/critical-value-category",
name: '危急值类别',
component: () =>
import ("../views/fee-settings/CriticalValueCategory.vue"),
},
{
path: "/critical-value",
name: '危急值',
component: () =>
import ("../views/fee-settings/CriticalValue.vue"),
},
//---------------------- 收费设置 start ----------------------
{
path: "/invoice-item-type",

686
src/views/fee-settings/CriticalValue.vue

@ -0,0 +1,686 @@
<template>
<div class="box">
<div style="position: relative">
<div class="middlebox">
<div class="contenttitle">
基础资料 /
<span class="contenttitleBold">危急值</span>
</div>
</div>
<div style="display: block; margin-top: 7px; margin-right: 110px">
<div style="background-color: #fff; padding: 15px; border-radius: 8px">
<div id="printTest">
<el-table
:data="tableData"
:height="window.pageHeight < 600 ? 480 : window.pageHeight - 130"
row-key="id"
class="el-table__body-wrapper tbody"
@row-click="rowclick"
highlight-current-row
ref="tableData"
>
<el-table-column prop="id" label="编号" width="300">
</el-table-column>
<el-table-column prop="displayName" label="名称" width="">
</el-table-column>
<el-table-column prop="criticalFollowValueTypeId" label="危急值类别" width="">
<template slot-scope="scope">
<div>
{{
getTreeName(
criticalFollowValueTypeId,
scope.row.criticalFollowValueTypeId
)
}}
</div>
</template>
</el-table-column>
<el-table-column prop="criticalFollowValueFlag" label="危急随访值标志" width="">
<template slot-scope="scope">
<div>
{{ dddw(criticalFollowValueFlag, "id", scope.row.criticalFollowValueFlag, "displayName") }}
</div>
</template>
</el-table-column>
<el-table-column prop="creatorName" label="创建者" width="">
</el-table-column>
<el-table-column prop="creationTime" label="创建时间" width="200">
<template slot-scope="scope">
{{ scope.row.creationTime | dateFormat }}
</template>
</el-table-column>
<el-table-column prop="lastModifierName" label="修改者" width="">
</el-table-column>
<el-table-column
prop="lastModificationTime"
label="修改时间"
width="200"
>
<template slot-scope="scope">
{{ scope.row.lastModificationTime | dateFormat }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template>
<el-tag
class="move"
style="
cursor: move;
background-color: rgb(245, 245, 245);
border: none;
"
draggable="true"
>
<i
class="el-icon-d-caret"
style="
width: 1rem;
height: 1rem;
color: rgb(113, 113, 113);
"
></i>
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<!-- 按钮区域 -->
<div
style="
margin-left: 10px;
margin-top: 3%;
position: absolute;
top: 0;
right: 0;
"
>
<el-button type="" @click="add" class="commonbutton">新增</el-button>
<div style="margin-top: 10px">
<el-button type="" @click="editpopup" class="commonbutton"
>编辑</el-button
>
</div>
<div style="margin-top: 10px">
<el-button type="" @click="delsrts" class="deleteButton"
>删除</el-button
>
</div>
<div style="margin-top: 10px">
<el-button type="" @click="topping" class="commonbutton"
>置顶</el-button
>
</div>
<div style="margin-top: 10px">
<el-button type="" @click="toppings" class="commonbutton"
>置底</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
:disabled="isshow"
@click="assertion"
class="commonbutton"
>排序</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
:disabled="isshow"
@click="cancellation"
class="commonbutton"
>取消</el-button
>
</div>
</div>
</div>
<!-- 新增或者编辑弹框 -->
<el-dialog
:title="title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible"
width="75%"
:close-on-click-modal="false"
>
<el-form ref="form" :model="form" label-width="110px">
<el-row>
<el-col :span="9">
<el-form-item label="编号">
<el-input
v-model="form.id"
style="width: 90%"
disabled
size="small"
></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="名称">
<el-input
ref="refinput"
v-model="form.displayName"
style="width: 80%"
size="small"
></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="危急值类别" prop="criticalFollowValueTypeId">
<el-cascader v-model="form.criticalFollowValueTypeId" :options="criticalFollowValueTypeId" popper-class="example" ref="criticalFollowValueTypeId"
@change="onchange" :props="{
value: 'criticalFollowValueTypeId',
label: 'displayName',
children: 'treeChildren',
checkStrictly: true,
expandTrigger: 'hover',
}" size="small"></el-cascader>
<!-- <el-select
v-model="form.itemTypeId"
placeholder="请选择"
style="width: 100%"
>
<el-option
v-for="item in itemTypeId"
:key="item.id"
:label="item.displayName"
:value="item.id"
>
</el-option>
</el-select> -->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="危急随访值标志">
<el-select
v-model="form.criticalFollowValueFlag"
placeholder="危急随访值标志"
size="small"
>
<el-option v-for="item in criticalFollowValueFlag"
:key="item.id"
:label="item.displayName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-divider></el-divider>
<el-col :span="4" style="margin-left: 15px">
<el-form-item label="创建者">
<el-input v-model="form.creatorName" disabled size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建时间">
<el-input
:value="form.creationTime | dateFormat"
disabled
style="width: 95%"
size="small"
></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="修改者">
<el-input v-model="form.lastModifierName" disabled size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="修改时间">
<el-input
:value="form.lastModificationTime | dateFormat"
disabled
style="width: 95%"
size="small"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" class="difference"> </el-button>
<el-button type="primary" @click="addoredit" class="commonbutton"
> </el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import { rowDrop, assertions } from "@/components/publicjs/public";
import Sortable from "sortablejs";
import { getapi, postapi, putapi } from "@/api/api";
import { mapState } from "vuex";
import {dddw } from "../../utlis/proFunc";
import {
physicallist,
medicalconclusionlist,
addconclusion,
quersmedicalid,
updateconlus,
bottomtops,
conlusiondraganddrop,
tijiandetid,
diagnosticediting,
xiugaijielun,
conclusionacquisition
} from "../../request/systemapi";
import {
criticalFollowValueType
} from "@/request/commonapi";
export default {
data() {
return {
isshow: true,
dialogVisible: false,
form: {
displayName: "",
criticalFollowValueTypeId: "",
criticalFollowValueFlag: "",
},
Selectacategory: [],
Selectvalue: "",
selars: "",
value: "",
criticalFollowValueTypeId: [],
criticalFollowValueFlag:[{
id:"0",
displayName:"危急值"
},{
id:"1",
displayName:"随访值"
}],
title: 1,
pages: {
TypeId: "",
SkipCount: 0,
MaxResultCount: 100,
Sorting: "displayOrder desc",
},
page: {
Filter: "",
SkipCount: 0,
MaxResultCount: 100,
Sorting: "displayOrder desc",
},
tableData: [],
initTableData: [],
item: {},
curRow: {},
};
},
created() {
this.getlist();
// this.getmedicalconclusionlist();
},
computed: {
...mapState(["window"]),
},
mounted() {
this.rowDrop();
this.typeid();
},
methods: {
dddw,
getTreeName(list, id) {
for (let i = 0; i < list.length; i++) {
if (list[i].criticalFollowValueTypeId === id) {
return list[i].displayName;
} else if (list[i].treeChildren && list[i].treeChildren.length > 0) {
let res = this.getTreeName(list[i].treeChildren, id);
if (res) {
return res;
}
}
}
},
typeid() {
criticalFollowValueType().then((res) => {
if (res.code != -1) {
this.criticalFollowValueTypeId = res.data;
this.criticalFollowValueTypeId = this.formatData(this.criticalFollowValueTypeId);
console.log(this.criticalFollowValueTypeId)
}
});
},
formatData(dataList) {
for (let i = 0; i < dataList.length; i++) {
if (dataList[i].treeChildren.length < 1) {
dataList[i].treeChildren = undefined;
} else {
this.formatData(dataList[i].treeChildren);
}
}
return dataList;
},
onchange(v) {
if (v.length > 1) {
this.form.criticalFollowValueTypeId = this.form.criticalFollowValueTypeId.slice(-1)[0];
} else {
this.form.criticalFollowValueTypeId = this.form.criticalFollowValueTypeId[0];
}
this.$refs.criticalFollowValueTypeId.toggleDropDownVisible();
},
createFilter(queryString) {
return (tableData) => {
return (
tableData.displayName
.toLowerCase()
.indexOf(queryString.toLowerCase()) != -1
);
};
},
handleSelect(item) {
this.page.Filter = item.displayName;
this.item = item;
this.formid = item.id;
//console.log(item);
// quersmedicalid(item.id).then((res) => {
// console.log(res);
// this.form = res.data;
// });
},
querySearch(queryString, cb) {
var tableData = this.tableData;
var tableDatas = queryString
? tableData.filter(this.createFilter(queryString))
: tableData;
// callback
cb(tableDatas);
},
isselctvalue(v) {
this.form.medicalConclusionTypeId = v;
this.pages.TypeId = v;
this.getlist();
},
getmedicalconclusionlist() {
medicalconclusionlist().then((res) => {
if(res.code!=-1){
this.Selectacategory = res.data;
}
});
},
// this.medicalconclusionlist()
//
delsrts() {
this.form = { ...this.curRow };
if (this.form.id == undefined) {
this.$message.warning("请选择删除的数据");
} else {
this.$confirm("是否确认删除,是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
cancelButtonClass:"difference",
confirmButtonClass:"commonbutton"
})
.then(() => {
postapi("/api/app/CriticalFollowValue/Delete",{
criticalFollowValueId:this.form.id
}).then((res) => {
if(res.code!=-1){
//this.$message.success('')
this.getlist();
this.curRow=this.$options.data().curRow
}
});
})
.catch(() => {});
}
},
//
cancellation() {
this.$message.info("取消操作");
this.isshow = true;
this.getlist();
},
assertiona() {
assertions(this.tableData, this.initTableData);
},
//
assertion() {
const result = [];
this.tableData.forEach((item, index) => {
// index 0 displayOrder
// const currentDisplayOrder = this.tableData.length -1
// const currentDisplayOrder = this.initTableData[index].displayOrder;
// if (item.displayOrder != currentDisplayOrder) {
// displayOrder
// result.push({ id: item.id, displayOrder: currentDisplayOrder });
// }
result.push({ id: item.id, displayOrder: index+1 });
});
postapi("/api/app/CriticalFollowValue/UpdateSortMany",{ itemList: result }).then((res) => {
if(res.code!=-1){
this.isshow = true;
this.getlist();
//this.$message.success('')
}
});
},
//
rowDrop() {
this.$nextTick(() => {
const tbody = document.querySelector(".el-table__body-wrapper tbody");
const _this = this;
Sortable.create(tbody, {
handle: ".move",
animation: 300,
onChoose({ oldIndex }) {
_this.$refs["tableData"].setCurrentRow(_this.tableData[oldIndex]);
_this.rowclick(_this.tableData[oldIndex],false);
},
onEnd({ newIndex, oldIndex }) {
_this.isshow = false;
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
_this.tableData.map((item, index) => {
if (index == newIndex && index == oldIndex) {
// console.log(item, "");
} else if (index == oldIndex) {
} else if (index == newIndex) {
}
});
},
});
});
},
//
toppings() {
this.form = { ...this.curRow };
if (this.form.id == undefined) {
this.$message.error("请点击选择操作的数据");
} else {
postapi("/api/app/CriticalFollowValue/UpdateManySort",{
criticalFollowValueId:this.form.id,
sortType:2
}).then((res) => {
if(res.code!=-1){
this.getlist();
//this.$message.success('')
}
});
}
},
//
topping() {
this.form = { ...this.curRow };
if (this.form.id == undefined) {
this.$message.error("请点击选择操作的数据");
} else {
postapi("/api/app/CriticalFollowValue/UpdateManySort",{
criticalFollowValueId:this.form.id,
sortType:1
}).then((res) => {
if(res.code!=-1){
this.getlist();
//this.$message.success('')
}
});
}
},
//
editpopup() {
this.form = { ...this.curRow };
if (this.form.id == undefined) {
this.$message.warning("请点击选择操作的数据");
} else {
this.dialogVisible = true;
this.title = 2;
if (this.$refs.form !== undefined) {
this.$refs.form.resetFields();
}
this.$nextTick(() => {
this.$refs.refinput.focus();
});
medicalconclusionlist().then((res) => {
if(res.code!=-1){
this.ars = res.data;
this.selars = this.form.medicalConclusionTypeId;
}
});
}
},
//id
rowclick(row) {
this.curRow = { ...row };
// quersmedicalid(row.id).then((res) => {
// if(res.code!=-1){
// this.curRow = { ...res.data };
// }
// });
},
//
addoredit() {
if (this.form.displayName == "") {
this.$message.warning("请输入名称");
} else if (this.form.criticalFollowValueTypeId == "") {
this.$message.warning("请选择危急值类别");
} else if (this.form.criticalFollowValueFlag == "") {
this.$message.warning("危急随访值标志");
} else {
if (this.title == 1) {
postapi("/api/app/CriticalFollowValue/Create",{
displayName: this.form.displayName,
criticalFollowValueTypeId: this.form.criticalFollowValueTypeId,
criticalFollowValueFlag: this.form.criticalFollowValueFlag
}).then((res) => {
if(res.code!=-1){
this.getlist();
this.dialogVisible = false;
//this.$message.success('')
}
});
} else if (this.title == 2) {
//diagnosticediting updateconlus
postapi("/api/app/CriticalFollowValue/Update", {
criticalFollowValueId:this.form.id,
displayName: this.form.displayName,
criticalFollowValueTypeId: this.form.criticalFollowValueTypeId,
criticalFollowValueFlag: this.form.criticalFollowValueFlag
}).then((res) => {
if(res.code!=-1){
this.getlist();
this.dialogVisible = false;
//this.$message.success('')
}
});
}
}
},
//
add() {
this.title = 1;
this.dialogVisible = true;
if (this.$refs.form !== undefined) {
this.$refs.form.resetFields();
}
this.form=this.$options.data().form
this.selars = "";
this.$nextTick(() => {
this.$refs.refinput.focus();
});
medicalconclusionlist().then((res) => {
if(res.code!=-1){
this.ars = res.data;
}
});
},
getlist() {
// conclusionacquisition(this.pages).then((res) => {
// console.log(res);
// this.initTableData = [...res.data.items];
// this.tableData = res.data.items;
// });
this.getlistM();
},
getlistM(rowsid) {
postapi("/api/app/CriticalFollowValue/GetList").then((res) => {
if(res.code!=-1){
this.initTableData = [...res.data];
this.tableData = res.data;
if (rowsid != null && rowsid != "") {
var row = this.tableData.filter((item) => item.id == rowsid);
this.$refs.tableData.setCurrentRow(row[0]);
quersmedicalid(rowsid).then((res) => {
this.form = res.data;
});
}
}
});
},
selsearch(id, typeid) {
this.Selectvalue = typeid;
this.pages.TypeId = typeid;
this.getlistM(id);
},
},
};
</script>
<style scoped>
@import "../../assets/css/global_button.css";
@import "../../assets/css/global_dialog.css";
@import "../../assets/css/global_table.css";
@import "../../assets/css/global_form.css";
@import "../../assets/css/global_input.css";
@import "../../assets/css/global.css";
.box {
display: flex;
flex-direction: column;
}
:deep .el-form-item {
margin-bottom: 14px;
}
/* el-dialog的头部样式 */
:deep .el-dialog__header {
padding: 11px 20px 11px;
}
/* el-dialog的主体样式 */
:deep .el-dialog__body {
padding: 0px 20px 0px;
}
/* el-divider样式 */
:deep .el-divider--horizontal {
margin: 0px 0 12px;
}
/* el-dialog的底部样式 */
:deep .el-dialog__footer {
padding: 0px 20px 14px;
}
.seachinput {
width: 250px;
margin-right: 110px;
}
:deep .seachinput .el-select {
width: 100%;
}
</style>

603
src/views/fee-settings/CriticalValueCategory.vue

@ -0,0 +1,603 @@
<template>
<div class="box">
<div style="position: relative">
<div class="contenttitle">
基础资料 /
<span class="contenttitleBold">危急值类别</span>
</div>
<div style="display: block; margin-top: 7px; margin-right: 110px">
<div style="background-color: #fff; border-radius: 8px; padding: 15px">
<el-table
:data="tableData"
:height="window.pageHeight < 600 ? 450 : window.pageHeight - 130"
row-key="criticalFollowValueTypeId"
:key="tableKey"
default-expand-all
:tree-props="{
children: 'treeChildren',
hasChildren: 'hasChildren',
}"
highlight-current-row
@row-click="treeclick"
ref="tableData"
class="el-table__body-wrapper tbody"
>
<el-table-column prop="displayName" label="类别">
<template slot-scope="scope">
<span>
<span class="treeicons">
<!-- <i
class="el-icon-document-remove"
v-if="data.parentId == null"
></i> -->
<img
style="width: 20px; height: 20px; vertical-align: sub"
src="@/assets/images/order.png"
v-if="!scope.row.parentId"
/>
</span>
<span
:class="
!scope.row.parentId ? 'maxtitle' : 'mintitle'
"
>{{ scope.row.displayName }}</span
>
</span>
</template>
</el-table-column>
<el-table-column
prop="simpleCode"
label="拼音简码"
></el-table-column>
<el-table-column label="操作" width="" align="center">
<template>
<el-tag
class="move"
style="
cursor: move;
background-color: rgb(245, 245, 245);
border: none;
"
draggable="true"
>
<i
class="el-icon-d-caret"
style="width: 1rem; height: 1rem; color: rgb(113, 113, 113)"
></i>
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 按钮区域 -->
<div
style="
margin-left: 10px;
margin-top: 3%;
position: absolute;
top: 0;
right: 0;
"
>
<!-- <el-button type="" @click="addll" class="commonbutton">新增</el-button> -->
<div
v-if="tableData.length == '0' ? true : false"
style="margin-bottom: 10px"
>
<el-button type="" class="commonbutton" @click="append"
>新增危急值类别</el-button
>
</div>
<div>
<el-button
type=""
@click="addll"
:disabled="isshow"
class="commonbutton"
>新增同级</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
@click="append"
:disabled="isshow"
class="commonbutton"
>新增子级</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
@click="rena"
:disabled="isshow"
class="commonbutton"
>编辑</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
@click="deleates"
:disabled="isshow"
class="deleteButton"
>删除</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
@click="assertion"
:disabled="isshows"
class="commonbutton"
>排序</el-button
>
</div>
<div style="margin-top: 10px">
<el-button
type=""
:disabled="isshows"
@click="cancellation"
class="commonbutton"
>取消</el-button
>
</div>
</div>
</div>
<el-dialog
:title="title == 1 ? '新增' : '修改'"
:visible.sync="dialogVisible"
width="40%"
:close-on-click-modal="false"
>
<el-form :model="form" label-width="80px" :rules="rules" ref="ruleForm">
<el-row v-if="title == 2 ? true : false">
<el-col :span="12">
<el-form-item label="上级部门">
<el-cascader
v-if="title == 2"
ref="depref"
@change="cascaderchang"
:show-all-levels="false"
v-model="departmentname"
style="margin-left: 10px"
:options="itemtypedata"
:props="{
checkStrictly: true,
children: 'treeChildren',
label: 'displayName',
value: 'criticalFollowValueTypeId',
}"
clearable
size="small"
></el-cascader>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="名称" prop="displayName">
<el-input
v-model="form.displayName"
ref="refinput"
size="small"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" class="difference"
> </el-button
>
<el-button type="" @click="addoredit" class="commonbutton"
> </el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import {
criticalFollowValueType ,
pojectadd,
projecteditid,
projecttype,
projectedid,
} from "@/request/commonapi";
import { basicsetings, physicalexaminationlist } from "@/request/systemapi";
import { getapi, postapi, putapi } from "@/api/api";
import { mapState } from "vuex";
import { objCopy } from "@/utlis/proFunc";
import Sortable from "sortablejs";
export default {
data() {
return {
departmentname: "",
itemtypedata: [],
rules: {
displayName: [
{ required: true, message: "请输入名称", trigger: "blur" },
]
},
defaultProps: {
children: "treeChildren",
label: "displayName",
},
title: 1,
tableData: [],
tableHeight: window.innerHeight - 180, //
screenHeight: window.innerHeight, //
form: {
criticalFollowValueTypeId: "",
displayName: "",
parentId: ""
},
dialogVisible: false,
guideoptions: [],
row: {},
isshow: true,
activeRows: [],
message: true,
tableKey:'',
isshows:true
};
},
created() {
this.getlist();
},
mounted() {
this.rowDrop();
},
computed: {
...mapState(["window"]),
},
methods: {
cascaderchang(v) {
this.departmentname = v[v.length - 1];
},
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, level + 1));
}
});
//
return arr;
},
flatToTree(flatData, idProp, parentIdProp) {
const treeData = [];
const idMap = {};
// 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);
}
}
return treeData;
},
screenData(tree,row,increase,arr = []){
if(increase){
arr.push(row)
}
tree.map((item,index)=>{
if(item.parentId===row.criticalFollowValueTypeId){
arr.push(item)
if(item.treeChildren && item.treeChildren != []){
arr.push(...this.screenData(item.treeChildren,item));
}
}
})
return arr;
},
//
rowDrop() {
this.$nextTick(() => {
const tbody = document.querySelector(".el-table__body-wrapper tbody");
const _this = this;
Sortable.create(tbody, {
handle: ".move",
animation: 300,
// onStart: () => { //
// _this.activeRows = _this.treeToTable(_this.tableData) //
// },
onMove({ dragged, related }) {
// if(dragged.rowIndex<related.rowIndex){
// if (_this.message) {
// _this.$message.warning("");
// _this.message = false;
// }
// return false;
// }
const oldRow = _this.activeRows[dragged.rowIndex];
const newRow = _this.activeRows[related.rowIndex];
if (
oldRow.level !== newRow.level ||
oldRow.parentId !== newRow.parentId
) {
if (_this.message) {
_this.$message.warning("不允许跨级拖拽");
_this.message = false;
}
return false;
}
},
onChoose({newIndex,oldIndex }) {
_this.$refs['tableData'].setCurrentRow(_this.activeRows[oldIndex]);
_this.treeclick(_this.activeRows[oldIndex]);
// const oldRow = _this.activeRows[oldIndex];
// const newRow = _this.activeRows[newIndex];
// if(oldRow.level === newRow.level ||
// oldRow.parentId === newRow.parentId){
// _this.$refs['tableData'].setCurrentRow(_this.activeRows[newIndex]);
// }
},
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,
"criticalFollowValueTypeId",
"parentId"
);
_this.$set(_this,'tableData',data)
_this.isshows = false;
let beforeScrollTop = _this.$refs.tableData.$el.querySelector('div.el-table__body-wrapper').scrollTop
_this.tableKey = new Date().getTime()
_this.$nextTick(() => {
_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()
});
}
}
})
});
},
//
assertion() {
const result = [];
this.activeRows.forEach((item, index) => {
result.push({ id: item.criticalFollowValueTypeId, displayOrder: index+1 });
});
postapi("/api/app/CriticalFollowValueType/UpdateSortMany",{ itemList: result }).then((res) => {
if (res.code != -1) {
this.isshows = true;
}
});
},
//
cancellation() {
this.getlist()
this.isshows=true
},
//
rena() {
this.departmentname = this.row.parentId;
this.title = 2;
this.dialogVisible = true;
if (this.$refs.ruleForm !== undefined) {
this.$refs.ruleForm.resetFields();
}
postapi("/api/app/CriticalFollowValueType/Get",{
criticalFollowValueTypeId:this.row.criticalFollowValueTypeId
}).then((res) => {
if (res.code != -1) {
objCopy(res.data, this.form);
this.form.criticalFollowValueTypeId=res.data.id
}
});
// getapi(`/api/app/item/in-item-type/${data.id}`).then((res) => {
// this.itemtypedata = res.data;
// console.log(res, "222222222222222222");
// });
//
criticalFollowValueType().then(
(res) => {
if (res.code != -1) {
this.itemtypedata = res.data;
}
}
);
},
//
deleates() {
this.$confirm("是否删除, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
cancelButtonClass: "difference",
confirmButtonClass: "commonbutton",
})
.then(() => {
postapi("/api/app/CriticalFollowValueType/Delete",{
criticalFollowValueTypeId:this.row.criticalFollowValueTypeId
}).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 = {};
// if(node&& data){
// this.form.parentId = data.id;
// }
// Object.assign(this.$data.form, this.$options.data().form);
this.form = this.$options.data().form;
this.form.parentId = this.row.criticalFollowValueTypeId;
this.dialogVisible = true;
if (this.$refs.ruleForm !== undefined) {
this.$refs.ruleForm.resetFields();
}
this.$nextTick(() => {
this.$refs.refinput.focus();
});
},
//
addll() {
// 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.dialogVisible = true;
this.title = 1;
if (this.$refs.ruleForm !== undefined) {
this.$refs.ruleForm.resetFields();
}
this.$nextTick(() => {
this.$refs.refinput.focus();
});
},
//
addoredit() {
this.$refs.ruleForm.validate((v) => {
if (v) {
if (this.title == 1) {
if (this.tableData.length == 0) {
postapi("/api/app/CriticalFollowValueType/Create", {
displayName: this.form.displayName,
}).then((res) => {
if (res.code != -1) {
this.getlist();
this.$refs["tableData"].setCurrentRow("");
this.dialogVisible = false;
this.isshow = true;
}
});
} else {
postapi("/api/app/CriticalFollowValueType/Create", {
parentId: this.form.parentId,
displayName: this.form.displayName
}).then((res) => {
if (res.code != -1) {
//this.$message.success("");
this.getlist();
this.$refs["tableData"].setCurrentRow("");
this.dialogVisible = false;
this.isshow = true;
}
});
}
// console.log(this.form);
} else if (this.title == 2) {
postapi("/api/app/CriticalFollowValueType/Update",{
criticalFollowValueTypeId: this.form.criticalFollowValueTypeId,
displayName: this.form.displayName
}).then((res) => {
if (res.code != -1) {
//this.$message.success("");
this.getlist();
this.$refs["tableData"].setCurrentRow("");
this.dialogVisible = false;
this.isshow = true;
}
});
}
}
});
},
//
treeclick(row) {
this.row = { ...row };
this.isshow = false;
},
getlist() {
criticalFollowValueType().then((res) => {
if (res.code != -1) {
this.tableData = [...res.data];
this.activeRows = this.treeToTable(this.tableData, 1);
}
});
},
},
};
</script>
<style scoped>
@import "../../assets/css/global_button.css";
@import "../../assets/css/global_dialog.css";
@import "../../assets/css/global_table.css";
@import "../../assets/css/global_form.css";
@import "../../assets/css/global_input.css";
@import "../../assets/css/global.css";
.box {
display: flex;
flex-direction: column;
}
.layeredleftright {
width: 100%;
display: flex;
flex-direction: column;
}
:deep .el-form-item {
margin-bottom: 14px;
}
/* el-dialog的头部样式 */
:deep .el-dialog__header {
padding: 11px 20px 11px;
}
/* el-dialog的主体样式 */
:deep .el-dialog__body {
padding: 0px 20px 0px;
}
/* el-divider样式 */
:deep .el-divider--horizontal {
margin: 0px 0 12px;
}
/* el-dialog的底部样式 */
:deep .el-dialog__footer {
padding: 0px 20px 14px;
}
:deep .el-table tr {
height: 35px;
}
</style>
Loading…
Cancel
Save