添加供应商物料导入功能

This commit is contained in:
yangjun 2026-03-17 13:14:13 +08:00
parent 31d87e810c
commit 60c97df2f5
25 changed files with 3604 additions and 1 deletions

View File

@ -9,7 +9,7 @@ VITE_PUBLIC_PATH = /devops
VITE_PROXY = [["/devopsapi","http://localhost:8080/devopsapi"],["/upload","http://localhost:3300/upload"]]
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=http://localhost:8080/devopsapi
VITE_GLOB_DOMAIN_URL=http://localhost:3100/devopsapi
#后台接口父地址(必填)
VITE_GLOB_API_URL=/devopsapi

View File

@ -0,0 +1,94 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/bizSuppliers/nuBizSuppliersApply/list',
listPage = '/bizSuppliers/nuBizSuppliersApply/listPage',
getModifyHistoryInfo = '/bizSuppliers/nuBizSuppliersApply/getModifyHistoryInfo',
getModifyInfo = '/bizSuppliers/nuBizSuppliersApply/getModifyInfo',
save='/bizSuppliers/nuBizSuppliersApply/add',
edit='/bizSuppliers/nuBizSuppliersApply/edit',
audit='/bizSuppliers/nuBizSuppliersApply/audit',
bgAudit='/bizSuppliers/nuBizSuppliersApply/bgAudit',
deleteOne = '/bizSuppliers/nuBizSuppliersApply/delete',
deleteBatch = '/bizSuppliers/nuBizSuppliersApply/deleteBatch',
importExcel = '/bizSuppliers/nuBizSuppliersApply/importExcel',
exportXls = '/bizSuppliers/nuBizSuppliersApply/exportXls',
}
export const getModifyHistoryInfo = (params) => {
return defHttp.post({ url: Api.getModifyHistoryInfo, params });
};
export const getModifyInfo = (params) => {
return defHttp.post({ url: Api.getModifyInfo, params });
};
/**
*
* @param params
*/
export const auditSubmit = (params) => {
return defHttp.post({ url: Api.audit, params });
};
export const bgAuditSubmit = (params) => {
return defHttp.post({ url: Api.bgAudit, params });
};
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
export const listPage = (params) => defHttp.get({ url: Api.listPage, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,191 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '供应商名称',
align: "center",
dataIndex: 'suppliersName'
},
{
title: '供应商性质',
align: "center",
dataIndex: 'suppliersNature_dictText',
width: 100
},
{
title: '负责人',
align: "center",
dataIndex: 'personInCharge',
width: 100
},
{
title: '联系电话',
align: "center",
dataIndex: 'contactNumber',
width: 100
},
// {
// title: '供应状态',
// align: "center",
// dataIndex: 'supplyState_dictText'
// },
{
title: '供应商地址',
align: "center",
dataIndex: 'suppliersAddress'
},
{
title: '开户行',
align: "center",
dataIndex: 'openingBank'
},
{
title: '开户行账号',
align: "center",
dataIndex: 'openingBankNo'
},
{
title: '资质照片',
align: "center",
dataIndex: 'imgPath',
customRender: render.renderImage,
width: 100
},
{
title: '审核状态',
align: "center",
dataIndex: 'applyStatus',
customRender: ({ text, record }) => {
var applyStatus = '';
if (text == '1' || text == '4') {
applyStatus = '待审核';
} else if (text == '2') {
applyStatus = '审核通过';
} else if (text == '3' || text == '5') {
applyStatus = '审核驳回';
}
return applyStatus;
},
width: 100
},
// {
// title: '审核内容',
// align: "center",
// dataIndex: 'applyContent',
// width: 150
// },
{
title: '申请时间',
align: "center",
dataIndex: 'createTime',
width: 150
},
];
//列表数据
export const columns2: BasicColumn[] = [
{
title: '供应商名称',
align: "center",
dataIndex: 'suppliersName'
},
{
title: '供应商性质',
align: "center",
dataIndex: 'suppliersNature_dictText',
width: 100
},
{
title: '负责人',
align: "center",
dataIndex: 'personInCharge',
width: 100
},
{
title: '联系电话',
align: "center",
dataIndex: 'contactNumber',
width: 100
},
// {
// title: '供应状态',
// align: "center",
// dataIndex: 'supplyState_dictText'
// },
{
title: '供应商地址',
align: "center",
dataIndex: 'suppliersAddress'
},
{
title: '开户行',
align: "center",
dataIndex: 'openingBank'
},
{
title: '开户行账号',
align: "center",
dataIndex: 'openingBankNo'
},
{
title: '资质照片',
align: "center",
dataIndex: 'imgPath',
customRender: render.renderImage,
width: 100
},
{
title: '审核状态',
align: "center",
dataIndex: 'applyStatus',
customRender: ({ text, record }) => {
var applyStatus = '';
if (text == '1' || text == '4') {
applyStatus = '待审核';
} else if (text == '2') {
applyStatus = '审核通过';
} else if (text == '3' || text == '5') {
applyStatus = '审核驳回';
}
return applyStatus;
},
width: 100
},
{
title: '驳回原因',
align: "center",
dataIndex: 'applyContent',
width: 150
},
];
// 高级查询数据
export const superQuerySchema = {
suppliersName: {title: '供应商名称',order: 0,view: 'text', type: 'string',},
suppliersNature: {title: '供应商性质',order: 1,view: 'list', type: 'string',dictCode: '',},
suppliersAddress: {title: '供应商地址',order: 2,view: 'text', type: 'string',},
personInCharge: {title: '负责人',order: 3,view: 'text', type: 'string',},
contactNumber: {title: '联系电话',order: 4,view: 'text', type: 'string',},
supplyState: {title: '供应状态',order: 5,view: 'list', type: 'string',dictCode: '',},
openingBank: {title: '开户行',order: 6,view: 'text', type: 'string',},
openingBankNo: {title: '开户行账号',order: 7,view: 'text', type: 'string',},
imgPath: {title: '资质照片',order: 8,view: 'image', type: 'string',},
status: {title: '审核状态',order: 9,view: 'text', type: 'string',},
auditContent: {title: '审核内容',order: 10,view: 'text', type: 'string',},
};
export const applyObj = {
suppliersName: '供应商名称',
suppliersNature: '供应商性质',
suppliersAddress: '供应商地址',
personInCharge: '负责人',
contactNumber: '联系电话',
openingBank: '开户行',
openingBankNo: '开户行账号',
imgPath: '营业执照',
};

