|
|
@@ -643,6 +643,7 @@
|
|
|
//员工列表接口
|
|
|
const getyglist = async ()=>{
|
|
|
if(formData.value.sczl_bh0 === ''){
|
|
|
+ ElMessage.warning('请输入员工编号')
|
|
|
return;
|
|
|
}
|
|
|
const response = await getYg({sczl_bh: formData.value.sczl_bh0});
|
|
|
@@ -720,19 +721,19 @@
|
|
|
const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
console.log(id3)
|
|
|
|
|
|
- if (event.keyCode === 13 && id3 === '流程单号') {
|
|
|
- console.log(id3);
|
|
|
+ if (event.keyCode === 13 && id3 === '流程单号') {
|
|
|
+ console.log(id3);
|
|
|
// 获取所有相关的输入框值
|
|
|
const allValues = [
|
|
|
- formData.value.流程单号1,
|
|
|
- formData.value.流程单号2,
|
|
|
- formData.value.流程单号3,
|
|
|
- formData.value.流程单号4,
|
|
|
- formData.value.流程单号5,
|
|
|
- formData.value.流程单号6,
|
|
|
- formData.value.流程单号7,
|
|
|
- formData.value.流程单号8,
|
|
|
- formData.value.流程单号9,
|
|
|
+ formData.value.流程单号1,
|
|
|
+ formData.value.流程单号2,
|
|
|
+ formData.value.流程单号3,
|
|
|
+ formData.value.流程单号4,
|
|
|
+ formData.value.流程单号5,
|
|
|
+ formData.value.流程单号6,
|
|
|
+ formData.value.流程单号7,
|
|
|
+ formData.value.流程单号8,
|
|
|
+ formData.value.流程单号9,
|
|
|
formData.value.流程单号10,
|
|
|
];
|
|
|
// 获取当前输入框的值
|
|
|
@@ -801,7 +802,7 @@
|
|
|
if (!foundNext) {
|
|
|
console.log("没有更多可用的输入框");
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}else if (event.keyCode === 13 && id3 === '定额代号') {
|
|
|
console.log("定额代号");
|
|
|
GetDedh()
|
|
|
@@ -887,6 +888,13 @@
|
|
|
// 如果没有找到下一个可用输入框,提示用户
|
|
|
if (!foundNext) {
|
|
|
console.log("已经是最后一个输入框");
|
|
|
+ ElMessageBox.confirm('数据存盘?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ enterDialog()
|
|
|
+ })
|
|
|
}
|
|
|
}else if (event.keyCode === 13 || event.keyCode === 40) {
|
|
|
if (event.target.id == '其他备注') {
|
|
|
@@ -1413,137 +1421,137 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-// 定义状态
|
|
|
-let GetDedhtreeData = reactive([]); // 树形数据
|
|
|
-const GetDedhVisible = ref(false); // 弹窗显隐状态
|
|
|
+
|
|
|
+// 定义状态
|
|
|
+let GetDedhtreeData = reactive([]); // 树形数据
|
|
|
+const GetDedhVisible = ref(false); // 弹窗显隐状态
|
|
|
const activeNodeKey = ref(null); // 当前选中节点的 key
|
|
|
const table_fplb = ref(null); // el-tree 的 ref
|
|
|
const defaultExpandedKey = ref(null); // 默认展开的节点 key
|
|
|
- const selectIndex = ref(0); // 当前选中的索引
|
|
|
-
|
|
|
-// 获取定额代号并构建树形结构
|
|
|
-const GetDedh = async () => {
|
|
|
- const response = await shougonggetDedh();
|
|
|
- if (response.code === 0) {
|
|
|
- // 封装数据为数组,便于递归处理根节点
|
|
|
- const data = [];
|
|
|
- data[0] = response.data;
|
|
|
-
|
|
|
- // 递归构建树形结构
|
|
|
- const buildTree = (node) => {
|
|
|
- return {
|
|
|
- label: `${node.sys_bh}【${node.sys_mc}】`,
|
|
|
- id: node.sys_bh,
|
|
|
- children: Array.isArray(node.bh_mc) ? node.bh_mc.map(buildTree) : []
|
|
|
- };
|
|
|
- };
|
|
|
-
|
|
|
- // 构建树形结构并赋值给响应变量
|
|
|
- GetDedhtreeData = data.map(buildTree);
|
|
|
- GetDedhVisible.value = true; // 显示弹窗
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 节点点击事件
|
|
|
-const GetDedhhandleNodeClick = (nodeData) => {
|
|
|
- console.log("单击节点:", nodeData);
|
|
|
- if (!nodeData.children || nodeData.children.length === 0) {
|
|
|
- // 如果点击的是子节点,则关闭弹窗并更新数据
|
|
|
- formData.value.sczl_dedh = nodeData.label.split("【")[0]; // 提取定额代号
|
|
|
- GetDedhVisible.value = false; // 关闭弹窗
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 树组件键盘事件
|
|
|
-const handleTreeKeydown = (event) => {
|
|
|
- const tree = table_fplb.value; // 获取树实例
|
|
|
- if (!tree) {
|
|
|
- console.error("树组件未加载");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const focusedElement = document.activeElement;
|
|
|
- const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
|
|
|
-
|
|
|
- // 回车键
|
|
|
- if (event.keyCode === 13 && focusedNodeId) {
|
|
|
- tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
|
|
|
- tree.$nextTick(() => {
|
|
|
- const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
|
|
|
- if (!currentNode) {
|
|
|
- console.warn("没有选中的节点");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 展开当前节点并收起其他节点
|
|
|
- Object.keys(tree.store.nodesMap).forEach((key) => {
|
|
|
- tree.store.nodesMap[key].expanded = false; // 收起所有节点
|
|
|
- });
|
|
|
- tree.store.nodesMap[currentNode.id].expanded = true; // 展开当前节点
|
|
|
-
|
|
|
- // 如果有子节点,选中第一个子节点
|
|
|
- if (currentNode.children && currentNode.children.length > 0) {
|
|
|
- const firstChild = currentNode.children[0];
|
|
|
- const firstChildKey = firstChild.id.toString();
|
|
|
- tree.setCurrentKey(firstChildKey); // 选中第一个子节点
|
|
|
- setTimeout(() => {
|
|
|
- const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
|
|
|
- if (firstChildDom) {
|
|
|
- firstChildDom.focus();
|
|
|
- firstChildDom.scrollIntoView({ block: "nearest" });
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 如果没有子节点,执行确认操作
|
|
|
+ const selectIndex = ref(0); // 当前选中的索引
|
|
|
+
|
|
|
+// 获取定额代号并构建树形结构
|
|
|
+const GetDedh = async () => {
|
|
|
+ const response = await shougonggetDedh();
|
|
|
+ if (response.code === 0) {
|
|
|
+ // 封装数据为数组,便于递归处理根节点
|
|
|
+ const data = [];
|
|
|
+ data[0] = response.data;
|
|
|
+
|
|
|
+ // 递归构建树形结构
|
|
|
+ const buildTree = (node) => {
|
|
|
+ return {
|
|
|
+ label: `${node.sys_bh}【${node.sys_mc}】`,
|
|
|
+ id: node.sys_bh,
|
|
|
+ children: Array.isArray(node.bh_mc) ? node.bh_mc.map(buildTree) : []
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ // 构建树形结构并赋值给响应变量
|
|
|
+ GetDedhtreeData = data.map(buildTree);
|
|
|
+ GetDedhVisible.value = true; // 显示弹窗
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 节点点击事件
|
|
|
+const GetDedhhandleNodeClick = (nodeData) => {
|
|
|
+ console.log("单击节点:", nodeData);
|
|
|
+ if (!nodeData.children || nodeData.children.length === 0) {
|
|
|
+ // 如果点击的是子节点,则关闭弹窗并更新数据
|
|
|
+ formData.value.sczl_dedh = nodeData.label.split("【")[0]; // 提取定额代号
|
|
|
+ GetDedhVisible.value = false; // 关闭弹窗
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 树组件键盘事件
|
|
|
+const handleTreeKeydown = (event) => {
|
|
|
+ const tree = table_fplb.value; // 获取树实例
|
|
|
+ if (!tree) {
|
|
|
+ console.error("树组件未加载");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const focusedElement = document.activeElement;
|
|
|
+ const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
|
|
|
+
|
|
|
+ // 回车键
|
|
|
+ if (event.keyCode === 13 && focusedNodeId) {
|
|
|
+ tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
|
|
|
+ tree.$nextTick(() => {
|
|
|
+ const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
|
|
|
+ if (!currentNode) {
|
|
|
+ console.warn("没有选中的节点");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 展开当前节点并收起其他节点
|
|
|
+ Object.keys(tree.store.nodesMap).forEach((key) => {
|
|
|
+ tree.store.nodesMap[key].expanded = false; // 收起所有节点
|
|
|
+ });
|
|
|
+ tree.store.nodesMap[currentNode.id].expanded = true; // 展开当前节点
|
|
|
+
|
|
|
+ // 如果有子节点,选中第一个子节点
|
|
|
+ if (currentNode.children && currentNode.children.length > 0) {
|
|
|
+ const firstChild = currentNode.children[0];
|
|
|
+ const firstChildKey = firstChild.id.toString();
|
|
|
+ tree.setCurrentKey(firstChildKey); // 选中第一个子节点
|
|
|
+ setTimeout(() => {
|
|
|
+ const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
|
|
|
+ if (firstChildDom) {
|
|
|
+ firstChildDom.focus();
|
|
|
+ firstChildDom.scrollIntoView({ block: "nearest" });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果没有子节点,执行确认操作
|
|
|
console.log("当前子节点:", currentNode.label);
|
|
|
- formData.value.sczl_dedh = currentNode.label.split("【")[0]
|
|
|
- GetDedhVisible.value = false; // 关闭弹窗
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // 上下箭头键
|
|
|
- else if (event.keyCode === 38 || event.keyCode === 40) {
|
|
|
- const currentNode = tree.getCurrentNode();
|
|
|
- if (currentNode) {
|
|
|
- const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
|
|
|
- if (currentNodeDom) {
|
|
|
- currentNodeDom.focus();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 弹窗键盘事件处理(绑定在弹窗上)
|
|
|
-const entdedh = (event) => {
|
|
|
- console.log("键盘事件触发"); // 用于调试
|
|
|
- event.preventDefault(); // 阻止浏览器默认行为(如滚动页面)
|
|
|
- event.stopPropagation(); // 阻止事件冒泡
|
|
|
-
|
|
|
- const tree = table_fplb.value?.$el;
|
|
|
- if (!tree) return;
|
|
|
-
|
|
|
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
|
- // 上下箭头键:切换选中的兄弟节点
|
|
|
- const focusedElement = document.activeElement;
|
|
|
- const focusedNodeId = focusedElement?.getAttribute("data-key");
|
|
|
- const currentNode = table_fplb.value?.store.nodesMap[focusedNodeId];
|
|
|
-
|
|
|
- if (currentNode) {
|
|
|
- let nextNode;
|
|
|
- if (event.key === "ArrowDown") {
|
|
|
- nextNode = table_fplb.value?.getNextSibling(currentNode);
|
|
|
- } else if (event.key === "ArrowUp") {
|
|
|
- nextNode = table_fplb.value?.getPreviousSibling(currentNode);
|
|
|
- }
|
|
|
-
|
|
|
- if (nextNode) {
|
|
|
- const nextNodeKey = nextNode.data.id.toString();
|
|
|
- table_fplb.value?.setCurrentKey(nextNodeKey); // 设置选中下一个节点
|
|
|
- focusAndScrollToNode(nextNodeKey); // 聚焦到下一个节点并滚动到视图中
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
+ formData.value.sczl_dedh = currentNode.label.split("【")[0]
|
|
|
+ GetDedhVisible.value = false; // 关闭弹窗
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 上下箭头键
|
|
|
+ else if (event.keyCode === 38 || event.keyCode === 40) {
|
|
|
+ const currentNode = tree.getCurrentNode();
|
|
|
+ if (currentNode) {
|
|
|
+ const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
|
|
|
+ if (currentNodeDom) {
|
|
|
+ currentNodeDom.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 弹窗键盘事件处理(绑定在弹窗上)
|
|
|
+const entdedh = (event) => {
|
|
|
+ console.log("键盘事件触发"); // 用于调试
|
|
|
+ event.preventDefault(); // 阻止浏览器默认行为(如滚动页面)
|
|
|
+ event.stopPropagation(); // 阻止事件冒泡
|
|
|
+
|
|
|
+ const tree = table_fplb.value?.$el;
|
|
|
+ if (!tree) return;
|
|
|
+
|
|
|
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
|
+ // 上下箭头键:切换选中的兄弟节点
|
|
|
+ const focusedElement = document.activeElement;
|
|
|
+ const focusedNodeId = focusedElement?.getAttribute("data-key");
|
|
|
+ const currentNode = table_fplb.value?.store.nodesMap[focusedNodeId];
|
|
|
+
|
|
|
+ if (currentNode) {
|
|
|
+ let nextNode;
|
|
|
+ if (event.key === "ArrowDown") {
|
|
|
+ nextNode = table_fplb.value?.getNextSibling(currentNode);
|
|
|
+ } else if (event.key === "ArrowUp") {
|
|
|
+ nextNode = table_fplb.value?.getPreviousSibling(currentNode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (nextNode) {
|
|
|
+ const nextNodeKey = nextNode.data.id.toString();
|
|
|
+ table_fplb.value?.setCurrentKey(nextNodeKey); // 设置选中下一个节点
|
|
|
+ focusAndScrollToNode(nextNodeKey); // 聚焦到下一个节点并滚动到视图中
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
// 默认行为:展开所有节点并选中第一个节点
|
|
|
const firstNodeDom = tree.querySelector("[data-key]");
|
|
|
if (firstNodeDom) {
|
|
|
@@ -1560,9 +1568,9 @@ const entdedh = (event) => {
|
|
|
table_fplb.value?.store.expandNode(firstNode, true);
|
|
|
expandAllNodes(firstNode); // 递归展开第一个节点的所有子节点
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
// let GetDedhtreeData = reactive([]);
|
|
|
@@ -1888,6 +1896,8 @@ const entdedh = (event) => {
|
|
|
sys_id: sys_id,
|
|
|
}
|
|
|
if (ADD.value == '新增') {
|
|
|
+ console.log(restoredData)
|
|
|
+ return;
|
|
|
const response = await inspectadd(restoredData);
|
|
|
// ADD.value='1'
|
|
|
// console.log(ADD.value)
|
|
|
@@ -1904,7 +1914,6 @@ const entdedh = (event) => {
|
|
|
//刷新页面
|
|
|
getTableData()
|
|
|
}
|
|
|
- dialogFormVisible.value = false
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -2134,6 +2143,15 @@ const entdedh = (event) => {
|
|
|
return;
|
|
|
}
|
|
|
updateDetailData()
|
|
|
+ for (let i = 1; i < 10; i++) {
|
|
|
+ formData.value[`流程单号${i}`]=0;
|
|
|
+ }
|
|
|
+ for (let i = 0; i < 12; i++) {
|
|
|
+ formData.value[`sczl_bh${i}`] = '';
|
|
|
+ formData.value[`sczl_bh${i}_name`] = '';
|
|
|
+ formData.value[`sczl_cl${i}`] = 0;
|
|
|
+ formData.value[`sczl_fp${i}`] = 0;
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
let tables = ref(5);
|