客户需求

This commit is contained in:
‘huanghaiixia’
2026-01-21 17:56:35 +08:00
parent b0e03cecc0
commit bdbffe4c30
18 changed files with 886 additions and 157 deletions

View File

@ -3,17 +3,44 @@ import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/dayPlan/demand/page',
// Page = '/dayPlan/demand/page',
Page = '/magic-api/dayPlan/pngDemandPageList',
List = '/dayPlan/demand/list',
Info = '/dayPlan/demand/info',
LngPngDemand = '/dayPlan/demand',
ContractList ='/magic-api/dayPlan/queryPngDemandContractList',
PointDelyList ='/magic-api/dayPlan/queryPngDemandPointDely',
Export = '/dayPlan/demand/export',
DataLog = '/dayPlan/demand/datalog',
}
export async function getLngPngDemandPointDely(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngDemandPageModel>(
{
url: Api.PointDelyList,
params: params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngPngDemand信息
*/
export async function getLngPngDemandContractList(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngDemandPageModel>(
{
url: Api.ContractList,
params: params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngPngDemand分页列表

View File

@ -88,4 +88,7 @@
:deep(.w-e-text-container) {
background-color: v-bind("props.disabled ? '#f5f5f5': '#fff'");
}
:deep(.w-e-text p img) {
margin: 0 auto;
}
</style>

View File

@ -0,0 +1,63 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<a-table bordered rowKey="id" :columns="columns" :data-source="dataList" :pagination="false" :row-selection="{ type:'radio', selectedRowKeys: selectedKeys, onChange: onSelectChange }"/>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'id', sorter: true},
{ title: t('合同名称'), dataIndex: 'kName', sorter: true},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const dataList =ref([])
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
dataList.value = data.list || []
isUpdate.value = !!data?.isUpdate;
});
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('合同列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择合同')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
</style>

View File

@ -1,112 +0,0 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="contractFactListModal"></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 { getLngContract } from '/@/api/contract/ContractSales';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{ field: 'kName', label: '合同号/名称', component: 'Input'},
];
const columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'kNo', sorter: true},
{ title: t('合同名称'), dataIndex: 'kName', sorter: true},
{ title: t('客户'), dataIndex: 'cpName', sorter: true},
{ title: t('有效期开始'), dataIndex: 'dateFrom', sorter: true},
{ title: t('有效期结束'), dataIndex: 'dateTo', sorter: true,},
{ title: t('交割点'), dataIndex: 'pointUpName', sorter: true,},
{ title: t('合同主体'), dataIndex: 'comName', sorter: true,},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('管道气销售合同列表'),
api: getLngContract,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params,approCode: 'YSP'};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('合同列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择合同')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.contractFactListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>

View File

@ -0,0 +1,63 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<a-table bordered rowKey="id" :columns="columns" :data-source="dataList" :pagination="false" :row-selection="{ type:'radio', selectedRowKeys: selectedKeys, onChange: onSelectChange }"/>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'id', sorter: true},
{ title: t('合同名称'), dataIndex: 'kName', sorter: true},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const dataList =ref([])
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
dataList.value = data.list || []
isUpdate.value = !!data?.isUpdate;
});
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('合同列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择合同')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
</style>

View File

@ -76,4 +76,24 @@ span {
.ant-form-item-label > label {
color: rgba(0, 0, 0, 0.65) !important;
}
}
.ant-table-container {
.ant-table-thead > tr > th, .ant-table-tbody > tr > td, .ant-table tfoot > tr > th, .ant-table tfoot > tr > td {
padding: 0px 8px;
height: 40px;
}
.ant-table-thead {
background: #F6F8FA;
height: 46px;
}
.ant-table-column-title {
font-weight: bold;
color: rgba(0, 0, 0, 0.85) !important;
}
.ant-table-column-sorters {
justify-content: flex-start;
display: inline-flex;
}
}

View File

@ -286,6 +286,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
title: (route) => route.query.formName
}
},
{
path: '/dayPlan/Demand/createForm',
name: 'Demand',
component: () => import('/@/views/dayPlan/Demand/components/createForm.vue'),
meta: {
title: (route) => route.query.formName
}
},
]

View File

@ -434,6 +434,9 @@
} else {
rules.dateTo = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.dateFrom = [{ required: false, message: "该项为必填项", trigger: 'change' }]
formState.dateFrom = dayjs('2000-01-01')
formState.dateTo = dayjs('2999-12-31')
}
}
const amountTypeCodeChange = (val) => {

View File

@ -16,7 +16,7 @@
</a-col>
<a-col :span="8">
<a-form-item label="合同期限" name="kPeriod">
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear>
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" @change="periodTypeCodeChange" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.kPeriodList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
@ -319,6 +319,12 @@
}
});
const periodTypeCodeChange = (val) => {
if (val !== 'Y') {
formState.dateFrom = dayjs('2000-01-01')
formState.dateTo = dayjs('2999-12-31')
}
}
const uploadListChange = (val) => {
dataFile.value = val
}

