From 4ab4596fbce6405e96c48b57aabf782147fab2e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?=
<14103883+leaf-phos@user.noreply.gitee.com>
Date: Thu, 17 Oct 2024 18:05:10 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BB=B7=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/yh/price.js | 80 +++
src/components/BooleanTag/index.vue | 36 +
.../Business/Dept/DeptTreeSelect.vue | 79 +++
src/utils/constants.js | 28 +
src/utils/filter.js | 16 +-
src/utils/index.js | 25 +
.../yh/price/components/VerifyPriceDialog.vue | 106 +++
src/views/yh/price/index.vue | 617 ++++++++++++++++++
8 files changed, 982 insertions(+), 5 deletions(-)
create mode 100644 src/api/yh/price.js
create mode 100644 src/components/BooleanTag/index.vue
create mode 100644 src/components/Business/Dept/DeptTreeSelect.vue
create mode 100644 src/views/yh/price/components/VerifyPriceDialog.vue
create mode 100644 src/views/yh/price/index.vue
diff --git a/src/api/yh/price.js b/src/api/yh/price.js
new file mode 100644
index 0000000..0d40128
--- /dev/null
+++ b/src/api/yh/price.js
@@ -0,0 +1,80 @@
+import request from '@/utils/request'
+
+// 查询单价列表
+export function listPrice(query) {
+ return request({
+ url: '/yh/price/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询单价详细
+export function getPrice(priceId) {
+ return request({
+ url: '/yh/price/' + priceId,
+ method: 'get'
+ })
+}
+
+// 新增单价
+export function addPrice(data) {
+ return request({
+ url: '/yh/price',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改单价
+export function updatePrice(data) {
+ return request({
+ url: '/yh/price',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除单价
+export function delPrice(priceId) {
+ return request({
+ url: '/yh/price/' + priceId,
+ method: 'delete'
+ })
+}
+
+// 提交单价
+export function submitPrice(priceId) {
+ return request({
+ url: `/yh/price/${priceId}/submit`,
+ method: 'put'
+ })
+}
+
+// 取消提交单价
+export function cancelPrice(priceId) {
+ return request({
+ url: `/yh/price/${priceId}/cancel`,
+ method: 'put'
+ })
+}
+
+// 审核单价
+export function verifyPrice(priceId, pass) {
+ return request({
+ url: `/yh/price/verify`,
+ method: 'put',
+ data: {
+ priceId,
+ pass
+ }
+ })
+}
+
+// 单价禁用
+export function disablePrice(priceId) {
+ return request({
+ url: `/yh/price/${priceId}/disable`,
+ method: 'put'
+ })
+}
diff --git a/src/components/BooleanTag/index.vue b/src/components/BooleanTag/index.vue
new file mode 100644
index 0000000..a6b6045
--- /dev/null
+++ b/src/components/BooleanTag/index.vue
@@ -0,0 +1,36 @@
+
+ {{value ? trueText : falseText}}
+
+
diff --git a/src/components/Business/Dept/DeptTreeSelect.vue b/src/components/Business/Dept/DeptTreeSelect.vue
new file mode 100644
index 0000000..99f5aae
--- /dev/null
+++ b/src/components/Business/Dept/DeptTreeSelect.vue
@@ -0,0 +1,79 @@
+
+
+
+
+
diff --git a/src/utils/constants.js b/src/utils/constants.js
index 274774e..95f6738 100644
--- a/src/utils/constants.js
+++ b/src/utils/constants.js
@@ -1,3 +1,31 @@
// 视图
export const views = {
}
+
+// 单价状态
+export const PriceStatus = {
+ WAIT_SUBMIT: "1", // 未提交
+ WAIT_VERIFY: "2", // 待审核
+ PASS: "3", // 已通过
+ REJECT: "4", // 未通过
+ // 允许编辑
+ canEdit(status) {
+ return [this.WAIT_SUBMIT].includes(status);
+ },
+ // 允许提交
+ canSubmit(status) {
+ return [this.WAIT_SUBMIT].includes(status);
+ },
+ // 允许取消提交
+ canCancel(status) {
+ return [this.WAIT_VERIFY].includes(status);
+ },
+ // 允许审核
+ canVerify(status) {
+ return [this.WAIT_VERIFY].includes(status);
+ },
+ // 允许禁用
+ canDisable(status) {
+ return [this.PASS].includes(status);
+ }
+}
diff --git a/src/utils/filter.js b/src/utils/filter.js
index 07ec714..09eac52 100644
--- a/src/utils/filter.js
+++ b/src/utils/filter.js
@@ -1,17 +1,23 @@
const filters = {
// 金钱显示,保留两位小数
money(num) {
- if (num == null) {
- return num;
- }
- return num.toFixed(2);
+ return filters.fix2(num);
},
// 缺省值
defaultValue(data) {
return data == null ? '--' : data;
},
fix2(num) {
- return filters.money(num);
+ if (num == null) {
+ return num;
+ }
+ return num.toFixed(2);
+ },
+ fix10(num) {
+ if (num == null) {
+ return num;
+ }
+ return num.toFixed(10);
},
dv(data) {
return filters.defaultValue(data);
diff --git a/src/utils/index.js b/src/utils/index.js
index df5db12..7b9cda1 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -388,3 +388,28 @@ export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
}
+// 深度比较两个对象是否相等
+export function isDeepEqual(obj1, obj2) {
+ if (obj1 === obj2) return true;
+
+ if (typeof obj1 !== typeof obj2) return false;
+
+ if (Array.isArray(obj1)) {
+ if (!Array.isArray(obj2) || obj1.length !== obj2.length) return false;
+ for (let i = 0; i < obj1.length; i++) {
+ if (!isDeepEqual(obj1[i], obj2[i])) return false;
+ }
+ } else if (typeof obj1 === 'object' && obj1 !== null) {
+ const keys1 = Object.keys(obj1);
+ const keys2 = Object.keys(obj2);
+ if (keys1.length !== keys2.length) return false;
+ for (let key of keys1) {
+ if (!isDeepEqual(obj1[key], obj2[key])) return false;
+ }
+ } else {
+ // 如果两者都不是数组也不是对象,直接比较值
+ return obj1 === obj2;
+ }
+
+ return true;
+}
diff --git a/src/views/yh/price/components/VerifyPriceDialog.vue b/src/views/yh/price/components/VerifyPriceDialog.vue
new file mode 100644
index 0000000..510565b
--- /dev/null
+++ b/src/views/yh/price/components/VerifyPriceDialog.vue
@@ -0,0 +1,106 @@
+
+
+
+ {{detail.deptName | dv}}
+ {{detail.category | dv}}
+ {{detail.size | dv}}
+ {{detail.name | dv}}
+ {{detail.subName | dv}}
+ {{detail.pattern | dv}}
+ {{detail.pattern | dv}}
+ {{detail.price | dv}} 元
+ {{detail.unit | dv}}
+ {{detail.classify | dv}}
+ {{detail.quantity | fix2 | dv}} 个
+ {{detail.remark | dv}}
+ {{detail.createBy | dv}}
+ {{detail.createTime | dv}}
+
+
+
+ 通过
+ 驳回
+
+
+
+
+
+
diff --git a/src/views/yh/price/index.vue b/src/views/yh/price/index.vue
new file mode 100644
index 0000000..f0dede0
--- /dev/null
+++ b/src/views/yh/price/index.vue
@@ -0,0 +1,617 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 全部
+ 启用
+ 禁用
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+ {{d.row[column.key]}}
+
+
+
+
+
+
+
+
+ {{d.row.quantity | fix2 | dv}} 个
+
+
+ {{d.row.price | dv}} 元
+
+
+ {{d.row[column.key] | dv}}
+
+
+
+
+
+
+ 修改
+ 提交
+ 取消提交
+ 审核
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 个
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+