修改供应商流程
This commit is contained in:
parent
174842147c
commit
d0a8f2abd2
|
|
@ -33,8 +33,10 @@
|
||||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<!-- 表单区域 -->
|
<!-- 物料详情 -->
|
||||||
<NuBizSuppliersMateriallInfoModal ref="wlRegisterModal" @success="handleSuccess"></NuBizSuppliersMateriallInfoModal>
|
<NuBizSuppliersMateriallInfoModal ref="wlRegisterModal" @success="handleSuccess"></NuBizSuppliersMateriallInfoModal>
|
||||||
|
<!-- 物料配置 -->
|
||||||
|
<SuppliersWlTypeModal ref="wlTypeModal" @success="handleSuccess"></SuppliersWlTypeModal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -46,9 +48,10 @@
|
||||||
import { syncList, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersInfo.api';
|
import { syncList, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizSuppliersInfo.api';
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
import NuBizSuppliersMateriallInfoModal from './NuBizSuppliersMateriallInfoModal.vue'
|
import NuBizSuppliersMateriallInfoModal from './NuBizSuppliersMateriallInfoModal.vue'
|
||||||
|
import SuppliersWlTypeModal from './components/SuppliersWlTypeModal.vue'
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,6 +62,7 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
const queryParam = reactive<any>({});
|
const queryParam = reactive<any>({});
|
||||||
const toggleSearchStatus = ref<boolean>(false);
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
const wlRegisterModal = ref();
|
const wlRegisterModal = ref();
|
||||||
|
const wlTypeModal = ref();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
//注册table数据
|
//注册table数据
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
|
@ -70,22 +74,13 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
useSearchForm: false,
|
useSearchForm: false,
|
||||||
showIndexColumn: true,
|
showIndexColumn: true,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 120,
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: async (params) => {
|
beforeFetch: async (params) => {
|
||||||
return Object.assign(params, queryParam);
|
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,selectedRows }] = tableContext;
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys,selectedRows }] = tableContext;
|
||||||
const labelCol = reactive({
|
const labelCol = reactive({
|
||||||
|
|
@ -120,33 +115,36 @@ import { defHttp } from '/@/utils/http/axios';
|
||||||
* 合作
|
* 合作
|
||||||
*/
|
*/
|
||||||
async function handleWlType(record) {
|
async function handleWlType(record) {
|
||||||
var params = { id: record.id }
|
wlTypeModal.value.disableSubmit = false;
|
||||||
await createConfirm({
|
wlTypeModal.value.edit(record);
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认合作',
|
// var params = { id: record.id }
|
||||||
content: '是否与此供应商进行合作',
|
// await createConfirm({
|
||||||
okText: '确认',
|
// iconType: 'warning',
|
||||||
cancelText: '取消',
|
// title: '确认合作',
|
||||||
onOk: () => {
|
// content: '是否与此供应商进行合作',
|
||||||
console.log("🚀 ~ handleWlType ~ record:", record)
|
// okText: '确认',
|
||||||
// 成功回调
|
// cancelText: '取消',
|
||||||
setTimeout(() => {
|
// onOk: () => {
|
||||||
createMessage.success("更新成功!")
|
// console.log("🚀 ~ handleWlType ~ record:", record)
|
||||||
searchQuery();
|
// // 成功回调
|
||||||
}, 1000);
|
// setTimeout(() => {
|
||||||
return defHttp.post({
|
// createMessage.success("更新成功!")
|
||||||
url: '/invoicing/configSuppliersInfo/cooperationSupp',
|
// searchQuery();
|
||||||
params,
|
// }, 1000);
|
||||||
timeout: 100000
|
// return defHttp.post({
|
||||||
}).then((res) => {
|
// url: '/invoicing/configSuppliersInfo/cooperationSupp',
|
||||||
// 返回一个立即解决的Promise,确保confirm可以关闭
|
// params,
|
||||||
return Promise.resolve();
|
// timeout: 100000
|
||||||
}).catch(error => {
|
// }).then((res) => {
|
||||||
// 出错时也要确保能关闭弹出框
|
// // 返回一个立即解决的Promise,确保confirm可以关闭
|
||||||
return Promise.resolve();
|
// return Promise.resolve();
|
||||||
});
|
// }).catch(error => {
|
||||||
}
|
// // 出错时也要确保能关闭弹出框
|
||||||
});
|
// return Promise.resolve();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -180,7 +178,7 @@ async function handleWlType(record) {
|
||||||
onClick: handleWlEdit.bind(null, record),
|
onClick: handleWlEdit.bind(null, record),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '合作',
|
label: '物料配置',
|
||||||
onClick: handleWlType.bind(null, record),
|
onClick: handleWlType.bind(null, record),
|
||||||
ifShow: !record.izEnabled
|
ifShow: !record.izEnabled
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ enum Api {
|
||||||
deleteBatch = '/bizSuppliers/nuBizSuppliersMaterialInfo/deleteBatch',
|
deleteBatch = '/bizSuppliers/nuBizSuppliersMaterialInfo/deleteBatch',
|
||||||
importExcel = '/bizSuppliers/nuBizSuppliersMaterialInfo/importExcel',
|
importExcel = '/bizSuppliers/nuBizSuppliersMaterialInfo/importExcel',
|
||||||
exportXls = '/allMaterialInfo/nuBizAllMaterialInfo/exportXls',
|
exportXls = '/allMaterialInfo/nuBizAllMaterialInfo/exportXls',
|
||||||
|
saveBacthType = '/bizSuppliers/nuBizSuppliersMaterialType/saveBacthType',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,3 +71,7 @@ export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
}
|
}
|
||||||
|
export const saveBacthType = (params, isUpdate) => {
|
||||||
|
let url = Api.saveBacthType;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,230 @@
|
||||||
|
<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.suppliersName" id="NuBizSuppliersMaterialInfoForm-suppliersName" name="suppliersName">
|
||||||
|
<a-input v-model:value="formData.suppliersName" disabled></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-tree
|
||||||
|
v-model:expandedKeys="expandedKeys"
|
||||||
|
v-model:checkedKeys="checkedKeys"
|
||||||
|
checkable
|
||||||
|
:tree-data="treeData"
|
||||||
|
@check="onCheck"
|
||||||
|
>
|
||||||
|
<template #title="{ title, key }">
|
||||||
|
<span>{{ title }}</span>
|
||||||
|
</template>
|
||||||
|
</a-tree>
|
||||||
|
</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,saveBacthType } from '../NuBizSuppliersMaterialInfo.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
import type { TreeProps } from 'ant-design-vue';
|
||||||
|
import { get } from 'sortablejs';
|
||||||
|
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: '',
|
||||||
|
suppliersName: '',
|
||||||
|
|
||||||
|
suppliersNature:'',
|
||||||
|
suppliersAddress:'',
|
||||||
|
personInCharge:'',
|
||||||
|
contactNumber:'',
|
||||||
|
openingBank:'',
|
||||||
|
openingBankNo:'',
|
||||||
|
openId:'',
|
||||||
|
imgPath:'',
|
||||||
|
});
|
||||||
|
|
||||||
|
let treeData = ref<any>([]);
|
||||||
|
const expandedKeys = ref<string[]>([]);
|
||||||
|
const checkedKeys = ref<string[]>([]);
|
||||||
|
const checkedDatas = ref<string[]>([]);
|
||||||
|
|
||||||
|
function onCheck(checkedKeys, e) {
|
||||||
|
console.log('onCheck', checkedKeys, e);
|
||||||
|
checkedDatas.value = e.checkedNodes
|
||||||
|
console.log('checkedDatas', checkedDatas.value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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) {
|
||||||
|
checkedKeys.value = []
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
const tmpData = {};
|
||||||
|
record.suppliersId = record.id;
|
||||||
|
Object.keys(formData).forEach((key) => {
|
||||||
|
if(record.hasOwnProperty(key)){
|
||||||
|
tmpData[key] = record[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
});
|
||||||
|
//获取树
|
||||||
|
getTreeData()
|
||||||
|
//获取树选中的数据
|
||||||
|
getCheckedDatas(record.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取物料类型树
|
||||||
|
function getTreeData() {
|
||||||
|
const params = { izEnabled: "Y"}
|
||||||
|
defHttp.get({ url: '/invoicing/configMaterialCategory/getMaterialTreeData', params }).then(res => {
|
||||||
|
console.log("🚀 ~ getTreeData ~ res:", res)
|
||||||
|
treeData.value = res;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取树选中的数据
|
||||||
|
function getCheckedDatas(suppliersId) {
|
||||||
|
defHttp.get({ url: '/bizSuppliers/nuBizSuppliersMaterialType/list', params:{suppliersId}}).then(res => {
|
||||||
|
console.log("🚀 ~ getCheckedDatas ~ res:", res)
|
||||||
|
// treeData.value = res;
|
||||||
|
|
||||||
|
checkedKeys.value = res.records.map(item => item.materialTypeId)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
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(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const insRecord = {
|
||||||
|
suppliersId: model.suppliersId,
|
||||||
|
suppliersName: model.suppliersName,
|
||||||
|
suppliersNature:model.suppliersNature,
|
||||||
|
suppliersAddress:model.suppliersAddress,
|
||||||
|
personInCharge:model.personInCharge,
|
||||||
|
contactNumber:model.contactNumber,
|
||||||
|
openingBank:model.openingBank,
|
||||||
|
openingBankNo:model.openingBankNo,
|
||||||
|
openId:model.openId,
|
||||||
|
imgPath:model.imgPath,
|
||||||
|
list:checkedDatas.value
|
||||||
|
}
|
||||||
|
console.log("🚀 ~ submitForm ~ insRecord:", insRecord)
|
||||||
|
confirmLoading.value = false;
|
||||||
|
await saveBacthType(insRecord, 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>
|
||||||
|
|
@ -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">
|
||||||
|
<SuppliersWlTypeForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></SuppliersWlTypeForm>
|
||||||
|
<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 SuppliersWlTypeForm from './SuppliersWlTypeForm.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 = '物料配置';
|
||||||
|
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>
|
||||||
Loading…
Reference in New Issue