You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1136 lines
34 KiB
1136 lines
34 KiB
<template>
|
|
<div class="box">
|
|
<div style="position: relative;">
|
|
<div class="middlebox">
|
|
<div class="contenttitle"
|
|
>
|
|
基础资料 /
|
|
<span class="contenttitleBold"
|
|
>项目模板</span
|
|
>
|
|
</div>
|
|
</div>
|
|
<div style="margin-top: 7px;">
|
|
<div style="margin-right: 110px;">
|
|
<div style="margin-bottom: 15px;background-color: #fff;padding: 15px;border-radius: 8px;">
|
|
<div>
|
|
<el-table
|
|
:data="tableData"
|
|
row-key="id"
|
|
:height="
|
|
window.pageHeight < 600
|
|
? 210
|
|
: Math.floor((window.pageHeight - 220) / 2)
|
|
"
|
|
class="el-table__body-wrapper tbody"
|
|
border:stripe="true"
|
|
@row-click="rowick"
|
|
ref="info"
|
|
highlight-current-row
|
|
>
|
|
<el-table-column prop="id" label="编号" width="300">
|
|
</el-table-column>
|
|
<el-table-column prop="displayName" label="名称">
|
|
</el-table-column>
|
|
<el-table-column prop="creatorName" label="创建者">
|
|
</el-table-column>
|
|
<el-table-column prop="creationTime" label="创建时间" width="180">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.creationTime | dateFormat }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="lastModifierName" label="修改者">
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="lastModificationTime"
|
|
label="修改时间"
|
|
width="180"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.lastModificationTime | dateFormat }}
|
|
</template>
|
|
</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="background-color: #fff; border-radius: 8px; padding: 15px">
|
|
<div class="mainbox" style="margin-top: 0px">
|
|
<div class="mainleftbox">
|
|
<div>
|
|
<span style="padding: 5px;font-size: 14px;font-weight: 400;color: #232748;font-family: NotoSansSC-Regular;margin-bottom: 10px;">项目类别</span>
|
|
<el-cascader
|
|
:options="dict.itemTypeTree"
|
|
v-model="itemTypeIds"
|
|
:props="{
|
|
checkStrictly: true,
|
|
expandTrigger: 'hover',
|
|
...customerOrg.treeprops,
|
|
}"
|
|
popper-class="example"
|
|
@change="getAsbItemByItemType"
|
|
size="small"
|
|
ref="itemTypeIds"
|
|
>
|
|
</el-cascader>
|
|
</div>
|
|
<div :style="'width:' + Math.floor((window.pageWidth - 300) / 2) + 'px;'">
|
|
<el-table
|
|
:data="dict.asbItem"
|
|
width="160"
|
|
:height="
|
|
window.pageHeight < 600
|
|
? 210
|
|
: Math.floor((window.pageHeight - 200) / 2)"
|
|
highlight-current-row
|
|
@row-dblclick="dbClickChoosedAsb"
|
|
@selection-change="handleSelectionChange"
|
|
:row-class-name="handleRowClassName"
|
|
@row-click="chooseAsbItem"
|
|
>
|
|
<el-table-column
|
|
type="index"
|
|
align="center"
|
|
label="序号"
|
|
/>
|
|
<el-table-column prop="displayName" label="未选项目" />
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
<div class="Selectbutton">
|
|
<div>
|
|
<el-button
|
|
class="commonbutton"
|
|
@click="addAbs(asbItemChoosed, 'choosed')"
|
|
>添加 <i class="el-icon-arrow-right"></i
|
|
></el-button>
|
|
</div>
|
|
<div style="margin-top: 18px">
|
|
<el-button
|
|
class="difference"
|
|
@click="addAbs(asbItemChoosed, 'all')"
|
|
>全部添加</el-button
|
|
>
|
|
</div>
|
|
<div style="margin-top: 18px">
|
|
<el-button
|
|
class="commonbutton"
|
|
@click="delAbs(patientRegisterAbsChoosed, 'choosed')"
|
|
>移除 <i class="el-icon-arrow-left"></i
|
|
></el-button>
|
|
</div>
|
|
<div style="margin-top: 18px">
|
|
<el-button
|
|
class="difference"
|
|
@click="delAbs(patientRegisterAbsChoosed, 'all')"
|
|
>全部移除</el-button
|
|
>
|
|
</div>
|
|
</div>
|
|
<div class="mainleftbox">
|
|
<div>
|
|
<span style="padding: 5px;font-size: 14px;font-weight: 400;color: #232748;font-family: NotoSansSC-Regular;margin-bottom: 10px;">快速选择</span>
|
|
<el-select
|
|
v-model="asbItemId"
|
|
placeholder="快速选择项目"
|
|
size="small"
|
|
filterable
|
|
default-first-option
|
|
:filter-method="filterMethod"
|
|
clearable
|
|
@clear="quickAsb = deepCopy(dict.asbItemQuick)"
|
|
@change="quickChoosedAsb"
|
|
ref="quickAsbOCX"
|
|
>
|
|
<el-option
|
|
v-for="item in quickAsb"
|
|
:key="item.id"
|
|
:value="item.id"
|
|
:label="item.displayName"
|
|
/>
|
|
</el-select>
|
|
</div>
|
|
<div :style="'width:' + Math.floor((window.pageWidth - 300) / 2) + 'px;'">
|
|
<el-table
|
|
:data="sampleGroupAsbitems"
|
|
:height="
|
|
window.pageHeight < 600
|
|
? 210
|
|
: Math.floor((window.pageHeight - 200) / 2)"
|
|
@selection-change="selecteditems"
|
|
highlight-current-row
|
|
:row-class-name="handleRowClassName"
|
|
@row-dblclick="removeAbs"
|
|
@row-click="removeAsbItem"
|
|
:summary-method="getSummaries"
|
|
show-summary
|
|
ref="table"
|
|
>
|
|
<el-table-column
|
|
type="index"
|
|
align="center"
|
|
label="序号"
|
|
/>
|
|
<el-table-column prop="displayName" label="已选项目" />
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 按钮区域 -->
|
|
<div style="margin-left: 10px; margin-top: 3%;position: absolute;right: 0;top: 0;">
|
|
<div>
|
|
<el-button @click="btnAdd" class="commonbutton">新增</el-button>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button @click="btnEdit" class="commonbutton">编辑</el-button>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button @click="btnDel" class="deleteButton">删除</el-button>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button @click="btnSetTop" class="commonbutton">置顶</el-button>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button @click="btnSetButtom" class="commonbutton">置底</el-button>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button :disabled="isshow" @click="btnSaveSort" class="commonbutton"
|
|
>排序</el-button
|
|
>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<el-button @click="saveAsb" class="commonbutton">确定项目</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 新增弹框 -->
|
|
<el-dialog
|
|
:title="title == 1 ? '新增' : '修改'"
|
|
:visible.sync="dialogVisible"
|
|
width="520px"
|
|
:close-on-click-modal="false"
|
|
@close="closeDialog"
|
|
>
|
|
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="名称" prop="displayName">
|
|
<el-input
|
|
ref="refinput"
|
|
v-model="form.displayName"
|
|
style="width: 100%"
|
|
size="small"
|
|
></el-input> </el-form-item
|
|
></el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="创建者">
|
|
<el-input v-model="form.creatorName" disabled size="small"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="创建时间">
|
|
<el-input :value="form.creationTime" disabled size="small"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="修改者">
|
|
<el-input v-model="form.lastModifierName" disabled size="small"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="修改时间">
|
|
<el-input :value="form.lastModificationTime" disabled 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="onSubmit" class="commonbutton">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import Sortable from "sortablejs";
|
|
import {
|
|
groupinglist,
|
|
samplegroup,
|
|
samplegropid,
|
|
barcodeediting,
|
|
barcodedeleteid,
|
|
barcodedetopbottom,
|
|
barcodedraganddrop,
|
|
projectlist,
|
|
itemtypeid,
|
|
sampleasbitemid,
|
|
asbitmfilte,
|
|
} from "@/request/commonapi";
|
|
import { specimenlist, containerlist } from "@/request/systemapi";
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api";
|
|
import { mapState } from "vuex";
|
|
import {
|
|
arrayExistObj,
|
|
tcdate,
|
|
arrayFilter,
|
|
arrayReduce,
|
|
deepCopy,
|
|
dddw,
|
|
objCopy,
|
|
} from "../../utlis/proFunc";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
itemTypeIds: [], //项目类别
|
|
asbItemId: "", //当前快速选到的给合项目ID
|
|
quickAsb: [], //过滤显示的项目
|
|
rules: {
|
|
displayName: [
|
|
{ required: true, message: "请输入名称", trigger: "blur" },
|
|
],
|
|
},
|
|
isdislob: true,
|
|
filetelists: [],
|
|
flitvalues: [],
|
|
checked: [],
|
|
tableHeight: window.innerHeight - 500, //表格动态高度
|
|
screenHeight: window.innerHeight, //内容区域高度
|
|
isshow: true,
|
|
form: {
|
|
displayName: "",
|
|
},
|
|
dialogVisible: false,
|
|
title: 1,
|
|
loading: false,
|
|
tableData: [],
|
|
initTableData: [],
|
|
projectid: [],
|
|
|
|
sampleGroupAsbitems: [], //右侧数据
|
|
num: "",
|
|
nums: "",
|
|
values: "",
|
|
rightobj: {},
|
|
leftobj: {},
|
|
ischank: 1,
|
|
filete: {
|
|
Filter: "",
|
|
},
|
|
|
|
ary1: [],
|
|
ary2: [],
|
|
sdate: [],
|
|
curRow: {},
|
|
};
|
|
},
|
|
created() {
|
|
this.dictInit();
|
|
|
|
this.getlist();
|
|
this.posjectlist();
|
|
},
|
|
mounted() {
|
|
this.rowDrop();
|
|
},
|
|
updated() {
|
|
this.$nextTick(() => {
|
|
this.$refs.table.doLayout()
|
|
})
|
|
},
|
|
watch: {
|
|
// 监听screenHeight从而改变table的高度
|
|
// screenHeight(val) {
|
|
// this.screenHeight = val;
|
|
// this.tableHeight = this.screenHeight - 220;
|
|
// },
|
|
},
|
|
|
|
computed: {
|
|
...mapState(["window", "dict", "customerOrg"]),
|
|
},
|
|
|
|
methods: {
|
|
//初始数据
|
|
dictInit() {
|
|
//体检类别 树结构
|
|
getapi("/api/app/item-type/by-code-all").then((res) => {
|
|
if (res.code != -1) {
|
|
this.dict.itemTypeTree = res.data;
|
|
tcdate(this.dict.itemTypeTree);
|
|
}
|
|
});
|
|
|
|
//获取所有项目
|
|
getapi("/api/app/item/in-filter").then((res) => {
|
|
if (res.code != -1) {
|
|
this.dict.asbItemAll = res.data;
|
|
this.dict.asbItemAll.forEach((e) => {
|
|
e.choosed = false;
|
|
});
|
|
this.dict.asbItem = deepCopy(this.dict.asbItemAll);
|
|
this.dict.asbItemQuick = deepCopy(res.data);
|
|
this.quickAsb = deepCopy(res.data);
|
|
}
|
|
});
|
|
},
|
|
|
|
handleRowClassName({ row, rowIndex }) {
|
|
// highLightBg 为 'selected'的高亮
|
|
//console.log(rowIndex, row)
|
|
//return row.highLightBg == 'selected' ? 'high-light-bg' : '';
|
|
if (row.choosed) {
|
|
return "current-row";
|
|
} else {
|
|
return "";
|
|
}
|
|
},
|
|
|
|
//项目类别过滤 项目,未过滤已选择的项目
|
|
getAsbItemByItemTypeAll() {
|
|
//console.log('getAsbItemByItemType', typeof this.itemTypeIds, this.itemTypeIds)
|
|
let lv = "";
|
|
if (typeof this.itemTypeIds === "object") {
|
|
lv = this.itemTypeIds[this.itemTypeIds.length - 1];
|
|
}
|
|
|
|
if (lv) {
|
|
this.dict.asbItem = arrayFilter(this.dict.asbItemAll, "itemTypeId", lv);
|
|
} else {
|
|
this.dict.asbItem = deepCopy(this.dict.asbItemAll);
|
|
}
|
|
//console.log('lv,this.dict.asbItem', lv, this.dict.asbItem)
|
|
this.dict.asbItemQuick = deepCopy(this.dict.asbItemAll);
|
|
},
|
|
|
|
//按项目类别显示项目,并过滤已选择的项目
|
|
getAsbItemByItemType(e) {
|
|
this.getAsbItemByItemTypeAll();
|
|
//刷新显示 未选项目
|
|
arrayReduce(this.dict.asbItem, [...this.sampleGroupAsbitems], "id=id");
|
|
arrayReduce(
|
|
this.dict.asbItemQuick,
|
|
[...this.sampleGroupAsbitems],
|
|
"id=id"
|
|
);
|
|
this.quickAsb = deepCopy(this.dict.asbItemQuick);
|
|
if(e){
|
|
this.$refs.itemTypeIds.toggleDropDownVisible();
|
|
}
|
|
},
|
|
|
|
//快速选择项目时,调整可按拼间简码及简称查找
|
|
filterMethod(keyWords) {
|
|
//console.log('filterMethod',this.dict.asbItemQuick)
|
|
if (keyWords) {
|
|
this.quickAsb = [];
|
|
this.dict.asbItemQuick.forEach((item) => {
|
|
if (
|
|
item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) >
|
|
-1 ||
|
|
item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > -1
|
|
) {
|
|
this.quickAsb.push(item);
|
|
}
|
|
});
|
|
} else {
|
|
this.quickAsb = deepCopy(this.dict.asbItemQuick);
|
|
}
|
|
},
|
|
|
|
// 添加项目
|
|
///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6'
|
|
async addAbs(asbItemChoosed, oprType) {
|
|
// console.log('this.customerOrgGroup',this.customerOrgGroup)
|
|
// console.log('asbItemChoosed', asbItemChoosed)
|
|
if (!this.form.id) {
|
|
this.$message.warning("请先选中条码分组");
|
|
return;
|
|
}
|
|
|
|
let message = [];
|
|
let checked = true;
|
|
let lfind = -1;
|
|
|
|
//oprType 不传值时,兼容勾选方式
|
|
//勾选时不需要此操作 start
|
|
if (oprType && oprType == "all") {
|
|
asbItemChoosed = deepCopy(this.dict.asbItem);
|
|
} else if (oprType && oprType == "choosed") {
|
|
asbItemChoosed = [];
|
|
this.dict.asbItem.forEach((e) => {
|
|
if (e.choosed) {
|
|
asbItemChoosed.push(e);
|
|
e.choosed = false;
|
|
}
|
|
});
|
|
}
|
|
//勾选时不需要此操作 end
|
|
|
|
if (asbItemChoosed.length < 1) {
|
|
this.$message.warning("请选择要添加的项目");
|
|
return;
|
|
}
|
|
|
|
// 去掉重复的项目
|
|
arrayReduce(asbItemChoosed, this.sampleGroupAsbitems, "id=id");
|
|
/*
|
|
for (let i = asbItemChoosed.length - 1; i > - 1; i--) {
|
|
if (this.customerOrgGroup.forSexId == 'A') break //未选性别时,无需判断项目性别限制
|
|
if (asbItemChoosed[i].forSexId == 'A' || asbItemChoosed[i].forSexId == 'U') continue
|
|
if (asbItemChoosed[i].forSexId != this.customerOrgGroup.forSexId) {
|
|
message.push(asbItemChoosed[i].displayName) //.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`)
|
|
checked = false
|
|
asbItemChoosed.splice(i,1)
|
|
}
|
|
}
|
|
//console.log(222,checked)
|
|
if (!checked) this.$message.warning(`所选项目【${JSON.stringify(message)}】不适合当前人员性别`)
|
|
*/
|
|
|
|
asbItemChoosed.forEach((e) => {
|
|
this.sampleGroupAsbitems.push(deepCopy(e));
|
|
});
|
|
|
|
//刷新
|
|
this.getAsbItemByItemType();
|
|
},
|
|
|
|
//双击选择项目
|
|
dbClickChoosedAsb(row) {
|
|
this.addAbs([row]);
|
|
},
|
|
//快速选择项目
|
|
quickChoosedAsb(v) {
|
|
//远程查询时,设置了 value-key 也不管用,只能取到value console.log('quickChoosedAsb',v)
|
|
let lfind = -1;
|
|
if (v) {
|
|
lfind = arrayExistObj(this.dict.asbItemQuick, "id", v);
|
|
if (lfind > -1) {
|
|
this.addAbs([this.dict.asbItemQuick[lfind]]);
|
|
}
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs["quickAsbOCX"].blur(); //total asbItemId
|
|
this.asbItemId = "";
|
|
this.quickAsb = deepCopy(this.dict.asbItemQuick);
|
|
this.$refs["quickAsbOCX"].focus(); //total asbItemId
|
|
});
|
|
},
|
|
|
|
//选择 未选的项目
|
|
chooseAsbItem(row) {
|
|
this.dict.asbItem.forEach((e, index) => {
|
|
e.index = index;
|
|
return e;
|
|
});
|
|
// 按住了shift键
|
|
if (this.window.shift) {
|
|
//清除所有选择
|
|
this.dict.asbItem.forEach((e) => {
|
|
e.choosed = false;
|
|
return e;
|
|
});
|
|
|
|
if (this.startPoint == -1) {
|
|
this.dict.asbItem[row.index].choosed = true;
|
|
this.startPoint = row.index;
|
|
return;
|
|
}
|
|
|
|
if (this.startPoint > row.index) {
|
|
for (let i = row.index; i <= this.startPoint; i++) {
|
|
this.dict.asbItem[i].choosed = true;
|
|
}
|
|
} else if (this.startPoint <= row.index) {
|
|
for (let i = this.startPoint; i <= row.index; i++) {
|
|
this.dict.asbItem[i].choosed = true;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 按住了ctrl 键
|
|
if (this.window.ctrl) {
|
|
this.dict.asbItem[row.index].choosed = true;
|
|
this.startPoint = row.index;
|
|
return;
|
|
}
|
|
|
|
// 未按住了ctrl 、shift 键
|
|
//清除所有选择
|
|
//console.log('清除所有选择')
|
|
this.dict.asbItem.forEach((e) => {
|
|
e.choosed = false;
|
|
return e;
|
|
});
|
|
this.dict.asbItem[row.index].choosed = true;
|
|
this.startPoint = row.index;
|
|
},
|
|
|
|
//删除 人员已选中的项目
|
|
///api/app/register-asbitem/many?RegisterAsbitemIds=3fa85f64-5717-4562-b3fc-2c963f66afa6
|
|
delAbs(absForDel, oprType) {
|
|
if (!this.form.id) {
|
|
this.$message.warning("请先选中单位分组");
|
|
return;
|
|
}
|
|
|
|
let lfind = -1;
|
|
|
|
//勾选时不需要此操作 start
|
|
if (oprType && oprType == "all") {
|
|
absForDel = deepCopy(this.sampleGroupAsbitems);
|
|
} else if (oprType && oprType == "choosed") {
|
|
absForDel = [];
|
|
this.sampleGroupAsbitems.forEach((e) => {
|
|
if (e.choosed) {
|
|
absForDel.push(deepCopy(e));
|
|
e.choosed = false;
|
|
}
|
|
});
|
|
}
|
|
//勾选时不需要此操作 end
|
|
|
|
if (absForDel.length < 1) {
|
|
this.$message.warning("请选择要移除的项目");
|
|
return;
|
|
}
|
|
|
|
for (let i = 0; i < absForDel.length; i++) {
|
|
lfind = arrayExistObj(this.sampleGroupAsbitems, "id", absForDel[i].id);
|
|
if (lfind > -1) this.sampleGroupAsbitems.splice(lfind, 1);
|
|
|
|
absForDel.splice(i, 1);
|
|
i--;
|
|
continue;
|
|
}
|
|
|
|
//刷新
|
|
this.getAsbItemByItemType();
|
|
},
|
|
|
|
//双击删除已选项目
|
|
removeAbs(row) {
|
|
this.delAbs([row]);
|
|
},
|
|
|
|
//选择 已选的项目
|
|
removeAsbItem(row) {
|
|
this.sampleGroupAsbitems.forEach((e, index) => {
|
|
e.index = index;
|
|
return e;
|
|
});
|
|
// 按住了shift键
|
|
if (this.window.shift) {
|
|
//清除所有选择
|
|
this.sampleGroupAsbitems.forEach((e) => {
|
|
e.choosed = false;
|
|
return e;
|
|
});
|
|
|
|
if (this.PstartPoint == -1) {
|
|
this.sampleGroupAsbitems[row.index].choosed = true;
|
|
this.PstartPoint = row.index;
|
|
return;
|
|
}
|
|
|
|
if (this.PstartPoint > row.index) {
|
|
for (let i = row.index; i <= this.PstartPoint; i++) {
|
|
this.sampleGroupAsbitems[i].choosed = true;
|
|
}
|
|
} else if (this.PstartPoint <= row.index) {
|
|
for (let i = this.PstartPoint; i <= row.index; i++) {
|
|
this.sampleGroupAsbitems[i].choosed = true;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 按住了ctrl 键
|
|
if (this.window.ctrl) {
|
|
this.sampleGroupAsbitems[row.index].choosed = true;
|
|
this.PstartPoint = row.index;
|
|
return;
|
|
}
|
|
|
|
// 未按住了ctrl 、shift 键
|
|
//清除所有选择
|
|
//console.log('清除所有选择')
|
|
this.sampleGroupAsbitems.forEach((e) => {
|
|
e.choosed = false;
|
|
return e;
|
|
});
|
|
this.sampleGroupAsbitems[row.index].choosed = true;
|
|
this.PstartPoint = row.index;
|
|
},
|
|
|
|
selectchange(v) {
|
|
this.sampleGroupAsbitems.push({ displayName: v.displayName });
|
|
// console.log(v);
|
|
},
|
|
saveAsb() {
|
|
if (!this.form.id) {
|
|
this.$message.warning("请选择要操作的模板!");
|
|
return;
|
|
}
|
|
let details = [];
|
|
let itemTemplateId = this.form.id;
|
|
|
|
this.sampleGroupAsbitems.forEach((e) => {
|
|
details.push({
|
|
itemTemplateId,
|
|
itemId: e.id,
|
|
});
|
|
});
|
|
|
|
let body = { itemTemplateId, details };
|
|
|
|
postapi(
|
|
"/api/app/itemtemplatedetail/createitemtemplatedetaimany",
|
|
body
|
|
).then((res) => {
|
|
if (res.code != -1) {
|
|
//this.$message.success('操作成功!')
|
|
}
|
|
});
|
|
},
|
|
|
|
//右侧勾选按钮
|
|
selecteditems(val) {
|
|
this.rightselctedata = val;
|
|
},
|
|
|
|
// 左侧未选
|
|
handleSelectionChange(val) {
|
|
// this.selecteddata = val;
|
|
this.unselecteddata = val;
|
|
},
|
|
|
|
clickPaixu(item, index) {
|
|
this.rightobj = item;
|
|
// let arr = [];
|
|
// arr.push({ itemId: this.rightobj.id });
|
|
// this.allid.forEach((item) => {
|
|
// if (item.id == arr[id]) {
|
|
// return;
|
|
// } else {
|
|
// this.allid.push({ id: arr[id] });
|
|
// }
|
|
// });
|
|
this.ischank = 2;
|
|
this.num = index;
|
|
this.isdislob = false;
|
|
},
|
|
|
|
// 获取项目类别接口
|
|
posjectlist() {
|
|
projectlist().then((res) => {
|
|
if(res.code!=-1){
|
|
this.projectid = res.data;
|
|
}
|
|
});
|
|
},
|
|
handlechang(value, direction, movedkeys) {
|
|
},
|
|
//取消按钮
|
|
cancellation() {
|
|
this.$message.info("取消操作");
|
|
this.isshow = true;
|
|
this.getlist();
|
|
},
|
|
//确定排序
|
|
btnSaveSort() {
|
|
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: index+1 });
|
|
// }
|
|
});
|
|
putapi("/api/app/itemtemplate/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["info"].setCurrentRow(_this.tableData[oldIndex]);
|
|
},
|
|
// 指定父元素下可被拖拽的子元素
|
|
// draggable: ".module-manager .el-table__row",
|
|
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, "新数据");
|
|
} else if (index == oldIndex) {
|
|
} else if (index == newIndex) {
|
|
}
|
|
});
|
|
},
|
|
});
|
|
});
|
|
},
|
|
//置底
|
|
btnSetButtom() {
|
|
this.form = { ...this.curRow };
|
|
if (this.form.id == undefined) {
|
|
this.$message.warning("请选择操作的数据");
|
|
} else {
|
|
putapi(
|
|
`/api/app/itemtemplate/updatemanysort?id=${
|
|
this.form.id
|
|
}&SortType=${2}`
|
|
).then((res) => {
|
|
if (res.code != -1) {
|
|
this.getlist();
|
|
//this.$message.success('操作成功')
|
|
}
|
|
});
|
|
}
|
|
},
|
|
//置顶
|
|
btnSetTop() {
|
|
this.form = { ...this.curRow };
|
|
if (this.form.id == undefined) {
|
|
this.$message.warning("请选择操作的数据");
|
|
} else {
|
|
putapi(
|
|
`/api/app/itemtemplate/updatemanysort?id=${
|
|
this.form.id
|
|
}&SortType=${1}`
|
|
).then((res) => {
|
|
if (res.code != -1) {
|
|
this.getlist();
|
|
//this.$message.success('操作成功')
|
|
}
|
|
});
|
|
}
|
|
},
|
|
//删除
|
|
btnDel() {
|
|
this.form = { ...this.curRow };
|
|
if (this.form.id == undefined) {
|
|
this.$message.warning("请选择操作的数据");
|
|
} else {
|
|
this.$confirm("是否确认删除, 是否继续?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
cancelButtonClass:"difference",
|
|
confirmButtonClass:"commonbutton"
|
|
}).then(() => {
|
|
deletapi(`/api/app/item-template/${this.form.id}`).then((res) => {
|
|
if (res.code != -1) {
|
|
this.getlist();
|
|
//this.$message.success('删除成功')
|
|
}
|
|
});
|
|
});
|
|
// barcodedeleteid(this.form.id).then((res) => {
|
|
// console.log(res);
|
|
// console.log("删除成功");
|
|
// this.getlist();
|
|
// });
|
|
}
|
|
},
|
|
//编辑弹框
|
|
btnEdit() {
|
|
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();
|
|
}
|
|
// //获取标本类型id
|
|
// specimenlist(this.pages).then((res) => {
|
|
// this.sampleTypeId = res.data.items;
|
|
// });
|
|
// // 获取标本容器Id
|
|
// containerlist(this.pages).then((res) => {
|
|
// this.sampleContainerId = res.data.items;
|
|
// });
|
|
// samplegropid(this.form.id).then((res) => {
|
|
// this.form = res.data;
|
|
// });
|
|
}
|
|
},
|
|
|
|
//确定新增或者编辑
|
|
onSubmit() {
|
|
this.$refs.form.validate((v) => {
|
|
if (v) {
|
|
if (this.title == 1) {
|
|
postapi("/api/app/item-template", this.form).then((res) => {
|
|
if (res.code != -1) {
|
|
// this.getlist(); 改为局部刷新
|
|
this.form.id = res.data.id;
|
|
this.tableData.push(deepCopy(res.data));
|
|
this.dialogVisible = false;
|
|
//this.$message.success('新增成功')
|
|
}
|
|
});
|
|
} else if (this.title == 2) {
|
|
putapi(`/api/app/item-template/${this.form.id}`, this.form).then(
|
|
(res) => {
|
|
if (res.code != -1) {
|
|
// this.getlist(); 改为局部刷新
|
|
this.dialogVisible = false;
|
|
//this.$message.success('修改成功')
|
|
}
|
|
}
|
|
);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
closeDialog() {
|
|
if (!this.form.id) return;
|
|
|
|
let currentRow = {};
|
|
let lfind = arrayExistObj(this.tableData, "id", this.form.id);
|
|
if (lfind > -1) {
|
|
objCopy(this.form, this.tableData[lfind]);
|
|
currentRow = this.tableData[lfind];
|
|
} else {
|
|
currentRow = deepCopy(this.form);
|
|
lfind = this.tableData.length;
|
|
this.tableData.push(currentRow);
|
|
}
|
|
|
|
if (lfind > -1) {
|
|
this.$nextTick(() => {
|
|
this.$refs["info"].setCurrentRow(currentRow);
|
|
this.rowick(currentRow);
|
|
});
|
|
}
|
|
},
|
|
|
|
//新增弹框
|
|
btnAdd() {
|
|
this.dialogVisible = true;
|
|
this.title = 1;
|
|
this.form = this.$options.data().form;
|
|
this.$nextTick(() => {
|
|
this.$refs.refinput.focus();
|
|
});
|
|
|
|
// //获取标本类型id
|
|
// specimenlist(this.pages).then((res) => {
|
|
// this.sampleTypeId = res.data.items;
|
|
// console.log(res);
|
|
// });
|
|
// // 获取标本容器Id
|
|
// containerlist(this.pages).then((res) => {
|
|
// this.sampleContainerId = res.data.items;
|
|
// console.log(res, "11111");
|
|
// });
|
|
},
|
|
|
|
//点击条码分组记录
|
|
rowick(row) {
|
|
this.curRow = deepCopy(row);
|
|
this.form = deepCopy(row);
|
|
|
|
// samplegropid(row.id).then((res) => {
|
|
// this.curRow = { ...res.data };
|
|
// this.form = res.data;
|
|
// });
|
|
|
|
postapi("/api/app/itemtemplatedetail/getitemtemplateinitem", {
|
|
ItemTemplateId: this.form.id,
|
|
}).then((res) => {
|
|
if (res.code != -1) {
|
|
this.sampleGroupAsbitems = res.data;
|
|
this.getAsbItemByItemType();
|
|
}
|
|
});
|
|
},
|
|
getSummaries(param){
|
|
const { columns, data } = param;
|
|
const sums = [];
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '合计';
|
|
return;
|
|
}
|
|
if(index === 1){
|
|
sums[index] = data.length+'个';
|
|
return;
|
|
}
|
|
});
|
|
|
|
return sums;
|
|
},
|
|
getlist() {
|
|
this.loading = true;
|
|
getapi("/api/app/item-template/in-filter").then((res) => {
|
|
if(res.code!=-1){
|
|
this.loading = false;
|
|
this.tableData = res.data;
|
|
this.initTableData = [...res.data];
|
|
}
|
|
});
|
|
},
|
|
//ary1 需要追加的数据 ary2目标数组
|
|
updatedate() {
|
|
this.ary1.forEach((item) => {
|
|
let iscz = false;
|
|
this.ary2.forEach((item2) => {
|
|
if (item2.id == item.id) {
|
|
iscz = true;
|
|
}
|
|
});
|
|
if (!iscz) {
|
|
this.ary2.push(item);
|
|
// this.allid.push({ id: item.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";
|
|
.mainleftbox {
|
|
flex: 1;
|
|
}
|
|
.Selectbutton {
|
|
margin: 0 20px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.mainbox {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-top: 5px;
|
|
}
|
|
.box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
/* form表单每一项的下边距 */
|
|
:deep .el-form-item {
|
|
margin-bottom: 14px;
|
|
}
|
|
/* 去掉input textarea的手动扩张样式 */
|
|
:deep(.el-textarea__inner) {
|
|
resize: none;
|
|
}
|
|
/* 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 .downText .el-input--suffix .el-input__inner {
|
|
width: 0;
|
|
height: 100%;
|
|
padding: 0 19px;
|
|
}
|
|
/* 默认结果后面下拉框图标样式 */
|
|
:deep .downText .el-input--suffix .el-input__suffix {
|
|
right: 12px;
|
|
}
|
|
/* 默认结果后面下拉框 */
|
|
:deep .downText {
|
|
display: flex !important;
|
|
}
|
|
/* 诊断函数后面按钮样式 */
|
|
:deep .el-input-group__append {
|
|
padding: 0 11px;
|
|
}
|
|
/* 默认结果整体样式 */
|
|
.my-el-form-item :deep .el-form-item__content {
|
|
line-height: 0 !important;
|
|
}
|
|
.my-el-form-item :deep .el-input__icon {
|
|
line-height: 0 !important;
|
|
}
|
|
/* 指引信息 */
|
|
.guidelines :deep .el-form-item {
|
|
margin-bottom: 0;
|
|
}
|
|
.seachinput {
|
|
width: 250px;
|
|
}
|
|
:deep .seachinput .el-select {
|
|
width: 100%;
|
|
}
|
|
.layeredleftright {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
</style>
|