View File

@ -0,0 +1,255 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="paramTitle">
<template #label><span title="供应商信息">供应商信息</span></template>
<a-input v-model:value="queryParam.paramTitle" placeholder="请输入供应商名称/负责人/联系电话" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="applyStatus">
<template #label><span title="审核状态">审核状态</span></template>
<a-select v-model:value="queryParam.applyStatus" placeholder="请选择审核状态" style="width: 200px"
:disabled="false">
<a-select-option value="1,2,3,4,5">全部</a-select-option>
<a-select-option value="1,4">待审核</a-select-option>
<a-select-option value="2">审核通过</a-select-option>
<a-select-option value="3,5">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="rzrq">
<template #label><span title="入驻日期">申请日期</span></template>
<a-date-picker placeholder="请选择入驻日期" v-model:value="queryParam.rzrq" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<NuBizSuppliersApplyModal ref="registerModal" @success="handleSuccess"></NuBizSuppliersApplyModal>
<NuBizSuppliersAuditHistoryModal ref="registerHistoryModal" @success="handleSuccess"></NuBizSuppliersAuditHistoryModal>
</div>
</template>
<script lang="ts" name="bizSuppliers-nuBizSuppliersApply" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './NuBizSuppliersApply.data';
import { listPage, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersApply.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import NuBizSuppliersApplyModal from './components/NuBizSuppliersApplyModal.vue'
import NuBizSuppliersAuditHistoryModal from './NuBizSuppliersAuditHistoryModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerHistoryModal = ref();
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '供应商申请信息',
api: listPage,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 220,
fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "供应商申请信息",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
sm:8,
xl:8,
xxl:8
});
const wrapperCol = reactive({
xs: 24,
sm: 18,
});
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 信息变更审核
* @param record
*/
function handleUpEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.upInfoEdit(record);
}
/**
* 审核历史详情
*/
function handleHistoryList(record: Recordable) {
registerHistoryModal.value.disableSubmit = true;
registerHistoryModal.value.edit(record);
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '新供应商审核',
onClick: handleEdit.bind(null, record),
ifShow: record.applyStatus == '1'
},
{
label: '信息变更审核',
onClick: handleUpEdit.bind(null, record),
ifShow: record.applyStatus == '4'
},
{
label: '审核历史',
onClick: handleHistoryList.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'bizSuppliers:nu_biz_suppliers_apply:delete'
}
]
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>

View File

