From 202557aeadba147a25ae72a8992fd184d13252d9 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期三, 11 六月 2025 18:02:41 +0800
Subject: [PATCH] 新增文档管理 优化其他页面
---
src/views/basicInformation/index.vue | 7
src/api/basicInformation/coalFieldMaintenance.js | 2
/dev/null | 541 -----------------------
src/api/archiveManagement/index.js | 58 ++
src/views/procureMent/components/ProductionDialog.vue | 142 +++++
src/api/basicInformation/coal.js | 2
src/views/production/index.vue | 22
src/views/archiveManagement/index.vue | 570 ++++++++++++++++++++++++
src/views/basicInformation/mould/coalQualityMaintenance.vue | 7
src/views/production/components/ProductionDialog.vue | 13
10 files changed, 779 insertions(+), 585 deletions(-)
diff --git a/src/api/archiveManagement/index.js b/src/api/archiveManagement/index.js
new file mode 100644
index 0000000..b8a9494
--- /dev/null
+++ b/src/api/archiveManagement/index.js
@@ -0,0 +1,58 @@
+// 鏂囨。绠$悊
+import request from '@/utils/request'
+
+// 鏌ヨ鏂囨。绠$悊鏍戝舰缁撴瀯
+export function getTree(query) {
+ return request({
+ url: '/tree/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 鏂板鎴栫紪杈戞枃妗d俊鎭�
+export function addOrEditTree(query) {
+ return request({
+ url: '/tree/addOrEditTree',
+ method: 'post',
+ data: query
+ })
+}
+// 鍒犻櫎鏂囨。淇℃伅鏁版嵁
+export function delTree(query) {
+ return request({
+ url: '/tree/delTree',
+ method: 'delete',
+ data: query
+ })
+}
+
+// /archive/list
+// 鏌ヨ鏂囨。鍒楄〃
+export function getArchiveList(query) {
+ return request({
+ url: '/archive/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// /archive/addOrEditArchive
+// 鏂板鎴栫紪杈戞枃妗d俊鎭�
+export function addOrEditArchive(query) {
+ return request({
+ url: '/archive/addOrEditArchive',
+ method: 'post',
+ data: query
+ })
+}
+
+// /archive/delArchive
+// 鍒犻櫎鏂囨。淇℃伅鏁版嵁
+export function delArchive(query) {
+ return request({
+ url: '/archive/delArchive',
+ method: 'delete',
+ data: query
+ })
+}
\ No newline at end of file
diff --git a/src/api/basicInformation/coal.js b/src/api/basicInformation/coal.js
index 635c0dd..f519cfc 100644
--- a/src/api/basicInformation/coal.js
+++ b/src/api/basicInformation/coal.js
@@ -6,7 +6,7 @@
return request({
url: '/coalInfo/list',
method: 'get',
- data: query
+ params: query
})
}
diff --git a/src/api/basicInformation/coalFieldMaintenance.js b/src/api/basicInformation/coalFieldMaintenance.js
index bbfcb39..68373f1 100644
--- a/src/api/basicInformation/coalFieldMaintenance.js
+++ b/src/api/basicInformation/coalFieldMaintenance.js
@@ -6,7 +6,7 @@
return request({
url: '/coalField/list',
method: 'get',
- data: query
+ params: query
})
}
// 鏂板鎴栫紪杈戠叅璐ㄥ瓧娈�
diff --git a/src/views/archiveManagement/index.vue b/src/views/archiveManagement/index.vue
new file mode 100644
index 0000000..139b1e2
--- /dev/null
+++ b/src/views/archiveManagement/index.vue
@@ -0,0 +1,570 @@
+<template>
+ <el-card class="archive-management-card">
+ <div class="left">
+ <div class="left-content">
+ <div class="tree-header">
+ <h3>鏂囨。绠$悊</h3>
+ <el-button type="primary" size="small" @click="append('')" icon="Plus"
+ >鏂板</el-button
+ >
+ </div>
+
+ <!-- 鎼滅储妗� -->
+ <div class="search-box">
+ <el-input
+ v-model="filterText"
+ placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
+ size="small"
+ clearable
+ @input="handleFilter"
+ >
+ <template #prefix>
+ <el-icon><Search /></el-icon>
+ </template>
+ </el-input>
+ </div>
+
+ <div class="tree-container">
+ <el-tree
+ ref="treeRef"
+ :data="treeData"
+ :props="props"
+ :filter-node-method="filterNode"
+ :expand-on-click-node="false"
+ :default-expand-all="false"
+ node-key="id"
+ @node-click="handleNodeClick"
+ class="custom-tree"
+ >
+ <template #default="{ node, data }">
+ <div class="tree-node-content" @dblclick="headerDbClick(data)">
+ <div class="node-icon">
+ <el-icon
+ v-if="!node.isLeaf"
+ :class="{ expanded: node.expanded }"
+ >
+ <Folder />
+ </el-icon>
+ <el-icon v-else>
+ <Document />
+ </el-icon>
+ </div>
+
+ <div class="node-label">
+ <span v-if="!data.isEdit" class="label-text">{{
+ node.label
+ }}</span>
+ <el-input
+ v-else
+ :ref="(el) => setInputRef(el, data)"
+ placeholder="璇疯緭鍏ヨ妭鐐瑰悕绉�"
+ v-model="newName"
+ @blur="($event) => handleInputBlur($event, data, node)"
+ @keyup.enter="
+ ($event) => handleInputBlur($event, data, node)
+ "
+ size="small"
+ class="tree-input"
+ autofocus
+ />
+ </div>
+ <div class="node-actions" v-show="!data.isEdit">
+ <el-button
+ link
+ size="small"
+ @click.stop="append(data)"
+ icon="Plus"
+ title="鏂板瀛愯妭鐐�"
+ ></el-button>
+ <el-button
+ link
+ size="small"
+ @click.stop="remove(node, data)"
+ icon="Delete"
+ title="鍒犻櫎"
+ ></el-button>
+ </div>
+ </div>
+ </template>
+ </el-tree>
+ </div>
+ </div>
+ </div>
+ <div class="right">
+ <el-row :gutter="24">
+ <el-col :span="2" :offset="20"><el-button :icon="Delete" type="danger">鍒犻櫎</el-button></el-col>
+ <el-col :span="2"><el-button :icon="Plus" type="primary">鏂板</el-button></el-col>
+ </el-row>
+ <ETable
+ :loading="loading"
+ :table-data="tableData"
+ :columns="columns"
+ @selection-change="handleSelectionChange"
+ @edit="handleEdit"
+ :show-selection="true"
+ :border="true"
+ >
+ </ETable>
+ <Pagination
+ :total="total"
+ :page-size="10"
+ :page-count="Math.ceil(total / 10)"
+ @page-change="currentPageChange"
+ ></Pagination>
+ </div>
+ </el-card>
+</template>
+<script setup>
+import { onMounted, ref, nextTick } from "vue";
+import ETable from "@/components/Table/ETable.vue";
+import { ElButton, ElInput, ElIcon } from "element-plus";
+import Pagination from "@/components/Pagination/index.vue";
+import {
+ Plus,
+ Search,
+ Folder,
+ Document,
+ Delete,
+} from "@element-plus/icons-vue";
+import {
+ getTree,
+ addOrEditTree,
+ delTree,
+ getArchiveList,
+ addOrEditArchive,
+ delArchive,
+} from "@/api/archiveManagement";
+const loading = ref(false);
+const tableData = ref([]);
+const treeData = ref([]);
+const newName = ref("");
+const inputRefs = ref(new Map()); // 瀛樺偍杈撳叆妗嗗紩鐢�
+const filterText = ref(""); // 鎼滅储鍏抽敭瀛�
+const treeRef = ref(); // 鏍戠粍浠跺紩鐢�
+const total = ref(0); // 鎬昏褰曟暟
+const current = ref(1); // 褰撳墠椤电爜
+const columns = [
+ { prop: "name", label: "鍚嶇О", minWidth: 180 },
+ { prop: "type", label: "绫诲瀷", minWidth: 120 },
+ { prop: "status", label: "鐘舵��", minWidth: 100 },
+];
+const handleSelectionChange = (selection) => {
+ console.log("Selected rows:", selection);
+};
+
+// 鎼滅储杩囨护鍔熻兘
+const handleFilter = () => {
+ treeRef.value?.filter(filterText.value);
+};
+
+const filterNode = (value, data) => {
+ if (!value) return true;
+ return data.name?.toLowerCase().includes(value.toLowerCase());
+};
+
+// 澶勭悊鑺傜偣鐐瑰嚮
+const handleNodeClick = async (data) => {
+ console.log("鐐瑰嚮鑺傜偣:", data);
+ let res = await getArchiveList(data.id);
+ tableData.value = res.data?.records || res.data || [];
+ console.log(data)
+};
+const currentPageChange = (id) => {
+ console.log(id);
+};
+// 鍙屽嚮缂栬緫鑺傜偣
+const headerDbClick = (comeTreeData) => {
+ comeTreeData.isEdit = true;
+ newName.value = comeTreeData.name;
+ nextTick(() => {
+ const inputEl = inputRefs.value.get(comeTreeData.id || comeTreeData);
+ if (inputEl) {
+ inputEl.focus();
+ inputEl.select();
+ }
+ });
+};
+
+// 璁剧疆杈撳叆妗嗗紩鐢ㄧ殑鏂规硶
+const setInputRef = (el, data) => {
+ if (el) {
+ inputRefs.value.set(data.id || data, el);
+ if (data.isEdit) {
+ nextTick(() => {
+ // el.focus();
+ // el.select();
+ });
+ }
+ }
+};
+
+// 澶勭悊杈撳叆妗嗗け鐒�
+const handleInputBlur = async (event, comeTreeData, node) => {
+ if (!comeTreeData.isEdit) return; // 濡傛灉涓嶆槸缂栬緫鐘舵�侊紝鐩存帴杩斿洖
+ if (event.relatedTarget && event.relatedTarget.tagName === "BUTTON") {
+ return;
+ }
+ comeTreeData.isEdit = false;
+ const newValue = newName.value.trim();
+ if (comeTreeData.name === newValue) {
+ console.log("娌℃湁淇敼鍐呭");
+ return;
+ }
+ if (newValue === "") {
+ console.warn("杈撳叆涓嶈兘涓虹┖");
+ newName.value = comeTreeData.name || "鏂拌妭鐐�";
+ return;
+ }
+ try {
+ comeTreeData.name = newValue;
+ // 鑾峰彇鐖惰妭鐐圭殑id - 閫氳繃 node 鍙傛暟鏇村噯纭湴鑾峰彇
+ let parentId = null;
+ if (node && node.parent && node.parent.data) {
+ parentId = node.parent.data.id;
+ }
+ await addOrEditTree({
+ name: newValue,
+ parentId: parentId || null, // 濡傛灉娌℃湁鐖惰妭鐐癸紝鍒欎负 null
+ });
+ } catch (error) {
+ console.error("瀛樺偍澶辫触", error);
+ comeTreeData.name = comeTreeData.name || "鏂拌妭鐐�";
+ }
+ console.log("淇濆瓨鎴愬姛:", newValue);
+};
+
+onMounted(async () => {
+ await getList();
+});
+const props = {
+ label: "name",
+ children: "children", // 鏀逛负 children 浠ュ尮閰嶆爣鍑嗙粨鏋�
+ isLeaf: "leaf",
+};
+
+const remove = async (node, data) => {
+ console.log("鍒犻櫎鑺傜偣:", data);
+ if (!data || !data.id) {
+ console.warn("鏃犳硶鍒犻櫎鏈畾涔夋垨鏃犳晥鐨勮妭鐐�");
+ return;
+ }
+ console.log("鍒犻櫎鑺傜偣 ID:", data.id);
+ let { code, msg } = await delTree([data.id]);
+ if (code !== 200) {
+ ElMessage.warning("鍒犻櫎澶辫触, " + msg);
+ } else {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ }
+ await getList();
+};
+
+const append = async (data) => {
+ if (data === "") {
+ // 鏂板鏍硅妭鐐�
+ console.log("鏂板鏍硅妭鐐�");
+ const newNode = {
+ id: Date.now(),
+ name: "鏂拌妭鐐�",
+ isEdit: true,
+ };
+ treeData.value.push(newNode);
+ newName.value = "鏂拌妭鐐�";
+
+ nextTick(() => {
+ const inputEl = inputRefs.value.get(newNode.id || newNode);
+ if (inputEl) {
+ inputEl.focus();
+ inputEl.select();
+ }
+ });
+ } else {
+ const hasChildren = data.children && data.children.length > 0;
+ const nodeKey = data.id || data;
+ const node = treeRef.value?.getNode(nodeKey);
+ const isExpanded = node?.expanded; // 濡傛灉鏈夊瓙绾т笖鏈睍寮�锛屽厛灞曞紑鑺傜偣
+ if (hasChildren && !isExpanded) {
+ console.log(treeRef.value, "灞曞紑鑺傜偣", nodeKey);
+ if (
+ treeRef.value &&
+ treeRef.value.store &&
+ treeRef.value.store.nodesMap[nodeKey]
+ ) {
+ treeRef.value.store.nodesMap[nodeKey].expanded = true;
+ }
+ }
+
+ const newNode = {
+ id: Date.now(),
+ name: "鏂板瓙鑺傜偣",
+ isEdit: true,
+ };
+
+ if (!data.children) {
+ data.children = [];
+ }
+ data.children.push(newNode);
+ newName.value = "鏂板瓙鑺傜偣";
+
+ // 鏍规嵁鏄惁闇�瑕佸睍寮�鏉ュ喅瀹氬欢杩熸椂闂�
+ const delay = hasChildren && !isExpanded ? 200 : 50;
+
+ // 绛夊緟DOM鏇存柊瀹屾垚鍚庡啀鑱氱劍
+ nextTick(() => {
+ setTimeout(() => {
+ const inputEl = inputRefs.value.get(newNode.id || newNode);
+ if (inputEl) {
+ inputEl.focus();
+ inputEl.select();
+
+ // 婊氬姩鍒版柊澧炵殑鑺傜偣浣嶇疆
+ inputEl.$el?.scrollIntoView?.({
+ behavior: "smooth",
+ block: "nearest",
+ });
+ }
+ }, delay);
+ });
+ }
+};
+
+const handleEdit = () => {};
+
+// 绉婚櫎鎳掑姞杞斤紝鐩存帴鑾峰彇鏁版嵁
+const getList = async () => {
+ try {
+ let res = await getTree();
+ if (res.code === 200) {
+ treeData.value = res.data?.records || res.data || [];
+ } else {
+ console.error("Failed to fetch tree data:", res.message);
+ treeData.value = [];
+ }
+ } catch (error) {
+ console.error("鑾峰彇鏍戝舰鏁版嵁澶辫触:", error);
+ treeData.value = [];
+ }
+};
+</script>
+<style scoped lang="scss">
+.custom-tree-node {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 14px;
+ padding-right: 8px;
+}
+
+// 鏍戝舰鑿滃崟鏍峰紡
+.tree-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 16px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #e4e7ed;
+
+ h3 {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+}
+
+.search-box {
+ margin-bottom: 16px;
+
+ .el-input {
+ border-radius: 6px;
+
+ :deep(.el-input__wrapper) {
+ border-radius: 6px;
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+
+ &:hover {
+ box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
+ }
+
+ &.is-focus {
+ box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
+ }
+ }
+ }
+}
+
+.tree-container {
+ flex: 1;
+ overflow-y: auto;
+ border: 1px solid #dcdfe6;
+ border-radius: 8px;
+ background: #fff;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+
+ .custom-tree {
+ padding: 8px;
+ background: transparent;
+
+ :deep(.el-tree-node) {
+ .el-tree-node__content {
+ height: 36px;
+ padding: 0 8px;
+ border-radius: 6px;
+ margin: 2px 0;
+ transition: all 0.2s ease;
+
+ &:hover {
+ background-color: #f0f9ff;
+ }
+
+ &.is-current {
+ background-color: #e6f7ff;
+ border: 1px solid #91d5ff;
+ }
+ }
+
+ .el-tree-node__expand-icon {
+ color: #606266;
+ font-size: 14px;
+ padding: 6px;
+
+ &.expanded {
+ transform: rotate(90deg);
+ }
+
+ &.is-leaf {
+ color: transparent;
+ }
+ }
+ }
+ }
+}
+
+.tree-node-content {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ padding: 4px 0;
+
+ .node-icon {
+ margin-right: 8px;
+ color: #faad14;
+ display: flex;
+ align-items: center;
+
+ .el-icon {
+ font-size: 16px;
+
+ &.expanded {
+ color: #1890ff;
+ }
+ }
+ }
+
+ .node-label {
+ flex: 1;
+ min-width: 0;
+
+ .label-text {
+ font-size: 14px;
+ color: #303133;
+ cursor: pointer;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ &:hover {
+ color: #1890ff;
+ }
+ }
+ }
+
+ .node-actions {
+ opacity: 0;
+ transition: opacity 0.2s ease;
+ display: flex;
+
+ .el-button {
+ padding: 4px;
+ margin-left: 4px;
+ color: #909399;
+ min-height: auto;
+
+ &:hover {
+ color: #1890ff;
+ background-color: #f0f9ff;
+ }
+
+ &.el-button--text:hover {
+ background-color: #f0f9ff;
+ }
+ }
+ }
+
+ &:hover .node-actions {
+ opacity: 1;
+ }
+}
+
+// 杈撳叆妗嗘牱寮忕編鍖�
+.tree-input {
+ flex: 1;
+
+ :deep(.el-input__wrapper) {
+ border-radius: 4px;
+ border: 1px solid #d9d9d9;
+ transition: all 0.2s ease;
+
+ &:hover {
+ border-color: #40a9ff;
+ }
+
+ &.is-focus {
+ border-color: #1890ff;
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
+ }
+ }
+
+ :deep(.el-input__inner) {
+ padding: 4px 8px;
+ font-size: 14px;
+ color: #303133;
+
+ &::placeholder {
+ color: #bfbfbf;
+ }
+ }
+}
+.el-card {
+ width: calc(100% - 40px);
+ height: calc(100vh - 130px);
+ margin: 20px;
+ box-sizing: border-box;
+ .left {
+ width: 30%;
+ height: calc(100vh - 160px);
+ background-color: #fafafa;
+ padding: 16px;
+ float: left;
+ box-sizing: border-box;
+ border-radius: 8px;
+
+ .left-content {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ }
+ }
+ .right {
+ width: 70%;
+ height: calc(100vh - 160px);
+ padding: 0px 10px;
+ float: left;
+ }
+}
+.archive-management-card{
+ margin: 0;
+}
+</style>
diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue
index c8be716..f399bc0 100644
--- a/src/views/basicInformation/index.vue
+++ b/src/views/basicInformation/index.vue
@@ -416,7 +416,10 @@
loading.value = true;
tabName.value = tab.props.name;
tableData.value = [];
-
+ pageNum.value = 1;
+ pageSizes.value = 10;
+ total.value = 0;
+ queryParams.searchAll = "";
// 鏍规嵁鏍囩椤电被鍨嬭缃搴旂殑鍒楅厤缃�
const tabConfig = {
supplier: () => {
@@ -615,7 +618,7 @@
ElMessage.error("鍒犻櫎鎺ュ彛鏈厤缃�");
return;
}
-
+ console.log(deleteIds)
const res = await deleteApi(deleteIds);
if (res.code !== 200 && res.msg !== "鎿嶄綔鎴愬姛") {
diff --git a/src/views/basicInformation/indexs.vue b/src/views/basicInformation/indexs.vue
deleted file mode 100644
index 7a9559d..0000000
--- a/src/views/basicInformation/indexs.vue
+++ /dev/null
@@ -1,541 +0,0 @@
-<template>
- <div class="app-container">
- <el-form :inline="true" :model="queryParams" class="search-form">
- <el-form-item label="鎼滅储">
- <el-input
- v-model="queryParams.searchText"
- placeholder="璇疯緭鍏ュ叧閿瘝"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="渚涘簲鍟嗗悕绉�">
- <el-input
- v-model="queryParams.supplierName"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="缁熶竴浜鸿瘑鍒彿">
- <el-input
- v-model="queryParams.identifyNumber"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="缁忚惀鍦板潃">
- <el-input
- v-model="queryParams.address"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleQuery">鏌ヨ</el-button>
- <el-button @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
- <el-card>
- <!-- 鏍囩椤� -->
- <el-tabs
- v-model="activeTab"
- class="info-tabs"
- @tab-click="handleTabClick"
- >
- <el-tab-pane
- v-for="tab in tabs"
- :key="tab.name"
- :label="tab.label"
- :name="tab.name"
- />
- </el-tabs>
-
- <!-- 鎿嶄綔鎸夐挳鍖� -->
- <el-row :gutter="24" class="table-toolbar">
- <el-button type="primary" :icon="Plus" @click="handleAdd"
- >鏂板缓</el-button
- >
- <el-button type="danger" :icon="Delete">鍒犻櫎</el-button>
- <el-button type="info" :icon="Download" @click="handleExport">瀵煎嚭</el-button>
- </el-row>
- <!-- 琛ㄦ牸缁勪欢 -->
- <div>
- <data-table
- :loading="loading"
- :table-data="tableData"
- :columns="columns"
- @selection-change="handleSelectionChange"
- @edit="handleEdit"
- @delete="handleDeleteSuccess"
- :show-selection="true"
- :border="true"
- :maxHeight="440"
- />
- </div>
- <pagination
- v-if="total>0"
- :page-num="queryParams.pageNum"
- :page-size="queryParams.pageSize"
- :total="total"
- @pagination="handleQuery"
- :layout="'total, prev, pager, next, jumper'"
- />
- <Supplier
- v-if="tabName === 'supplier'"
- v-model:supplierDialogFormVisible="dialogFormVisible"
- :form="form"
- :title="title"
- @submit="handleSubmit"
- @beforeClose="handleBeforeClose"
- @update:dialogFormVisible="handleDialogFormVisible"
- :addOrEdit="addOrEdit"
- />
- <Customer
- v-if="tabName === 'customer'"
- v-model:customerDialogFormVisible="dialogFormVisible"
- :form="form"
- :title="title"
- @submit="handleSubmit"
- @beforeClose="handleBeforeClose"
- />
- <Coal
- v-if="tabName === 'coal'"
- v-model:coalDialogFormVisible="dialogFormVisible"
- :form="form"
- :title="title"
- @submit="handleSubmit"
- />
- </el-card>
- </div>
-</template>
-
-<script setup>
-import { usePaginationApi } from "../../../hooks/usePaginationApi";
-import { ref, reactive, onMounted } from "vue";
-import { ElMessage } from "element-plus";
-import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue";
-import DataTable from "@/components/Table/ETable.vue";
-import Pagination from "@/components/Pagination";
-import Supplier from "./mould/supplier.vue";
-import Customer from "./mould/customer.vue";
-import Coal from "./mould/coal.vue";
-const { proxy } = getCurrentInstance()
-
-const {
- columns
-} = usePaginationApi(()=> {
- // 鍒嗛〉閫昏緫鍙互鍦ㄨ繖閲屽鐞�
-},{
- searchText: "",
- supplierName: "",
- identifyNumber: "",
- address: "",
- pageNum: 1,
- pageSize: 10,
-},[
- { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 200 },
- { prop: "identifyNumber", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
- { prop: "address", label: "缁忚惀鍦板潃", minWidth: 150 },
- { prop: "bank", label: "寮�鎴疯", minWidth: 120 },
- { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },
- { prop: "contacts", label: "鑱旂郴浜�", minWidth: 100 },
- { prop: "contactAddress", label: "鑱旂郴鍦板潃", minWidth: 150 },
- { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
- { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
-]);
-
-
-
-
-
-// 寮圭獥
-const customerDialogFormVisible = ref(false);
-const coalDialogFormVisible = ref(false);
-const supplierDialogFormVisible = ref(false);
-const dialogFormVisible = ref(false);
-const form = ref({});
-const title = ref("");
-const copyForm = ref({});
-// 褰撳墠鏍囩
-const tabName = ref("supplier");
-// 鐘舵�佸彉閲�
-const loading = ref(false);
-const total = ref(200);
-const activeTab = ref("supplier");
-const selectedRows = ref([]);
-// 鏌ヨ鍙傛暟
-const queryParams = reactive({
- searchText: "",
- supplierName: "",
- identifyNumber: "",
- address: "",
- pageNum: 1,
- pageSize: 10,
-});
-onMounted(() => {
- handleTabClick({ props: { name: "supplier" } });
-});
-// 鏍囩椤垫暟鎹�
-const tabs = reactive([
- { name: "supplier", label: "渚涘簲鍟嗕俊鎭�" },
- { name: "customer", label: "瀹㈡埛淇℃伅" },
- { name: "coal", label: "鐓ょ淇℃伅" },
-]);
-// 鏄惁缂栬緫
-const addOrEdit = ref("add");
-// 琛ㄦ牸鏁版嵁
-const tableData = ref([]);
-// 鏂规硶瀹氫箟
-const handleQuery = () => {
- loading.value = true;
- // 杩欓噷娣诲姞瀹為檯鐨勬煡璇㈤�昏緫
- setTimeout(() => {
- loading.value = false;
- }, 500);
-};
-
-/* // supplier 渚涘簲鍟嗘暟鎹�
-const supplierColumns = reactive([
- { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 200 },
- { prop: "identifyNumber", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
- { prop: "address", label: "缁忚惀鍦板潃", minWidth: 150 },
- { prop: "bank", label: "寮�鎴疯", minWidth: 120 },
- { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },
- { prop: "contacts", label: "鑱旂郴浜�", minWidth: 100 },
- { prop: "contactAddress", label: "鑱旂郴鍦板潃", minWidth: 150 },
- { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
- { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
-]);
-// customer 瀹㈡埛鏁版嵁
-const customerColumns = reactive([
- { prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 200 },
- { prop: "identifyNumber", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
- { prop: "address", label: "缁忚惀鍦板潃", minWidth: 150 },
- { prop: "bank", label: "寮�鎴疯", minWidth: 120 },
- { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },
- { prop: "contacts", label: "鑱旂郴浜�", minWidth: 100 },
- { prop: "contactAddress", label: "鑱旂郴鍦板潃", minWidth: 150 },
- { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
- { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
-]);
-// coal 鐓ょ鏁版嵁
-const coalColumns = reactive([
- { prop: "coalName", label: "鐓ょ鍚嶇О", minWidth: 200 },
- { prop: "maintainer", label: "缁存姢浜�", minWidth: 120 },
- { prop: "maintenanceDate", label: "缁存姢鏃ユ湡", minWidth: 150 },
-]); */
-
-// 鏍囩椤电偣鍑�
-const handleTabClick = (tab) => {
- loading.value = true;
- tabName.value = tab.props.name;
- tableData.value = [];
- getList();
- switch (tabName.value) {
- case "supplier":
- dialogFormVisible.value = supplierDialogFormVisible.value;
- break;
- case "customer":
- columns.value = customerColumns;
- dialogFormVisible.value = customerDialogFormVisible.value;
- break;
- case "coal":
- columns.value = coalColumns;
- dialogFormVisible.value = coalDialogFormVisible.value;
- break;
- }
- setTimeout(() => {
- loading.value = false;
- }, 500);
-};
-// 閲嶇疆鏌ヨ
-const resetQuery = () => {
- Object.keys(queryParams).forEach((key) => {
- if (key !== "pageNum" && key !== "pageSize") {
- queryParams[key] = "";
- }
- });
- handleQuery();
-};
-// 鏂板
-const handleAdd = () => {
- addOrEdit.value = "add";
- handleAddEdit(tabName.value);
-};
-// 鏂板缂栬緫
-const handleAddEdit = (tabName) => {
- addOrEdit.value == "add" ? (title.value = "鏂板") : (title.value = "缂栬緫");
- if (tabName === "supplier") {
- dialogFormVisible.value = true;
- title.value = title.value + "渚涘簲鍟嗕俊鎭�";
- openDialog();
- } else if (tabName === "customer") {
- dialogFormVisible.value = true;
- title.value = title.value + "瀹㈡埛淇℃伅";
- openDialog();
- } else if (tabName === "coal") {
- dialogFormVisible.value = true;
- title.value = title.value + "鐓ょ淇℃伅";
- openDialog();
- }
-};
-// 鎵撳紑寮圭獥
-const openDialog = () => {
- if (addOrEdit.value === "edit") {
- copyForm.value = JSON.parse(JSON.stringify(form.value));
- dialogFormVisible.value = true;
- return;
- }
- form.value = {};
- dialogFormVisible.value = true;
-};
-
-// 鎻愪氦琛ㄥ崟
-const handleSubmit = (val) => {
- // 鎷垮埌鎻愪氦鏁版嵁
- dialogFormVisible.value = false;
- getList();
-};
-const handleDialogFormVisible = (value) => {
- dialogFormVisible.value = value;
-};
-// 閫夋嫨琛�
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection;
-};
-// 缂栬緫
-const handleEdit = (row) => {
- if (row.supplierName) {
- form.value = JSON.parse(JSON.stringify(row));
- addOrEdit.value = "edit";
- handleAddEdit(tabName.value);
- return;
- }
- if (selectedRows.value.length === 1) {
- form.value = JSON.parse(JSON.stringify(selectedRows.value[0]));
- addOrEdit.value = "edit";
- handleAddEdit(tabName.value);
- return;
- } else {
- ElMessage.warning("璇烽�夋嫨涓�鏉℃暟鎹慨鏀�");
- }
-};
-
-const handleDeleteSuccess = (row) => {
- ElMessage.success("鍒犻櫎鎴愬姛锛�" + row.supplierName);
-};
-// 鍏抽棴寮圭獥
-const handleBeforeClose = () => {
- dialogFormVisible.value = false;
- form.value = {};
-};
-const handleExport = (row) => {
- proxy.download("system/post/export", {
- ...queryParams.value
- }, `post_${new Date().getTime()}.xlsx`)
- ElMessage.success("瀵煎嚭鏁版嵁锛�" + row.supplierName);
-};
-const getList = () => {
- loading.value = true;
- setTimeout(() => {
- tableData.value = [
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "123412123123123111",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- contactsPhone: "19345678901",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "123412123123123111",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- contactsPhone: "19345678901",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "123412123123123111",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- contactsPhone: "19345678901",
- },
- {
- supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
- identifyNumber: "042-26881314",
- address: "姹熻タ鐪�",
- bank: "骞冲畨閾惰",
- bankAccount: "123456789012345678",
- contacts: "鍛ㄧ櫧鐜�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鍛ㄧ櫧鐜�",
- maintainDate: "2022-08-29",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "019-65851198",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- },
- {
- supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
- identifyNumber: "042-26881314",
- address: "姹熻タ鐪�",
- bank: "骞冲畨閾惰",
- bankAccount: "123456789012345678",
- contacts: "鍛ㄧ櫧鐜�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鍛ㄧ櫧鐜�",
- maintainDate: "2022-08-29",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "019-65851198",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- },
- {
- supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
- identifyNumber: "042-26881314",
- address: "姹熻タ鐪�",
- bank: "骞冲畨閾惰",
- bankAccount: "123456789012345678",
- contacts: "鍛ㄧ櫧鐜�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鍛ㄧ櫧鐜�",
- maintainDate: "2022-08-29",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "019-65851198",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- },
- {
- supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
- identifyNumber: "042-26881314",
- address: "姹熻タ鐪�",
- bank: "骞冲畨閾惰",
- bankAccount: "123456789012345678",
- contacts: "鍛ㄧ櫧鐜�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鍛ㄧ櫧鐜�",
- maintainDate: "2022-08-29",
- },
- {
- supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
- identifyNumber: "019-65851198",
- address: "灞辫タ鐪�",
- bank: "浜ら�氶摱琛�",
- bankAccount: "901234567890123456",
- contacts: "鏉庨洩鑺�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鏉庨洩鑺�",
- maintainDate: "2022-09-26",
- },
- {
- supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
- identifyNumber: "042-26881314",
- address: "姹熻タ鐪�",
- bank: "骞冲畨閾惰",
- bankAccount: "123456789012345678",
- contacts: "鍛ㄧ櫧鐜�",
- contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
- maintainer: "鍛ㄧ櫧鐜�",
- maintainDate: "2022-08-29",
- },
- ];
- total.value = tableData.value.length;
- loading.value = false;
- }, 500);
-};
-getList();
-</script>
-
-<style scoped>
-.app-container{
- box-sizing: border-box;
-}
-.search-form {
- background-color: #fff;
- padding: 20px 20px 0 20px;
- margin-bottom: 20px;
- border-radius: 4px;
- box-shadow: var(--el-box-shadow-light);
-}
-.search-form :deep(.el-form-item) {
- margin-bottom: 16px;
- width: 100%;
-}
-
-/* 鍝嶅簲寮忓竷灞� */
-@media screen and (min-width: 768px) {
- .search-form :deep(.el-form-item) {
- width: 50%;
- }
-}
-@media screen and (min-width: 1200px) {
- .search-form :deep(.el-form-item) {
- width: 18%;
- }
-}
-.info-tabs {
- margin-bottom: 20px;
-}
-.table-toolbar {
- margin-bottom: 20px;
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
-}
-
-/* 鍝嶅簲寮忚〃鏍� */
-@media screen and (max-width: 768px) {
- .table-toolbar {
- flex-direction: column;
- }
- .table-toolbar .el-button {
- width: 100%;
- }
-}
-/* 琛ㄦ牸宸ュ叿鏍� */
-.table-toolbar, .table-toolbar > * {
- margin: 0 0 0 0 !important;
-}
-.table-toolbar{
- margin-bottom: 20px !important;
-}
-</style>
\ No newline at end of file
diff --git a/src/views/basicInformation/mould/coalQualityMaintenance.vue b/src/views/basicInformation/mould/coalQualityMaintenance.vue
index 26fe0ac..da58839 100644
--- a/src/views/basicInformation/mould/coalQualityMaintenance.vue
+++ b/src/views/basicInformation/mould/coalQualityMaintenance.vue
@@ -118,12 +118,11 @@
*/
const initFormData = (newForm) => {
formData.value = { ...newForm };
- console.log(formData.value)
// 澶勭悊 coalFieldList 瀛楁锛氱紪杈戞椂闇�瑕佸皢瀛楃涓茶浆鎹负鏁扮粍渚涘閫夌粍浠朵娇鐢�
- if (newForm.coalFields) {
- if (typeof newForm.coalFields === 'string') {
+ if (newForm.fieldIds) {
+ if (typeof newForm.fieldIds === 'string') {
// 灏嗗瓧绗︿覆杞崲涓篒D鏁扮粍锛岀劧鍚庡尮閰嶅搴旂殑閫夐」瀵硅薄
- const ids = parseCoalFields(newForm.coalFields);
+ const ids = parseCoalFields(newForm.fieldIds);
formData.value.coalFieldList = ids.map(id => {
const option = fieldOptions.find(opt => opt.value === id);
return option || { fields: `瀛楁${id}`, value: id };
diff --git a/src/views/procureMent/components/ProductionDialog.vue b/src/views/procureMent/components/ProductionDialog.vue
index 3216d1f..5a0f8a9 100644
--- a/src/views/procureMent/components/ProductionDialog.vue
+++ b/src/views/procureMent/components/ProductionDialog.vue
@@ -33,48 +33,66 @@
<el-option label="鍚�" value="鍚�" />
<el-option label="鍗冨厠" value="鍗冨厠" />
</el-select>
- </el-form-item>
- <el-form-item label="閲囪喘鏁伴噺" prop="purchaseQuantity">
- <el-input v-model.number="form.purchaseQuantity" placeholder="璇疯緭鍏�" >
+ </el-form-item> <el-form-item label="閲囪喘鏁伴噺" prop="purchaseQuantity">
+ <el-input
+ v-model.number="form.purchaseQuantity"
+ placeholder="璇疯緭鍏�"
+ @blur="handleQuantityBlur"
+ >
<template v-slot:suffix>
<i style="font-style:normal;">{{form.unit?form.unit:''}}</i>
</template>
</el-input>
+ </el-form-item><el-form-item label="绋庣巼" prop="taxRate">
+ <el-input
+ v-model.number="form.taxRate"
+ placeholder="璇疯緭鍏ョ◣鐜�"
+ @blur="handleTaxRateBlur"
+ >
+ <template v-slot:suffix>
+ <i style="font-style:normal;">%</i>
+ </template>
+ </el-input>
</el-form-item>
<el-form-item label="鍗曚环(涓嶅惈绋�)" prop="priceExcludingTax">
- <el-input v-model.number="form.priceExcludingTax" placeholder="璇疯緭鍏�" >
+ <el-input
+ v-model.number="form.priceExcludingTax"
+ placeholder="璇疯緭鍏�"
+ @blur="handlePriceBlur"
+ >
+ <template v-slot:suffix>
+ <i style="font-style:normal;">鍏�</i>
+ </template>
+ </el-input>
+ </el-form-item> <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax">
+ <el-input
+ v-model.number="form.priceIncludingTax"
+ placeholder="鑷姩璁$畻"
+ >
<template v-slot:suffix>
<i style="font-style:normal;">鍏�</i>
</template>
</el-input>
</el-form-item>
<el-form-item label="鎬讳环(涓嶅惈绋�)" prop="totalPriceExcludingTax">
- <el-input v-model.number="form.totalPriceExcludingTax" placeholder="璇疯緭鍏�" >
- <template v-slot:suffix>
- <i style="font-style:normal;">鍏�</i>
- </template>
- </el-input>
- </el-form-item>
- <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax">
- <el-input v-model.number="form.priceIncludingTax" placeholder="璇疯緭鍏�" >
+ <el-input
+ v-model.number="form.totalPriceExcludingTax"
+ placeholder="鑷姩璁$畻"
+ >
<template v-slot:suffix>
<i style="font-style:normal;">鍏�</i>
</template>
</el-input>
</el-form-item>
<el-form-item label="鎬讳环(鍚◣)" prop="totalPriceIncludingTax">
- <el-input v-model.number="form.totalPriceIncludingTax" placeholder="璇疯緭鍏�" >
+ <el-input
+ v-model.number="form.totalPriceIncludingTax"
+ placeholder="鑷姩璁$畻"
+ >
<template v-slot:suffix>
<i style="font-style:normal;">鍏�</i>
</template>
</el-input>
- </el-form-item>
- <el-form-item label="绋庣巼" prop="taxRate">
- <el-input v-model="form.taxRate" placeholder="璇疯緭鍏ョ◣鐜�" >
- <template v-slot:suffix>
- <i style="font-style:normal;">%</i>
- </template>
- </el-input>
</el-form-item>
<el-form-item label="鐧昏浜�" prop="registrantId">
<el-input v-model="form.registrantId" disabled placeholder="璇疯緭鍏�" />
@@ -111,7 +129,7 @@
</template>
<script setup name="ProductionDialog">
-import { ref, defineProps, watch, onMounted, nextTick } from "vue";
+import { ref, defineProps, watch, onMounted, nextTick, computed } from "vue";
import { ElMessage } from "element-plus";
import useUserStore from '@/store/modules/user'
import {addOrEditPR} from "@/api/procureMent";
@@ -134,8 +152,89 @@
required: true,
type: Object,
});
+
+const toFixed = (num, precision = 2) => {
+ if (isNaN(num) || num === null || num === undefined || num === '') {
+ return 0;
+ }
+ return Math.floor(parseFloat(num) * Math.pow(10, precision)) / Math.pow(10, precision);
+};
+// 鍚◣鍗曚环璁$畻
+const unitPriceWithTax = computed(() => {
+ const priceExcludingTax = parseFloat(form.value.priceExcludingTax) || 0;
+ const taxRate = parseFloat(form.value.taxRate) || 0;
+ if (!priceExcludingTax || !taxRate) {
+ return 0;
+ }
+ const result = priceExcludingTax * (1 + taxRate / 100);
+ return toFixed(result, 2);
+});
+
+// 鍚◣鎬讳环璁$畻
+const totalUnitPriceWithTax = computed(() => {
+ const priceExcludingTax = parseFloat(form.value.priceExcludingTax) || 0;
+ const taxRate = parseFloat(form.value.taxRate) || 0;
+ const purchaseQuantity = parseFloat(form.value.purchaseQuantity) || 0;
+
+ if (!priceExcludingTax || !taxRate || !purchaseQuantity) {
+ return 0;
+ }
+
+ const unitPriceWithTaxValue = priceExcludingTax * (1 + taxRate / 100);
+ const result = unitPriceWithTaxValue * purchaseQuantity;
+ return toFixed(result, 2);
+});
+
+// 涓嶅惈绋庢�讳环璁$畻
+const taxExclusiveTotalPrice = computed(() => {
+ const purchaseQuantity = parseFloat(form.value.purchaseQuantity) || 0;
+ const priceExcludingTax = parseFloat(form.value.priceExcludingTax) || 0;
+
+ if (!purchaseQuantity || !priceExcludingTax) {
+ return 0;
+ }
+
+ const result = purchaseQuantity * priceExcludingTax;
+ return toFixed(result, 2);
+});
+
+// 鐩戝惉璁$畻鍊煎彉鍖栵紝鍚屾鍒� form 瀵硅薄涓�
+watch(unitPriceWithTax, (newValue) => {
+ form.value.priceIncludingTax = newValue;
+});
+
+watch(totalUnitPriceWithTax, (newValue) => {
+ form.value.totalPriceIncludingTax = newValue;
+});
+
+watch(taxExclusiveTotalPrice, (newValue) => {
+ form.value.totalPriceExcludingTax = newValue;
+});
+
const userStore = useUserStore()
const userInfo = ref({});
+
+// 澶勭悊绋庣巼杈撳叆妗嗗け鐒︼紝纭繚绮惧害
+const handleTaxRateBlur = () => {
+ if (form.value.taxRate !== null && form.value.taxRate !== undefined && form.value.taxRate !== '') {
+ form.value.taxRate = toFixed(parseFloat(form.value.taxRate), 2);
+ }
+};
+
+// 澶勭悊涓嶅惈绋庡崟浠疯緭鍏ユ澶辩劍锛岀‘淇濈簿搴�
+const handlePriceBlur = () => {
+ if (form.value.priceExcludingTax !== null && form.value.priceExcludingTax !== undefined && form.value.priceExcludingTax !== '') {
+ form.value.priceExcludingTax = toFixed(parseFloat(form.value.priceExcludingTax), 2);
+ }
+};
+
+// 澶勭悊閲囪喘鏁伴噺杈撳叆妗嗗け鐒︼紝纭繚绮惧害
+const handleQuantityBlur = () => {
+ if (form.value.purchaseQuantity !== null && form.value.purchaseQuantity !== undefined && form.value.purchaseQuantity !== '') {
+ form.value.purchaseQuantity = toFixed(parseFloat(form.value.purchaseQuantity), 3); // 鏁伴噺淇濈暀3浣嶅皬鏁�
+ }
+};
+
onMounted(async () => {
let res = await userStore.getInfo()
userInfo.value = res;
@@ -176,6 +275,7 @@
const formRef = ref(null);
// 鎻愪氦琛ㄥ崟
const handleSubmit = async () => {
+ console.log("鎻愪氦琛ㄥ崟", form.value);
if (!formRef.value) return;
await formRef.value.validate(async (valid) => {
if (valid) {
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 7ce8482..035d75a 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -1,4 +1,4 @@
-<template>
+div<template>
<el-dialog
v-model="dialogVisible"
:title="dialogType === 'add' ? '鏂板鐢熶骇鍔犲伐' : '缂栬緫鐢熶骇鍔犲伐'"
@@ -17,9 +17,9 @@
@row-click="handleRowClick"
:editableColumns="['used']"
/>
- <div v-if="tableData.length > 0" class="empty-table">
+ <div class="empty-table">
<h1>鐢熶骇鏄庣粏</h1>
- <el-row :gutter="10">
+ <el-row :gutter="10" v-if="tableData.length > 0">
<el-col :span="2">
<el-button type="primary" @click="addNewRow">
<el-icon>
@@ -45,6 +45,7 @@
</el-col> -->
</el-row>
<ProductionDetailsTable
+ v-if="tableData.length > 0"
v-model="detailsTableData"
:border="false"
:show-operations="true"
@@ -52,8 +53,9 @@
@input-change="handleDetailsChange"
@delete-row="handleDeleteRow"
/>
- </div>
<div style="margin-top: 20px;" v-else>鏆傛棤鏁版嵁锛岃閫夋嫨閰嶇疆鏁版嵁</div>
+
+ </div>
<template #footer>
<div class="dialog-footer">
@@ -452,4 +454,7 @@
.el-row > .el-col > h1 {
font-weight: bolder;
}
+.empty-table > .el-row{
+ margin-bottom: 12px;
+}
</style>
diff --git a/src/views/production/index.vue b/src/views/production/index.vue
index 8872835..0e9b005 100644
--- a/src/views/production/index.vue
+++ b/src/views/production/index.vue
@@ -32,17 +32,17 @@
import Pagination from "@/components/Pagination/index.vue";
const childRef = ref(null);
const columns = [
- { prop: "category", label: "鐓ょ", width: 150 },
- { prop: "unit", label: "鍗曚綅", width: 120 },
- { prop: "productionVolume", label: "鐢熶骇鏁伴噺", width: 150 },
- { prop: "laborCost", label: "浜哄伐鎴愭湰", width: 150 },
- { prop: "materialCost", label: "鍘熸枡鎴愭湰", width: 120 },
- { prop: "equipmentCost", label: "璁惧璐圭敤", width: 143 },
- { prop: "totalCost", label: "鎬绘垚鏈�", width: 150 },
- { prop: "totalPrice", label: "鎬诲敭浠�", width: 150 },
- { prop: "profit", label: "鍒╂鼎", width: 100 },
- { prop: "reviewer", label: "澶嶈浜�", width: 120 },
- { prop: "date", label: "鏃ユ湡", width: 150 },
+ { prop: "category", label: "鐓ょ", minWidth: 150 },
+ { prop: "unit", label: "鍗曚綅", minWidth: 120 },
+ { prop: "productionVolume", label: "鐢熶骇鏁伴噺", minWidth: 150 },
+ { prop: "laborCost", label: "浜哄伐鎴愭湰", minWidth: 150 },
+ { prop: "materialCost", label: "鍘熸枡鎴愭湰", minWidth: 120 },
+ { prop: "equipmentCost", label: "璁惧璐圭敤", minWidth: 143 },
+ { prop: "totalCost", label: "鎬绘垚鏈�", minWidth: 150 },
+ { prop: "totalPrice", label: "鎬诲敭浠�", minWidth: 150 },
+ { prop: "profit", label: "鍒╂鼎", minWidth: 100 },
+ { prop: "reviewer", label: "澶嶈浜�", minWidth: 120 },
+ { prop: "date", label: "鏃ユ湡", minWidth: 150 },
];
// 鎼滅储琛ㄥ崟鏁版嵁
--
Gitblit v1.9.3