价格采购申请
This commit is contained in:
290
src/views/price/PricePurPngApp/components/createForm.vue
Normal file
290
src/views/price/PricePurPngApp/components/createForm.vue
Normal file
@ -0,0 +1,290 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
<div class="page-bg-wrap formViewStyle">
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<Card title="价格申请" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="16">
|
||||
<a-form-item label="申请说明" name="appName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
||||
<a-input v-model:value="formState.appName" placeholder="请输入" :disabled="isDisable"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="定价类型" name="priceTypeCode">
|
||||
<a-select v-model:value="formState.priceTypeCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.priceTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="交易主体" name="comId">
|
||||
<a-select v-model:value="formState.comId" :disabled="isDisable || dataListPrice.length" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.comIdList" :key="item.id" :value="item.id">
|
||||
{{ item.shortName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="状态" name="approCode">
|
||||
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="说明" name="priceDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.priceDesc" :disabled="isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</Card>
|
||||
<priceInfoList :list="dataListPrice" :formState="formState" :optionSelect="optionSelect" ref="priceRef" pageType="pur" :isDisable="isDisable" :rateCode="rateCode" @change="priceChange"/>
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
|
||||
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { addLngPricePurPngApp,updateLngPricePurPngApp, getLngPricePurPngApp } from '/@/api/price/PricePurPngApp';
|
||||
import dayjs from 'dayjs';
|
||||
import { h } from 'vue';
|
||||
import { SearchOutlined } from '@ant-design/icons-vue';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import priceInfoList from '/@/components/common/priceInfoList.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { getParameter } from '/@/api/contract/ContractProc';
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'PricePurPngApp';
|
||||
const columnName = 'PricePurPngApp'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
const priceRef = ref()
|
||||
const props = defineProps({
|
||||
disabled: false,
|
||||
id: ''
|
||||
|
||||
});
|
||||
const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
const isDisable = ref(false);
|
||||
const { formPath } = currentRoute.value.query;
|
||||
const pathArr = [];
|
||||
|
||||
const tabStore = useMultipleTabStore();
|
||||
const formProps = ref(null);
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const pageType = ref(currentRoute.value.query?.type);
|
||||
const pageId = ref(currentRoute.value.query?.id)
|
||||
const spinning = ref(false);
|
||||
const curIdx = ref(null)
|
||||
const rateCode = ref()
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const formState = reactive({
|
||||
approCode: 'WTJ',
|
||||
});
|
||||
const [registerPur, { openModal:openModalPur}] = useModal();
|
||||
const rules= reactive({
|
||||
appName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
priceTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
}
|
||||
const dataFile = ref([]);
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
priceTypeCodeList: [],
|
||||
comIdList: [],
|
||||
baseIncList: []
|
||||
});
|
||||
const dataListPrice = ref([
|
||||
// {
|
||||
// lngPricePurPngAppSuDtlList: []
|
||||
// }
|
||||
])
|
||||
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(async() => {
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
}
|
||||
let a = await getParameter({code: 'RATE_M3_GJ'})||[]
|
||||
rateCode.value = a[0]?.valueNum1
|
||||
});
|
||||
|
||||
|
||||
const priceChange = (val) => {
|
||||
dataListPrice.value = val
|
||||
}
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPricePurPngApp(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
Object.assign(dataListPrice.value, formState.lngPricePurPngAppSuList || [])
|
||||
dataListPrice.value.forEach(v=> {
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom) : null
|
||||
})
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.priceTypeCodeList = await getDictionary('LNG_PRC_T')
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.baseIncList = await getDictionary('LNG_BASE')
|
||||
optionSelect.comIdList = await getAllCom() || []
|
||||
|
||||
}
|
||||
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
let priceList = priceRef.value.getList()
|
||||
for(let i=0; i<priceList.length; i++) {
|
||||
let isFlag = !priceList[i].kName || !priceList[i].dateFrom
|
||||
if (isFlag) {
|
||||
message.warn('请完善供应商价格信息必选项')
|
||||
return
|
||||
}
|
||||
let arr = priceList[i].lngPricePurPngAppSuDtlList || []
|
||||
for(let i=0; i<arr.length; i++) {
|
||||
if (!arr[i].priceCode) {
|
||||
message.warn('请完善供应商价格信息必选项')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let obj = {
|
||||
...formState,
|
||||
lngPricePurPngAppSuList: priceList,
|
||||
lngFileUploadList: dataFile.value,
|
||||
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngPricePurPngApp :updateLngPricePurPngApp
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
// 新增保存
|
||||
if (data?.id) {
|
||||
getInfo(data?.id)
|
||||
}
|
||||
// 同意保存不提示
|
||||
if (!type) {
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: data?.id ? t('新增成功!') : t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
return data?.id ? data : obj
|
||||
|
||||
} finally {
|
||||
spinning.value = false;
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
spinning.value = false;
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: '提示',
|
||||
description: '请完善信息'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleSubmit,
|
||||
getFormValue
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-form-item .ant-form-item-label) {
|
||||
width: 135px !important;
|
||||
max-width: 135px !important;
|
||||
}
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.redStyle {
|
||||
color: red;
|
||||
}
|
||||
.tbStyle {
|
||||
border: 1px dashed #d9d9d9;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -59,6 +59,9 @@
|
||||
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
@ -159,7 +162,9 @@
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
readonly: 1,
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
@ -169,18 +174,32 @@
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/PricePurPngApp/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'price/PricePurPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PricePurPngApp',
|
||||
formName: "查看"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'',
|
||||
id: record.id,
|
||||
disabled: 1,
|
||||
}
|
||||
});
|
||||
}
|
||||
// router.push({
|
||||
// path: '/form/PricePurPngApp/' + record.id + '/viewForm',
|
||||
// query: {
|
||||
// formPath: 'price/PricePurPngApp',
|
||||
// formName: formName,
|
||||
// formId:currentRoute.value.meta.formId
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +215,11 @@
|
||||
function handleAdd() {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PricePurPngApp',
|
||||
formName: "新建"+formName,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
@ -211,18 +234,41 @@
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/PricePurPngApp/' + record.id + '/updateForm',
|
||||
query: {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PricePurPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
formName: "编辑"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'edit',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/PricePurPngApp/' + record.id + '/updateForm',
|
||||
query: {
|
||||
formPath: 'price/PricePurPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function handleApprove(record: Recordable) {
|
||||
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: "审批"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
@ -283,9 +329,10 @@
|
||||
|
||||
let actionsList: ActionItem[] = [];
|
||||
let editAndDelBtn: ActionItem[] = [];
|
||||
let hasFlowRecord = false;
|
||||
let approveBtn: ActionItem[] = [];
|
||||
let hasFlowRecord = false;
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['view', 'copyData'].includes(button.code)) {
|
||||
if (['view', 'copyData', 'datalog'].includes(button.code)) {
|
||||
actionsList.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
@ -300,21 +347,42 @@
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (['approve'].includes(button.code)) {
|
||||
approveBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (button.code === 'flowRecord') hasFlowRecord = true;
|
||||
});
|
||||
if (record.workflowData?.enabled) {
|
||||
//与工作流有关联的表单
|
||||
if (record.workflowData.status) {
|
||||
actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
} else {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
} else {
|
||||
if (!record.workflowData?.processId) {
|
||||
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
// 未提交或已驳回
|
||||
if (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
|
||||
if (record.createUserId !== userInfo.id) {
|
||||
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
|
||||
idx > -1 && actionsList.splice(idx, 1)
|
||||
}
|
||||
}
|
||||
// 审批中SPZ
|
||||
if (record.workflowData?.editable) {
|
||||
actionsList = actionsList.concat(approveBtn);
|
||||
}
|
||||
|
||||
// if (record.workflowData?.enabled) {
|
||||
// //与工作流有关联的表单
|
||||
// if (record.workflowData.status) {
|
||||
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
// } else {
|
||||
// actionsList = actionsList.concat(editAndDelBtn);
|
||||
// }
|
||||
// } else {
|
||||
// if (!record.workflowData?.processId) {
|
||||
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||
// actionsList = actionsList.concat(editAndDelBtn);
|
||||
// }
|
||||
// }
|
||||
return actionsList;
|
||||
}
|
||||
function handleStartwork(record: Recordable) {
|
||||
|
||||
287
src/views/price/PriceSalesPngApp/components/createForm.vue
Normal file
287
src/views/price/PriceSalesPngApp/components/createForm.vue
Normal file
@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
<div class="page-bg-wrap formViewStyle">
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<Card title="价格申请" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="16">
|
||||
<a-form-item label="申请说明" name="appName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
||||
<a-input v-model:value="formState.appName" placeholder="请输入" :disabled="isDisable"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="定价类型" name="priceTypeCode">
|
||||
<a-select v-model:value="formState.priceTypeCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.priceTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="交易主体" name="comId">
|
||||
<a-select v-model:value="formState.comId" :disabled="isDisable || dataListPrice.length" placeholder="请选择" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.comIdList" :key="item.id" :value="item.id">
|
||||
{{ item.shortName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="状态" name="approCode">
|
||||
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="说明" name="priceDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.priceDesc" :disabled="isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</Card>
|
||||
<priceInfoList :list="dataListPrice" :formState="formState" :optionSelect="optionSelect" ref="priceRef" pageType="pur" :isDisable="isDisable" :rateCode="rateCode" @change="priceChange"/>
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
|
||||
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { addLngPricePurPngApp,updateLngPricePurPngApp, getLngPricePurPngApp } from '/@/api/price/PricePurPngApp';
|
||||
import dayjs from 'dayjs';
|
||||
import { h } from 'vue';
|
||||
import { SearchOutlined } from '@ant-design/icons-vue';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import priceInfoList from '/@/components/common/priceInfoList.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { getParameter } from '/@/api/contract/ContractProc';
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'PricePurPngApp';
|
||||
const columnName = 'PricePurPngApp'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
const priceRef = ref()
|
||||
const props = defineProps({
|
||||
disabled: false,
|
||||
id: ''
|
||||
|
||||
});
|
||||
const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
const isDisable = ref(false);
|
||||
const { formPath } = currentRoute.value.query;
|
||||
const pathArr = [];
|
||||
|
||||
const tabStore = useMultipleTabStore();
|
||||
const formProps = ref(null);
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const pageType = ref(currentRoute.value.query?.type);
|
||||
const pageId = ref(currentRoute.value.query?.id)
|
||||
const spinning = ref(false);
|
||||
const curIdx = ref(null)
|
||||
const rateCode = ref()
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const formState = reactive({
|
||||
approCode: 'WTJ',
|
||||
});
|
||||
const [registerPur, { openModal:openModalPur}] = useModal();
|
||||
const rules= reactive({
|
||||
appName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
priceTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
}
|
||||
const dataFile = ref([]);
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
priceTypeCodeList: [],
|
||||
comIdList: [],
|
||||
baseIncList: []
|
||||
});
|
||||
const dataListPrice = ref([
|
||||
// {
|
||||
// lngPricePurPngAppSuDtlList: []
|
||||
// }
|
||||
])
|
||||
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(async() => {
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
}
|
||||
let a = await getParameter({code: 'RATE_M3_GJ'})||[]
|
||||
rateCode.value = a[0]?.valueNum1
|
||||
});
|
||||
|
||||
|
||||
const priceChange = (val) => {
|
||||
dataListPrice.value = val
|
||||
}
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngPricePurPngApp(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
Object.assign(dataListPrice.value, formState.lngPricePurPngAppSuList || [])
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.priceTypeCodeList = await getDictionary('LNG_PRC_T')
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.baseIncList = await getDictionary('LNG_BASE')
|
||||
optionSelect.comIdList = await getAllCom() || []
|
||||
|
||||
}
|
||||
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
let priceList = priceRef.value.getList()
|
||||
for(let i=0; i<priceList.length; i++) {
|
||||
let isFlag = !priceList[i].kName || !priceList[i].dateFrom
|
||||
if (isFlag) {
|
||||
message.warn('请完善供应商价格信息必选项')
|
||||
return
|
||||
}
|
||||
let arr = priceList[i].lngPricePurPngAppSuDtlList || []
|
||||
for(let i=0; i<arr.length; i++) {
|
||||
if (!arr[i].priceCode) {
|
||||
message.warn('请完善供应商价格信息必选项')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let obj = {
|
||||
...formState,
|
||||
lngPricePurPngAppSuList: priceList,
|
||||
lngFileUploadList: dataFile.value,
|
||||
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngPricePurPngApp :updateLngPricePurPngApp
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
// 新增保存
|
||||
if (data?.id) {
|
||||
getInfo(data?.id)
|
||||
}
|
||||
// 同意保存不提示
|
||||
if (!type) {
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: data?.id ? t('新增成功!') : t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
return data?.id ? data : obj
|
||||
|
||||
} finally {
|
||||
spinning.value = false;
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
spinning.value = false;
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: '提示',
|
||||
description: '请完善信息'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleSubmit,
|
||||
getFormValue
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-form-item .ant-form-item-label) {
|
||||
width: 135px !important;
|
||||
max-width: 135px !important;
|
||||
}
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.redStyle {
|
||||
color: red;
|
||||
}
|
||||
.tbStyle {
|
||||
border: 1px dashed #d9d9d9;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -59,7 +59,10 @@
|
||||
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const { notification } = useMessage();
|
||||
@ -159,7 +162,9 @@
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
readonly: 1,
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
@ -169,18 +174,32 @@
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/PriceSalesPngApp/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'price/PriceSalesPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PriceSalesPngApp',
|
||||
formName: "查看"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'',
|
||||
id: record.id,
|
||||
disabled: 1,
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// router.push({
|
||||
// path: '/form/PriceSalesPngApp/' + record.id + '/viewForm',
|
||||
// query: {
|
||||
// formPath: 'price/PriceSalesPngApp',
|
||||
// formName: formName,
|
||||
// formId:currentRoute.value.meta.formId
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +215,11 @@
|
||||
function handleAdd() {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PriceSalesPngApp',
|
||||
formName: "新建"+formName,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
@ -211,18 +234,41 @@
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/PriceSalesPngApp/' + record.id + '/updateForm',
|
||||
query: {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'price/PriceSalesPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
formName: "编辑"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'edit',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/PriceSalesPngApp/' + record.id + '/updateForm',
|
||||
query: {
|
||||
formPath: 'price/PriceSalesPngApp',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function handleApprove (record: Recordable) {
|
||||
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: "审批"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
@ -283,9 +329,10 @@
|
||||
|
||||
let actionsList: ActionItem[] = [];
|
||||
let editAndDelBtn: ActionItem[] = [];
|
||||
let hasFlowRecord = false;
|
||||
let approveBtn: ActionItem[] = [];
|
||||
let hasFlowRecord = false;
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['view', 'copyData'].includes(button.code)) {
|
||||
if (['view', 'copyData','datalog'].includes(button.code)) {
|
||||
actionsList.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
@ -300,21 +347,41 @@
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (['approve'].includes(button.code)) {
|
||||
approveBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (button.code === 'flowRecord') hasFlowRecord = true;
|
||||
});
|
||||
if (record.workflowData?.enabled) {
|
||||
//与工作流有关联的表单
|
||||
if (record.workflowData.status) {
|
||||
actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
} else {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
} else {
|
||||
if (!record.workflowData?.processId) {
|
||||
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
// 未提交或已驳回
|
||||
if (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
|
||||
if (record.createUserId !== userInfo.id) {
|
||||
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
|
||||
idx > -1 && actionsList.splice(idx, 1)
|
||||
}
|
||||
}
|
||||
// 审批中SPZ
|
||||
if (record.workflowData?.editable) {
|
||||
actionsList = actionsList.concat(approveBtn);
|
||||
}
|
||||
// if (record.workflowData?.enabled) {
|
||||
// //与工作流有关联的表单
|
||||
// if (record.workflowData.status) {
|
||||
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
// } else {
|
||||
// actionsList = actionsList.concat(editAndDelBtn);
|
||||
// }
|
||||
// } else {
|
||||
// if (!record.workflowData?.processId) {
|
||||
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||
// actionsList = actionsList.concat(editAndDelBtn);
|
||||
// }
|
||||
// }
|
||||
return actionsList;
|
||||
}
|
||||
function handleStartwork(record: Recordable) {
|
||||
|
||||
Reference in New Issue
Block a user