采购计量
This commit is contained in:
63
src/components/common/approStatusModal.vue
Normal file
63
src/components/common/approStatusModal.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" :showOkBtn="false" :showCancelBtn="false">
|
||||
<BasicTable @register="registerTable"></BasicTable>
|
||||
</BasicModal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, nextTick } from 'vue';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { getLngSupplierPage } from '/@/api/supplier/Supplier';
|
||||
|
||||
const { t } = useI18n();
|
||||
const columns: BasicColumn[] = [
|
||||
{ dataIndex: 'suCode', title: '审批人', align: 'left', sorter: true },
|
||||
{ dataIndex: 'suName', title: '审批时间', align: 'left', sorter: true },
|
||||
{ dataIndex: 'suSname', title: '通过/驳回', align: 'left', sorter: true },
|
||||
{ dataIndex: 'dI', title: '驳回原因', align: 'left', sorter: true },
|
||||
];
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const isUpdate = ref(true);
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
|
||||
setModalProps({ confirmLoading: false });
|
||||
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
});
|
||||
|
||||
const [registerTable, {}] = useTable({
|
||||
title: t('审批状态'),
|
||||
api: getLngSupplierPage,
|
||||
columns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: [],
|
||||
|
||||
showResetButton: false,
|
||||
showSubmitButton: false
|
||||
},
|
||||
bordered: true,
|
||||
pagination: false,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showTableSetting: false,
|
||||
immediate: true, // 设置为不立即调用
|
||||
beforeFetch: (params) => {
|
||||
return { ...params,};
|
||||
},
|
||||
});
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? t('审批状态') : t('')));
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-title) {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -4,7 +4,7 @@
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="相对方名称" name="cpName" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }">
|
||||
<a-input-search v-model:value="formState.cpName" :disabled="isDisable" placeholder="请选择名称" readonly @search="onSearchUser"/>
|
||||
<a-input-search v-model:value="formState.cpName" placeholder="请选择名称" readonly @search="onSearchUser"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
@ -14,7 +14,7 @@
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="对方银行名称" name="cpBankCode" :label-col="{ span: 8 }" :wrapper-col="{ span: 24 }">
|
||||
<a-select v-model:value="formState.cpBankCode" placeholder="请选择银行名称" :disabled="isDisable" style="width: 100%" allow-clear @change="bankChange">
|
||||
<a-select v-model:value="formState.cpBankCode" placeholder="请选择银行名称" style="width: 100%" allow-clear @change="bankChange">
|
||||
<a-select-option v-for="item in optionList" :key="item.bankCode" :value="item.bankCode">
|
||||
{{ item.bankName }}
|
||||
</a-select-option>
|
||||
@ -53,7 +53,7 @@
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注" name="note" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.note" placeholder="请输入备注" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
<a-textarea v-model:value="formState.note" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -84,6 +84,7 @@ const getTitle = computed(() => (!unref(isUpdate) ? t('新增相对方') : t('
|
||||
let formState = reactive({
|
||||
});
|
||||
const list = ref()
|
||||
const curIdx = ref()
|
||||
const rules = {
|
||||
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
cpBankCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
@ -119,8 +120,8 @@ const bankChange = (val) => {
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
setModalProps({ confirmLoading: false });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDisable.value = data?.btnType == 'view' ? true : false
|
||||
list.value = data.list
|
||||
curIdx.value = data.curIdx
|
||||
if (unref(isUpdate)) {
|
||||
Object.assign(formState, {...data.record})
|
||||
getBankInfo(formState.cpCode, formState.cpTableName, 'code')
|
||||
@ -137,6 +138,17 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value.validate();
|
||||
let arr = []
|
||||
list.value.forEach(v=> {
|
||||
if (v.cpCode == formState.cpCode) {
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
let isFlag = ( curIdx.value != null && formState.cpCode!==list.value[curIdx.value].cpCode)
|
||||
if (arr.length > 0 && (curIdx.value == null || isFlag)) {
|
||||
message.warning('相对方名称:'+ arr[0].cpName + '已重复')
|
||||
return
|
||||
}
|
||||
emit('success', formState);
|
||||
notification.success({
|
||||
message: t('操作'),
|
||||
|
||||
Reference in New Issue
Block a user