条码类别与项目对照、参数设置
This commit is contained in:
parent
9859df5a4d
commit
2c4a3efba1
@ -129,3 +129,27 @@ export function rptgetruleDelDetail(query?: Object) {
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
// 查询条码类别与项目对照
|
||||
export function feeitemvsList(query?: Object) {
|
||||
return request({
|
||||
url: '/feeitemvsclass/query',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
// 保存对照的项目
|
||||
export function feeitemvAdd(query?: Object) {
|
||||
return request({
|
||||
url: '/feeitemvsclass/add',
|
||||
method: 'post',
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
// 保存对照的项目
|
||||
export function feeitemvDel(query?: Object) {
|
||||
return request({
|
||||
url: '/feeitemvsclass/del',
|
||||
method: 'delete',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
44
src/api/system/parameter.ts
Normal file
44
src/api/system/parameter.ts
Normal file
@ -0,0 +1,44 @@
|
||||
//@ts-ignore js语法检查忽略
|
||||
import request from '@/utils/request';
|
||||
|
||||
|
||||
// 查询参数列表
|
||||
export function paramList(query?: Object) {
|
||||
return request({
|
||||
url: '/param/query',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
// 新增参数列表
|
||||
export function addParam(query?: Object) {
|
||||
return request({
|
||||
url: '/param/add',
|
||||
method: 'post',
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
// 修改参数列表
|
||||
export function updateParam(query?: Object) {
|
||||
return request({
|
||||
url: '/param/update',
|
||||
method: 'post',
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
// 删除参数列表
|
||||
export function delParam(query?: Object) {
|
||||
return request({
|
||||
url: '/param/del',
|
||||
method: 'delete',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
// 查询参数列表树状结构
|
||||
export function paramTree(query?: Object) {
|
||||
return request({
|
||||
url: '/param/queryTree',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
@ -13,11 +13,17 @@ type PrinterInfo = {
|
||||
};
|
||||
|
||||
|
||||
type ClientInfo = any;
|
||||
interface ClientInfo {
|
||||
id?: string;
|
||||
version?: string;
|
||||
os?: string;
|
||||
[key: string]: string | number | boolean | undefined;
|
||||
}
|
||||
|
||||
type OnPrinterUpdate = (printerList: PrinterInfo[]) => void;
|
||||
let socket: Socket | null = null;
|
||||
|
||||
let clientInfo: ClientInfo = null;
|
||||
let clientInfo: ClientInfo | null = null;
|
||||
// 初始化 Socket 连接
|
||||
function initSocket(onPrinterUpdate?: OnPrinterUpdate) {
|
||||
const printStore = usePrintStore();
|
||||
@ -90,29 +96,46 @@ const yxHiprint = () => {
|
||||
// 挂载到window,使其能被全局访问
|
||||
(window as any).downExe = downExe;
|
||||
(window as any).yxHiprint = yxHiprint;
|
||||
function silentPrintPdf(url: string, printOptions?: object) {
|
||||
const printStore = usePrintStore();
|
||||
if (!url) {
|
||||
console.log("请传入有效的PDF文件路径!");
|
||||
return;
|
||||
|
||||
|
||||
// 自定义打印参数(可选)
|
||||
interface PrintOptions {
|
||||
orientation?: "portrait" | "landscape"; // 纵向(landscape=横向)
|
||||
copies?: number;
|
||||
monochrome?: boolean; // 是否黑白打印
|
||||
paperName?: 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'letter' | 'legal' | 'tabloid' | 'statement'; //纸张大小
|
||||
}
|
||||
const templateId = `pdf-print-${Date.now()}`;
|
||||
// 检查是否连接客户端
|
||||
if (!printStore.isConnected) {
|
||||
/**
|
||||
* 执行批量静默打印
|
||||
* @param urls PDF文件URL数组
|
||||
* @param options 打印选项(可选)
|
||||
*/
|
||||
function silentPrint(urls: string[], options?: PrintOptions) {
|
||||
if (urls.length === 0) return ElMessage.error('没有打印数据');
|
||||
const printStore = usePrintStore();
|
||||
const handlePrint = () => {
|
||||
ElMessage.success('正在打印文件,请稍候...');
|
||||
urls.forEach(url => silentPrintPdf(url, options));
|
||||
};
|
||||
|
||||
// 已连接直接打印,未连接则初始化后打印
|
||||
if (printStore.isConnected) {
|
||||
handlePrint();
|
||||
} else {
|
||||
initSocket((printerList) => {
|
||||
if (printerList.length > 0) {
|
||||
socket?.emit("news", {
|
||||
client: clientInfo,
|
||||
printer: targetPrinter,
|
||||
type: "url_pdf",
|
||||
templateId: templateId,
|
||||
pdf_path: url,
|
||||
});
|
||||
ElMessage.success('正在打印文件,请稍候...')
|
||||
handlePrint();
|
||||
} else {
|
||||
ElMessage.warning('未检测到可用打印机');
|
||||
}
|
||||
return
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//静默打印单个PDF文件
|
||||
function silentPrintPdf(url: string, options?: PrintOptions) {
|
||||
const printStore = usePrintStore();
|
||||
const templateId = `pdf-print-${Date.now()}`;
|
||||
const targetPrinter = printStore.defaultPrinter;
|
||||
if (!targetPrinter) {
|
||||
console.log("未检测到打印机,请先连接打印机!");
|
||||
@ -125,7 +148,6 @@ function silentPrintPdf(url: string, printOptions?: object) {
|
||||
templateId: templateId,
|
||||
pdf_path: url,
|
||||
});
|
||||
ElMessage.success('正在打印文件,请稍候...')
|
||||
// console.log(`🚀 PDF打印请求已发送,任务ID:${templateId},打印机:${targetPrinter}`);
|
||||
|
||||
}
|
||||
@ -143,6 +165,7 @@ function destroy() {
|
||||
// 更新 getter 函数以从 store 获取值
|
||||
export const HiprintPrinter = {
|
||||
initSocket,
|
||||
silentPrint,
|
||||
silentPrintPdf,
|
||||
destroy,
|
||||
get isConnected() {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="医疗机构:" prop="yljg">
|
||||
<el-select v-model="queryParams.yljg" placeholder="请选择">
|
||||
<el-select v-model="queryParams.yljg" placeholder="请选择" style="width: 150px;">
|
||||
<el-option v-for="item in dictData.HOS" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -51,7 +51,7 @@
|
||||
<el-button type="danger" plain icon="Edit" @click="selectStatusRows">选中所有未打印</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain @click="printHandle1">打印</el-button>
|
||||
<el-button type="success" plain @click="printPdf">打印</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="openBlock('采样登记')">采样登记</el-button>
|
||||
@ -63,7 +63,7 @@
|
||||
<el-button type="warning" plain @click="goReport">报告查询</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain>条码作废</el-button>
|
||||
<el-button type="warning" plain @click="cancelHandle">条码作废</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain>打印机设置</el-button>
|
||||
@ -362,36 +362,39 @@ const cyTableConfig = ref({
|
||||
})
|
||||
|
||||
// 采样登记
|
||||
const openBlock = async (value: string) => {
|
||||
const openBlock = (value: string) => {
|
||||
if (sqhs.value.length > 0) {
|
||||
try {
|
||||
ElMessageBox.confirm(`确定操作选中的数据吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: async (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
// 生成请求Promise数组
|
||||
const requests = sqhs.value.map((item: any) => fetchCodeExec({
|
||||
sqh: item.sqh,
|
||||
const requests = sqhs.value.map((item: any) => { return item.sqh });
|
||||
fetchCodeExec({
|
||||
sqh: requests.join(','),
|
||||
userid: 'lis',
|
||||
status: 12,
|
||||
status: value == '采样登记' ? 12 : 13,
|
||||
yljg: 1
|
||||
}));
|
||||
const results = await Promise.all(requests);
|
||||
console.log('results==>', results);
|
||||
if (results.some((item: any) => item.code != 0)) {
|
||||
ElMessage.error('调用失败');
|
||||
} else {
|
||||
}).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success('调用成功');
|
||||
done();
|
||||
getList()
|
||||
} else {
|
||||
ElMessage.error('调用失败');
|
||||
}
|
||||
|
||||
return results;
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message);
|
||||
throw error;
|
||||
})
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
|
||||
} else {
|
||||
title.value = value
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 采样读取
|
||||
const sqdQuery = () => {
|
||||
@ -446,6 +449,38 @@ const goReport = () => {
|
||||
router.push('/report')
|
||||
};
|
||||
|
||||
const cancelHandle = () => {
|
||||
if (sqhs.value.length <= 0) return ElMessage.warning('请选择数据!')
|
||||
ElMessageBox.confirm(`确定作废选中的数据吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: async (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
const requests = sqhs.value.map((item: any) => { return item.sqh });
|
||||
fetchCodeExec({
|
||||
sqh: requests.join(','),
|
||||
userid: 'lis',
|
||||
status: 9,
|
||||
yljg: 1
|
||||
}).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success('调用成功');
|
||||
done();
|
||||
getList()
|
||||
} else {
|
||||
ElMessage.error('调用失败');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 初始化3天区间(今天-前两天)
|
||||
// const end = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
@ -463,9 +498,6 @@ onMounted(async () => {
|
||||
HOS: toRaw(dictRefs.HOS.value) || [],
|
||||
ST: toRaw(dictRefs.ST.value) || [],
|
||||
};
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 字典格式化方法
|
||||
@ -543,25 +575,34 @@ const selectStatusRows = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const printHandle1 = () => {
|
||||
const url = 'http://47.97.125.165:8904/lis.pdf'
|
||||
// const url = sqhs.value[0]?.pdfUrl
|
||||
HiprintPrinter.silentPrintPdf(
|
||||
url,
|
||||
{
|
||||
// 自定义打印参数(可选)
|
||||
orientation: "portrait", // 纵向(landscape=横向)
|
||||
copies: 1,
|
||||
monochrome: false, // 是否黑白打印
|
||||
// paperName: 'A4', // 纸张大小 A2, A3, A4, A5, A6, letter, legal, tabloid, statement
|
||||
},
|
||||
);
|
||||
|
||||
// 打印pdf
|
||||
const printPdf = () => {
|
||||
if (sqhs.value.length <= 0) return ElMessage.warning('请选择数据!')
|
||||
ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: async (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
const requests = sqhs.value.map((item: any) => { return item.sqh });
|
||||
fetchCodeExec({
|
||||
sqh: requests.join(','),
|
||||
userid: 'lis',
|
||||
status: 11,
|
||||
yljg: 1
|
||||
}).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
done();
|
||||
getList()
|
||||
HiprintPrinter.silentPrint(res.data);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -462,23 +462,26 @@ const addNewItem = () => {
|
||||
};
|
||||
// 删除项
|
||||
const handleDelete = (row: any) => {
|
||||
ElMessageBox.confirm(`确定删除该${row.sflbdh}吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
ElMessageBox.confirm(
|
||||
`确定删除该${row.sflbdh}吗?`, "提示",
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
feeitemclassDel({ sflbdh: row.sflbdh }).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
getList()
|
||||
ElMessage.success('删除成功');
|
||||
done();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
})
|
||||
|
||||
|
||||
};
|
||||
const handleQuery = () => {
|
||||
|
||||
168
src/views/mzcx/category/index.vue
Normal file
168
src/views/mzcx/category/index.vue
Normal file
@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 左侧表格 -->
|
||||
<div style="flex:1">
|
||||
<el-input v-model="leftSearchValue" placeholder="请输入类别名称或代号" />
|
||||
<el-table :data="filteredLeftTableData" @row-click="handleLeftRowClick" highlight-current-row
|
||||
:cell-style="cellStyle" height="80vh">
|
||||
<el-table-column prop="sflbdh" label="分单类别代号" width="110" />
|
||||
<el-table-column prop="sflbmc" label="类别名称" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 中间表格 -->
|
||||
<div style="flex:2">
|
||||
<el-input v-model="middleSearchValue" placeholder="请输入项目名称或代号" />
|
||||
<el-table :data="filteredMiddleTableData" @row-dblclick="handleMiddleRowDblClick" height="80vh">
|
||||
<el-table-column prop="sfxmdh" label="项目代号" />
|
||||
<el-table-column prop="sfxmmc" label="当前类别包含门诊项目" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 右侧表格 -->
|
||||
<div style="flex:3">
|
||||
<el-input v-model="rightSearchValue" placeholder="请输入项目名称、代号或助记符" />
|
||||
<el-table :data="filteredRightTableData" @row-dblclick="handleRightRowDblClick" height="80vh">
|
||||
<el-table-column prop="sfxmdh" label="门诊项目代号" />
|
||||
<el-table-column prop="sfxmmc" label="门诊项目名称" />
|
||||
<el-table-column prop="zjf" label="助记符" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { feeitemclassList, feeitemvsList, feeitemvAdd, feeitemvDel } from '@/api/mzcx/index';
|
||||
import { classCom } from '@/utils/classCom';
|
||||
|
||||
interface FeeItem {
|
||||
sfxmdh: string;
|
||||
sfxmmc: string;
|
||||
zjf?: string;
|
||||
xh?: number;
|
||||
sflbdh?: string;
|
||||
}
|
||||
|
||||
const leftSearchValue = ref('');
|
||||
const middleSearchValue = ref('');
|
||||
const rightSearchValue = ref('');
|
||||
|
||||
const leftTableData = ref<Array<{ sflbdh: string; sflbmc: string }>>([]);
|
||||
const middleTableData = ref<FeeItem[]>([]);
|
||||
const rightTableData = ref<FeeItem[]>([]);
|
||||
const sflbdhData = ref<{ sflbdh?: string; sflbmc?: string }>({});
|
||||
|
||||
// 过滤后的数据
|
||||
const filteredLeftTableData = computed(() => {
|
||||
const searchVal = leftSearchValue.value.toLowerCase().trim();
|
||||
if (!searchVal) return leftTableData.value;
|
||||
|
||||
return leftTableData.value.filter(item =>
|
||||
item.sflbdh.toLowerCase().includes(searchVal) ||
|
||||
item.sflbmc.toLowerCase().includes(searchVal)
|
||||
);
|
||||
});
|
||||
|
||||
const filteredMiddleTableData = computed(() => {
|
||||
const searchVal = middleSearchValue.value.toLowerCase().trim();
|
||||
if (!searchVal) return middleTableData.value;
|
||||
|
||||
return middleTableData.value.filter(item =>
|
||||
item.sfxmdh.toLowerCase().includes(searchVal) ||
|
||||
item.sfxmmc.toLowerCase().includes(searchVal)
|
||||
);
|
||||
});
|
||||
|
||||
const filteredRightTableData = computed(() => {
|
||||
const searchVal = rightSearchValue.value.toLowerCase().trim();
|
||||
if (!searchVal) return rightTableData.value;
|
||||
|
||||
return rightTableData.value.filter(item =>
|
||||
item.sfxmdh.toLowerCase().includes(searchVal) ||
|
||||
item.sfxmmc.toLowerCase().includes(searchVal) ||
|
||||
(item.zjf && item.zjf.toLowerCase().includes(searchVal))
|
||||
);
|
||||
});
|
||||
|
||||
// 左侧表格行点击事件
|
||||
const handleLeftRowClick = (row: any) => {
|
||||
sflbdhData.value = row;
|
||||
feeitemvsList({ sflbdh: sflbdhData.value.sflbdh }).then((res: any) => {
|
||||
middleTableData.value = res.data.labFeeitemVsClassList;
|
||||
rightTableData.value = res.data.xmFeeList;
|
||||
}).catch((err: any) => {
|
||||
console.error('请求数据失败:', err);
|
||||
});
|
||||
};
|
||||
|
||||
// 中间表格行双击事件
|
||||
const handleMiddleRowDblClick = (row: any) => {
|
||||
const index = middleTableData.value.findIndex(
|
||||
(item: any) => item.sfxmdh === row.sfxmdh,
|
||||
);
|
||||
if (index !== -1) {
|
||||
const removedItem = middleTableData.value[index];
|
||||
|
||||
feeitemvDel({ sfxmdh: removedItem.sfxmdh }).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
middleTableData.value.splice(index, 1)
|
||||
rightTableData.value.push(removedItem);
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// 右侧表格行双击事件
|
||||
const handleRightRowDblClick = (row: any) => {
|
||||
const index = rightTableData.value.findIndex(
|
||||
(item: any) => item.sfxmdh === row.sfxmdh,
|
||||
);
|
||||
if (index !== -1) {
|
||||
const removedItem = rightTableData.value[index];
|
||||
removedItem.xh = middleTableData.value.length + 1;
|
||||
removedItem.sflbdh = sflbdhData.value.sflbdh;
|
||||
|
||||
feeitemvAdd([removedItem]).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
rightTableData.value.splice(index, 1)
|
||||
middleTableData.value.push(removedItem);
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
const getList = () => {
|
||||
feeitemclassList().then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
leftTableData.value = res.rows;
|
||||
handleLeftRowClick(res.rows[0]);
|
||||
}
|
||||
})
|
||||
}
|
||||
getList()
|
||||
|
||||
// 单元格样式
|
||||
const cellStyle = ({ row, column, rowIndex, columnIndex }: {
|
||||
row: any;
|
||||
column: any;
|
||||
rowIndex: number;
|
||||
columnIndex: number;
|
||||
}) => {
|
||||
const bgColor = classCom.decimalToHexColor(row.bkcolor);
|
||||
const textColor = classCom.getContrastTextColor(bgColor);
|
||||
return {
|
||||
backgroundColor: `${bgColor} !important`,
|
||||
color: textColor,
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-container {
|
||||
display: flex;
|
||||
padding: 20px;
|
||||
gap: 35px;
|
||||
|
||||
}
|
||||
</style>
|
||||
@ -538,24 +538,26 @@ const addNewItem = () => {
|
||||
};
|
||||
// 删除项
|
||||
const handleDelete = (row: any) => {
|
||||
ElMessageBox.confirm(`确定删除该${row.sfxmdh}吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
|
||||
ElMessageBox.confirm(
|
||||
`确定删除${row.sfxmdh}数据吗?`, "提示",
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
xmfeeDel({ sfxmdh: row.sfxmdh }).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
getList()
|
||||
ElMessage.success('删除成功');
|
||||
done();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
})
|
||||
};
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
</div>
|
||||
|
||||
<el-table :data="detailList" border style="width: 100%;" class="detail-table" :cell-class-name="cellClassName">
|
||||
<el-table-column prop="weekday" label="起始日期" width="120">
|
||||
<el-table-column prop="weekday" label="起始日期" width="100">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.weekday" placeholder="选择星期" size="small" class="week-select"
|
||||
@change="handleDetailChange(scope.row)">
|
||||
@ -55,7 +55,7 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="weekday1" label="截止日期" width="120">
|
||||
<el-table-column prop="weekday1" label="截止日期" width="100">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.weekday1" placeholder="选择星期" size="small" class="week-select"
|
||||
@change="handleDetailChange(scope.row)">
|
||||
@ -235,7 +235,7 @@ const handleRowClick = (row: any) => {
|
||||
row.originalData = JSON.parse(JSON.stringify(row));
|
||||
getgzList(row)
|
||||
}
|
||||
|
||||
// 新增规则
|
||||
const addgz = () => {
|
||||
ruleList.value.unshift(
|
||||
{
|
||||
@ -265,6 +265,7 @@ const addgz = () => {
|
||||
rptgetruledetail.value.push(...detailList.value)
|
||||
}
|
||||
|
||||
// 新增规则明细
|
||||
const addDetail = () => {
|
||||
detailList.value.push({
|
||||
bglqdh: currentRule.value.bglqdh,
|
||||
@ -287,14 +288,12 @@ const addDetail = () => {
|
||||
}
|
||||
|
||||
const editHandle = (row: any, field: string) => {
|
||||
console.log('row==>', row, field);
|
||||
ruleList.value.forEach((item: any) => {
|
||||
if (item.bglqdh == row.bglqdh) {
|
||||
item[field] = row[field]
|
||||
item.status = JSON.stringify(row[field]) !== JSON.stringify(item.originalData[field]);
|
||||
}
|
||||
});
|
||||
console.log('ruleList==>', ruleList.value);
|
||||
czList()
|
||||
}
|
||||
|
||||
@ -346,15 +345,19 @@ const saveHandle = () => {
|
||||
}
|
||||
// 删除规则
|
||||
const handleDelete = (row: any) => {
|
||||
ElMessageBox.confirm(`确定删除该${row.bglqdh}吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
ElMessageBox.confirm(
|
||||
`确定删除${row.bglqdh}数据吗?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
const handleSueess = () => {
|
||||
ruleList.value = ruleList.value.filter((item: any) => item.bglqdh !== row.bglqdh)
|
||||
handleRowClick(ruleList.value[0])
|
||||
done();
|
||||
};
|
||||
if (row.addFlag) {
|
||||
handleSueess()
|
||||
@ -366,23 +369,24 @@ const handleDelete = (row: any) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
})
|
||||
};
|
||||
// 删除规则明细
|
||||
const delDetail = (row: any) => {
|
||||
ElMessageBox.confirm(`确定删除该项数据吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
ElMessageBox.confirm(
|
||||
`确定删除该项数据吗?`, "提示",
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
const handleSueess = () => {
|
||||
detailList.value = detailList.value.filter((item: any) => item.xh !== row.xh)
|
||||
done();
|
||||
};
|
||||
if (row.detaiFlag) {
|
||||
handleSueess()
|
||||
@ -394,11 +398,11 @@ const delDetail = (row: any) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
}).catch(() => { });
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
})
|
||||
|
||||
};
|
||||
const getList = () => {
|
||||
rptgetruleList().then((res: any) => {
|
||||
|
||||
337
src/views/system/parameter/index.vue
Normal file
337
src/views/system/parameter/index.vue
Normal file
@ -0,0 +1,337 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<!--部门数据-->
|
||||
<el-col :span="4" :xs="24">
|
||||
<div>
|
||||
<el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="Search"
|
||||
style="margin-bottom: 20px" />
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree :data="deptOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false"
|
||||
:filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all
|
||||
@node-click="handleNodeClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<!--用户数据-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="仪器" prop="yq">
|
||||
<el-input v-model="queryParams.yq" placeholder="请输入仪器" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数代号" prop="xxdh">
|
||||
<el-input v-model="queryParams.xxdh" placeholder="请输入参数代号" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数值" prop="xxqz">
|
||||
<el-input v-model="queryParams.xxqz" placeholder="请输入参数值" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="handleImport">导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col> -->
|
||||
<!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> -->
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="tableData" height="calc(100vh - 300px)">
|
||||
<!-- <el-table-column type="selection" width="50" align="center" /> -->
|
||||
<el-table-column label="仪器" align="center" prop="yq" />
|
||||
<el-table-column label="代号" align="center" prop="xxdh" />
|
||||
<el-table-column label="类别" align="center" prop="xxlb" />
|
||||
<el-table-column label="参数值" align="center" prop="xxqz" />
|
||||
<el-table-column label="备注" align="center" prop="bz" width="120" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button type="text" plain icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button type="text" plain icon="delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form :model="form" :rules="rules" ref="csRef" label-width="80px">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="仪器" prop="yq">
|
||||
<el-input v-model="form.yq" placeholder="请输入仪器" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form-item label="代号" prop="xxdh">
|
||||
<el-input v-model="form.xxdh" placeholder="请输入代号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="类别" prop="xxlb">
|
||||
<el-input v-model="form.xxlb" placeholder="请输入类别" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form-item label="参数值" prop="xxqz">
|
||||
<el-input v-model="form.xxqz" placeholder="请输入参数值" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.bz" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, toRaw, computed, watch, nextTick } from 'vue'
|
||||
import { paramList, addParam, updateParam, delParam, paramTree } from '@/api/system/parameter'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
const open = ref(false)
|
||||
const title = ref("")
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
yq: undefined,
|
||||
xxdh: undefined,
|
||||
xxqz: undefined,
|
||||
})
|
||||
const form = ref({
|
||||
yq: undefined,
|
||||
xxdh: undefined,
|
||||
xxqz: undefined,
|
||||
xxlb: undefined,
|
||||
bz: undefined
|
||||
})
|
||||
const tableData = ref([])
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const deptName = ref("");
|
||||
|
||||
|
||||
const rules = ref({
|
||||
yq: [{ required: true, message: "仪器不能为空", trigger: "blur" },],
|
||||
xxdh: [{ required: true, message: "代号不能为空", trigger: "blur" }],
|
||||
xxlb: [{ required: true, message: "类别不能为空", trigger: "blur" },],
|
||||
xxqz: [{ required: true, message: "值不能为空", trigger: ["blur", "change"] }],
|
||||
})
|
||||
const ids = ref([]);
|
||||
const csRef = ref()
|
||||
const deptTreeRef = ref()
|
||||
const queryRef = ref()
|
||||
/** 根据名称筛选部门树 */
|
||||
watch(deptName, val => {
|
||||
deptTreeRef.value.filter(val);
|
||||
});
|
||||
|
||||
/** 通过条件过滤节点 */
|
||||
const filterNode = (value: string, data: any) => {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
};
|
||||
|
||||
const deptOptions = ref([
|
||||
{
|
||||
label: '全部',
|
||||
children: [
|
||||
{
|
||||
label: '仪器',
|
||||
children: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
/** 查询下拉树数据 */
|
||||
const getDeptTree = () => {
|
||||
paramTree().then((response: any) => {
|
||||
const level1Nodes: any[] = [];
|
||||
const level2Nodes: any[] = [];
|
||||
|
||||
response.data.forEach((item: any) => {
|
||||
if (item.lx == 1) {
|
||||
level1Nodes.push({ label: item.yq });
|
||||
} else if (item.lx == 2) {
|
||||
level2Nodes.push({ label: item.yq });
|
||||
}
|
||||
});
|
||||
|
||||
deptOptions.value = [
|
||||
{
|
||||
label: '全部',
|
||||
children: [...level1Nodes, { label: '仪器', children: [...level2Nodes] }]
|
||||
}
|
||||
];
|
||||
});
|
||||
};
|
||||
getDeptTree()
|
||||
/** 节点单击事件 */
|
||||
const handleNodeClick = (data: any) => {
|
||||
if (data.label == '仪器') return
|
||||
if (data.label == '全部') {
|
||||
queryParams.value.yq = undefined;
|
||||
handleQuery();
|
||||
} else {
|
||||
queryParams.value.yq = data.label;
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
};
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加参数";
|
||||
nextTick(() => {
|
||||
csRef.value?.resetFields();
|
||||
});
|
||||
};
|
||||
const handleUpdate = (row: any) => {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "修改参数";
|
||||
nextTick(() => {
|
||||
csRef.value?.resetFields();
|
||||
form.value = Object.assign({}, row);
|
||||
});
|
||||
|
||||
};
|
||||
const handleImport = () => { };
|
||||
// 保存
|
||||
const submitForm = async () => {
|
||||
const valid = await csRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
if (title.value == "添加参数") {
|
||||
addParam(form.value).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.msg);
|
||||
open.value = false;
|
||||
getList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
updateParam(form.value).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.msg);
|
||||
open.value = false;
|
||||
getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
const cancel = () => {
|
||||
open.value = false;
|
||||
};
|
||||
const handleSelectionChange = (selection: any) => {
|
||||
ids.value = selection[0]
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
/** 重置操作表单 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
yq: undefined,
|
||||
xxdh: undefined,
|
||||
xxlb: undefined,
|
||||
xxqz: undefined,
|
||||
bz: undefined,
|
||||
};
|
||||
};
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
const resetQuery = () => {
|
||||
queryRef.value?.resetFields();
|
||||
getList()
|
||||
}
|
||||
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (row: any) => {
|
||||
ElMessageBox.confirm(
|
||||
`确定删除数据吗?`, "提示",
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
delParam({ xxdh: row.xxdh, yq: row.yq }).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
getList()
|
||||
ElMessage.success(res.msg);
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
})
|
||||
};
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
// proxy.download("system/user/export", {
|
||||
// ...queryParams.value,
|
||||
// }, `user_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
|
||||
const getList = () => {
|
||||
paramList(queryParams.value).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
loading.value = false
|
||||
tableData.value = res.rows
|
||||
total.value = res.total
|
||||
}
|
||||
})
|
||||
}
|
||||
getList()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-form--inline .el-form-item {
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.head-container {
|
||||
height: 80vh;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user