|
@@ -37,9 +37,9 @@
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
|
|
<!-- 新增/编辑部门弹窗 -->
|
|
<!-- 新增/编辑部门弹窗 -->
|
|
|
- <el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px" destroy-on-close>
|
|
|
|
|
- <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
|
|
|
|
- <el-form-item label="上级部门">
|
|
|
|
|
|
|
+ <el-dialog v-model="dialogVisible" :title="dialogTitle" width="700px" destroy-on-close>
|
|
|
|
|
+ <el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px">
|
|
|
|
|
+ <el-form-item label="上级部门" prop="parentId">
|
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
v-model="formData.parentId"
|
|
v-model="formData.parentId"
|
|
|
:data="deptList"
|
|
:data="deptList"
|
|
@@ -54,19 +54,82 @@
|
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
|
<el-input v-model="formData.deptName" placeholder="请输入部门名称" />
|
|
<el-input v-model="formData.deptName" placeholder="请输入部门名称" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="状态" prop="status">
|
|
|
|
|
- <el-radio-group v-model="formData.status">
|
|
|
|
|
- <el-radio label="0">启用</el-radio>
|
|
|
|
|
- <el-radio label="1">停用</el-radio>
|
|
|
|
|
- </el-radio-group>
|
|
|
|
|
|
|
+ <el-form-item label="部门主管" prop="deptManage">
|
|
|
|
|
+ <el-select v-model="formData.deptManage" placeholder="请选择" clearable style="width: 100%">
|
|
|
|
|
+ <el-option v-for="contact in contactList" :key="contact.id" :label="contact.contactName" :value="contact.id" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="是否启用部门">
|
|
|
|
|
+ <el-radio-group v-model="formData.status">
|
|
|
|
|
+ <el-radio label="0">是</el-radio>
|
|
|
|
|
+ <el-radio label="1">否</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="是否额度控制">
|
|
|
|
|
+ <el-radio-group v-model="formData.isLimit">
|
|
|
|
|
+ <el-radio label="0">是</el-radio>
|
|
|
|
|
+ <el-radio label="1">否</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-form-item label="选择年度" prop="selectYear">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="formData.selectYear"
|
|
|
|
|
+ type="year"
|
|
|
|
|
+ placeholder="请选择年度"
|
|
|
|
|
+ value-format="YYYY"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ :disabled="formData.isLimit === '1'"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <div style="color: #999; font-size: 12px; margin-left: 120px; margin-bottom: 18px">
|
|
|
|
|
+ 只能对当期年度进行额度设置,往期年度,显示最后一日数据,无法充值额度。
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form-item v-if="formData.isLimit === '0'" label="分项费用类型" prop="expenseTypeId">
|
|
|
|
|
+ <el-select v-model="formData.expenseTypeId" placeholder="请选择" style="width: 100%">
|
|
|
|
|
+ <el-option v-for="item in expenseTypeList" :key="item.id" :label="item.expenseName" :value="item.id" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <!-- <el-button type="primary" link style="margin-left: 12px">查询其他分项费用情况</el-button> -->
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="现有额度(年)" prop="yearlyBudget">
|
|
|
|
|
+ <el-input v-model="formData.yearlyBudget" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="已用额度(年)" prop="usedBudget">
|
|
|
|
|
+ <el-input v-model="formData.usedBudget" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="剩余额度" prop="residueBudget">
|
|
|
|
|
+ <el-input v-model="formData.residueBudget" disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="年度额度">
|
|
|
|
|
- <el-input-number v-model="formData.yearlyBudget" :min="0" :precision="2" controls-position="right" style="width: 200px" />
|
|
|
|
|
|
|
+ <el-form-item v-if="formData.isLimit === '0'" label="充值额度" prop="recharge">
|
|
|
|
|
+ <el-input v-model="formData.recharge" style="width: 100%" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="绑定状态">
|
|
|
|
|
+ <el-switch v-model="formData.bindStatus" :active-value="'0'" :inactive-value="'1'" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-if="formData.bindStatus === '0'" label="绑定地址" prop="bindAddress">
|
|
|
|
|
+ <el-radio-group v-model="formData.bindAddress" style="width: 100%">
|
|
|
|
|
+ <el-radio v-for="addr in addressList" :key="addr.id" :value="addr.id" style="display: block; margin-bottom: 10px">
|
|
|
|
|
+ {{ addr.provincialCityCountry }}-{{ addr.address }}-{{ addr.contactPhone }}
|
|
|
|
|
+ </el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <div style="margin-left: 120px; margin-top: 10px">
|
|
|
|
|
+ <div style="font-weight: bold; margin-bottom: 8px">充值说明:</div>
|
|
|
|
|
+ <div style="color: #666; font-size: 13px; line-height: 1.8">
|
|
|
|
|
+ 1. 需要给当前部门进行额度充值时,请在充值额度中填写"正数"即可。<br />
|
|
|
|
|
+ 2. 需要给当前部门进行额度扣减时请在充值额度中填写"负数"即可,扣减额度不能高于剩余额度。<br />
|
|
|
|
|
+ 3. 当现有额度为0时,则该部门的此项费用不能进行采购。
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button type="danger" @click="handleSubmit">确定</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleSubmit">确定</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</div>
|
|
</div>
|
|
@@ -76,8 +139,11 @@
|
|
|
import { ref, reactive, computed, onMounted } from 'vue';
|
|
import { ref, reactive, computed, onMounted } from 'vue';
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
import { PageTitle } from '@/components';
|
|
import { PageTitle } from '@/components';
|
|
|
-import { getDeptTree, addDept, updateDept, deleteDept } from '@/api/pc/organization';
|
|
|
|
|
|
|
+import { getDeptTree, addDept, updateDept, deleteDept, getContactList } from '@/api/pc/organization';
|
|
|
|
|
+import { getAddressList } from '@/api/pc/enterprise';
|
|
|
|
|
+import { getItemExpenseList } from '@/api/pc/cost/itemExpense';
|
|
|
import { DeptInfo } from '@/api/pc/organization/types';
|
|
import { DeptInfo } from '@/api/pc/organization/types';
|
|
|
|
|
+import { de } from 'element-plus/es/locale/index.mjs';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
|
|
const { sys_platform_yes_no } = toRefs<any>(proxy?.useDict('sys_platform_yes_no'));
|
|
const { sys_platform_yes_no } = toRefs<any>(proxy?.useDict('sys_platform_yes_no'));
|
|
@@ -91,18 +157,32 @@ const formData = reactive({
|
|
|
deptId: undefined,
|
|
deptId: undefined,
|
|
|
deptName: '',
|
|
deptName: '',
|
|
|
parentId: undefined,
|
|
parentId: undefined,
|
|
|
|
|
+ deptManage: undefined,
|
|
|
status: '0',
|
|
status: '0',
|
|
|
- yearlyBudget: 0,
|
|
|
|
|
|
|
+ isLimit: '1',
|
|
|
|
|
+ selectYear: new Date().getFullYear().toString(),
|
|
|
|
|
+ expenseTypeId: undefined,
|
|
|
|
|
+ yearlyBudget: '0.00',
|
|
|
|
|
+ usedBudget: '0.00',
|
|
|
|
|
+ residueBudget: '0.00',
|
|
|
|
|
+ recharge: undefined,
|
|
|
|
|
+ bindStatus: '1',
|
|
|
|
|
+ bindAddress: undefined,
|
|
|
parentName: ''
|
|
parentName: ''
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const formRules = {
|
|
const formRules = {
|
|
|
- deptName: [{ required: true, message: '请输入部门名称', trigger: 'blur' }]
|
|
|
|
|
|
|
+ parentId: [{ required: true, message: '上级部门不能为空', trigger: 'change' }],
|
|
|
|
|
+ deptName: [{ required: true, message: '请输入部门名称', trigger: 'blur' }],
|
|
|
|
|
+ deptManage: [{ required: true, message: '部门主管不能为空', trigger: 'change' }]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const dialogTitle = computed(() => (editingRow.value ? '编辑部门' : '新增部门'));
|
|
const dialogTitle = computed(() => (editingRow.value ? '编辑部门' : '新增部门'));
|
|
|
|
|
|
|
|
const deptList = ref([]);
|
|
const deptList = ref([]);
|
|
|
|
|
+const contactList = ref([]);
|
|
|
|
|
+const addressList = ref([]);
|
|
|
|
|
+const expenseTypeList = ref([]);
|
|
|
|
|
|
|
|
// 加载部门树
|
|
// 加载部门树
|
|
|
const loadDeptTree = async () => {
|
|
const loadDeptTree = async () => {
|
|
@@ -130,8 +210,17 @@ const handleAdd = (parent: any) => {
|
|
|
formData.deptId = undefined;
|
|
formData.deptId = undefined;
|
|
|
formData.deptName = '';
|
|
formData.deptName = '';
|
|
|
formData.parentId = parent ? parent.deptId : undefined;
|
|
formData.parentId = parent ? parent.deptId : undefined;
|
|
|
|
|
+ formData.deptManage = undefined;
|
|
|
formData.status = '0';
|
|
formData.status = '0';
|
|
|
- formData.yearlyBudget = 0;
|
|
|
|
|
|
|
+ formData.isLimit = '1';
|
|
|
|
|
+ formData.selectYear = new Date().getFullYear().toString();
|
|
|
|
|
+ formData.expenseTypeId = undefined;
|
|
|
|
|
+ formData.yearlyBudget = '0.00';
|
|
|
|
|
+ formData.usedBudget = '0.00';
|
|
|
|
|
+ formData.residueBudget = '0.00';
|
|
|
|
|
+ formData.recharge = undefined;
|
|
|
|
|
+ formData.bindStatus = '1';
|
|
|
|
|
+ formData.bindAddress = undefined;
|
|
|
formData.parentName = parent ? parent.parentName : '';
|
|
formData.parentName = parent ? parent.parentName : '';
|
|
|
dialogVisible.value = true;
|
|
dialogVisible.value = true;
|
|
|
};
|
|
};
|
|
@@ -142,8 +231,17 @@ const handleEdit = (row: any) => {
|
|
|
formData.deptId = row.deptId;
|
|
formData.deptId = row.deptId;
|
|
|
formData.deptName = row.deptName;
|
|
formData.deptName = row.deptName;
|
|
|
formData.parentId = row.parentId == 100 ? undefined : row.parentId;
|
|
formData.parentId = row.parentId == 100 ? undefined : row.parentId;
|
|
|
|
|
+ formData.deptManage = row.deptManage;
|
|
|
formData.status = row.status || '0';
|
|
formData.status = row.status || '0';
|
|
|
- formData.yearlyBudget = row.yearlyBudget || 0;
|
|
|
|
|
|
|
+ formData.isLimit = row.isLimit || '1';
|
|
|
|
|
+ formData.selectYear = row.selectYear || new Date().getFullYear().toString();
|
|
|
|
|
+ formData.expenseTypeId = row.expenseTypeId;
|
|
|
|
|
+ formData.yearlyBudget = row.yearlyBudget || '0.00';
|
|
|
|
|
+ formData.usedBudget = row.usedBudget || '0.00';
|
|
|
|
|
+ formData.residueBudget = ((row.yearlyBudget || 0) - (row.usedBudget || 0)).toFixed(2);
|
|
|
|
|
+ formData.recharge = row.recharge;
|
|
|
|
|
+ formData.bindStatus = row.bindStatus || '1';
|
|
|
|
|
+ formData.bindAddress = row.bindAddress;
|
|
|
formData.parentName = '';
|
|
formData.parentName = '';
|
|
|
dialogVisible.value = true;
|
|
dialogVisible.value = true;
|
|
|
};
|
|
};
|
|
@@ -171,11 +269,21 @@ const handleSubmit = async () => {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const data = {
|
|
const data = {
|
|
|
|
|
+ deptManage: formData.deptManage,
|
|
|
|
|
+ isLimit: formData.isLimit,
|
|
|
|
|
+ selectYear: formData.selectYear,
|
|
|
|
|
+ expenseTypeId: formData.expenseTypeId,
|
|
|
|
|
+ yearlyBudget: formData.yearlyBudget,
|
|
|
|
|
+ usedBudget: formData.usedBudget,
|
|
|
|
|
+ residueBudget: formData.residueBudget,
|
|
|
|
|
+ recharge: formData.recharge,
|
|
|
|
|
+ bindStatus: formData.bindStatus,
|
|
|
|
|
+ bindAddress: formData.bindAddress,
|
|
|
deptId: formData.deptId,
|
|
deptId: formData.deptId,
|
|
|
deptName: formData.deptName,
|
|
deptName: formData.deptName,
|
|
|
parentId: formData.parentId,
|
|
parentId: formData.parentId,
|
|
|
status: formData.status,
|
|
status: formData.status,
|
|
|
- yearlyBudget: formData.yearlyBudget
|
|
|
|
|
|
|
+ parentName: parentRow.value ? parentRow.value.deptName : ''
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
if (editingRow.value) {
|
|
if (editingRow.value) {
|
|
@@ -194,9 +302,48 @@ const handleSubmit = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 加载联系人列表
|
|
|
|
|
+const loadContactList = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getContactList();
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ contactList.value = res.rows || res.data || [];
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取联系人列表失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 加载收货地址列表
|
|
|
|
|
+const loadAddressList = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getAddressList();
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ addressList.value = res.rows || res.data || [];
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取收货地址列表失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 加载分项费用列表
|
|
|
|
|
+const loadExpenseTypeList = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getItemExpenseList();
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ expenseTypeList.value = res.rows || res.data || [];
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取分项费用列表失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 页面加载时获取部门树
|
|
// 页面加载时获取部门树
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadDeptTree();
|
|
loadDeptTree();
|
|
|
|
|
+ loadContactList();
|
|
|
|
|
+ loadAddressList();
|
|
|
|
|
+ loadExpenseTypeList();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|