diff --git a/src/api/points/rule.js b/src/api/points/rule.js
index b20c268..8529cdf 100644
--- a/src/api/points/rule.js
+++ b/src/api/points/rule.js
@@ -8,6 +8,10 @@ export function listFactoryDepartments() {
return request({ url: '/system/dept/factoryList', method: 'get' })
}
+export function getMyFactoryDepartment() {
+ return request({ url: '/system/dept/myFactory', method: 'get' })
+}
+
export function togglePointsRule(id, enabled) {
return request({
url: '/business/points/rule/toggleEnabled',
diff --git a/src/views/hazard/ledger/index.vue b/src/views/hazard/ledger/index.vue
index 64219d9..185f3e5 100644
--- a/src/views/hazard/ledger/index.vue
+++ b/src/views/hazard/ledger/index.vue
@@ -1,55 +1,405 @@
-
-
-
-
-
- 查询重置
- 当前筛选 {{ total }} 条本页待审核 {{ summary.pending }}本页整改中 {{ summary.rectifying }}本页已闭环 {{ summary.closed }}本页已驳回 {{ summary.rejected }}
-
-
-
-
- {{ levelLabel(scope.row) }}
- {{ statusLabel(scope.row) }}
- {{ pointsLabel(scope.row) }}
- {{ pushLabel(scope.row) }}
- {{ formatTime(scope.row.createTime || scope.row.discoverTime) }}
- 详情去审核重试同步
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+ 当前筛选 {{ total }} 条
+ 本页待提交 {{ summary.draft }}
+ 本页审核中 {{ summary.reviewing }}
+ 本页整改中 {{ summary.rectifying }}
+ 本页已通过 {{ summary.approved }}
+ 本页已驳回 {{ summary.rejected }}
+
+
+
+
+
+
+
+
+ {{ levelLabel(scope.row) }}
+
+
+
+
+ {{ statusLabel(scope.row) }}
+
+
+
+
+ {{ pointsLabel(scope.row) }}
+
+
+
+
+
+
+ {{ formatTime(scope.row.createTime || scope.row.discoverTime) }}
+
+
+
+ 详情
+ 去审核
+ 重试同步
+
+
- 隐患状态与员工端一致:待审核 → 整改中 → 已闭环(审批通过即发积分)/ 已驳回。整改闭环由生产运营平台负责,不在本系统范围。
-
-
+
+
+
+
+ 隐患状态:待提交 → 审核中 → 整改中 → 已通过 / 已驳回。整改闭环由生产运营平台负责,不在本系统范围。
+
+
+
- {{ detail.reportNo || '暂无编号' }}{{ detail.hazardName || '未命名隐患' }}
{{ levelLabel(detail) }}{{ statusLabel(detail) }}
{{ displayField(detail, item) }}{{ displayField(detail, item) }}描述与处理
{{ item.label }}{{ detail[item.key] || '—' }}
附件({{ attachments.length }})
{{ item.fileName || '附件' }}暂无附件
- 关闭去审核
+
+
+
+
+ {{ detail.reportNo || '暂无编号' }}
+ {{ detail.hazardName || '未命名隐患' }}
+
+
+ {{ levelLabel(detail) }}
+ {{ statusLabel(detail) }}
+
+
+
+ {{ displayField(detail, item) }}
+
+
+ {{ displayField(detail, item) }}
+
+
+
描述与处理
+
+
{{ item.label }}
+
{{ detail[item.key] || '—' }}
+
+
+
+
附件({{ attachments.length }})
+
+
暂无附件
+
+
+
+
+
+ 关闭
+ 去审核
+
diff --git a/src/views/login.vue b/src/views/login.vue
index de706b1..3f2a0d1 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -35,7 +35,7 @@
记住密码
- 登 陆
+ 登 录
diff --git a/src/views/points/management/index.vue b/src/views/points/management/index.vue
index 0155d9e..c23a797 100644
--- a/src/views/points/management/index.vue
+++ b/src/views/points/management/index.vue
@@ -66,7 +66,6 @@
+
+
+ {{ factoryLabel(scope.row) }}
+
+
{{ tierLabel(scope.row) }}
@@ -170,7 +178,7 @@
append-to-body
>{{
- detail.deptName || (detail.deptId ? detail.deptId : "全局规则")
+ factoryLabel(detail)
}}{{
levelLabel(detail)
@@ -217,16 +225,16 @@
>取消确定 {
const page = res.data || res;
this.ruleList = this.sortRules(page.list || page.rows || []);
@@ -369,16 +398,32 @@ export default {
this.loading = false;
});
},
- getFactories() {
- listFactoryDepartments()
+ loadFactoryScope() {
+ this.factoryLoading = true;
+ const request = this.isSuperAdmin
+ ? listFactoryDepartments()
+ : getMyFactoryDepartment();
+ request
.then((res) => {
const data = res.data || res;
- this.factoryOptions = Array.isArray(data)
- ? data
- : data.list || data.rows || [];
+ if (this.isSuperAdmin) {
+ this.factoryOptions = Array.isArray(data)
+ ? data
+ : data.list || data.rows || [];
+ return;
+ }
+ this.currentFactory = data || null;
+ if (this.addVisible) {
+ this.addForm.deptId = this.factoryId(this.currentFactory);
+ }
})
.catch(() => {
this.factoryOptions = [];
+ this.currentFactory = null;
+ this.$modal.msgError("厂区信息加载失败");
+ })
+ .finally(() => {
+ this.factoryLoading = false;
});
},
sortRules(rows) {
@@ -407,7 +452,7 @@ export default {
},
openAdd() {
this.addForm = {
- deptId: "",
+ deptId: this.isSuperAdmin ? "" : this.factoryId(this.currentFactory),
hazardLevel: "",
hazardCategory: "",
points: null,
@@ -417,6 +462,7 @@ export default {
remark: "",
};
this.addVisible = true;
+ this.$nextTick(() => this.$refs.addForm.clearValidate());
},
suggestTier() {
this.addForm.hazardCategory = this.nextTier(this.addForm.hazardLevel);
@@ -463,23 +509,29 @@ export default {
.toUpperCase();
},
submitAdd() {
+ if (!this.canSubmitAdd) {
+ this.$modal.msgError("当前厂区信息未加载,暂不能新增积分规则");
+ return;
+ }
this.$refs.addForm.validate((valid) => {
if (!valid) return;
const payload = {
- deptId: this.addForm.deptId,
hazardLevel: this.addForm.hazardLevel,
hazardCategory: this.addForm.hazardCategory,
points: this.addForm.points,
enabled: 1,
priority: this.addForm.priority,
ruleCode: this.addForm.ruleCode || undefined,
- ruleName: this.addForm.ruleName || undefined,
+ ruleName: this.addForm.ruleName,
remark: this.addForm.remark || undefined,
};
- const item = this.factoryOptions.find(
- (row) => String(row.deptId || row.id) === String(payload.deptId)
- );
- if (item) payload.deptName = item.deptName || item.label || item.name;
+ if (this.isSuperAdmin) {
+ payload.deptId = this.addForm.deptId;
+ const item = this.factoryOptions.find(
+ (row) => this.factoryId(row) === String(payload.deptId)
+ );
+ if (item) payload.deptName = this.factoryName(item);
+ }
this.saving = true;
addPointsRule(payload)
.then(() => {
@@ -523,6 +575,17 @@ export default {
showPendingAction(name) {
this.$modal.msgInfo(`${name}功能暂未接入接口`);
},
+ factoryId(item) {
+ const value =
+ item && item.deptId !== undefined ? item.deptId : item && item.id;
+ return value === undefined || value === null ? "" : String(value);
+ },
+ factoryName(item) {
+ return (item && (item.deptName || item.label || item.name)) || "";
+ },
+ factoryLabel(row) {
+ return this.factoryName(row) || this.factoryId(row) || "全局规则";
+ },
toEnabled(value) {
return Number(value) === 1 ? 1 : 0;
},