修复逻辑
This commit is contained in:
@@ -8,4 +8,4 @@ VITE_OPEN=true
|
|||||||
ENV=development
|
ENV=development
|
||||||
|
|
||||||
# ADMIN 服务地址
|
# ADMIN 服务地址
|
||||||
VITE_ADMIN_PROXY_PATH = http://scj-v3.zhxy.link/api
|
VITE_ADMIN_PROXY_PATH = http://127.0.0.1:9999
|
||||||
|
|||||||
16
src/api/order/purchase-apply.ts
Normal file
16
src/api/order/purchase-apply.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
export function getObj(id: any) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingapply/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingapply/edit',
|
||||||
|
method: 'post',
|
||||||
|
data: obj
|
||||||
|
})
|
||||||
|
}
|
||||||
106
src/api/purchase/purchasingBusinessDept.ts
Normal file
106
src/api/purchase/purchasingBusinessDept.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
// ========== 基础CRUD接口 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询列表数据
|
||||||
|
* @param query - 查询参数对象
|
||||||
|
* @returns Promise<分页数据>
|
||||||
|
*/
|
||||||
|
export function fetchList(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingBusinessDept/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
* @param obj - 要新增的数据对象
|
||||||
|
* @returns Promise<boolean> - 操作结果
|
||||||
|
*/
|
||||||
|
export function addObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingBusinessDept',
|
||||||
|
method: 'post',
|
||||||
|
data: obj
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情数据
|
||||||
|
* @param obj - 查询参数对象(包含ID等)
|
||||||
|
* @returns Promise<数据详情>
|
||||||
|
*/
|
||||||
|
export function getObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingBusinessDept/details',
|
||||||
|
method: 'get',
|
||||||
|
params: obj
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据
|
||||||
|
* @param ids - 要删除的ID数组
|
||||||
|
* @returns Promise<操作结果>
|
||||||
|
*/
|
||||||
|
export function delObjs(ids?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingBusinessDept',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据
|
||||||
|
* @param obj - 要更新的数据对象
|
||||||
|
* @returns Promise<操作结果>
|
||||||
|
*/
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingBusinessDept',
|
||||||
|
method: 'put',
|
||||||
|
data: obj
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 工具函数 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证字段值唯一性
|
||||||
|
* @param rule - 验证规则对象
|
||||||
|
* @param value - 要验证的值
|
||||||
|
* @param callback - 验证回调函数
|
||||||
|
* @param isEdit - 是否为编辑模式
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // 在表单验证规则中使用
|
||||||
|
* fieldName: [
|
||||||
|
* {
|
||||||
|
* validator: (rule, value, callback) => {
|
||||||
|
* validateExist(rule, value, callback, form.id !== '');
|
||||||
|
* },
|
||||||
|
* trigger: 'blur',
|
||||||
|
* },
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
|
export function validateExist(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||||
|
// 编辑模式下跳过验证
|
||||||
|
if (isEdit) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询是否存在相同值
|
||||||
|
getObj({ [rule.field]: value }).then((response) => {
|
||||||
|
const result = response.data;
|
||||||
|
if (result !== null && result.length > 0) {
|
||||||
|
callback(new Error('数据已经存在'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
useMessage().error("不存在的表单,请检查")
|
useMessage().error("不存在的表单,请检查")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data.currTabComp = `../../views${path}.vue`
|
data.currTabComp = `../../views${path}.vue`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 审批项 -->
|
<!-- 审批项 -->
|
||||||
|
|
||||||
|
|
||||||
<el-form v-if="!data.currJob.hiJob && !orderVue.vueKeySys.sysPaths.includes(data.currElTab.path)" label-width="72px" style="margin-top: 22px;">
|
<el-form v-if="!data.currJob.hiJob && !orderVue.vueKeySys.sysPaths.includes(data.currElTab.path)" label-width="72px" style="margin-top: 22px;">
|
||||||
|
|
||||||
<template v-if="data.currElTab.isAutoAudit !== '1'">
|
<template v-if="data.currElTab.isAutoAudit !== '1'">
|
||||||
<el-form-item :label="t('jfcomment.remark')">
|
<el-form-item :label="t('jfcomment.remark')">
|
||||||
<el-input v-model="data.currJob.comment" :autosize="{ minRows: 3, maxRows: 6}" maxlength="50" show-word-limit
|
<el-input v-model="data.currJob.comment" :autosize="{ minRows: 3, maxRows: 6}" maxlength="50" show-word-limit
|
||||||
@@ -525,11 +528,12 @@
|
|||||||
let elTabs = data.currJob.elTabs.filter(f => (f.isFormEdit !== '0' && !hiJob))
|
let elTabs = data.currJob.elTabs.filter(f => (f.isFormEdit !== '0' && !hiJob))
|
||||||
if (elTabs) {
|
if (elTabs) {
|
||||||
let find = elTabs.find(f => f.isSave !== true);
|
let find = elTabs.find(f => f.isSave !== true);
|
||||||
if (find) useMessage().info(find.formName + ' 未保存')
|
// 这里测试流程,临时屏蔽判断 todo
|
||||||
else {
|
// if (find) useMessage().info(find.formName + ' 未保存')
|
||||||
|
// else {
|
||||||
methods.timeoutLoading()
|
methods.timeoutLoading()
|
||||||
btnMethods.onHandleJob(jobBtn)
|
btnMethods.onHandleJob(jobBtn)
|
||||||
}
|
// }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
methods.timeoutLoading()
|
methods.timeoutLoading()
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import EmailInput from "./form-create/email.vue";
|
|||||||
import SignInput from "./sign/index.vue";
|
import SignInput from "./sign/index.vue";
|
||||||
|
|
||||||
// vite glob导入
|
// vite glob导入
|
||||||
const modules: Record<string, () => Promise<unknown>> = import.meta.glob(['../../views/jsonflow/*/*.vue', '../../views/order/*/*.vue'])
|
const modules: Record<string, () => Promise<unknown>> = import.meta.glob(
|
||||||
|
['../../views/jsonflow/*/*.vue', '../../views/order/*/*.vue', '../../views/purchase/*/*.vue']
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出全局注册工作流审批表单组件
|
* 导出全局注册工作流审批表单组件
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
class="bcrumb-item"
|
class="bcrumb-item"
|
||||||
@click="goOrganiseLevel(item)"
|
@click="goOrganiseLevel(item)"
|
||||||
>
|
>
|
||||||
<span class="name line-1">{{ item.name }}</span>
|
<span class="name line-1">{{ item.realName }}</span>
|
||||||
<el-icon style="color: #a1a2a4; width: 16px; height: 16px"><ArrowRight /></el-icon>
|
<el-icon style="color: #a1a2a4; width: 16px; height: 16px"><ArrowRight /></el-icon>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -684,13 +684,13 @@
|
|||||||
let name = searchKey.value.toLowerCase();
|
let name = searchKey.value.toLowerCase();
|
||||||
await onLoadListenSearch(name)
|
await onLoadListenSearch(name)
|
||||||
if (data.jobType === DIC_PROP.JOB_USER_TYPE[0].value) {
|
if (data.jobType === DIC_PROP.JOB_USER_TYPE[0].value) {
|
||||||
data.searchUsers = data.jobTypeUsers.filter((v) => v.name.toLowerCase().includes(name));
|
data.searchUsers = data.jobTypeUsers.filter((v) => v.realName.toLowerCase().includes(name));
|
||||||
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[1].value) {
|
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[1].value) {
|
||||||
data.searchUsers = data.jobTypeUsers.filter((v) => v.roleName.toLowerCase().includes(name));
|
data.searchUsers = data.jobTypeUsers.filter((v) => v.roleName.toLowerCase().includes(name));
|
||||||
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[2].value) {
|
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[2].value) {
|
||||||
data.searchUsers = data.jobTypeUsers.filter((v) => v.postName.toLowerCase().includes(name));
|
data.searchUsers = data.jobTypeUsers.filter((v) => v.postName.toLowerCase().includes(name));
|
||||||
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[3].value) {
|
} else if (data.jobType === DIC_PROP.JOB_USER_TYPE[3].value) {
|
||||||
data.searchUsers = data.jobTypeUsers.filter((v) => v.name.toLowerCase().includes(name));
|
data.searchUsers = data.jobTypeUsers.filter((v) => v.realName.toLowerCase().includes(name));
|
||||||
}
|
}
|
||||||
updateItemChecked()
|
updateItemChecked()
|
||||||
};
|
};
|
||||||
@@ -709,10 +709,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showKeyName(item) {
|
function showKeyName(item) {
|
||||||
if (userJobType(item)) return item.name
|
if (userJobType(item)) return item.realName
|
||||||
else if (roleJobType(item)) return item.roleName
|
else if (roleJobType(item)) return item.roleName
|
||||||
else if (postJobType(item)) return item.postName
|
else if (postJobType(item)) return item.postName
|
||||||
else if (deptJobType(item)) return item.name
|
else if (deptJobType(item)) return item.realName
|
||||||
}
|
}
|
||||||
|
|
||||||
const methodsRemote = {
|
const methodsRemote = {
|
||||||
@@ -813,7 +813,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 140px;
|
max-width: 140px;
|
||||||
.name {
|
.realName {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
|
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -826,7 +826,7 @@
|
|||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
&:last-child {
|
&:last-child {
|
||||||
.name {
|
.realName {
|
||||||
color: #a1a2a4;
|
color: #a1a2a4;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
@@ -981,6 +981,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
|||||||
225
src/views/purchase/apply/flow.vue
Normal file
225
src/views/purchase/apply/flow.vue
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form
|
||||||
|
ref="dataFormRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="dataRules"
|
||||||
|
label-width="120px"
|
||||||
|
v-loading="loading"
|
||||||
|
:disabled="operType === 'view'"
|
||||||
|
>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.projectName">
|
||||||
|
<el-form-item label="采购项目名称" prop="projectName">
|
||||||
|
<el-input v-model="form.projectName" placeholder="请输入采购项目名称" :disabled="disabledFields.projectName" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.projectType">
|
||||||
|
<el-form-item label="项目类别" prop="projectType">
|
||||||
|
<el-select v-model="form.projectType" placeholder="请选择" :disabled="disabledFields.projectType" clearable style="width: 100%">
|
||||||
|
<el-option label="货物" value="A" />
|
||||||
|
<el-option label="工程" value="B" />
|
||||||
|
<el-option label="服务" value="C" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20" v-if="!hiddenFields.projectContent">
|
||||||
|
<el-form-item label="采购内容" prop="projectContent">
|
||||||
|
<el-input v-model="form.projectContent" type="textarea" :rows="3" placeholder="请输入采购内容" :disabled="disabledFields.projectContent" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.applyDate">
|
||||||
|
<el-form-item label="填报日期" prop="applyDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.applyDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择日期"
|
||||||
|
:disabled="disabledFields.applyDate"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.fundSource">
|
||||||
|
<el-form-item label="资金来源" prop="fundSource">
|
||||||
|
<el-input v-model="form.fundSource" placeholder="资金来源" :disabled="disabledFields.fundSource" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.budget">
|
||||||
|
<el-form-item label="预算金额(元)" prop="budget">
|
||||||
|
<el-input-number v-model="form.budget" :min="0" :precision="2" :disabled="disabledFields.budget" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.isCentralized">
|
||||||
|
<el-form-item label="是否集采" prop="isCentralized">
|
||||||
|
<el-select v-model="form.isCentralized" placeholder="请选择" :disabled="disabledFields.isCentralized" clearable style="width: 100%">
|
||||||
|
<el-option label="否" value="0" />
|
||||||
|
<el-option label="是" value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.isSpecial">
|
||||||
|
<el-form-item label="是否特殊情况" prop="isSpecial">
|
||||||
|
<el-select v-model="form.isSpecial" placeholder="请选择" :disabled="disabledFields.isSpecial" clearable style="width: 100%">
|
||||||
|
<el-option label="否" value="0" />
|
||||||
|
<el-option label="紧急" value="1" />
|
||||||
|
<el-option label="单一" value="2" />
|
||||||
|
<el-option label="进口" value="3" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.purchaseMode">
|
||||||
|
<el-form-item label="采购形式" prop="purchaseMode">
|
||||||
|
<el-input v-model="form.purchaseMode" placeholder="采购形式" :disabled="disabledFields.purchaseMode" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20" v-if="!hiddenFields.purchaseType">
|
||||||
|
<el-form-item label="采购方式" prop="purchaseType">
|
||||||
|
<el-input v-model="form.purchaseType" placeholder="采购方式" :disabled="disabledFields.purchaseType" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20" v-if="!hiddenFields.remark">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="备注" :disabled="disabledFields.remark" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template v-if="data.submitBtn">
|
||||||
|
<footer class="el-dialog__footer">
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm" :disabled="loading">提交</el-button>
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<footer class="el-dialog__footer">
|
||||||
|
<span class="dialog-footer" />
|
||||||
|
</footer>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="PurchaseApplyFlow">
|
||||||
|
import { useMessage } from '/@/hooks/message'
|
||||||
|
import * as purchaseApply from '/@/api/order/purchase-apply'
|
||||||
|
import * as orderVue from '/@/api/order/order-key-vue'
|
||||||
|
import { handleCustomFormPerm, handleFormPrint } from '/@/flow/utils/form-perm'
|
||||||
|
import { deepClone } from '/@/utils/other'
|
||||||
|
import { initCustomFormMethods } from '/@/views/order/index'
|
||||||
|
|
||||||
|
const emits = defineEmits(['handleJob'])
|
||||||
|
|
||||||
|
const dataFormRef = ref()
|
||||||
|
const loading = ref(false)
|
||||||
|
const operType = ref<'view' | 'flow'>('flow')
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
currJob: { type: Object, default: null },
|
||||||
|
currElTab: { type: Object, default: () => ({}) }
|
||||||
|
})
|
||||||
|
|
||||||
|
const form = reactive<Record<string, any>>({
|
||||||
|
id: null,
|
||||||
|
code: '',
|
||||||
|
flowKey: 'PURCHASE_APPLY',
|
||||||
|
flowInstId: null,
|
||||||
|
purchaseNo: '',
|
||||||
|
projectName: '',
|
||||||
|
projectType: '',
|
||||||
|
projectContent: '',
|
||||||
|
applyDate: '',
|
||||||
|
fundSource: '',
|
||||||
|
budget: null,
|
||||||
|
isCentralized: '',
|
||||||
|
isSpecial: '',
|
||||||
|
purchaseMode: '',
|
||||||
|
purchaseSchool: '',
|
||||||
|
purchaseType: '',
|
||||||
|
categoryCode: '',
|
||||||
|
fileIds: [],
|
||||||
|
remark: '',
|
||||||
|
runJobId: '',
|
||||||
|
flowVarUser: null
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataRules = ref({
|
||||||
|
projectContent: [{ required: true, message: '请输入采购内容', trigger: 'blur' }],
|
||||||
|
budget: [{ required: true, message: '请输入预算金额', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
const fieldsPerm = {
|
||||||
|
projectName: false,
|
||||||
|
projectType: false,
|
||||||
|
projectContent: false,
|
||||||
|
applyDate: false,
|
||||||
|
fundSource: false,
|
||||||
|
budget: false,
|
||||||
|
isCentralized: false,
|
||||||
|
isSpecial: false,
|
||||||
|
purchaseMode: false,
|
||||||
|
purchaseType: false,
|
||||||
|
remark: false
|
||||||
|
}
|
||||||
|
const hiddenFields = reactive({ ...fieldsPerm })
|
||||||
|
const disabledFields = reactive(deepClone(fieldsPerm))
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
submitBtn: true,
|
||||||
|
elTab: null as any
|
||||||
|
})
|
||||||
|
|
||||||
|
const methods = initCustomFormMethods(data, disabledFields, operType)
|
||||||
|
|
||||||
|
function initJobData() {
|
||||||
|
if (props.currJob?.orderId) handleGetObj(props.currJob.orderId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleGetObj(id: string | number) {
|
||||||
|
purchaseApply.getObj(id).then(async (resp: any) => {
|
||||||
|
const formData = resp?.data ?? {}
|
||||||
|
Object.assign(form, formData)
|
||||||
|
form.runJobId = props.currJob?.id ?? ''
|
||||||
|
await initFormPermPrint()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initFormPermPrint() {
|
||||||
|
const elTab = orderVue.currElTabIsExist(props.currJob, props.currElTab?.id)
|
||||||
|
const res = await handleCustomFormPerm(props, hiddenFields, disabledFields, elTab)
|
||||||
|
await orderVue.currElTabIsView(methods, props.currJob, props.currElTab?.id, submitForm, res?.callback)
|
||||||
|
await handleFormPrint(form, elTab?.type, elTab?.id, '1')
|
||||||
|
data.elTab = elTab
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitForm() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
await purchaseApply.putObj(form)
|
||||||
|
orderVue.currElTabIsSave(props.currJob, props.currElTab?.id, true, emits)
|
||||||
|
useMessage().success(form.id ? '修改成功' : '保存成功')
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err?.msg ?? '操作失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.currJob?.id,
|
||||||
|
() => { initJobData() }
|
||||||
|
)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initJobData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.el-dialog__footer {
|
||||||
|
text-align: center;
|
||||||
|
.dialog-footer {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
142
src/views/purchase/purchasingBusinessDept/form.vue
Normal file
142
src/views/purchase/purchasingBusinessDept/form.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||||
|
:close-on-click-modal="false" draggable>
|
||||||
|
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="部门ID" prop="deptId">
|
||||||
|
<el-input v-model="form.deptId" placeholder="请输入部门ID"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
|
<el-input v-model="form.deptName" placeholder="请输入部门名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="分管负责人ID" prop="userId">
|
||||||
|
<el-input v-model="form.userId" placeholder="请输入分管负责人ID"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="分管负责人工号" prop="username">
|
||||||
|
<el-input v-model="form.username" placeholder="请输入分管负责人工号"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入姓名"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="PurchasingBusinessDeptDialog">
|
||||||
|
// ========== 1. 导入语句 ==========
|
||||||
|
import { useDict } from '/@/hooks/dict';
|
||||||
|
import { rule } from '/@/utils/validate';
|
||||||
|
import { useMessage } from "/@/hooks/message";
|
||||||
|
import { getObj, addObj, putObj, validateExist } from '/@/api/purchase/purchasingBusinessDept';
|
||||||
|
|
||||||
|
// ========== 2. 组件定义 ==========
|
||||||
|
// 定义组件事件
|
||||||
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
|
// ========== 3. 响应式数据定义 ==========
|
||||||
|
// 基础响应式变量
|
||||||
|
const dataFormRef = ref(); // 表单引用
|
||||||
|
const visible = ref(false); // 弹窗显示状态
|
||||||
|
const loading = ref(false); // 加载状态
|
||||||
|
|
||||||
|
// 表单数据对象
|
||||||
|
const form = reactive({
|
||||||
|
id: '', // 主键
|
||||||
|
remark: '', // 备注
|
||||||
|
deptId: '', // 部门ID
|
||||||
|
deptName: '', // 部门名称
|
||||||
|
userId: '', // 分管负责人ID
|
||||||
|
username: '', // 分管负责人工号
|
||||||
|
name: '', // 姓名
|
||||||
|
});
|
||||||
|
|
||||||
|
// ========== 4. 字典数据处理 ==========
|
||||||
|
|
||||||
|
// ========== 5. 表单校验规则 ==========
|
||||||
|
const dataRules = ref({
|
||||||
|
});
|
||||||
|
|
||||||
|
// ========== 6. 方法定义 ==========
|
||||||
|
// 获取详情数据
|
||||||
|
const getPurchasingBusinessDeptData = async (id: string) => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const { data } = await getObj({ id: id });
|
||||||
|
// 直接将第一条数据赋值给表单
|
||||||
|
Object.assign(form, data[0]);
|
||||||
|
} catch (error) {
|
||||||
|
useMessage().error('获取数据失败');
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开弹窗方法
|
||||||
|
const openDialog = (id: string) => {
|
||||||
|
visible.value = true;
|
||||||
|
form.id = '';
|
||||||
|
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取PurchasingBusinessDept信息
|
||||||
|
if (id) {
|
||||||
|
form.id = id;
|
||||||
|
getPurchasingBusinessDeptData(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交表单方法
|
||||||
|
const onSubmit = async () => {
|
||||||
|
loading.value = true; // 防止重复提交
|
||||||
|
|
||||||
|
// 表单校验
|
||||||
|
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||||
|
if (!valid) {
|
||||||
|
loading.value = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 根据是否有ID判断是新增还是修改
|
||||||
|
form.id ? await putObj(form) : await addObj(form);
|
||||||
|
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||||
|
visible.value = false;
|
||||||
|
emit('refresh'); // 通知父组件刷新列表
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========== 7. 对外暴露 ==========
|
||||||
|
// 暴露方法给父组件
|
||||||
|
defineExpose({
|
||||||
|
openDialog
|
||||||
|
});
|
||||||
|
</script>
|
||||||
228
src/views/purchase/purchasingBusinessDept/index.vue
Normal file
228
src/views/purchase/purchasingBusinessDept/index.vue
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button
|
||||||
|
icon="folder-add"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'purchase_purchasingBusinessDept_add'"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
icon="upload-filled"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="excelUploadRef.show()"
|
||||||
|
v-auth="'purchase_purchasingBusinessDept_add'"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
:disabled="multiple"
|
||||||
|
icon="Delete"
|
||||||
|
type="primary"
|
||||||
|
v-auth="'purchase_purchasingBusinessDept_del'"
|
||||||
|
@click="handleDelete(selectObjs)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
:export="'purchase_purchasingBusinessDept_export'"
|
||||||
|
@exportExcel="exportExcel"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right;"
|
||||||
|
@queryTable="getDataList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 数据表格区域 -->
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
@selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column
|
||||||
|
prop="remark"
|
||||||
|
label="备注"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="deptId"
|
||||||
|
label="部门ID"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="deptName"
|
||||||
|
label="部门名称"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="userId"
|
||||||
|
label="分管负责人ID"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="username"
|
||||||
|
label="分管负责人工号"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
label="姓名"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
icon="edit-pen"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'purchase_purchasingBusinessDept_edit'"
|
||||||
|
@click="formDialogRef.openDialog(scope.row.id)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="delete"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'purchase_purchasingBusinessDept_del'"
|
||||||
|
@click="handleDelete([scope.row.id])"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
v-bind="state.pagination"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 编辑、新增弹窗 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||||
|
|
||||||
|
<!-- 导入excel弹窗 (需要在 upms-biz/resources/file 下维护模板) -->
|
||||||
|
<upload-excel
|
||||||
|
ref="excelUploadRef"
|
||||||
|
title="导入"
|
||||||
|
url="/purchase/purchasingBusinessDept/import"
|
||||||
|
temp-url="/admin/sys-file/local/file/purchasingBusinessDept.xlsx"
|
||||||
|
@refreshDataList="getDataList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="systemPurchasingBusinessDept">
|
||||||
|
// ========== 导入声明 ==========
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
|
import { fetchList, delObjs } from "/@/api/purchase/purchasingBusinessDept";
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
import { useDict } from '/@/hooks/dict';
|
||||||
|
|
||||||
|
// ========== 组件声明 ==========
|
||||||
|
// 异步加载表单弹窗组件
|
||||||
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
|
|
||||||
|
// ========== 字典数据 ==========
|
||||||
|
|
||||||
|
// ========== 组件引用 ==========
|
||||||
|
const formDialogRef = ref(); // 表单弹窗引用
|
||||||
|
const excelUploadRef = ref(); // Excel上传弹窗引用
|
||||||
|
const queryRef = ref(); // 查询表单引用
|
||||||
|
|
||||||
|
// ========== 响应式数据 ==========
|
||||||
|
const showSearch = ref(true); // 是否显示搜索区域
|
||||||
|
const selectObjs = ref([]) as any; // 表格多选数据
|
||||||
|
const multiple = ref(true); // 是否多选
|
||||||
|
|
||||||
|
// ========== 表格状态 ==========
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {}, // 查询参数
|
||||||
|
pageList: fetchList // 分页查询方法
|
||||||
|
});
|
||||||
|
|
||||||
|
// ========== Hook引用 ==========
|
||||||
|
// 表格相关Hook
|
||||||
|
const {
|
||||||
|
getDataList,
|
||||||
|
currentChangeHandle,
|
||||||
|
sizeChangeHandle,
|
||||||
|
sortChangeHandle,
|
||||||
|
downBlobFile,
|
||||||
|
tableStyle
|
||||||
|
} = useTable(state);
|
||||||
|
|
||||||
|
// ========== 方法定义 ==========
|
||||||
|
/**
|
||||||
|
* 重置查询条件
|
||||||
|
*/
|
||||||
|
const resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields();
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = [];
|
||||||
|
// 重新查询
|
||||||
|
getDataList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel文件
|
||||||
|
*/
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile(
|
||||||
|
'/purchase/purchasingBusinessDept/export',
|
||||||
|
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||||
|
'purchasingBusinessDept.xlsx'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格多选事件处理
|
||||||
|
* @param objs 选中的数据行
|
||||||
|
*/
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id);
|
||||||
|
multiple.value = !objs.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据处理
|
||||||
|
* @param ids 要删除的数据ID数组
|
||||||
|
*/
|
||||||
|
const handleDelete = async (ids: string[]) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm('此操作将永久删除');
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await delObjs(ids);
|
||||||
|
getDataList();
|
||||||
|
useMessage().success('删除成功');
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user