View File

@ -16,7 +16,7 @@
</a-col>
<a-col :span="8">
<a-form-item label="合同期限" name="kPeriod">
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear>
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.kPeriodList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
@ -113,9 +113,9 @@
</Card>
<Card title="业务信息" :bordered="false" >
<h4>交割点</h4>
<a-button type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="addUpLoad" v-if="!isDisable">新增</a-button>
<a-button type="primary" @click="deleteUpLoad" v-if="!isDisable">删除</a-button>
<div v-for="(item, idx) in dataListPoint" class="tbStyle">
<a-button type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="addUpLoad" v-if="!isDisable">新增</a-button>
<a-button type="primary" @click="deleteUpLoad(idx)" v-if="!isDisable">删除</a-button>
<a-row>
<a-col :span="8">
<a-form-item name="pointDelyName">
@ -339,6 +339,12 @@
}
});
const periodTypeCodeChange = (val) => {
if (val !== 'Y') {
formState.dateFrom = dayjs('2000-01-01')
formState.dateTo = dayjs('2999-12-31')
}
}
const uploadListChange = (val) => {
dataFile.value = val
}
@ -470,12 +476,12 @@
purList: []
})
}
const deleteUpLoad = () => {
const deleteUpLoad = (idx) => {
if (dataListPoint.value[dataListPoint.value.length -1].id) {
hasDel.value = true
}
if (dataListPoint.value.length == 1) return
dataListPoint.value.pop()
dataListPoint.value.splice(idx, 1)
}
const handleSuccess = (val) => {

View File

@ -58,4 +58,7 @@
font-size: 14px;
height: 440px;
}
:deep(.content-box p img) {
margin: 0 auto;
}
</style>

View File

@ -2,17 +2,17 @@
<a-row>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
<a-date-picker v-model:value="formState.datePlan" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择计划日期" />
<a-date-picker v-model:value="formState.datePlan" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择计划日期" @change="datePlanChange" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同" name="kName">
<a-input-search v-model:value="formState.kName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onSearch"/>
<a-input-search v-model:value="formState.kName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="下载点" name="fullName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
{{ formState.fullName }}
<a-col :span="8">
<a-form-item label="下载点" name="pointDelyName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-input-search v-model:value="formState.pointDelyName" :disabled="isDisable" placeholder="请选择下载点" readonly @search="onSearchUpLoad"/>
</a-form-item>
</a-col>
<a-col :span="8">
@ -89,17 +89,27 @@
</template>
</template>
</a-table>
<ContractSalesListModal @register="registerContractSales" @success="handleSuccessContractSales" selectType="radio" />
<ContractDemandListModal @register="registerContract" @success="handleSuccessContract" />
<upLoadDemandListModal @register="registerUpLoad" @success="handleSuccessUpLoad" />
</template>
<script lang="ts" setup>
import { useI18n } from '/@/hooks/web/useI18n';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import ContractSalesListModal from '/@/components/common/ContractSalesListModal.vue';
import { useModal } from '/@/components/Modal';
import ContractDemandListModal from '/@/components/common/ContractDemandListModal.vue';
import upLoadDemandListModal from '/@/components/common/upLoadDemandListModal.vue';
import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getCompDept } from '/@/api/approve/Appro';
import { useUserStore } from '/@/store/modules/user';
import { getLngPngDemandContractList, getLngPngDemandPointDely } from '/@/api/dayPlan/Demand';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { t } = useI18n();
const [registerContractSales, { openModal:openModalContractSales}] = useModal();
const [registerContract, { openModal:openModalContractSales}] = useModal();
const [registerUpLoad, { openModal:openModalUpLoad}] = useModal();
const props = defineProps({
formObj: {},
list: [],
@ -119,6 +129,12 @@
]);
const formState = reactive({})
const dataList = ref([])
const contractList = ref([])
const pointDelyList = ref([])
onMounted(async () =>{
const res = await getCompDept(userInfo.id)
formState.cuCode = res?.comp?.code
})
async function numChange () {
let num = 0;
let num1 = 1;
@ -129,11 +145,46 @@
formState.qtySalesGj = num
formState.qtySalesM3 = num1
}
const onSearch = (val)=> {
openModalContractSales(true,{isUpdate: false})
const datePlanChange = async (val) => {
if (!val) return
let obj = {
cuCode:formState.cuCode,
datePlan: dayjs(formState.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandContractList(obj)
contractList.value = res || []
if (contractList.value.length == 1) {
formState.kName = contractList.value[0].kName
formState.ksId = contractList.value[0].id
}
}
const handleSuccessContractSales = (val) => {
const onSearch = (val)=> {
if (!formState.datePlan) {
message.warn('请选择计划日期')
return
}
openModalContractSales(true,{isUpdate: false, list: contractList.value})
}
const handleSuccessContract = async(val) => {
formState.kName = val[0].kName
formState.ksId = val[0].id
let res = await getLngPngDemandPointDely({kId: formState.ksId})
pointDelyList.value = res || []
if (pointDelyList.value.length == 1) {
formState.pointDelyName = contractList.value[0].kName
formState.pointDelyCode = contractList.value[0].id
}
}
const onSearchUpLoad = (val)=> {
if (!formState.kName) {
message.warn('请选择合同')
return
}
openModalUpLoad(true,{isUpdate: false, list: pointDelyList.value})
}
const handleSuccessUpLoad = (val) => {
formState.kName = val[0].kName
formState.ksId = val[0].id
}
const disabledDateStart = (current) => {
const today = new Date();

View File

@ -51,7 +51,7 @@ export const columns: BasicColumn[] = [
title: '版本号',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
@ -60,12 +60,12 @@ export const columns: BasicColumn[] = [
title: '计划日期',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'pointDelyCode',
dataIndex: 'pointDelyName',
title: '下载点',
componentType: 'input',
align: 'left',
@ -110,7 +110,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'ksId',
dataIndex: 'ksName',
title: '合同',
componentType: 'input',
align: 'left',
@ -135,22 +135,12 @@ export const columns: BasicColumn[] = [
sorter: true,
},
{
dataIndex: 'id',
title: 'id',
dataIndex: 'approName',
title: '审批状态',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'orgId',
title: 'orgId',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
];

View File

@ -78,9 +78,9 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true,"isUse":true},{"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true,"isUse":true},{"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]);
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"提交","code":"submit","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"撤回","code":"back","icon":"ant-design:rollback-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true,"isUse":true},{"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true,"isUse":true},{"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":true,"isUse":true},{"name":"取消","code":"update","icon":"ant-design:close-outlined","isDefault":true,"isUse":true},{"name":"对比","code":"compare","icon":"ant-design:file-done-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'update', 'back', 'compare', 'submit', 'cancel']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
@ -131,7 +131,7 @@
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
@ -206,7 +206,7 @@
});
} else {
router.push({
path: '/form/Demand/0/createForm',
path: '/dayPlan/Demand/createForm',
query: {
formPath: 'dayPlan/Demand',
formName: formName,

View File

@ -36,7 +36,154 @@ export const searchFormSchema: FormSchema[] = [
},
},
];
export const columnsGd: BasicColumn[] = [
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{
dataIndex: 'daysSign',
title: '当日/次日',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'pointName',
title: '下载点',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjGd',
title: '待管道审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjXs',
title: '前审中量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjYsp',
title: '管道已审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
sorter: true,
},
];
export const columnsJsz: BasicColumn[] = [
{
dataIndex: 'catName',
title: '品种',
componentType: 'input',
align: 'left',
width: 80,
sorter: true,
},
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{
dataIndex: 'daysSign',
title: '当日/次日',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjAll',
title: '全部上报量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjJsz',
title: '待接收站审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjXs',
title: '前审中量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjYsp',
title: '管道已审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'uomName',
title: '单位',
componentType: 'input',
align: 'left',
sorter: true,
},
];
export const columns: BasicColumn[] = [

View File

@ -0,0 +1,452 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'approName'">
<a @click="btnCheck(record)">{{ record.approName }}</a>
</template>
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<PngApproModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<approStatusModal @register="registerApproStatus" ></approStatusModal>
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/pngAppro/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, } from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngPngApproPage, deleteLngPngAppro} from '/@/api/dayPlan/PngAppro';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngPngAppro,getLngPngApproPageGd, getLngPngApproPageJsz, approveLngPngApproSZ, approveLngPngApproGD, approveLngPngAppro
} from '/@/api/dayPlan/PngAppro';
import { useModal,BasicModal } from '/@/components/Modal';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import LaunchProcess from '/@/views/workflow/task/components/LaunchProcess.vue';
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
import { getDraftInfo } from '/@/api/workflow/process';
import { isValidJSON } from '/@/utils/event/design';
import PngApproModal from './components/PngApproModal.vue';
import {formConfig, searchFormSchema, columns, columnsGd, columnsJsz } from './components/config';
import Icon from '/@/components/Icon/index';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import approStatusModal from '/@/components/common/approStatusModal.vue';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true},{"isUse":true,"name":"审批通过","code":"batchapprove","icon":"ant-design:check-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve','reject']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,reject: handleReject,batchapprove: handleBatchApprove}
const { currentRoute } = useRouter();
const router = useRouter();
const path = currentRoute.value?.path
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const visibleLookProcessRef = ref(false);
const processIdRef = ref('');
const visibleLaunchProcessRef = ref(false);
const schemaIdRef = ref('');
const formDataRef = ref();
const rowKeyData = ref();
const draftsId = ref();
const selectedKeys = ref([])
const visibleApproveProcessRef = ref(false);
const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal}] = useModal();
const [registerApproStatus, { openModal: openModalApproStatus}] = useModal();
let formName='管道气销售审批';
let curPath = 'dayPlan/PngAppro/index'
let request = ''
let requestApprove = ''
if (path.includes('dayPlan/PngAppro/index')) {
formName='管道气销售审批'
curPath = 'dayPlan/PngAppro/index'
request = getLngPngApproPage
requestApprove = approveLngPngAppro
}
if (path.includes('dayPlan/pngPipeAppro/index')) {
formName='管道气管道审批'
curPath = 'dayPlan/pngPipeAppro'
request = getLngPngApproPageGd
requestApprove = approveLngPngApproGD
}
if (path.includes('dayPlan/pngReceiveStationAppro/index')) {
formName='管道气接收站审批'
curPath = 'dayPlan/pngReceiveStationAppro'
request = getLngPngApproPageJsz
requestApprove = approveLngPngApproSZ
}
const [registerTable, { reload, clearSelectedRowKeys, setTableData }] = useTable({
title: '' || (formName + '列表'),
api: request,
rowKey: 'datePlan',
columns: curPath.includes('pngPipeAppro') ? columnsGd : columnsJsz,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: [],
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true]],
showResetButton: false,
showSubmitButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
const btnCheck = (record)=> {
openModalApproStatus(true,{isUpdate: false,id:record.demandId});
}
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
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
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else {
router.push({
path: '/dayPlan/PngAppro/createForm',
query: {
formPath: curPath,
formName: formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'view'
}
});
// router.push({
// path: '/form/PngAppro/' + record.id + '/viewForm',
// query: {
// formPath: 'dayPlan/PngAppro',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
async function handleApprove(record: Recordable) {
let obj = {
"result": "C",
"remark": "",
"data": [{datePlan: record.datePlan}]
}
await requestApprove(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
}
async function handleReject (record: Recordable) {
let obj = {
"result": "R",
"remark": "",
"data": [{datePlan: record.datePlan}]
}
await requestApprove(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('已拒绝!'),
});
}
async function handleBatchApprove () {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要审批的数据'),
});
return;
}
let arr = selectedKeys.value.map(v=> {
return {
datePlan: v
}
})
let obj = {
"result": "C",
"remark": "",
"data": arr
}
await requestApprove(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
clearSelectedRowKeys()
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData', 'approve', 'reject'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
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);
// }
// }
return actionsList;
}
function handleStartwork(record: Recordable) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
}
function handleFlowRecord(record: Recordable) {
if (record.workflowData) {
visibleFlowRecordModal.value = true;
processIdRef.value = record.workflowData?.processId;
}
}
async function handleLaunchProcess(record: Recordable) {
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
if(schemaId){
if(record.workflowData?.draftId){
let res = await getDraftInfo(record.workflowData.draftId);
if (isValidJSON(res.formData)) {
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: '/flow/' + schemaId + '/'+record.workflowData.draftId+'/createFlow'
});
return;
}
}
const result = await getLngPngAppro(record['id']);
const form={};
const key="form_"+schemaId+"_"+record['id'];
form[key]=result;
localStorage.setItem('formJsonStr', JSON.stringify(form));
router.push({
path: '/flow/' + schemaId + '/0/createFlow',
query: {
fromKey: key
}
});
}
}
function handleApproveProcess(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
}
function handleCloseLaunch() {
visibleLaunchProcessRef.value = false;
reload();
}
function handleCloseApproval() {
visibleApproveProcessRef.value = false;
reload();
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>

View File

@ -149,7 +149,7 @@ export const columns: BasicColumn[] = [
title: '客户确认时间',
componentType: 'input',
align: 'left',
width: 150,
width: 180,
sorter: true,
},

View File

@ -8,6 +8,5 @@ export const customFormConfig = {
'contractFactApprove',
'addContractPurPng',
'addContractSales',
'addDemand'
],
};