From ad5e7a527167a86ca7969e874df9950a5c4e2ff9 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期五, 30 十月 2026 09:57:41 +0800
Subject: [PATCH] 器官收费
---
src/views/project/externalperson/index.vue | 184 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 150 insertions(+), 34 deletions(-)
diff --git a/src/views/project/externalperson/index.vue b/src/views/project/externalperson/index.vue
index c818a8a..043b51e 100644
--- a/src/views/project/externalperson/index.vue
+++ b/src/views/project/externalperson/index.vue
@@ -1,6 +1,7 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
+ <el-form
+ class="opo-query-form" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="璐﹀彿绫诲埆" prop="usertype">
<el-select v-model="queryParams.usertype" placeholder="璇烽�夋嫨璐﹀彿绫诲埆" clearable size="small">
@@ -47,13 +48,15 @@
<el-table v-loading="loading" :data="externalpersonList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
- <el-table-column label="璐﹀彿绫诲埆" align="center" prop="usertype">
+ <el-table-column label="璐﹀彿绫诲埆" align="center" prop="usertype" width="220">
<template slot-scope="scope">
- <dict-tag :options="dict.type.sys_UserType" :value="scope.row.usertype" />
+ <dict-tag v-for="t in splitUserType(scope.row.usertype)" :key="t"
+ :options="dict.type.sys_UserType" :value="t" />
</template>
</el-table-column>
<el-table-column label="璐﹀彿缂栧彿" align="center" prop="userno" />
<el-table-column label="璐﹀彿鍚嶇О" align="center" prop="username" />
+ <el-table-column label="缁╂晥绉戝" align="center" prop="deptName" width="140" />
<el-table-column label="韬唤璇佸彿" width="200" align="center" prop="idcardno" />
<el-table-column label="鑱岀О" align="center" prop="title">
<template slot-scope="scope">
@@ -90,7 +93,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12"><el-form-item label="璐﹀彿绫诲埆" prop="usertype">
- <el-select v-model="form.usertype" placeholder="璇烽�夋嫨璐﹀彿绫诲埆">
+ <el-select v-model="form.usertype" multiple collapse-tags placeholder="璇烽�夋嫨璐﹀彿绫诲埆锛堝彲澶氶�夛級">
<el-option v-for="dict in dict.type.sys_UserType" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
@@ -109,8 +112,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍚敤鐘舵��" prop="userstatus" :disabled="ismanager == false">
- <el-radio-group v-model="form.userstatus">
+ <el-form-item label="鍚敤鐘舵��" prop="userstatus" >
+ <el-radio-group v-model="form.userstatus" :disabled="!ismanager">
<el-radio v-for="dict in dict.type.sys_0_1" :key="dict.value" :label="parseInt(dict.value)">{{
dict.label
}}</el-radio>
@@ -118,14 +121,35 @@
</el-form-item>
</el-col>
</el-row>
- <el-row v-if="form.usertype != 'org'">
+ <el-row v-if="hasUserType(form.usertype, 'performance')">
+ <el-col :span="12">
+ <el-form-item label="缁╂晥绉戝" prop="deptId">
+ <el-select
+ v-model="form.deptId"
+ placeholder="璇烽�夋嫨缁╂晥绉戝"
+ clearable
+ filterable
+ style="width: 100%"
+ @change="handleDeptChange"
+ >
+ <el-option
+ v-for="dept in deptList"
+ :key="dept.deptId"
+ :label="dept.deptName"
+ :value="dept.deptId"
+ />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row v-if="!isUnitForm">
<el-col :span="24">
<el-form-item label="韬唤璇佸彿" prop="idcardno">
<el-input v-model="form.idcardno" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" />
</el-form-item>
</el-col>
</el-row>
- <el-row v-if="form.usertype != 'org'"><el-col :span="12">
+ <el-row v-if="!isUnitForm"><el-col :span="12">
<el-form-item label="鎬у埆" prop="sex">
<el-select v-model="form.sex" placeholder="璇烽�夋嫨鎬у埆">
<el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
@@ -140,7 +164,7 @@
</el-form-item>
</el-col>
</el-row>
- <el-row v-if="form.usertype != 'org'">
+ <el-row v-if="!isUnitForm">
<el-col :span="12">
<el-form-item label="鎵�鍦ㄥ崟浣�" prop="unitname">
<el-select v-model="form.unitno" placeholder="鎵�鍦ㄥ崟浣�" clearable filterable allow-create style="width: 100%">
@@ -215,6 +239,7 @@
} from "@/api/project/organization";
import { getUserProfile } from "@/api/system/user";
+import { listDept } from "@/api/system/dept";
export default {
name: "Externalperson",
@@ -240,6 +265,8 @@
//鍖荤枟鏈烘瀯鍒楄〃
unitList: [],
+ // 缁╂晥绉戝鍒楄〃
+ deptList: [],
// 寮瑰嚭灞傛爣棰�
title: "",
// 鏄惁鏄剧ず寮瑰嚭灞�
@@ -253,6 +280,9 @@
usertype: null
},
+ //鏄惁鏄笓瀹惰垂鐨凮PO瀹℃壒浜哄憳
+ ismanager: false,
+
// 鏌ヨ鏈�鏂板簭鍙峰弬鏁�
seqnoParams: {
businessType: "externalperson",
@@ -269,39 +299,85 @@
{ required: true, message: "璇疯緭鍏ヨ处鎴峰悕绉�", trigger: "blur" }
],
idcardno: [
- { required: true, message: "璇疯緭鍏ヨ韩浠借瘉鍙风爜", trigger: "blur" }
+ {
+ //璐﹀彿绫诲埆涓�"鍗曚綅鏈烘瀯"鏃舵棤闇�韬唤璇佸彿
+ validator: (rule, value, callback) => {
+ if (this.hasUserType(this.form.usertype, "org")) {
+ return callback();
+ }
+ if (!value || !String(value).trim()) {
+ return callback(new Error("璇疯緭鍏ヨ韩浠借瘉鍙风爜"));
+ }
+ return callback();
+ },
+ trigger: "blur"
+ }
],
bankcardno: [
{ required: true, message: "璇疯緭鍏ラ摱琛岃处鍙�", trigger: "blur" }
],
depositbank: [
{ required: true, message: "璇疯緭鍏ュ紑鎴烽摱琛�", trigger: "blur" }
+ ],
+ deptId: [
+ {
+ validator: (rule, value, callback) => {
+ if (
+ this.hasUserType(this.form.usertype, "performance") &&
+ (value === null || value === undefined || value === "")
+ ) {
+ return callback(new Error("璇烽�夋嫨缁╂晥绉戝"));
+ }
+ return callback();
+ },
+ trigger: "change"
+ }
]
- },
- //鏄惁鏄笓瀹惰垂鐨凮PO瀹℃壒浜哄憳
- ismanager: false
+ },
};
+ },
+ computed: {
+ /** 琛ㄥ崟鏄惁閫夋嫨浜�"鍗曚綅鏈烘瀯"锛堣处鍙风被鍒负澶氬�硷紝鍚� org 鍗充负鍗曚綅锛� */
+ isUnitForm() {
+ return this.hasUserType(this.form.usertype, "org");
+ }
},
created() {
this.getUserProfile();
this.getUnitList();
+ this.getDeptList();
// 榛樿涓嶆墦寮�
// this.getList();
},
methods: {
//鑾峰彇褰撳墠鐢ㄦ埛淇℃伅
getUserProfile() {
- getUserProfile().then(res => {
- if (
- res.data.userName == "admin" ||
- res.data.userName == "053" ||
- res.data.userName == "047"
- ) {
- this.ismanager = true;
- } else {
- this.ismanager = false;
- }
+ getUserProfile().then(res => {
+ const managerList = ["admin", "048", "047"];
+ this.ismanager = managerList.includes(res.data.userName);
});
+ },
+
+ /** 浜哄憳绫诲瀷锛堝鍊硷紝閫楀彿鍒嗛殧锛夎浆鏁扮粍 */
+ splitUserType(usertype) {
+ if (!usertype) {
+ return [];
+ }
+ if (Array.isArray(usertype)) {
+ return usertype;
+ }
+ return String(usertype)
+ .split(",")
+ .map(t => t.trim())
+ .filter(t => t);
+ },
+ /** 浜哄憳绫诲瀷鏁扮粍杞�楀彿鍒嗛殧瀛楃涓� */
+ joinUserType(usertype) {
+ return Array.isArray(usertype) ? usertype.join(",") : usertype;
+ },
+ /** 浜哄憳绫诲瀷鏄惁鍖呭惈鎸囧畾绫诲瀷锛堝 org = 鍗曚綅鏈烘瀯锛� */
+ hasUserType(usertype, code) {
+ return this.splitUserType(usertype).indexOf(code) > -1;
},
/** 鏌ヨ鍗曚綅銆佷汉鍛樿处鍙峰垪琛� */
@@ -337,7 +413,7 @@
userno: null,
username: null,
userstatus: 0,
- usertype: null,
+ usertype: [],
personnelunitno: null,
delFlag: null,
createBy: null,
@@ -345,7 +421,9 @@
updateBy: null,
updateTime: null,
pym: null,
- wbm: null
+ wbm: null,
+ deptId: null,
+ deptName: null
};
this.resetForm("form");
},
@@ -389,6 +467,11 @@
const id = row.id || this.ids;
getExternalperson(id).then(response => {
this.form = response.data;
+ //璐﹀彿绫诲埆涓哄鍊硷紙閫楀彿鍒嗛殧锛夛紝琛ㄥ崟鐢ㄦ暟缁勫洖鏄�
+ this.form.usertype = this.splitUserType(response.data.usertype);
+ if (this.form.deptId !== null && this.form.deptId !== undefined && this.form.deptId !== "") {
+ this.form.deptId = Number(this.form.deptId);
+ }
this.open = true;
this.title = "浜哄憳/鍗曚綅璐﹀彿淇℃伅淇敼";
});
@@ -402,6 +485,15 @@
if (res.organizationid == this.form.unitno)
this.form.unitname = res.organizationname;
});
+ //缁╂晥绉戝锛氭彁浜ゅ墠鎸� deptId 鍥炲~ deptName
+ if (this.form.deptId !== null && this.form.deptId !== undefined && this.form.deptId !== "") {
+ const dept = this.deptList.find(
+ item => String(item.deptId) === String(this.form.deptId)
+ );
+ this.form.deptName = dept ? dept.deptName : this.form.deptName;
+ }
+ //璐﹀彿绫诲埆涓哄鍊硷細鎻愪氦鍓嶈浆鍥為�楀彿鍒嗛殧鐨勫瓧绗︿覆
+ this.form.usertype = this.joinUserType(this.form.usertype);
console.log(this.form);
if (this.form.id != null) {
updateExternalperson(this.form).then(response => {
@@ -411,15 +503,8 @@
this.getList();
});
} else {
- //妫�鏌ヨ韩浠借瘉鍞竴
- getInfoByIDCardNo(this.form.idcardno).then(res => {
- if (res.data.length > 1) {
- this.$modal.msgWarning("韬唤璇佸彿淇℃伅宸茶鐧昏锛岃妫�鏌ヨ韩浠借瘉鍙凤紒"
- );
- return;
- }
-
- //淇濆瓨淇℃伅
+ //淇濆瓨淇℃伅锛堝崟浣嶈处鍙锋病鏈夎韩浠借瘉鍙凤紝璺宠繃韬唤璇佹煡閲嶏級
+ const saveNew = () => {
getOnlyCode(this.seqnoParams).then(res => {
this.form.userno = res.data.currentvalue;
@@ -430,7 +515,21 @@
this.getList();
});
});
+ };
+ if (!this.form.idcardno || !String(this.form.idcardno).trim()) {
+ saveNew();
+ return;
+ }
+
+ //妫�鏌ヨ韩浠借瘉鍞竴
+ getInfoByIDCardNo(this.form.idcardno).then(res => {
+ if (res.data.length > 1) {
+ this.$modal.msgWarning("韬唤璇佸彿淇℃伅宸茶鐧昏锛岃妫�鏌ヨ韩浠借瘉鍙凤紒"
+ );
+ return;
+ }
+ saveNew();
});
}
}
@@ -478,6 +577,23 @@
console.log(this.unitList);
}
});
+ },
+ /** 缁╂晥绉戝鍒楄〃 */
+ getDeptList() {
+ listDept({}).then(response => {
+ this.deptList = response.data || [];
+ });
+ },
+ /** 缁╂晥绉戝閫夋嫨鍙樺寲锛氬悓姝ュ悕绉� */
+ handleDeptChange(deptId) {
+ if (deptId === null || deptId === undefined || deptId === "") {
+ this.form.deptName = null;
+ return;
+ }
+ const dept = this.deptList.find(
+ item => String(item.deptId) === String(deptId)
+ );
+ this.form.deptName = dept ? dept.deptName : null;
}
}
};
--
Gitblit v1.9.3