style: lint格式化文件
This commit is contained in:
@ -1,189 +1,177 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="registerModal"
|
||||
title="查看采购申请"
|
||||
:width="1000"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<div class="info-box">
|
||||
<div class="sub-title">基础信息</div>
|
||||
<a-row>
|
||||
<a-col :span="12">申请单号:{{ baseInfo?.applyNumber }}</a-col>
|
||||
<a-col :span="12">申请主题:{{ baseInfo?.theme }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请日期:{{ baseInfo?.applyDate }}</a-col>
|
||||
<a-col :span="12">申请部门:{{ baseInfo?.applyDepName }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请人员:{{ baseInfo?.applyUserNames }}</a-col>
|
||||
<a-col :span="12">关联项目:{{ baseInfo?.relatedProjectName }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请单号:{{ baseInfo?.applyNumber }}</a-col>
|
||||
<a-col :span="12">申请主题:{{ baseInfo?.theme }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">备注:{{ baseInfo?.remark }}</a-col>
|
||||
</a-row>
|
||||
<BasicTable @register="registerTable" />
|
||||
<div class="table-bottom">
|
||||
<span>合计</span>
|
||||
<div>
|
||||
<span>
|
||||
总量:
|
||||
<span class="price">{{ baseInfo?.countSum }}</span>
|
||||
</span>
|
||||
<span>
|
||||
总金额:
|
||||
<span class="price">{{ baseInfo?.amountSum }}</span>
|
||||
</span>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" title="查看采购申请" :width="1000" @cancel="handleCancel">
|
||||
<div class="info-box">
|
||||
<div class="sub-title">基础信息</div>
|
||||
<a-row>
|
||||
<a-col :span="12">申请单号:{{ baseInfo?.applyNumber }}</a-col>
|
||||
<a-col :span="12">申请主题:{{ baseInfo?.theme }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请日期:{{ baseInfo?.applyDate }}</a-col>
|
||||
<a-col :span="12">申请部门:{{ baseInfo?.applyDepName }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请人员:{{ baseInfo?.applyUserNames }}</a-col>
|
||||
<a-col :span="12">关联项目:{{ baseInfo?.relatedProjectName }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">申请单号:{{ baseInfo?.applyNumber }}</a-col>
|
||||
<a-col :span="12">申请主题:{{ baseInfo?.theme }}</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">备注:{{ baseInfo?.remark }}</a-col>
|
||||
</a-row>
|
||||
<BasicTable @register="registerTable" />
|
||||
<div class="table-bottom">
|
||||
<span>合计</span>
|
||||
<div>
|
||||
<span>
|
||||
总量:
|
||||
<span class="price">{{ baseInfo?.countSum }}</span>
|
||||
</span>
|
||||
<span>
|
||||
总金额:
|
||||
<span class="price">{{ baseInfo?.amountSum }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sub-title">附件</div>
|
||||
<Upload v-if="baseInfo?.filePath" v-model:value="baseInfo.filePath" listType="dragger" :style="{ width: '200px', display: 'none' }" :showRemoveIcon="false" />
|
||||
<div style="height: 100px" v-else></div>
|
||||
<div class="sub-title">审批记录</div>
|
||||
<FlowRecord v-if="isReady" :list="workflowList" :processId="processId" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="sub-title">附件</div>
|
||||
<Upload
|
||||
v-if="baseInfo?.filePath"
|
||||
v-model:value="baseInfo.filePath"
|
||||
listType="dragger"
|
||||
:style="{ width: '200px', display: 'none' }"
|
||||
:showRemoveIcon="false"
|
||||
/>
|
||||
<div style="height: 100px" v-else></div>
|
||||
<div class="sub-title">审批记录</div>
|
||||
<FlowRecord v-if="isReady" :list="workflowList" :processId="processId" />
|
||||
</div>
|
||||
</BasicModal>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
|
||||
import Upload from '/@/components/Form/src/components/Upload.vue';
|
||||
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
|
||||
import { getCaseErpApply } from '/@/api/erp/purchase/apply';
|
||||
import { getRecordList } from '/@/api/erp/purchase/order';
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
|
||||
import Upload from '/@/components/Form/src/components/Upload.vue';
|
||||
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
|
||||
import { getCaseErpApply } from '/@/api/erp/purchase/apply';
|
||||
import { getRecordList } from '/@/api/erp/purchase/order';
|
||||
|
||||
const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '物料编码',
|
||||
dataIndex: 'code',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '物料名称',
|
||||
dataIndex: 'name',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '规格型号',
|
||||
dataIndex: 'model',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '单位',
|
||||
dataIndex: 'unitName',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '预计单价',
|
||||
dataIndex: 'price',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '申请数量',
|
||||
dataIndex: 'count',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '预计金额',
|
||||
dataIndex: 'amount',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '交付日期',
|
||||
dataIndex: 'payDate',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '用途',
|
||||
dataIndex: 'purpose',
|
||||
width: 100,
|
||||
},
|
||||
];
|
||||
const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '物料编码',
|
||||
dataIndex: 'code',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '物料名称',
|
||||
dataIndex: 'name',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '规格型号',
|
||||
dataIndex: 'model',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '单位',
|
||||
dataIndex: 'unitName',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '预计单价',
|
||||
dataIndex: 'price',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '申请数量',
|
||||
dataIndex: 'count',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '预计金额',
|
||||
dataIndex: 'amount',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '交付日期',
|
||||
dataIndex: 'payDate',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '用途',
|
||||
dataIndex: 'purpose',
|
||||
width: 100
|
||||
}
|
||||
];
|
||||
|
||||
const rowId = ref('');
|
||||
const processId = ref('');
|
||||
const workflowList = ref();
|
||||
const baseInfo = ref();
|
||||
const isReady = ref(false);
|
||||
const rowId = ref('');
|
||||
const processId = ref('');
|
||||
const workflowList = ref();
|
||||
const baseInfo = ref();
|
||||
const isReady = ref(false);
|
||||
|
||||
const [registerTable, { setTableData }] = useTable({
|
||||
title: '物品明细',
|
||||
columns,
|
||||
bordered: true,
|
||||
pagination: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
|
||||
setModalProps({
|
||||
confirmLoading: false,
|
||||
destroyOnClose: true,
|
||||
footer: null,
|
||||
showCancelBtn: false,
|
||||
showOkBtn: false,
|
||||
const [registerTable, { setTableData }] = useTable({
|
||||
title: '物品明细',
|
||||
columns,
|
||||
bordered: true,
|
||||
pagination: false
|
||||
});
|
||||
|
||||
rowId.value = data.id;
|
||||
processId.value = data.processId;
|
||||
if (processId.value) {
|
||||
const res = await getRecordList(processId.value);
|
||||
workflowList.value = [
|
||||
{
|
||||
records: res.taskRecords,
|
||||
schemaName: '当前流程',
|
||||
},
|
||||
];
|
||||
}
|
||||
isReady.value = true;
|
||||
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
|
||||
setModalProps({
|
||||
confirmLoading: false,
|
||||
destroyOnClose: true,
|
||||
footer: null,
|
||||
showCancelBtn: false,
|
||||
showOkBtn: false
|
||||
});
|
||||
|
||||
const record = await getCaseErpApply(data.id);
|
||||
baseInfo.value = record;
|
||||
setTableData(record.caseErpApplyDetailList || []);
|
||||
});
|
||||
rowId.value = data.id;
|
||||
processId.value = data.processId;
|
||||
if (processId.value) {
|
||||
const res = await getRecordList(processId.value);
|
||||
workflowList.value = [
|
||||
{
|
||||
records: res.taskRecords,
|
||||
schemaName: '当前流程'
|
||||
}
|
||||
];
|
||||
}
|
||||
isReady.value = true;
|
||||
|
||||
const handleCancel = () => {
|
||||
isReady.value = false;
|
||||
workflowList.value = [];
|
||||
};
|
||||
const record = await getCaseErpApply(data.id);
|
||||
baseInfo.value = record;
|
||||
setTableData(record.caseErpApplyDetailList || []);
|
||||
});
|
||||
|
||||
const handleCancel = () => {
|
||||
isReady.value = false;
|
||||
workflowList.value = [];
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.info-box {
|
||||
padding: 0 16px;
|
||||
.info-box {
|
||||
padding: 0 16px;
|
||||
|
||||
:deep(.vben-basic-table) {
|
||||
height: 300px;
|
||||
:deep(.vben-basic-table) {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.ant-row {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.sub-title {
|
||||
font-weight: bold;
|
||||
margin: 15px 0 20px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.table-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
|
||||
& > div > span {
|
||||
margin-left: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ant-row {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.sub-title {
|
||||
font-weight: bold;
|
||||
margin: 15px 0 20px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.table-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
|
||||
& > div > span {
|
||||
margin-left: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,126 +1,118 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="registerModal"
|
||||
:title="getTitle"
|
||||
@ok="handleSubmit"
|
||||
@cancel="handleClose"
|
||||
:paddingRight="15"
|
||||
:bodyStyle="{ minHeight: '400px !important' }"
|
||||
>
|
||||
<SimpleForm ref="formRef" :formProps="formProps" :formModel="state.formModel" />
|
||||
</BasicModal>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||
<SimpleForm ref="formRef" :formProps="formProps" :formModel="state.formModel" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { addCaseErpApply, getCaseErpApply, updateCaseErpApply } from '/@/api/erp/purchase/apply';
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { addCaseErpApply, getCaseErpApply, updateCaseErpApply } from '/@/api/erp/purchase/apply';
|
||||
|
||||
import { formProps } from './config';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { formProps } from './config';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
const formRef = ref();
|
||||
formProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
rowId: '',
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 1200,
|
||||
const { notification } = useMessage();
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
const formRef = ref();
|
||||
formProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
rowId: ''
|
||||
});
|
||||
const viewformProps = cloneDeep(formProps);
|
||||
setDisabled(viewformProps.schemas);
|
||||
formRef.value.setProps(state.isView ? viewformProps : formProps);
|
||||
if (state.isUpdate || state.isView) {
|
||||
state.rowId = data.id;
|
||||
const record = await getCaseErpApply(data.id);
|
||||
formRef.value.setFieldsValue(record);
|
||||
} else {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
|
||||
function setDisabled(schemas) {
|
||||
const layoutComponents = ['tab', 'grid', 'card'];
|
||||
schemas?.map((info) => {
|
||||
if (layoutComponents.includes(info.type!)) {
|
||||
info.children?.map((childInfo) => {
|
||||
childInfo.list.map((com) => {
|
||||
if (layoutComponents.includes(com.type)) {
|
||||
setDisabled(childInfo.list);
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 1200
|
||||
});
|
||||
const viewformProps = cloneDeep(formProps);
|
||||
setDisabled(viewformProps.schemas);
|
||||
formRef.value.setProps(state.isView ? viewformProps : formProps);
|
||||
if (state.isUpdate || state.isView) {
|
||||
state.rowId = data.id;
|
||||
const record = await getCaseErpApply(data.id);
|
||||
formRef.value.setFieldsValue(record);
|
||||
} else {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
|
||||
function setDisabled(schemas) {
|
||||
const layoutComponents = ['tab', 'grid', 'card'];
|
||||
schemas?.map((info) => {
|
||||
if (layoutComponents.includes(info.type!)) {
|
||||
info.children?.map((childInfo) => {
|
||||
childInfo.list.map((com) => {
|
||||
if (layoutComponents.includes(com.type)) {
|
||||
setDisabled(childInfo.list);
|
||||
} else {
|
||||
com.dynamicDisabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (info.type == 'one-for-one') {
|
||||
setDisabled(info.componentProps.childSchemas);
|
||||
} else {
|
||||
com.dynamicDisabled = true;
|
||||
info.dynamicDisabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (info.type == 'one-for-one') {
|
||||
setDisabled(info.componentProps.childSchemas);
|
||||
} else {
|
||||
info.dynamicDisabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
|
||||
// TODO custom api
|
||||
if (!state.isUpdate) {
|
||||
//false 新增
|
||||
await addCaseErpApply(values);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!'),
|
||||
}); //提示消息
|
||||
} else {
|
||||
values.id = state.rowId;
|
||||
await updateCaseErpApply(values);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!'),
|
||||
}); //提示消息
|
||||
}
|
||||
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
|
||||
// TODO custom api
|
||||
if (!state.isUpdate) {
|
||||
//false 新增
|
||||
await addCaseErpApply(values);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!')
|
||||
}); //提示消息
|
||||
} else {
|
||||
values.id = state.rowId;
|
||||
await updateCaseErpApply(values);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user