@ -0,0 +1,232 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<!-- <a-col :lg="6">
<a-form-item name="suppliersName">
<template #label><span title="供应商名称">供应商名称</span></template>
<j-input placeholder="请输入供应商名称" v-model:value="queryParam.suppliersName" allow-clear></j-input>
</a-form-item>
</a-col> -->
<a-col :lg="6">
<a-form-item name="personInCharge">
<template #label><span title="负责人">负责人</span></template>
<j-input placeholder="请输入负责人" v-model:value="queryParam.personInCharge" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="applyStatus">
<template #label><span title="审核状态">审核状态</span></template>
<a-select v-model:value="queryParam.applyStatus" placeholder="请选择审核状态" style="width: 200px"
:disabled="false">
<a-select-option value="1,2,3,4,5">全部</a-select-option>
<a-select-option value="1,4">待审核</a-select-option>
<a-select-option value="2">审核通过</a-select-option>
<a-select-option value="3,5">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
<!-- <template v-if="column.dataIndex ==='imgPath'">
<j-image-upload :fileMax="1" :value="opeMediaAddress + text" disabled></j-image-upload>
</template> -->
</template>
</BasicTable>
<!-- 表单区域 -->
<NuBizSuppliersApplyHistoryModal ref="registerModal" @success="handleSuccess"></NuBizSuppliersApplyHistoryModal>
</div>
</template>
<script lang="ts" name="configSuppliersApply-nuConfigSuppliersApply" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns2, superQuerySchema } from './NuBizSuppliersApply.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersApply.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import NuBizSuppliersApplyHistoryModal from './components/NuBizSuppliersApplyHistoryModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
import { useMessage } from '/@/hooks/web/useMessage';
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerDetailModal = ref();
const suppliersId = ref<any>('');
const userStore = useUserStore();
const { createMessage } = useMessage();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: 'nu_config_suppliers_apply',
api: list,
columns:columns2,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 100,
fixed: 'right',
},
beforeFetch: async (params) => {
if (!queryParam.applyStatus) {
// queryParam.applyStatus = '1,2,3,4,5'
}
return Object.assign(params, queryParam);
},
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 6
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
console.log("🚀 ~ handleDetail ~ record:", record)
if(record.optType == '变更'){
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}else if(record.optType == '入驻'){
registerModal.value.disableSubmit = true;
registerModal.value.editDitail(record);
}else{
createMessage.error('错误数据,请联系管员');
}
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
];
}
/**
* 查询
*/
function searchQuery() {
queryParam.suppliersId = suppliersId.value;
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
searchQuery();
}
//
function init(record) {
console.log("🚀 ~ init ~ record:", record)
suppliersId.value = record.suppliersId;
queryParam.suppliersName = record.suppliersName;
searchQuery();
}
defineExpose({
init,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 14px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,94 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<NuBizSuppliersAuditHistoryList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
</NuBizSuppliersAuditHistoryList>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersAuditHistoryList from './NuBizSuppliersAuditHistoryList.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('1400');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const upInfoForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = "审核历史";
visible.value = true;
nextTick(() => {
registerForm.value.init(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
/**
* 信息变更确认
*/
function handleUpInfoOk() {
upInfoForm.value.submitForm();
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/bizSuppliers/nuBizSuppliersInfo/list',
save='/bizSuppliers/nuBizSuppliersInfo/add',
edit='/bizSuppliers/nuBizSuppliersInfo/edit',
deleteOne = '/bizSuppliers/nuBizSuppliersInfo/delete',
deleteBatch = '/bizSuppliers/nuBizSuppliersInfo/deleteBatch',
importExcel = '/bizSuppliers/nuBizSuppliersInfo/importExcel',
exportXls = '/allMaterialInfo/nuBizAllMaterialInfo/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,77 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '供应商名称',
align: "center",
dataIndex: 'suppliersName'
},
{
title: '供应商性质',
align: "center",
dataIndex: 'suppliersNature_dictText'
},
{
title: '供应商地址',
align: "center",
dataIndex: 'suppliersAddress'
},
{
title: '负责人',
align: "center",
dataIndex: 'personInCharge',
width: 100
},
{
title: '联系电话',
align: "center",
dataIndex: 'contactNumber',
width: 100
},
// {
// title: '供应状态',
// align: "center",
// dataIndex: 'supplyState_dictText'
// },
{
title: '开户行',
align: "center",
dataIndex: 'openingBank'
},
{
title: '开户行账号',
align: "center",
dataIndex: 'openingBankNo'
},
{
title: '资质照片',
align: "center",
dataIndex: 'imgPath',
customRender: render.renderImage,
width: 100
},
{
title: '入驻日期',
align: "center",
dataIndex: 'createTime',
width: 160
},
];
// 高级查询数据
export const superQuerySchema = {
suppliersName: {title: '供应商名称',order: 0,view: 'text', type: 'string',},
suppliersNature: {title: '供应商性质',order: 1,view: 'list', type: 'string',dictCode: 'suppliers_nature',},
suppliersAddress: {title: '供应商地址',order: 2,view: 'text', type: 'string',},
personInCharge: {title: '负责人',order: 3,view: 'text', type: 'string',},
contactNumber: {title: '联系电话',order: 4,view: 'text', type: 'string',},
supplyState: {title: '供应状态',order: 5,view: 'list', type: 'string',dictCode: 'supply_status',},
openingBank: {title: '开户行',order: 6,view: 'text', type: 'string',},
openingBankNo: {title: '开户行账号',order: 7,view: 'text', type: 'string',},
imgPath: {title: '资质照片',order: 8,view: 'image', type: 'string',},
createTime: {title: '创建日期',order: 9,view: 'datetime', type: 'string',},
};

View File

@ -0,0 +1,192 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="suppliersName">
<template #label><span title="供应商名称">供应商名</span></template>
<JInput v-model:value="queryParam.suppliersName" placeholder="请输入供应商名称"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<a-button type="primary" preIcon="ant-design:import-outlined" @click="handleDaoru" style="margin-left: 8px">导入物料</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<NuBizSuppliersInfoModal ref="registerModal" @success="handleSuccess"></NuBizSuppliersInfoModal>
<NuBizSuppliersMateriallInfoModal ref="wlRegisterModal" @success="handleSuccess"></NuBizSuppliersMateriallInfoModal>
<SuppDaoruModal ref="daoruModal" @success="handleSuccess"></SuppDaoruModal>
</div>
</template>
<script lang="ts" name="bizSuppliers-nuBizSuppliersInfo" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './NuBizSuppliersInfo.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import NuBizSuppliersInfoModal from './components/NuBizSuppliersInfoModal.vue'
import NuBizSuppliersMateriallInfoModal from './NuBizSuppliersMateriallInfoModal.vue'
import SuppDaoruModal from './SuppDaoruModal.vue'
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const registerModal = ref();
const wlRegisterModal = ref();
const daoruModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '供应商信息',
api: list,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "供应商物料模板",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
sm:8,
xl:8,
xxl:8
});
const wrapperCol = reactive({
xs: 24,
sm: 16,
});
function handleDaoru(){
daoruModal.value.disableSubmit = true;
daoruModal.value.edit(null);
}
/**
* 物料事件
*/
function handleWlEdit(record: Recordable) {
wlRegisterModal.value.disableSubmit = true;
wlRegisterModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '物料',
onClick: handleWlEdit.bind(null, record),
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>

View File

@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/bizSuppliers/nuBizSuppliersMaterialInfo/list',
save='/bizSuppliers/nuBizSuppliersMaterialInfo/add',
edit='/bizSuppliers/nuBizSuppliersMaterialInfo/edit',
deleteOne = '/bizSuppliers/nuBizSuppliersMaterialInfo/delete',
deleteBatch = '/bizSuppliers/nuBizSuppliersMaterialInfo/deleteBatch',
importExcel = '/bizSuppliers/nuBizSuppliersMaterialInfo/importExcel',
exportXls = '/allMaterialInfo/nuBizAllMaterialInfo/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,45 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '物料名称',
align: "center",
dataIndex: 'materialName'
},
{
title: '规格型号',
align: "center",
dataIndex: 'specificationModel',
},
{
title: '品牌型号',
align: "center",
dataIndex: 'brandType',
},
{
title: '销售单价',
align: "center",
dataIndex: 'salesUnitPrice',
width: 100
},
{
title: '销售单位',
align: "center",
dataIndex: 'salesUnit',
width: 100
},
];
// 高级查询数据
export const superQuerySchema = {
suppliersId: {title: '供应商',order: 0,view: 'list', type: 'string',dictTable: "nu_biz_suppliers_info", dictCode: 'id', dictText: 'suppliers_name',},
materialName: {title: '物料名称',order: 1,view: 'text', type: 'string',},
specificationModel: {title: '规格型号',order: 2,view: 'text', type: 'string',},
brandType: {title: '品牌型号',order: 3,view: 'text', type: 'string',},
salesUnitPrice: {title: '销售单价',order: 4,view: 'number', type: 'number',},
salesUnit: {title: '销售单位',order: 5,view: 'text', type: 'string',},
};

View File

@ -0,0 +1,195 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<!-- <a-col :lg="6">
<a-form-item name="suppliersId">
<template #label><span title="供应商">供应商</span></template>
<j-select-multiple placeholder="请选择供应商" v-model:value="queryParam.suppliersId" dictCode="nu_biz_suppliers_info,suppliers_name,id" allow-clear />
</a-form-item>
</a-col> -->
<a-col :lg="8">
<a-form-item name="materialName">
<template #label><span title="物料名称">物料名称</span></template>
<JInput placeholder="请输入物料名称" v-model:value="queryParam.materialName" allow-clear ></JInput>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 下载物料模板</a-button> -->
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<NuBizSuppliersMaterialInfoModal ref="registerModal" @success="handleSuccess"></NuBizSuppliersMaterialInfoModal>
</div>
</template>
<script lang="ts" name="bizSuppliers-nuBizSuppliersMaterialInfo" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './NuBizSuppliersMaterialInfo.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersMaterialInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import NuBizSuppliersMaterialInfoModal from './components/NuBizSuppliersMaterialInfoModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const suppliersId = ref<string>('');
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '供应商可提供的物料信息',
api: list,
columns,
canResize:false,
useSearchForm: false,
showActionColumn: false,
immediate: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: async (params) => {
params.column = 'id'
params.order = 'desc'
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "供应商可提供的物料信息",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload }, { selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'bizSuppliers:nu_biz_suppliers_material_info:edit'
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
function init(record) {
console.log("🚀 ~ init ~ record:", record)
suppliersId.value = record.id;
queryParam.suppliersId = record.id;
queryParam.suppliersName = record.suppliersName;
reload();
}
defineExpose({
init,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<NuBizSuppliersMaterialInfoList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
</NuBizSuppliersMaterialInfoList>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersMaterialInfoList from './NuBizSuppliersMaterialInfoList.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('1400');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const upInfoForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = "物料信息";
visible.value = true;
nextTick(() => {
registerForm.value.init(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,167 @@
<template>
<div >
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="suppliersName">
<template #label><span title="供应商名称">供应商名</span></template>
<JInput v-model:value="queryParam.suppliersName" placeholder="请输入供应商名称"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<span style="margin-left: 8px"><j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button></span>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- <div style="width:100%;"> -->
<a-row :span="24">
<a-col v-for="item in dataList" :key="item.id" :span="8" class="radio-item">
<a-radio-group v-model:value="suppliersId" @change="handleChangeRadio" class="radio-group">
<a-radio :value="item.id" >
{{ item.suppliersName }}
</a-radio>
</a-radio-group>
</a-col>
<a-col v-show="dataList.length == 0">
<a-empty />
</a-col>
<a-col style="text-align: right;margin-top:14px;">
<Pagination
v-model:current="pageNo"
v-model:pageSize="pageSize"
show-size-changer
:total="totalRecord"
@showSizeChange="onPageChange"
@change="onPageChange"
/>
</a-col>
</a-row>
<!-- </div> -->
</div>
</template>
<script lang="ts" name="bizSuppliers-nuBizSuppliersInfo" setup>
import { ref, reactive } from 'vue';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import { defHttp } from '/@/utils/http/axios';
import { useListPage } from '/@/hooks/system/useListPage';
import { Pagination } from 'ant-design-vue';
const suppliersId = ref<string>('');
//table
let { onImportXls } = useListPage({
tableProps: {
},
importConfig: {
url: () => `/bizSuppliers/nuBizSuppliersMaterialInfo/importExcel?supplierId=${suppliersId.value}`,
success: searchQuery,
},
});
const formRef = ref();
const queryParam = reactive<any>({});
const dataList = ref<any>([]);
const myActiveKey = ref('1');
let pageNo = ref(1);
const pageSize = ref(20);
let totalRecord = ref(0);
const labelCol = reactive({
xs:24,
sm:8,
xl:8,
xxl:8
});
const wrapperCol = reactive({
xs: 24,
sm: 16,
});
function handleChangeRadio(e) {
suppliersId.value = e.target.value;
}
async function onPageChange(e) {
await reload();
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
//
reload();
}
function reload() {
queryParam.pageNo = pageNo.value;
queryParam.pageSize = pageSize.value;
defHttp.get({ url: '/bizSuppliers/nuBizSuppliersInfo/list', params: queryParam }).then(res => {
dataList.value = res.records;
totalRecord.value = res.total;
suppliersId.value = res.records[0].id;
});
}
function init(data) {
reload();
}
defineExpose({
init,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
.radio-item{
background-color: white;
height: 64px;
border-radius: 8px;
}
.radio-group{
display: flex;
margin: 20px;
}
</style>

View File

@ -0,0 +1,74 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<SuppDaoruList ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
</SuppDaoruList>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import SuppDaoruList from './SuppDaoruList.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('1400');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = "导入物料";
visible.value = true;
nextTick(() => {
registerForm.value.init(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,266 @@
<template>
<a-spin :spinning="confirmLoading">
<div class="container2">
<a-row>
<a-col :span="24">
<a-table :dataSource="filteredTableData" :columns="columns" :pagination="false" bordered size="small"
:rowClassName="setRowClassName">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'd1'">
<span>{{ applyObj[record.d1] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && isImg(record.d1)">
<JImageUpload v-if="!!record.d2" :fileMax="1" :value="record.d2" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template v-if="column.dataIndex === 'd3' && isImg(record.d1)">
<JImageUpload v-if="!!record.d3" :fileMax="1" :value="record.d3" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template
v-if="column.dataIndex === 'd2' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d2] }}</span>
</template>
<template
v-if="column.dataIndex === 'd3' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d3] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d3 }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'endTime'">
<span>{{ record.d2 == '9999-12-31' ? '长期' : record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'endTime'">
<span>{{ record.d3 == '9999-12-31' ? '长期' : record.d3 }}</span>
</template>
</template>
</a-table>
</a-col>
</a-row>
<a-form style="margin-top: 14px;height: 100px;" ref="formRef" layout="horizontal" :model="formData"
:label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="审核状态" name="status" v-bind="validateInfos.status">
<a-select v-model:value="formData.status" style="width: 200px" placeholder="请选择审核状态">
<a-select-option value="">请选择审核状态</a-select-option>
<a-select-option value="modifyPass">审核通过</a-select-option>
<a-select-option value="modifyFail">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" v-if="formData.status == 'modifyFail'">
<a-form-item label="驳回原因" name="applyContent" v-bind="validateInfos.applyContent">
<a-textarea :maxlength="50" show-count v-model:value="formData.applyContent" placeholder="请输入驳回原因(如驳回)"
style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { Table as ATable, Input, Row, Col, Form } from 'ant-design-vue';
import { applyObj } from '../NuBizSuppliersApply.data'
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getModifyInfo, bgAuditSubmit } from '../NuBizSuppliersApply.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { initDictOptions } from '/@/utils/dict';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const formRef = ref();
const AForm = Form;
const AFormItem = Form.Item;
const useForm = Form.useForm;
const { createMessage } = useMessage();
const confirmLoading = ref<boolean>(false);
//
const labelCol = { span: 6 }; //
const wrapperCol = { span: 18 }; //
const isImg = (v_) => {
return v_ == 'imgPath'
}
const provinceOptions = ref({})
const formData = reactive<Record<string, any>>({
status: '',
applyContent: '',
id: '',
pkId: '',
openId:'',
});
const validatorRules = reactive({
status: [{ required: true, message: '请选择审核状态!' },],
applyContent: [
{
validator: async (_rule, value) => {
if (formData.status === 'modifyFail' && !value) {
return Promise.reject('请输入驳回原因!');
}
return Promise.resolve();
},
},
],
})
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const tableData = ref([]);
const emit = defineEmits(['ok']);
//
const filteredTableData = computed(() => {
return tableData.value.filter(item =>
item.d1 !== 'id'
&& item.d1 !== 'supplyState'
&& item.d1 !== 'wechartId'
&& item.d1 !== 'delFlag'
&& item.d1 !== 'createBy'
&& item.d1 !== 'createTime'
&& item.d1 !== 'updateBy'
&& item.d1 !== 'updateTime'
&& item.d1 !== 'sysOrgCode'
&& item.d1 !== 'izEnabled'
&& item.d1 !== 'sourceType'
&& item.d1 !== 'openId'
);
});
const columns = [
{
title: '名称',
dataIndex: 'd1',
key: 'd1',
width: 150,
},
{
title: '变更前',
dataIndex: 'd2',
key: 'd2',
},
{
title: '变更后',
dataIndex: 'd3',
key: 'd3',
}
];
//
const setRowClassName = (record) => {
return record.d2 !== record.d3 && record.d1 !== 'createTime' ? 'highlight-row' : '';
};
const fieldMap = {
suppliersName: 'suppliersName',
suppliersNature: 'suppliersNature',
suppliersAddress: 'suppliersAddress',
personInCharge: 'personInCharge',
contactNumber: 'contactNumber',
openingBank: 'openingBank',
openingBankNo: 'openingBankNo',
imgPath: 'imgPath',
};
async function show(record) {
console.log("🚀 ~ show ~ record:", record)
let data = await getModifyInfo({ id: record.id })
resetFields();
formData.id = record.id
formData.suppliersId = record.suppliersId
formData.status = '';
formData.applyContent = ''
// idpkIdformData
Object.keys(fieldMap).forEach(fieldName => {
const record = data.find(item => item.d1 === fieldName);
if (record) {
formData[fieldName] = record.d3;
}
});
tableData.value = data.map(item => ({
...item,
// null/undefined
d2: item.d2 ?? '',
d3: item.d3 ?? ''
}));
}
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = false;
if (formData.startTime) {
formData.startTime = formData.startTime.replace(/-/g, '.');
}
if (formData.endTime) {
formData.endTime = formData.endTime.replace(/-/g, '.');
}
await bgAuditSubmit(formData)
.then((res) => {
confirmLoading.value = false;
emit('ok');
})
}
// numberValues
onMounted(async () => {
const dictData = await initDictOptions('sys_category,name,id,first_letter is not null order by code asc', '');
dictData.reduce((prev, next) => {
if (next) {
provinceOptions.value[next['value']] = next['text'] || next['label']
}
return prev;
}, []);
});
defineExpose({
show,
submitForm
});
</script>
<style lang="less" scoped>
.container2 {
padding: 16px;
}
.antd-modal-form {
// padding: 14px;
}
:deep(.ant-table-cell) {
padding: 8px 12px !important;
}
//
:deep(.highlight-row) {
background-color: #fff1f0 !important; //
}
//
:deep(.ant-form-item) {
// margin-bottom: 16px;
}
:deep(.ant-table-cell-row-hover) {
// border: 1px solid red;
}
</style>

View File

@ -0,0 +1,246 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="NuConfigSuppliersApplyForm">
<a-row>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<SectionDivider :title="'基本信息'" />
</a-col>
<a-col :span="24">
<a-form-item label="供应商名称" v-bind="validateInfos.suppliersName"
id="NuConfigSuppliersApplyForm-suppliersName" name="suppliersName">
<a-input v-model:value="formData.suppliersName" placeholder="请输入供应商名称" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商性质" v-bind="validateInfos.suppliersNature_dictText"
id="NuConfigSuppliersApplyForm-suppliersNature_dictText" name="suppliersNature_dictText">
<a-input v-model:value="formData.suppliersNature_dictText" placeholder="请输入供应商性质" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商地址" v-bind="validateInfos.suppliersAddress"
id="NuConfigSuppliersApplyForm-suppliersAddress" name="suppliersAddress">
<a-textarea v-model:value="formData.suppliersAddress" placeholder="请输入供应商地址" rows="2" disabled></a-textarea>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="负责人" v-bind="validateInfos.personInCharge"
id="NuConfigSuppliersApplyForm-personInCharge" name="personInCharge">
<a-input v-model:value="formData.personInCharge" placeholder="请输入负责人" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="联系电话" v-bind="validateInfos.contactNumber"
id="NuConfigSuppliersApplyForm-contactNumber" name="contactNumber">
<a-input v-model:value="formData.contactNumber" placeholder="请输入联系电话" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuConfigSuppliersApplyForm-openingBank"
name="openingBank">
<a-input v-model:value="formData.openingBank" placeholder="请输入开户行" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行账号" v-bind="validateInfos.openingBankNo"
id="NuConfigSuppliersApplyForm-openingBankNo" name="openingBankNo">
<a-input v-model:value="formData.openingBankNo" placeholder="请输入开户行账号" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="营业执照" v-bind="validateInfos.imgPath" id="NuConfigSuppliersApplyForm-imgPath"
name="imgPath">
<!-- <a-input v-model:value="formData.imgPath" placeholder="请输入营业执照" disabled ></a-input> -->
<j-image-upload v-if="formData.imgPath" :fileMax="1" :value="formData.imgPath"
disabled></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;" >
<SectionDivider :title="'审核信息'" />
</a-col>
<a-col :span="24" >
<a-form-item label="审核状态" v-bind="validateInfos.applyStatus" id="NuConfigSuppliersApplyForm-applyStatus"
name="applyStatus">
<!-- <a-input v-model:value="formData.applyStatus" placeholder="请输入审核状态" ></a-input> -->
<a-select v-model:value="formData.applyStatus" placeholder="请选择审核状态" style="width: 200px"
:disabled="false">
<a-select-option value="1">待审核</a-select-option>
<a-select-option value="2">审核通过</a-select-option>
<a-select-option value="3">审核驳回</a-select-option>
<a-select-option value="4">待审核</a-select-option>
<a-select-option value="5">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24" v-show="formData.applyStatus == 3 || formData.applyStatus == 5">
<a-form-item label="驳回原因" v-bind="validateInfos.applyContent" id="NuConfigSuppliersApplyForm-applyContent"
name="applyContent">
<a-textarea :maxlength="50" show-count v-model:value="formData.applyContent" placeholder="请输入驳回原因" rows="4"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../NuBizSuppliersApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersName: '',
suppliersNature: '',
suppliersAddress: '',
personInCharge: '',
contactNumber: '',
supplyState: '',
openingBank: '',
openingBankNo: '',
wechartId: '',
imgPath: '',
applyStatus: '',
applyContent: '',
suppliersNature_dictText: '',
applyId: '',
suppliersId: '',
sourceType: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 2 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
if (model.applyStatus == '1') {
createMessage.warning('请选择审核状态');
confirmLoading.value = false;
return;
}
if (model.applyStatus == 3 && !model.applyContent) {
createMessage.warning('请填写驳回原因');
confirmLoading.value = false;
return;
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 0px;
}
</style>

View File

@ -0,0 +1,232 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="true">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizSuppliersApplyForm">
<a-row>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;" v-if="!disabled">
<SectionDivider :title="'供应商信息'" />
</a-col>
<a-col :span="24">
<a-form-item label="供应商名称" v-bind="validateInfos.suppliersName" id="NuBizSuppliersApplyForm-suppliersName" name="suppliersName">
<a-input v-model:value="formData.suppliersName" placeholder="请输入供应商名称" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商性质" v-bind="validateInfos.suppliersNature" id="NuBizSuppliersApplyForm-suppliersNature" name="suppliersNature">
<j-dict-select-tag v-model:value="formData.suppliersNature" dictCode="suppliers_nature" placeholder="请选择供应商性质" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商地址" v-bind="validateInfos.suppliersAddress" id="NuBizSuppliersApplyForm-suppliersAddress" name="suppliersAddress">
<a-input v-model:value="formData.suppliersAddress" placeholder="请输入供应商地址" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="负责人" v-bind="validateInfos.personInCharge" id="NuBizSuppliersApplyForm-personInCharge" name="personInCharge">
<a-input v-model:value="formData.personInCharge" placeholder="请输入负责人" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="联系电话" v-bind="validateInfos.contactNumber" id="NuBizSuppliersApplyForm-contactNumber" name="contactNumber">
<a-input v-model:value="formData.contactNumber" placeholder="请输入联系电话" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuBizSuppliersApplyForm-openingBank" name="openingBank">
<a-input v-model:value="formData.openingBank" placeholder="请输入开户行" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行账号" v-bind="validateInfos.openingBankNo" id="NuBizSuppliersApplyForm-openingBankNo" name="openingBankNo">
<a-input v-model:value="formData.openingBankNo" placeholder="请输入开户行账号" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="资质照片" v-bind="validateInfos.imgPath" id="NuBizSuppliersApplyForm-imgPath" name="imgPath">
<j-image-upload :fileMax="1" v-model:value="formData.imgPath" ></j-image-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizSuppliersApplyForm">
<a-row>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;" v-if="!disabled">
<SectionDivider :title="'审核信息'" />
</a-col>
<a-col :span="24" v-if="!disabled">
<a-form-item label="审核状态" v-bind="validateInfos.status" id="NuConfigSuppliersApplyForm-status"
name="status">
<a-select v-model:value="formData.status" style="width: 200px" placeholder="请选择审核状态">
<a-select-option value="modifyPass">审核通过</a-select-option>
<a-select-option value="modifyFail">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24" v-show="formData.status == 'modifyFail'" v-if="!disabled">
<a-form-item label="驳回原因" v-bind="validateInfos.applyContent" id="NuConfigSuppliersApplyForm-applyContent"
name="applyContent">
<a-textarea :maxlength="50" show-count v-model:value="formData.applyContent" placeholder="请输入驳回原因" rows="4"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { auditSubmit } from '../NuBizSuppliersApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { duplicateValidate } from '/@/utils/helper/validator'
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersName: '',
suppliersNature: '',
suppliersAddress: '',
personInCharge: '',
contactNumber: '',
supplyState: '',
openingBank: '',
openingBankNo: '',
imgPath: '',
status: '',
auditContent: '',
openId:'',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
// suppliersName: [{ required: false}, { validator: suppliersNameDuplicatevalidate }],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await auditSubmit(formData)
.then((res) => {
emit('ok');
})
confirmLoading.value = false;
// await auditSubmit(model, isUpdate.value)
// .then((res) => {
// if (res.success) {
// emit('ok');
// } else {
// createMessage.warning(res.message);
// }
// })
// .finally(() => {
// confirmLoading.value = false;
// });
}
// async function suppliersNameDuplicatevalidate(_r, value) {
// return duplicateValidate('nu_biz_suppliers_apply', 'suppliers_name', value, formData.openId || '')
// }
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,271 @@
<template>
<div class="container2" >
<a-row>
<a-col :span="24">
<a-table :dataSource="filteredTableData" :columns="columns" :pagination="false" bordered size="small"
:rowClassName="setRowClassName">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'd1'">
<span>{{ applyObj[record.d1] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && isImg(record.d1)">
<JImageUpload v-if="!!record.d2" :fileMax="1" :value="record.d2" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template v-if="column.dataIndex === 'd3' && isImg(record.d1)">
<JImageUpload v-if="!!record.d3" :fileMax="1" :value="record.d3" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template
v-if="column.dataIndex === 'd2' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d2] }}</span>
</template>
<template
v-if="column.dataIndex === 'd3' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d3] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d3 }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'endTime'">
<span>{{ record.d2 == '9999-12-31' ? '长期' : record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'endTime'">
<span>{{ record.d3 == '9999-12-31' ? '长期' : record.d3 }}</span>
</template>
</template>
</a-table>
</a-col>
</a-row>
<JFormContainer :disabled="true">
<template #detail>
<a-form style="margin-top: 14px;height: 100px;" ref="formRef" layout="horizontal" :model="formData"
:label-col="labelCol" :wrapper-col="wrapperCol" >
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="审核状态" name="status" v-bind="validateInfos.status">
<a-select v-model:value="formData.status" style="width: 200px" placeholder="请选择审核状态">
<a-select-option value="modifyStatus">待审核</a-select-option>
<a-select-option value="modifyPass">审核通过</a-select-option>
<a-select-option value="modifyFail">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" v-if="formData.status == 'modifyFail'">
<a-form-item label="驳回原因" name="applyContent" v-bind="validateInfos.applyContent">
<a-textarea :maxlength="50" show-count v-model:value="formData.applyContent" placeholder="请输入驳回原因(如驳回)"
style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { Table as ATable, Input, Row, Col, Form } from 'ant-design-vue';
import { applyObj } from '../NuBizSuppliersApply.data'
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getModifyHistoryInfo, auditSubmit } from '../NuBizSuppliersApply.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { initDictOptions } from '/@/utils/dict';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const formRef = ref();
const AForm = Form;
const AFormItem = Form.Item;
const useForm = Form.useForm;
const { createMessage } = useMessage();
//
const labelCol = { span: 6 }; //
const wrapperCol = { span: 18 }; //
const isImg = (v_) => {
return v_ == 'imgPath'
}
const provinceOptions = ref({})
const formData = reactive<Record<string, any>>({
status: undefined,
applyContent: '',
id: '',
pkId: ''
});
const validatorRules = reactive({
})
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const tableData = ref([]);
const emit = defineEmits(['ok']);
//
const filteredTableData = computed(() => {
return tableData.value.filter(item =>
item.d1 !== 'id'
&& item.d1 !== 'supplyState'
&& item.d1 !== 'wechartId'
&& item.d1 !== 'delFlag'
&& item.d1 !== 'createBy'
&& item.d1 !== 'createTime'
&& item.d1 !== 'updateBy'
&& item.d1 !== 'updateTime'
&& item.d1 !== 'sysOrgCode'
&& item.d1 !== 'izEnabled'
&& item.d1 !== 'sourceType'
&& item.d1 !== 'applyStatus'
&& item.d1 !== 'applyContent'
&& item.d1 !== 'applyId'
&& item.d1 !== 'suppliersId'
&& item.d1 !== 'izHistory'
&& item.d1 !== 'applyOrg'
&& item.d1 !== 'optType'
&& item.d1 !== 'openId'
&& item.d1 !== 'izRejected'
);
});
const columns = [
{
title: '名称',
dataIndex: 'd1',
key: 'd1',
width: 150,
},
{
title: '变更前',
dataIndex: 'd2',
key: 'd2',
},
{
title: '变更后',
dataIndex: 'd3',
key: 'd3',
}
];
//
const setRowClassName = (record) => {
return record.d2 !== record.d3 && record.d1 !== 'createTime' ? 'highlight-row' : '';
};
const fieldMap = {
suppliersName: 'suppliersName',
suppliersNature: 'suppliersNature',
suppliersAddress: 'suppliersAddress',
personInCharge: 'personInCharge',
contactNumber: 'contactNumber',
openingBank: 'openingBank',
openingBankNo: 'openingBankNo',
imgPath: 'imgPath',
};
async function show(record) {
console.log("🚀 ~ show ~ record:", record)
let data = await getModifyHistoryInfo({ id: record.id })
formData.id = record.id
formData.suppliersId = record.suppliersId
if(record.applyStatus == '5' || record.applyStatus == '3'){
formData.status = 'modifyFail'
}else if(record.applyStatus == '2'){
formData.status = 'modifyPass'
}else if(record.applyStatus == '4'){
formData.status = 'modifyStatus'
}
formData.applyContent = record.applyContent
// idpkIdformData
Object.keys(fieldMap).forEach(fieldName => {
const record = data.find(item => item.d1 === fieldName);
if (record) {
formData[fieldName] = record.d3;
}
});
console.log("🚀 ~ show ~ formData:", formData)
tableData.value = data.map(item => ({
...item,
// null/undefined
d2: item.d2 ?? '',
d3: item.d3 ?? ''
}));
}
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
if (formData.startTime) {
formData.startTime = formData.startTime.replace(/-/g, '.');
}
if (formData.endTime) {
formData.endTime = formData.endTime.replace(/-/g, '.');
}
auditSubmit(formData)
.then((res) => {
emit('ok');
})
}
// numberValues
onMounted(async () => {
const dictData = await initDictOptions('sys_category,name,id,first_letter is not null order by code asc', '');
dictData.reduce((prev, next) => {
if (next) {
provinceOptions.value[next['value']] = next['text'] || next['label']
}
return prev;
}, []);
});
defineExpose({
show,
submitForm
});
</script>
<style lang="less" scoped>
.container2 {
// padding: 16px;
}
.antd-modal-form {
// padding: 14px;
}
:deep(.ant-table-cell) {
padding: 8px 12px !important;
}
//
:deep(.highlight-row) {
background-color: #fff1f0 !important; //
}
//
:deep(.ant-form-item) {
// margin-bottom: 16px;
}
:deep(.ant-table-cell-row-hover) {
// border: 1px solid red;
}
</style>

View File

@ -0,0 +1,109 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<NuBizSuppliersApplyHistoryForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
</NuBizSuppliersApplyHistoryForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
<a-drawer :title="title" :width="width" v-model:visible="visibleDetail" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<NuBizSuppliersApplyDetailForm ref="registerFormDetail" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false">
</NuBizSuppliersApplyDetailForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancelDetail">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersApplyHistoryForm from './NuBizSuppliersApplyHistoryForm.vue'
import NuBizSuppliersApplyDetailForm from './NuBizSuppliersApplyDetailForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('800');
const visible = ref<boolean>(false);
const visibleDetail = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const registerFormDetail = ref();
const upInfoForm = ref();
const upInfoVisible = ref<boolean>(false);
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = "审核历史比对";
visible.value = true;
nextTick(() => {
registerForm.value.show(record);
});
}
function editDitail(record) {
title.value = "详情";
visibleDetail.value = true;
nextTick(() => {
registerFormDetail.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
function handleCancelDetail() {
visibleDetail.value = false;
}
/**
* 信息变更确认
*/
function handleUpInfoOk() {
upInfoForm.value.submitForm();
}
defineExpose({
edit,
editDitail,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,118 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{padding:'0px'}" @close="handleCancel">
<NuBizSuppliersApplyForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuBizSuppliersApplyForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
<a-drawer :title="title" :width="width" v-model:visible="bgvisible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{padding:'0px'}" @close="handleBgCancel">
<NuBizSuppliersApplyBgForm ref="bgregisterForm" @ok="submitBgCallback" :formDisabled="disableSubmit" :formBpm="false"></NuBizSuppliersApplyBgForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleBgCancel">关闭</a-button>
<a-button type="primary" @click="handleBgOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersApplyForm from './NuBizSuppliersApplyForm.vue'
import NuBizSuppliersApplyBgForm from './NuBizSuppliersApplyBgForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const bgvisible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const bgregisterForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '新供应商审核';
visible.value = true;
nextTick(() => {
record.status = null;
record.applyContent = null;
registerForm.value.edit(record);
});
}
function upInfoEdit(record) {
title.value = '信息变更审核';
bgvisible.value = true;
nextTick(() => {
record.status = null;
record.applyContent = null;
bgregisterForm.value.show(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* 确定按钮点击事件
*/
function handleBgOk() {
bgregisterForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
function submitBgCallback() {
handleBgCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
function handleBgCancel() {
bgvisible.value = false;
}
defineExpose({
add,
edit,
upInfoEdit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,190 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizSuppliersInfoForm">
<a-row>
<a-col :span="24">
<a-form-item label="供应商名称" v-bind="validateInfos.suppliersName" id="NuBizSuppliersInfoForm-suppliersName" name="suppliersName">
<a-input v-model:value="formData.suppliersName" placeholder="请输入供应商名称" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商性质" v-bind="validateInfos.suppliersNature" id="NuBizSuppliersInfoForm-suppliersNature" name="suppliersNature">
<j-dict-select-tag v-model:value="formData.suppliersNature" dictCode="suppliers_nature" placeholder="请选择供应商性质" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="供应商地址" v-bind="validateInfos.suppliersAddress" id="NuBizSuppliersInfoForm-suppliersAddress" name="suppliersAddress">
<a-input v-model:value="formData.suppliersAddress" placeholder="请输入供应商地址" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="负责人" v-bind="validateInfos.personInCharge" id="NuBizSuppliersInfoForm-personInCharge" name="personInCharge">
<a-input v-model:value="formData.personInCharge" placeholder="请输入负责人" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="联系电话" v-bind="validateInfos.contactNumber" id="NuBizSuppliersInfoForm-contactNumber" name="contactNumber">
<a-input v-model:value="formData.contactNumber" placeholder="请输入联系电话" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuBizSuppliersInfoForm-openingBank" name="openingBank">
<a-input v-model:value="formData.openingBank" placeholder="请输入开户行" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="开户行账号" v-bind="validateInfos.openingBankNo" id="NuBizSuppliersInfoForm-openingBankNo" name="openingBankNo">
<a-input v-model:value="formData.openingBankNo" placeholder="请输入开户行账号" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="资质照片" v-bind="validateInfos.imgPath" id="NuBizSuppliersInfoForm-imgPath" name="imgPath">
<j-image-upload :fileMax="1" v-model:value="formData.imgPath" ></j-image-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../NuBizSuppliersInfo.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersName: '',
suppliersNature: '',
suppliersAddress: '',
personInCharge: '',
contactNumber: '',
supplyState: '',
openingBank: '',
openingBankNo: '',
imgPath: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" :bodyStyle="{ padding: '14px' }" @close="handleCancel">
<NuBizSuppliersInfoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuBizSuppliersInfoForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersInfoForm from './NuBizSuppliersInfoForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,176 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizSuppliersMaterialInfoForm">
<a-row>
<a-col :span="24">
<a-form-item label="供应商" v-bind="validateInfos.suppliersId" id="NuBizSuppliersMaterialInfoForm-suppliersId" name="suppliersId">
<j-dict-select-tag v-model:value="formData.suppliersId" dictCode="nu_biz_suppliers_info,suppliers_name,id" placeholder="请选择供应商" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="物料名称" v-bind="validateInfos.materialName" id="NuBizSuppliersMaterialInfoForm-materialName" name="materialName">
<a-input v-model:value="formData.materialName" placeholder="请输入物料名称" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="规格型号" v-bind="validateInfos.specificationModel" id="NuBizSuppliersMaterialInfoForm-specificationModel" name="specificationModel">
<a-input v-model:value="formData.specificationModel" placeholder="请输入规格型号" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="品牌型号" v-bind="validateInfos.brandType" id="NuBizSuppliersMaterialInfoForm-brandType" name="brandType">
<a-input v-model:value="formData.brandType" placeholder="请输入品牌型号" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="销售单价" v-bind="validateInfos.salesUnitPrice" id="NuBizSuppliersMaterialInfoForm-salesUnitPrice" name="salesUnitPrice">
<a-input-number v-model:value="formData.salesUnitPrice" placeholder="请输入销售单价" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="销售单位" v-bind="validateInfos.salesUnit" id="NuBizSuppliersMaterialInfoForm-salesUnit" name="salesUnit">
<a-input v-model:value="formData.salesUnit" placeholder="请输入销售单位" allow-clear ></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../NuBizSuppliersMaterialInfo.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersId: '',
materialName: '',
specificationModel: '',
brandType: '',
salesUnitPrice: undefined,
salesUnit: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<NuBizSuppliersMaterialInfoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuBizSuppliersMaterialInfoForm>
</j-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import NuBizSuppliersMaterialInfoForm from './NuBizSuppliersMaterialInfoForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>