糟车销售
This commit is contained in:
90
src/api/contract/ContractSalesLng/index.ts
Normal file
90
src/api/contract/ContractSalesLng/index.ts
Normal file
@ -0,0 +1,90 @@
|
||||
import { LngContractPageModel, LngContractPageParams, LngContractPageResult } from './model/ContractSalesLngModel';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
// Page = '/contract/contractSalesLng/page',
|
||||
Page = '/magic-api/contract/contractSalesLng/page',
|
||||
List = '/contract/contractSalesLng/list',
|
||||
Info = '/contract/contractSalesLng/info',
|
||||
LngContract = '/contract/contractSalesLng',
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询LngContract分页列表
|
||||
*/
|
||||
export async function getLngContractPage(params: LngContractPageParams, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngContractPageResult>(
|
||||
{
|
||||
url: Api.Page,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取LngContract信息
|
||||
*/
|
||||
export async function getLngContract(id: String, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngContractPageModel>(
|
||||
{
|
||||
url: Api.Info,
|
||||
params: { id },
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 新增LngContract
|
||||
*/
|
||||
export async function addLngContract(lngContract: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.LngContract,
|
||||
params: lngContract,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新LngContract
|
||||
*/
|
||||
export async function updateLngContract(lngContract: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.put<boolean>(
|
||||
{
|
||||
url: Api.LngContract,
|
||||
params: lngContract,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除LngContract(批量删除)
|
||||
*/
|
||||
export async function deleteLngContract(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.delete<boolean>(
|
||||
{
|
||||
url: Api.LngContract,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
267
src/api/contract/ContractSalesLng/model/ContractSalesLngModel.ts
Normal file
267
src/api/contract/ContractSalesLng/model/ContractSalesLngModel.ts
Normal file
@ -0,0 +1,267 @@
|
||||
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||
|
||||
/**
|
||||
* @description: LngContract分页参数 模型
|
||||
*/
|
||||
export interface LngContractPageParams extends BasicPageParams {
|
||||
id: string;
|
||||
|
||||
kNo: string;
|
||||
|
||||
kName: string;
|
||||
|
||||
cpName: string;
|
||||
|
||||
onlineSign: string;
|
||||
|
||||
dateFromStart: string;
|
||||
dateFromEnd: string;
|
||||
|
||||
dateToStart: string;
|
||||
dateToEnd: string;
|
||||
|
||||
approCode: string;
|
||||
|
||||
comId: string;
|
||||
|
||||
note: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContract分页返回值模型
|
||||
*/
|
||||
export interface LngContractPageModel {
|
||||
id: string;
|
||||
|
||||
kNo: string;
|
||||
|
||||
kName: string;
|
||||
|
||||
cpName: string;
|
||||
|
||||
onlineSign: string;
|
||||
|
||||
dateFrom: string;
|
||||
|
||||
dateTo: string;
|
||||
|
||||
approCode: string;
|
||||
|
||||
comId: string;
|
||||
|
||||
note: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContract表类型
|
||||
*/
|
||||
export interface LngContractModel {
|
||||
id: number;
|
||||
|
||||
comId: number;
|
||||
|
||||
kNo: string;
|
||||
|
||||
kName: string;
|
||||
|
||||
typeCode: string;
|
||||
|
||||
onlineSign: string;
|
||||
|
||||
cpTableName: string;
|
||||
|
||||
cpCode: string;
|
||||
|
||||
cpName: string;
|
||||
|
||||
kPeriod: string;
|
||||
|
||||
dateSign: string;
|
||||
|
||||
dateFrom: string;
|
||||
|
||||
dateTo: string;
|
||||
|
||||
dateCfmFrom: string;
|
||||
|
||||
dateCfmTo: string;
|
||||
|
||||
curCode: string;
|
||||
|
||||
amountDesc: string;
|
||||
|
||||
empId: number;
|
||||
|
||||
bDeptId: number;
|
||||
|
||||
approCode: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
|
||||
lngContractSalesLngDiscList?: LngContractSalesLngDiscModel;
|
||||
|
||||
lngContractSalesLngList?: LngContractSalesLngModel;
|
||||
|
||||
lngContractSalesLngQtyList?: LngContractSalesLngQtyModel;
|
||||
|
||||
lngContractSalesLngStaList?: LngContractSalesLngStaModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContractSalesLngDisc表类型
|
||||
*/
|
||||
export interface LngContractSalesLngDiscModel {
|
||||
id: number;
|
||||
|
||||
kId: number;
|
||||
|
||||
discTypeCode: string;
|
||||
|
||||
dateFrom: string;
|
||||
|
||||
dateTo: string;
|
||||
|
||||
discDesc: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContractSalesLng表类型
|
||||
*/
|
||||
export interface LngContractSalesLngModel {
|
||||
id: number;
|
||||
|
||||
kId: number;
|
||||
|
||||
prcTypeCode: string;
|
||||
|
||||
periodTypeCode: string;
|
||||
|
||||
uomCode: string;
|
||||
|
||||
allStaSign: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContractSalesLngQty表类型
|
||||
*/
|
||||
export interface LngContractSalesLngQtyModel {
|
||||
id: number;
|
||||
|
||||
kId: number;
|
||||
|
||||
dateFrom: string;
|
||||
|
||||
dateTo: string;
|
||||
|
||||
baseInc: string;
|
||||
|
||||
sort: number;
|
||||
|
||||
rateTonGj: number;
|
||||
|
||||
qtyGjMonth: number;
|
||||
|
||||
qtyTonMonth: number;
|
||||
|
||||
qtyGjDay: number;
|
||||
|
||||
qtyTonDay: number;
|
||||
|
||||
zfbyTypeCode: string;
|
||||
|
||||
zfbyValue: number;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContractSalesLngSta表类型
|
||||
*/
|
||||
export interface LngContractSalesLngStaModel {
|
||||
id: number;
|
||||
|
||||
kId: number;
|
||||
|
||||
staCode: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngContract分页返回值结构
|
||||
*/
|
||||
export type LngContractPageResult = BasicFetchResult<LngContractPageModel>;
|
||||
228
src/components/common/contractQtyLngList.vue
Normal file
228
src/components/common/contractQtyLngList.vue
Normal file
@ -0,0 +1,228 @@
|
||||
<template>
|
||||
<div style="width: 100%">
|
||||
<a-button type="primary" style="margin-bottom: 10px" @click="addContractAgree" v-if="!disabled">新增行</a-button>
|
||||
<a-table :columns="columns" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 1300}">
|
||||
<template #headerCell="{ column }">
|
||||
<template v-if="column.dataIndex == 'dateFrom'">
|
||||
<span><span class="redStyle">*</span>开始日期</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'dateTo'">
|
||||
<span><span class="redStyle">*</span>结束日期</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'baseInc'">
|
||||
<span><span class="redStyle">*</span>基础量/增量</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'sort'">
|
||||
<span><span class="redStyle">*</span>优先级</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'qtyGjMonth'">
|
||||
<span><span class="redStyle">*</span>总合同量(吉焦)</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'qtyTonMonth'">
|
||||
<span><span class="redStyle">*</span>总合同量(吨)</span>
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'dateFrom'">
|
||||
<a-date-picker v-model:value="record.dateFrom" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" :disabled="disabled" @change="dateFromTb(dayjs(record.dateFrom || null), index, record)" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'dateTo'">
|
||||
<a-date-picker v-model:value="record.dateTo" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" :disabled="disabled" @change="dateToTb(dayjs(record.dateTo || null), index, record)" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'sort'">
|
||||
<a-input-number v-model:value="record.sort" :disabled="disabled" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'baseInc'">
|
||||
<a-select v-model:value="record.baseInc" :disabled="disabled" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.baseIncList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'rateTonGj'">
|
||||
<a-input-number v-model:value="record.rateTonGj" v-if="!disabled"
|
||||
:formatter="value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
||||
:disabled="disabled" :min="0" @change="numChange('rateTonGj', record, index)" style="width: 100%" />
|
||||
<div v-else>{{ Number.format(Number.parse(record.rateTonGj || 0),numFormat) }}</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyGjMonth'">
|
||||
<a-input-number v-model:value="record.qtyGjMonth" v-if="!disabled"
|
||||
:precision="3" :formatter="value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
||||
:disabled="disabled" :min="0" @change="numChange('qtyGjMonth', record, index)" style="width: 100%" />
|
||||
<div v-else>{{ Number.format(Number.parse(record.qtyGjMonth || 0),numFormat) }}</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyTonMonth'">
|
||||
<a-input-number v-model:value="record.qtyTonMonth" v-if="!disabled"
|
||||
:precision="3" :formatter="value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
||||
:disabled="disabled" :min="0" @change="numChange('qtyTonMonth', record, index)" style="width: 100%" />
|
||||
<div v-else>{{ Number.format(Number.parse(record.qtyTonMonth || 0),numFormat) }}</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'zfbyTypeCode'">
|
||||
<a-select v-model:value="record.zfbyTypeCode" :disabled="disabled" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.zfbyTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyGjDay'">
|
||||
{{ Number.format(Number.parse(record.qtyGjDay || 0),numFormat) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyTonDay'">
|
||||
{{ Number.format(Number.parse(record.qtyTonDay || 0),numFormat) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'zfbyValue'">
|
||||
<a-input-number v-model:value="record.zfbyValue" :disabled="disabled" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'note'">
|
||||
<a-input v-model:value="record.note" :disabled="disabled" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck(record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { ref, watch} from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { message } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const router = useRouter();
|
||||
const numFormat = "###,###,###,###,###,###.000"
|
||||
const { t } = useI18n();
|
||||
const dataListContractAgree = ref([])
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('开始日期'), dataIndex: 'dateFrom', width:160},
|
||||
{ title: t('结束日期'), dataIndex: 'dateTo', width: 160},
|
||||
{ title: t('基础量/增量'), dataIndex: 'baseInc', width: 130},
|
||||
{ title: t('优先级'), dataIndex: 'sort', width: 100},
|
||||
{ title: t('比值(吨/吉焦)'), dataIndex: 'rateTonGj', width: 150},
|
||||
{ title: t('总合同量(吉焦)'), dataIndex: 'qtyGjMonth', width: 150},
|
||||
{ title: t('总合同量(吨)'), dataIndex: 'qtyTonMonth', width: 150},
|
||||
{ title: t('日合同量(吉焦)'), dataIndex: 'qtyGjDay', width: 120},
|
||||
{ title: t('日合同量(吨)'), dataIndex: 'qtyTonDay', width: 120},
|
||||
{ title: t('照付不议类型'), dataIndex: 'zfbyTypeCode', width: 120},
|
||||
{ title: t('照付不议比例%/量数值'), dataIndex: 'zfbyValue', width: 120},
|
||||
{ title: t('备注'), dataIndex: 'note', width: 200},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
|
||||
]);;
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const props = defineProps({
|
||||
disabled: Boolean,
|
||||
list: Array,
|
||||
optionSelect: Object
|
||||
});
|
||||
const emit = defineEmits(['change']);
|
||||
|
||||
const addContractAgree = () => {
|
||||
dataListContractAgree.value.push({
|
||||
dateFrom: null, dateTo: null, rateTonGj: null, qtyGjMonth: null, qtyTonMonth: null, qtyGjDay: null, qtyTonDay: null
|
||||
})
|
||||
}
|
||||
const dateFromTb = (startValue, index, record) => {
|
||||
if (!startValue) return
|
||||
const endValue = dataListContractAgree.value[index]?.dateTo;
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
if (startValue.valueOf() > endValue.valueOf()) {
|
||||
message.warning('结束日期须大于等于开始日期')
|
||||
dataListContractAgree.value[index].dateFrom = ''
|
||||
return
|
||||
}
|
||||
dayCount(record)
|
||||
}
|
||||
|
||||
const dateToTb = (endValue, index, record) => {
|
||||
if (!endValue) return
|
||||
const startValue = dataListContractAgree.value[index]?.dateFrom;
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
if (startValue.valueOf() > endValue.valueOf()) {
|
||||
message.warning('结束日期须大于等于开始日期')
|
||||
dataListContractAgree.value.splice(index, 1, { ...dataListContractAgree.value[index], dateTo: '' });
|
||||
return
|
||||
}
|
||||
dayCount(record)
|
||||
}
|
||||
const numChange = (key, record) => {
|
||||
if (key == 'qtyGjMonth') {
|
||||
numCount2(record)
|
||||
dayCount(record)
|
||||
}
|
||||
if (key == 'qtyTonMonth') {
|
||||
numCount1(record)
|
||||
dayCount(record)
|
||||
}
|
||||
if (key == 'rateTonGj') {
|
||||
numCount1(record)
|
||||
numCount2(record)
|
||||
dayCount(record)
|
||||
}
|
||||
}
|
||||
const numCount1 = (record) => {
|
||||
// 总合同量(吉焦 =总合同量(吨)qty_ton_mont*rate_ton_gj比值(吨/吉焦)
|
||||
record.qtyGjMonth = (Number(record.qtyTonMonth) || 0) * (Number(record.rateTonGj) || 0)
|
||||
record.qtyGjMonth = record.qtyGjMonth ? record.qtyGjMonth.toFixed(3) : '0'
|
||||
}
|
||||
const numCount2 = (record) => {
|
||||
// 总合同量(吨) = 总合同量(吉焦)qty_gj_month/rate_ton_gj
|
||||
record.qtyTonMonth = Number(record.rateTonGj) ? (Number(record.qtyGjMonth) || 0) /Number(record.rateTonGj) : 0
|
||||
record.qtyTonMonth = record.qtyTonMonth ? record.qtyTonMonth.toFixed(3) : '0'
|
||||
}
|
||||
const dayCount = (record) => {
|
||||
// 日合同量(吉焦) = 总合同量(吉焦)qty_gj_month/开始日期到结束日期的天数;计算结果保留整数
|
||||
const days = dayjs(record.dateTo).diff(dayjs(record.dateFrom), 'day');
|
||||
record.qtyGjDay = days ? (Number(record.qtyGjMonth) || 0) /days : 0
|
||||
// record.qtyGjDay = parseInt(record.qtyGjDay)
|
||||
record.qtyGjDay = record.qtyGjDay ? record.qtyGjDay.toFixed(3) : '0'
|
||||
// 日合同量(吨) = 月气量(万方)/开始日期到结束日期的天数;计算结果保留4位小数;
|
||||
record.qtyTonDay = days ? (Number(record.qtyTonMonth) || 0) /days : 0
|
||||
record.qtyTonDay = record.qtyTonDay ? record.qtyTonDay.toFixed(3) : '0'
|
||||
}
|
||||
const btnCheck = (record, index) => {
|
||||
dataListContractAgree.value.splice(index, 1)
|
||||
}
|
||||
const getQtyList = () => {
|
||||
return dataListContractAgree.value
|
||||
}
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columns.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.list,
|
||||
async (val) => {
|
||||
dataListContractAgree.value = val || []
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
defineExpose({
|
||||
getQtyList,
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.redStyle {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onAppro">关联签报</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false" :scroll="{x: 500}">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'file'">
|
||||
<div v-for="item in (record.lngFileUploadList )">
|
||||
@ -33,13 +33,13 @@
|
||||
const { t } = useI18n();
|
||||
const dataList = ref([])
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 100},
|
||||
{ title: t('标题'), dataIndex: 'title', width:100},
|
||||
{ title: t('编号'), dataIndex: 'code', },
|
||||
{ title: t('签报类型'), dataIndex: 'typeName', width: 140},
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 50},
|
||||
{ title: t('标题'), dataIndex: 'title',},
|
||||
{ title: t('编号'), dataIndex: 'code', width: 100 },
|
||||
{ title: t('签报类型'), dataIndex: 'typeName', width: 100},
|
||||
{ title: t('拟稿人'), dataIndex: 'empName', width: 140},
|
||||
{ title: t('拟稿人所属部门'), dataIndex: 'bDeptName', width: 140},
|
||||
{ title: t('拟稿时间'), dataIndex: 'dateAppro', width: 140},
|
||||
{ title: t('拟稿人所属部门'), dataIndex: 'bDeptName', width: 180},
|
||||
{ title: t('拟稿时间'), dataIndex: 'dateAppro', width: 180},
|
||||
{ title: t('附件'), dataIndex: 'file', width: 140},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
|
||||
140
src/components/common/discountList.vue
Normal file
140
src/components/common/discountList.vue
Normal file
@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<div style="width: 100%">
|
||||
<a-button type="primary" style="margin-bottom: 10px" @click="add" v-if="!disabled">新增行</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<template #headerCell="{ column }">
|
||||
<template v-if="column.dataIndex == 'dateFrom'">
|
||||
<span><span class="redStyle">*</span>开始日期</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex == 'dateTo'">
|
||||
<span><span class="redStyle">*</span>结束日期</span>
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'dateFrom'">
|
||||
<a-date-picker v-model:value="record.dateFrom" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" :disabled="disabled" @change="dateFromTb(dayjs(record.dateFrom || null), index, record)" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'dateTo'">
|
||||
<a-date-picker v-model:value="record.dateTo" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" :disabled="disabled" @change="dateToTb(dayjs(record.dateTo || null), index, record)" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'discTypeCode'">
|
||||
<a-select v-model:value="record.discTypeCode" :disabled="disabled" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.discTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'discDesc'">
|
||||
<a-input v-model:value="record.discDesc" :disabled="disabled" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'note'">
|
||||
<a-input v-model:value="record.note" :disabled="disabled" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck(record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { ref, watch} from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { message } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const router = useRouter();
|
||||
const numFormat = "###,###,###,###,###,###.000"
|
||||
const { t } = useI18n();
|
||||
const dataList = ref([])
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('返优惠类型'), dataIndex: 'discTypeCode', width: 100},
|
||||
{ title: t('开始日期'), dataIndex: 'dateFrom', width:160},
|
||||
{ title: t('结束日期'), dataIndex: 'dateTo', width: 160},
|
||||
{ title: t('优惠说明'), dataIndex: 'discDesc', width: 130},
|
||||
{ title: t('备注'), dataIndex: 'note', width: 200},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const props = defineProps({
|
||||
disabled: Boolean,
|
||||
list: Array,
|
||||
optionSelect: Object
|
||||
});
|
||||
const emit = defineEmits(['change']);
|
||||
|
||||
const add = () => {
|
||||
dataList.value.push({
|
||||
dateFrom: null, dateTo: null, discTypeCode: null, discDesc: null, note: null
|
||||
})
|
||||
}
|
||||
const dateFromTb = (startValue, index, record) => {
|
||||
if (!startValue) return
|
||||
const endValue = dataList.value[index]?.dateTo;
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
if (startValue.valueOf() > endValue.valueOf()) {
|
||||
message.warning('结束日期须大于等于开始日期')
|
||||
dataList.value[index].dateFrom = ''
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const dateToTb = (endValue, index, record) => {
|
||||
if (!endValue) return
|
||||
const startValue = dataList.value[index]?.dateFrom;
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
if (startValue.valueOf() > endValue.valueOf()) {
|
||||
message.warning('结束日期须大于等于开始日期')
|
||||
dataList.value.splice(index, 1, { ...dataList.value[index], dateTo: '' });
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
const btnCheck = (record, index) => {
|
||||
dataList.value.splice(index, 1)
|
||||
}
|
||||
const getDataList = () => {
|
||||
return dataList.value
|
||||
}
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columns.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.list,
|
||||
async (val) => {
|
||||
dataList.value = val || []
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
defineExpose({
|
||||
getDataList,
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.redStyle {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
105
src/components/common/lngStationList.vue
Normal file
105
src/components/common/lngStationList.vue
Normal file
@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div style="width: 100%">
|
||||
<a-button type="primary" style="margin-bottom: 10px" @click="add" v-if="!disabled">新增行</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'staName'">
|
||||
<a-input-search v-model:value="record.staName" readonly :disabled="isEdit" @search="onSearch(index, record)"/>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'note'">
|
||||
<a-input v-model:value="record.note" :disabled="isEdit" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck(record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<lngStationModal @register="register" @success="handleSuccess"></lngStationModal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { ref, watch} from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { message } from 'ant-design-vue';
|
||||
import lngStationModal from '/@/components/common/lngStationModal.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const dataList = ref([])
|
||||
const curIdx = ref(null)
|
||||
const curCode = ref('')
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('气源地'), dataIndex: 'staName', width:300},
|
||||
{ title: t('备注'), dataIndex: 'note'},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const props = defineProps({
|
||||
disabled: Boolean,
|
||||
isEdit: Boolean,
|
||||
list: Array,
|
||||
optionSelect: Object
|
||||
});
|
||||
const emit = defineEmits(['change']);
|
||||
|
||||
const add = () => {
|
||||
curIdx.value = null
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const onSearch = (idx, record) => {
|
||||
curIdx.value = idx
|
||||
curCode.value = record.staCode
|
||||
openModal(true,{isUpdate: false,curCode: curCode.value, list: dataList.value})
|
||||
}
|
||||
const handleSuccess = (val) => {
|
||||
if (!dataList.value.length) {
|
||||
dataList.value = [{staCode: val[0].code, staName: val[0].fullName, note: val[0].note}]
|
||||
return
|
||||
}
|
||||
if (curIdx.value != null) {
|
||||
dataList.value[curIdx.value] = {staCode: val[0].code, staName: val[0].fullName, note: val[0].note}
|
||||
return
|
||||
}
|
||||
dataList.value.push({staCode: val[0].code, staName: val[0].fullName, note: val[0].note})
|
||||
}
|
||||
|
||||
const btnCheck = (record, index) => {
|
||||
dataList.value.splice(index, 1)
|
||||
}
|
||||
const getDataList = () => {
|
||||
return dataList.value
|
||||
}
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columns.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.list,
|
||||
async (val) => {
|
||||
dataList.value = val || []
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
defineExpose({
|
||||
getDataList,
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
115
src/components/common/lngStationModal.vue
Normal file
115
src/components/common/lngStationModal.vue
Normal file
@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit" @cancel="handleCancel"
|
||||
@visible-change="handleVisibleChange" >
|
||||
<BasicTable @register="registerTable" class="lngStationModal"></BasicTable>
|
||||
</BasicModal>
|
||||
</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 { addCodeRule, getCodeRuleInfo, editCodeRule } from '/@/api/system/code';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { getLngBStationLngPage } from '/@/api/mdm/LNGStation';
|
||||
|
||||
const { t } = useI18n();
|
||||
const codeFormSchema: FormSchema[] = [
|
||||
{ field: 'fullName', label: '名称', component: 'Input'},
|
||||
];
|
||||
|
||||
const columns: BasicColumn[] = [
|
||||
{ dataIndex: 'code', title: '编码', componentType: 'input', width: 120,align: 'left', },
|
||||
{ dataIndex: 'fullName', title: '名称', componentType: 'input', align: 'left', },
|
||||
{ dataIndex: 'note', title: '备注', componentType: 'input', align: 'left', },
|
||||
];
|
||||
|
||||
const emit = defineEmits(['success', 'register', 'cancel']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const selectedValues = ref([]);
|
||||
const props = defineProps({
|
||||
selectType: { type: String, default: 'radio' },
|
||||
});
|
||||
const list = ref([])
|
||||
const curCode = ref()
|
||||
const type = ref('')
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
|
||||
setModalProps({ confirmLoading: false });
|
||||
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
list.value = data.list || []
|
||||
curCode.value = data.curCode
|
||||
});
|
||||
|
||||
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
||||
title: t('列表'),
|
||||
api: getLngBStationLngPage,
|
||||
columns,
|
||||
|
||||
bordered: true,
|
||||
pagination: true,
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
labelCol:{span: 9},
|
||||
schemas: codeFormSchema,
|
||||
showResetButton: true,
|
||||
},
|
||||
immediate: false, // 设置为不立即调用
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, valid: 'Y'};
|
||||
},
|
||||
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('')));
|
||||
function handleCancel () {
|
||||
emit('cancel',);
|
||||
}
|
||||
async function handleSubmit() {
|
||||
if (!selectedValues.value.length) {
|
||||
notification.warning({
|
||||
message: t('提示'),
|
||||
description: t('请选择数据')
|
||||
});
|
||||
return
|
||||
}
|
||||
// 新增
|
||||
let idx = list.value.findIndex(v=>v.staCode == selectedValues.value[0].code)
|
||||
let addFlag = !curCode.value && idx>-1
|
||||
let editFlag = curCode.value && curCode.value!==selectedValues.value[0].code && idx > -1
|
||||
if (addFlag || editFlag) {
|
||||
message.warn(selectedValues.value[0].fullName +'不可重复')
|
||||
return
|
||||
}
|
||||
|
||||
closeModal();
|
||||
emit('success', selectedValues.value, type.value);
|
||||
}
|
||||
|
||||
</script>
|
||||
<style >
|
||||
.lngStationModal .basicCol{
|
||||
position: inherit !important;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
@ -63,6 +63,9 @@ span {
|
||||
color: rgb(0 0 0 / 85%) !important;
|
||||
}
|
||||
|
||||
.ant-select-disabled .ant-select-selection-placeholder {
|
||||
display: none;
|
||||
}
|
||||
.ant-picker.ant-picker-disabled .ant-picker-input .ant-picker-suffix {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||
</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 { formProps } from './config';
|
||||
import ModalForm from './Form.vue';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const formRef = ref();
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
isCopy: false,
|
||||
rowId: '',
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
state.isCopy = !!data?.isCopy;
|
||||
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 900,
|
||||
});
|
||||
if (state.isUpdate || state.isView || state.isCopy) {
|
||||
state.rowId = data.id;
|
||||
if (state.isView) {
|
||||
await formRef.value.setDisabledForm();
|
||||
}
|
||||
await formRef.value.setFormDataFromId(state.rowId);
|
||||
} else {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
|
||||
async function saveModal() {
|
||||
let saveSuccess = false;
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
if (values !== false) {
|
||||
try {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
saveSuccess = await formRef.value.add(values);
|
||||
} else {
|
||||
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||
}
|
||||
return saveSuccess;
|
||||
} catch (error) {}
|
||||
}
|
||||
} catch (error) {
|
||||
return saveSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const saveSuccess = await saveModal();
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (saveSuccess) {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
//false 新增
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!'),
|
||||
}); //提示消息
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!'),
|
||||
}); //提示消息
|
||||
}
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
}
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
</script>
|
||||
224
src/views/contract/ContractSalesLng/components/Form.vue
Normal file
224
src/views/contract/ContractSalesLng/components/Form.vue
Normal file
@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<SimpleForm
|
||||
ref="systemFormRef"
|
||||
:formProps="data.formDataProps"
|
||||
:formModel="{}"
|
||||
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||
import { formProps, formEventConfigs ,formConfig} from './config';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { addLngContract, getLngContract, updateLngContract, deleteLngContract } from '/@/api/contract/ContractSalesLng';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||
const { currentRoute } = useRouter();
|
||||
|
||||
const RowKey = 'id';
|
||||
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||
const props = defineProps({
|
||||
fromPage: {
|
||||
type: Number,
|
||||
default: FromPageType.MENU,
|
||||
},
|
||||
});
|
||||
const systemFormRef = ref();
|
||||
const data: { formDataProps: FormDataProps } = reactive({
|
||||
formDataProps: {schemas:[]} as FormDataProps,
|
||||
});
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
});
|
||||
|
||||
let customFormEventConfigs=[];
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
||||
await mergeCustomFormRenderConfig();
|
||||
|
||||
if (props.fromPage == FromPageType.MENU) {
|
||||
setMenuPermission();
|
||||
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
} else if (props.fromPage == FromPageType.FLOW) {
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||
// 预览 无需权限,表单事件也无需执行
|
||||
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||
// 桌面设计 表单事件需要执行
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
emits('form-mounted', formProps);
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
async function mergeCustomFormRenderConfig() {
|
||||
let cloneProps=cloneDeep(formProps);
|
||||
let fEventConfigs=cloneDeep(formEventConfigs);
|
||||
if (formConfig.useCustomConfig) {
|
||||
if(props.fromPage !== FromPageType.FLOW){
|
||||
let formPath=currentRoute.value.query.formPath;
|
||||
//1.合并字段配置
|
||||
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
|
||||
//2.合并表单事件配置
|
||||
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
|
||||
}
|
||||
}
|
||||
data.formDataProps=cloneProps;
|
||||
customFormEventConfigs=fEventConfigs;
|
||||
}
|
||||
|
||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||
function setMenuPermission() {
|
||||
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
||||
}
|
||||
|
||||
// 校验form 通过返回表单数据
|
||||
async function validate() {
|
||||
let values = [];
|
||||
try {
|
||||
values = await systemFormRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (data.formDataProps.hiddenComponent?.length) {
|
||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
return values;
|
||||
}
|
||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||
async function setFormDataFromId(rowId, skipUpdate) {
|
||||
try {
|
||||
const record = await getLngContract(rowId);
|
||||
if (skipUpdate) {
|
||||
return record;
|
||||
}
|
||||
setFieldsValue(record);
|
||||
state.formModel = record;
|
||||
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||
return record;
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
// 辅助设置表单数据
|
||||
function setFieldsValue(record) {
|
||||
systemFormRef.value.setFieldsValue(record);
|
||||
}
|
||||
// 重置表单数据
|
||||
async function resetFields() {
|
||||
await systemFormRef.value.resetFields();
|
||||
}
|
||||
// 设置表单数据全部为Disabled 【查看】
|
||||
async function setDisabledForm(isDisabled) {
|
||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||
}
|
||||
// 获取行键值
|
||||
function getRowKey() {
|
||||
return RowKey;
|
||||
}
|
||||
// 更新api表单数据
|
||||
async function update({ values, rowId }) {
|
||||
try {
|
||||
values[RowKey] = rowId;
|
||||
state.formModel = values;
|
||||
let saveVal = await updateLngContract(values);
|
||||
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 新增api表单数据
|
||||
async function add(values) {
|
||||
try {
|
||||
state.formModel = values;
|
||||
let saveVal = await addLngContract(values);
|
||||
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||
try {
|
||||
const cloneProps=cloneDeep(formProps);
|
||||
customFormEventConfigs=cloneDeep(formEventConfigs);
|
||||
if (formConfig.useCustomConfig) {
|
||||
const parts = obj.formConfigKey.split('_');
|
||||
const formId=parts[1];
|
||||
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
|
||||
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
|
||||
}
|
||||
|
||||
let flowData = changeWorkFlowForm(cloneProps, obj);
|
||||
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||
data.formDataProps = buildOptionJson;
|
||||
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||
if (isViewProcess) {
|
||||
setDisabledForm(); //查看
|
||||
}
|
||||
state.formModel = formModels;
|
||||
if(formModels[RowKey]) {
|
||||
setFormDataFromId(formModels[RowKey], false)
|
||||
} else {
|
||||
setFieldsValue(formModels)
|
||||
}
|
||||
} catch (error) {}
|
||||
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
function getFormModel() {
|
||||
return systemFormRef.value.formModel
|
||||
}
|
||||
async function handleDelete(id) {
|
||||
return await deleteLngContract([id]);
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
validate,
|
||||
add,
|
||||
update,
|
||||
setFormDataFromId,
|
||||
setDisabledForm,
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
getFormModel,
|
||||
handleDelete
|
||||
});
|
||||
</script>
|
||||
747
src/views/contract/ContractSalesLng/components/config.ts
Normal file
747
src/views/contract/ContractSalesLng/components/config.ts
Normal file
@ -0,0 +1,747 @@
|
||||
import { FormProps, FormSchema } from '/@/components/Form';
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
|
||||
export const formConfig = {
|
||||
useCustomConfig: false,
|
||||
};
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
|
||||
{
|
||||
field: 'kName',
|
||||
label: '合同号/名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'cpName',
|
||||
label: '客户',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
|
||||
{
|
||||
dataIndex: 'kNo',
|
||||
title: '合同号',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'kName',
|
||||
title: '合同名称',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 200,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cpName',
|
||||
title: '客户',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'onlineSign',
|
||||
title: '竞拍',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 90,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'dateFrom',
|
||||
title: '有效期开始',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'dateTo',
|
||||
title: '有效期结束',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'approName',
|
||||
title: '状态',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 100,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'comName',
|
||||
title: '合同主体',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'note',
|
||||
title: '备注',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
//表单事件
|
||||
export const formEventConfigs = {
|
||||
0: [
|
||||
{
|
||||
type: 'circle',
|
||||
color: '#2774ff',
|
||||
text: '开始节点',
|
||||
icon: '#icon-kaishi',
|
||||
bgcColor: '#D8E5FF',
|
||||
isUserDefined: false,
|
||||
},
|
||||
{
|
||||
color: '#F6AB01',
|
||||
icon: '#icon-chushihua',
|
||||
text: '初始化表单',
|
||||
bgcColor: '#f9f5ea',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
1: [
|
||||
{
|
||||
color: '#B36EDB',
|
||||
icon: '#icon-shujufenxi',
|
||||
text: '获取表单数据',
|
||||
detail: '(新增无此操作)',
|
||||
bgcColor: '#F8F2FC',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
2: [
|
||||
{
|
||||
color: '#F8625C',
|
||||
icon: '#icon-jiazai',
|
||||
text: '加载表单',
|
||||
bgcColor: '#FFF1F1',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
3: [
|
||||
{
|
||||
color: '#6C6AE0',
|
||||
icon: '#icon-jsontijiao',
|
||||
text: '提交表单',
|
||||
bgcColor: '#F5F4FF',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
4: [
|
||||
{
|
||||
type: 'circle',
|
||||
color: '#F8625C',
|
||||
text: '结束节点',
|
||||
icon: '#icon-jieshuzhiliao',
|
||||
bgcColor: '#FFD6D6',
|
||||
isLast: true,
|
||||
isUserDefined: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
export const formProps: FormProps = {
|
||||
labelCol: { span: 3, offset: 0 },
|
||||
labelAlign: 'right',
|
||||
layout: 'horizontal',
|
||||
size: 'default',
|
||||
schemas: [
|
||||
{
|
||||
key: '5fd2021fb4364f89af03715c02e24c6e',
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入id',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'bc43e07c314b42d09479a47cb100e264',
|
||||
field: 'kNo',
|
||||
label: '合同号',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入合同号',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'ce7975ba0930445e8819dcb81327a1a8',
|
||||
field: 'kName',
|
||||
label: '合同名称',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入合同名称',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'ce8d212247424964bb200367eab4a8ac',
|
||||
field: 'cpName',
|
||||
label: '客户',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入客户',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'f3ea91406ce74686a8cbfd85b3a5ea69',
|
||||
field: 'onlineSign',
|
||||
label: '竞拍',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入竞拍',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'ce61bc1f7bd64a9cb3f994313d64f2fa',
|
||||
field: 'dateFrom',
|
||||
label: '有效期开始',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入有效期开始',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '67f46ba642c44afdbdbf10f1c86c4ee3',
|
||||
field: 'dateTo',
|
||||
label: '有效期结束',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入有效期结束',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'f149e1fc19b74d1c82b07d8447c6b73f',
|
||||
field: 'approCode',
|
||||
label: '状态',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入状态',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '2099a21542154dafb7a2d8b8fae09057',
|
||||
field: 'comId',
|
||||
label: '合同主体',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入合同主体',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'cb929d16b0ce4d60bdf30bf55e88c87d',
|
||||
field: 'note',
|
||||
label: '备注',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入备注',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '9a10c785177349a29662a3ab4cefa23e',
|
||||
label: '表格组件',
|
||||
field: 'lngContractSalesLngStaList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngContractSalesLngStaList',
|
||||
columns: [
|
||||
{
|
||||
key: 'fbf35895ffb44781a4e4b7d705b99a8b',
|
||||
title: '单行文本',
|
||||
dataIndex: 'id',
|
||||
componentType: 'Input',
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入单行文本',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
},
|
||||
},
|
||||
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
|
||||
],
|
||||
span: '24',
|
||||
preloadType: 'api',
|
||||
apiConfig: {},
|
||||
itemId: '',
|
||||
dicOptions: [],
|
||||
useSelectButton: false,
|
||||
buttonName: '选择数据',
|
||||
showLabel: true,
|
||||
showComponentBorder: true,
|
||||
showFormBorder: true,
|
||||
showIndex: false,
|
||||
isShow: true,
|
||||
multipleHeads: [],
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'c6991d84526548b39bdad4012d6fdef2',
|
||||
label: '表格组件',
|
||||
field: 'lngContractSalesLngQtyList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngContractSalesLngQtyList',
|
||||
columns: [
|
||||
{
|
||||
key: '3584c389ed484f20b69c0e8d0bd38ea5',
|
||||
title: '单行文本',
|
||||
dataIndex: 'id',
|
||||
componentType: 'Input',
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入单行文本',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
},
|
||||
},
|
||||
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
|
||||
],
|
||||
span: '24',
|
||||
preloadType: 'api',
|
||||
apiConfig: {},
|
||||
itemId: '',
|
||||
dicOptions: [],
|
||||
useSelectButton: false,
|
||||
buttonName: '选择数据',
|
||||
showLabel: true,
|
||||
showComponentBorder: true,
|
||||
showFormBorder: true,
|
||||
showIndex: false,
|
||||
isShow: true,
|
||||
multipleHeads: [],
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'c3c45fe855384fd8ae2b719ec3d7b3fe',
|
||||
label: '表格组件',
|
||||
field: 'lngContractSalesLngDiscList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngContractSalesLngDiscList',
|
||||
columns: [
|
||||
{
|
||||
key: '2d27f81a3c794524b2abeff976351cb3',
|
||||
title: '单行文本',
|
||||
dataIndex: 'id',
|
||||
componentType: 'Input',
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入单行文本',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
},
|
||||
},
|
||||
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
|
||||
],
|
||||
span: '24',
|
||||
preloadType: 'api',
|
||||
apiConfig: {},
|
||||
itemId: '',
|
||||
dicOptions: [],
|
||||
useSelectButton: false,
|
||||
buttonName: '选择数据',
|
||||
showLabel: true,
|
||||
showComponentBorder: true,
|
||||
showFormBorder: true,
|
||||
showIndex: false,
|
||||
isShow: true,
|
||||
multipleHeads: [],
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'aaa9a38647db471f99a49b55e264273a',
|
||||
label: '表格组件',
|
||||
field: 'lngContractSalesLngList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngContractSalesLngList',
|
||||
columns: [
|
||||
{
|
||||
key: '166269879a9848d0b6ad6d16a09b4de9',
|
||||
title: '单行文本',
|
||||
dataIndex: 'id',
|
||||
componentType: 'Input',
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入单行文本',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
},
|
||||
},
|
||||
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
|
||||
],
|
||||
span: '24',
|
||||
preloadType: 'api',
|
||||
apiConfig: {},
|
||||
itemId: '',
|
||||
dicOptions: [],
|
||||
useSelectButton: false,
|
||||
buttonName: '选择数据',
|
||||
showLabel: true,
|
||||
showComponentBorder: true,
|
||||
showFormBorder: true,
|
||||
showIndex: false,
|
||||
isShow: true,
|
||||
multipleHeads: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
showActionButtonGroup: false,
|
||||
buttonLocation: 'center',
|
||||
actionColOptions: { span: 24 },
|
||||
showResetButton: false,
|
||||
showSubmitButton: false,
|
||||
hiddenComponent: [],
|
||||
};
|
||||
580
src/views/contract/ContractSalesLng/components/createForm.vue
Normal file
580
src/views/contract/ContractSalesLng/components/createForm.vue
Normal file
@ -0,0 +1,580 @@
|
||||
<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="8">
|
||||
<a-form-item label="合同号" name="kNo">
|
||||
<a-input v-model:value="formState.kNo" :disabled="isDisable" style="width: 65%" /><a-button v-if="!isDisable" type="primary" @click="onContract">关联合同</a-button>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同名称" name="kName">
|
||||
<a-input v-model:value="formState.kName" placeholder="请输入合同名称" :disabled="isDisable"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同主体" name="comName">
|
||||
<a-input v-model:value="formState.comName" disabled />
|
||||
</a-form-item>
|
||||
</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 @change="periodTypeCodeChange">
|
||||
<a-select-option v-for="item in optionSelect.kPeriodList" :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="dateFrom">
|
||||
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="有效期结束" name="dateTo">
|
||||
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同签订日期" name="dateSign">
|
||||
<a-date-picker v-model:value="formState.dateSign" style="width: 100%" :disabled="isDisable" placeholder="请选择合同签订日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="确认函开始日" name="dateCfmFrom">
|
||||
<a-date-picker v-model:value="formState.dateCfmFrom" @change="dateCfmChange" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateCfmStart" placeholder="请选择确认函开始日" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="确认函结束日" name="dateCfmTo">
|
||||
<a-date-picker v-model:value="formState.dateCfmTo" @change="dateCfmChange" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateCfmEnd" placeholder="请选择确认函结束日" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="客户" name="cpName">
|
||||
<a-input-search v-model:value="formState.cpName" :disabled="isDisable" placeholder="请选择客户" readonly @search="onSearchCustomer"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="业务人员" name="empName">
|
||||
<a-input-search v-model:value="formState.empName" :disabled="isDisable" placeholder="请选择业务联系人" readonly @search="onSearchUser"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="业务部门" name="bDeptName">
|
||||
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="8">
|
||||
<a-form-item label="定价机制" name="prcTypeCode">
|
||||
<a-select v-model:value="formState.prcTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.prcTypeCodeList" :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="periodTypeCode">
|
||||
<a-select v-model:value="formState.periodTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.periodTypeCodeList" :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="onlineSign">
|
||||
<a-select v-model:value="formState.onlineSign" disabled style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.onlineSignList" :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="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-row>
|
||||
</Card>
|
||||
<Card title="业务信息" :bordered="false" >
|
||||
<div>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="全部气源地可用" name="allStaSign">
|
||||
<a-radio-group v-model:value="formState.allStaSign" :disabled="isDisable">
|
||||
<template v-for="item in optionSelect.onlineSignList">
|
||||
<a-radio :value="item.code" >{{item.name}}</a-radio>
|
||||
</template>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<h4>气源地列表</h4>
|
||||
<lngStationList :list="dataListStation" ref="lngStationRef" :disabled="isDisable" :isEdit="isDisable ||!formState.allStaSign|| formState.allStaSign=='Y'"></lngStationList>
|
||||
</div>
|
||||
<div>
|
||||
<h4>合同约定</h4>
|
||||
<contractQtyLngList :list="dataListContractAgree" :disabled="isDisable" :optionSelect="optionSelect" ref="contractQty"></contractQtyLngList>
|
||||
</div>
|
||||
<div>
|
||||
<h4>返优惠列表</h4>
|
||||
<discountList :list="dataListDiscount" ref="discountRef" :optionSelect="optionSelect" :disabled="isDisable"></discountList>
|
||||
</div>
|
||||
|
||||
</Card>
|
||||
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</Card>
|
||||
<Card title="关联合同信息" :bordered="false" >
|
||||
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
|
||||
</Card>
|
||||
<Card title="签报列表" :bordered="false" >
|
||||
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
|
||||
</Card>
|
||||
</a-form>
|
||||
</div>
|
||||
<deptUserModal @register="register" @success="handleSuccess"/>
|
||||
<deptListModal @register="registerDept" @success="handleSuccessDept" />
|
||||
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
|
||||
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
|
||||
</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 { addLngContract,updateLngContract, getLngContract, getTransList, getPurList } from '/@/api/contract/ContractSalesLng';
|
||||
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import deptUserModal from '/@/components/common/deptUserModal.vue';
|
||||
import deptListModal from '/@/components/common/deptListModal.vue';
|
||||
import correlationApproList from '/@/components/common/correlationApproList.vue';
|
||||
import correlationContractFactList from '/@/components/common/correlationContractFactList.vue';
|
||||
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
|
||||
import lngStationList from '/@/components/common/lngStationList.vue';
|
||||
import customerListModal from '/@/components/common/customerListModal.vue';
|
||||
import contractQtyLngList from '/@/components/common/contractQtyLngList.vue';
|
||||
import discountList from '/@/components/common/discountList.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'ContractSales';
|
||||
const columnName = 'ContractSales'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = 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 contractQty = ref()
|
||||
const lngStationRef = ref()
|
||||
const discountRef = ref()
|
||||
const spinning = ref(false);
|
||||
const curIdx = ref(null)
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const hasDel = ref(false)
|
||||
const formState = reactive({
|
||||
approCode: 'WTJ',
|
||||
typeCode: 'SL',
|
||||
onlineSign: 'N',
|
||||
cpTableName: 'lng_customer',
|
||||
curCode: 'CNY',
|
||||
lngContractSalesLngList: [{}],
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerDept, { openModal:openModalDept}] = useModal();
|
||||
const [registerContractFact, { openModal:openModalContractFact}] = useModal();
|
||||
const [registerDownLoad, { openModal:openModalDownLoad}] = useModal();
|
||||
const [registerCustomer, { openModal:openModalCustomer}] = useModal();
|
||||
const rules= reactive({
|
||||
kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
prcTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
uomCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dateTo:[{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dateFrom:[{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
allStaSign:[{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
periodTypeCode:[{ required: false, message: "该项为必填项", trigger: 'change' }],
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
}
|
||||
const dataListContractAgree = ref([])
|
||||
const dataListStation = ref([])
|
||||
const dataListDiscount = ref([])
|
||||
const dataFile = ref([]);
|
||||
const dataListAppro = ref([])
|
||||
const dataListContractFact = ref([])
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
kPeriodList: [],
|
||||
prcTypeCodeList: [],
|
||||
periodTypeCodeList: [],
|
||||
onlineSignList: [],
|
||||
discTypeCodeList: [],
|
||||
baseIncList: [],
|
||||
zfbyTypeCodeList: []
|
||||
});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
} else {
|
||||
formState.empName = userInfo.name
|
||||
formState.empId = userInfo.id
|
||||
formState.tel = userInfo.mobile
|
||||
}
|
||||
|
||||
});
|
||||
const periodTypeCodeChange = (val) => {
|
||||
if (val !== 'Y') {
|
||||
formState.dateFrom = dayjs('2000-01-01')
|
||||
formState.dateTo = dayjs('2999-12-31')
|
||||
}
|
||||
}
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngContract(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataListContractAgree.value, formState.lngContractSalesLngQtyList || [])
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
Object.assign(dataListContractFact.value, formState.lngContractFactRelList || [])
|
||||
Object.assign(dataListAppro.value, formState.lngContractApproRelList || [])
|
||||
Object.assign(dataListStation.value, formState.lngContractSalesLngStaList || [])
|
||||
Object.assign(dataListDiscount.value, formState.lngContractSalesLngDiscList || [])
|
||||
formState.dateCfmFrom = formState.dateCfmFrom ? dayjs(formState.dateCfmFrom) : null
|
||||
formState.dateCfmTo = formState.dateCfmTo ? dayjs(formState.dateCfmTo) : null
|
||||
formState.dateSign = formState.dateSign ? dayjs(formState.dateSign) : null
|
||||
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
|
||||
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
|
||||
formState.prcTypeCode = (formState?.lngContractSalesLngList[0] || {}).prcTypeCode
|
||||
formState.periodTypeCode = (formState?.lngContractSalesLngList[0] || {}).periodTypeCode
|
||||
formState.uomCode = (formState?.lngContractSalesLngList[0] || {}).uomCode
|
||||
formState.allStaSign = (formState?.lngContractSalesLngList[0] || {}).allStaSign
|
||||
|
||||
dataListContractAgree.value.forEach(v => {
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom) : null
|
||||
v.dateTo = v.dateTo ? dayjs(v.dateTo) : null
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.log(error, 'error')
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.kPeriodList = await getDictionary('LNG_K_PER')
|
||||
optionSelect.prcTypeCodeList = await getDictionary('LNG_PRC')
|
||||
optionSelect.periodTypeCodeList = await getDictionary('LNG_PRC_P')
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.onlineSignList = await getDictionary('LNG_YN')
|
||||
optionSelect.discTypeCodeList = await getDictionary('LNG_DISC')
|
||||
optionSelect.baseIncList = await getDictionary('LNG_BASE')
|
||||
optionSelect.zfbyTypeCodeList = await getDictionary('LNG_ZFBY')
|
||||
|
||||
|
||||
if (!pageId.value) {
|
||||
const res = await getCompDept(userInfo.id)
|
||||
formState.bDeptName = res?.dept?.name
|
||||
formState.bDeptId = res?.dept?.id
|
||||
|
||||
formState.comName = res?.comp?.name
|
||||
formState.comId = res?.comp?.id
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const dateCfmChange = (val) => {
|
||||
if (formState.dateCfmFrom || formState.dateCfmTo) {
|
||||
rules.periodTypeCode = [{ required: true, message: "该项为必填项", trigger: 'change' }]
|
||||
} else {
|
||||
rules.periodTypeCode = [{ required: false, message: "该项为必填项", trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
|
||||
const getApproList = (val) => {
|
||||
dataListAppro.value = val
|
||||
}
|
||||
const getApproContractFactList = (val) => {
|
||||
console.log(val, 'dataListContractFact')
|
||||
dataListContractFact.value = val
|
||||
}
|
||||
const disabledDateStart = (startValue) => {
|
||||
const endValue = formState?.dateTo;
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
return startValue.valueOf() >= endValue.valueOf();
|
||||
}
|
||||
const disabledDateEnd = (endValue) => {
|
||||
const startValue = formState?.dateFrom;
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
const disabledDateCfmStart = (startValue) => {
|
||||
const endValue = formState?.dateCfmTo;
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
return startValue.valueOf() >= endValue.valueOf();
|
||||
}
|
||||
const disabledDateCfmEnd = (endValue) => {
|
||||
const startValue = formState?.dateCfmFrom;
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
const onSearch = (val)=> {
|
||||
openModalDept(true,{isUpdate: false})
|
||||
}
|
||||
const onSearchCustomer = () => {
|
||||
openModalCustomer(true,{isUpdate: false})
|
||||
}
|
||||
const onSearchUser = (val)=> {
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const onContract = (val)=> {
|
||||
openModalContractFact(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleSuccess = (val) => {
|
||||
formState.empName = val[0].name
|
||||
formState.empId = val[0].id
|
||||
formState.tel = val[0].mobile
|
||||
}
|
||||
const handleSuccessDept = (val, info) => {
|
||||
formState.bDeptName = val[0].name
|
||||
formState.bDeptId = val[0].id
|
||||
|
||||
formState.comName = info.name
|
||||
formState.comId = info.id
|
||||
}
|
||||
const handleSuccessCustomer = (val) => {
|
||||
formState.cpCode = val[0].cuCode
|
||||
formState.cpName = val[0].cuName
|
||||
}
|
||||
const handleSuccessContractFact = (val) => {
|
||||
val.forEach(v => {
|
||||
v.id = null
|
||||
})
|
||||
if (!dataListContractFact.value.length) {
|
||||
dataListContractFact.value = val
|
||||
return
|
||||
}
|
||||
let arr = []
|
||||
val.forEach(v => {
|
||||
dataListContractFact.value.forEach(i => {
|
||||
if (v.kNo == i.kNo){
|
||||
message.warning(v.kNo + '已重复, 合同不需要重复选择')
|
||||
} else {
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
})
|
||||
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
|
||||
}
|
||||
function unique(arr, u_key) {
|
||||
const map = new Map()
|
||||
arr.forEach((item, index) => {
|
||||
if (!map.has(item[u_key])) {
|
||||
map.set(item[u_key], item)
|
||||
}
|
||||
})
|
||||
return [...map.values()]
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
}
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
let arr = contractQty.value.getQtyList()
|
||||
for(let i=0; i<arr.length; i++) {
|
||||
let isFlag = !arr[i].dateFrom || !arr[i].dateTo || !arr[i].baseInc || arr[i].qtyGjMonth == null || arr[i].qtyGjMonth === ''|| arr[i].qtyTonMonth == null || arr[i].qtyTonMonth === ''
|
||||
if (isFlag) {
|
||||
message.warn('请完善合同约定必选项')
|
||||
return
|
||||
}
|
||||
arr[i].dateFrom = dayjs(arr[i].dateFrom).format('YYYY-MM-DD HH:mm:ss')
|
||||
arr[i].dateTo = dayjs(arr[i].dateTo).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
dataListAppro.value.forEach((v,idx)=>{
|
||||
v.tableName = 'Ing_contract'
|
||||
v.sort = idx
|
||||
})
|
||||
dataListContractFact.value.forEach((v,idx)=> {
|
||||
v.sort = idx
|
||||
})
|
||||
let arrDic = discountRef.value.getDataList()
|
||||
let arrSta = lngStationRef.value.getDataList()
|
||||
|
||||
let obj = {
|
||||
...formState,
|
||||
lngContractSalesLngDiscList: arrDic,
|
||||
lngContractSalesLngStaList: arrSta,
|
||||
lngContractSalesLngQtyList: arr,
|
||||
lngFileUploadList: dataFile.value,
|
||||
lngContractFactRelList: dataListContractFact.value,
|
||||
lngContractApproRelList: dataListAppro.value,
|
||||
lngContractSalesLngList: [
|
||||
{
|
||||
...formState.lngContractSalesLngList[0],
|
||||
"kId": formState.id,
|
||||
"prcTypeCode": formState.prcTypeCode,
|
||||
"periodTypeCode": formState.periodTypeCode,
|
||||
"uomCode": formState.uomCode,
|
||||
allStaSign: formState.allStaSign
|
||||
}
|
||||
],
|
||||
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngContract :updateLngContract
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
// 新增保存
|
||||
if (data?.id) {
|
||||
getInfo(data?.id)
|
||||
}
|
||||
// 同意保存不提示
|
||||
if (!type) {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: data?.id ? t('新增成功!') : t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
return data?.id ? data : obj
|
||||
|
||||
} finally {
|
||||
spinning.value = false;
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
console.log(errorInfo, 'errorInfo')
|
||||
spinning.value = false;
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: 'Tip',
|
||||
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;
|
||||
}
|
||||
.iconStyle {
|
||||
position: absolute;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
// top: 0;
|
||||
}
|
||||
.tbStyle {
|
||||
border: 1px dashed #d9d9d9;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,268 @@
|
||||
export const permissionList = [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: 'id',
|
||||
fieldId: 'id',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '5fd2021fb4364f89af03715c02e24c6e',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '合同号',
|
||||
fieldId: 'kNo',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'bc43e07c314b42d09479a47cb100e264',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '合同名称',
|
||||
fieldId: 'kName',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'ce7975ba0930445e8819dcb81327a1a8',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '客户',
|
||||
fieldId: 'cpName',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'ce8d212247424964bb200367eab4a8ac',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '竞拍',
|
||||
fieldId: 'onlineSign',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'f3ea91406ce74686a8cbfd85b3a5ea69',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '有效期开始',
|
||||
fieldId: 'dateFrom',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'ce61bc1f7bd64a9cb3f994313d64f2fa',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '有效期结束',
|
||||
fieldId: 'dateTo',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '67f46ba642c44afdbdbf10f1c86c4ee3',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '状态',
|
||||
fieldId: 'approCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'f149e1fc19b74d1c82b07d8447c6b73f',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '合同主体',
|
||||
fieldId: 'comId',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '2099a21542154dafb7a2d8b8fae09057',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '备注',
|
||||
fieldId: 'note',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'cb929d16b0ce4d60bdf30bf55e88c87d',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngStaList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngContractSalesLngStaList',
|
||||
type: 'form',
|
||||
key: '9a10c785177349a29662a3ab4cefa23e',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngStaList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'id',
|
||||
key: 'fbf35895ffb44781a4e4b7d705b99a8b',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngQtyList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngContractSalesLngQtyList',
|
||||
type: 'form',
|
||||
key: 'c6991d84526548b39bdad4012d6fdef2',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngQtyList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'id',
|
||||
key: '3584c389ed484f20b69c0e8d0bd38ea5',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngDiscList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngContractSalesLngDiscList',
|
||||
type: 'form',
|
||||
key: 'c3c45fe855384fd8ae2b719ec3d7b3fe',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngDiscList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'id',
|
||||
key: '2d27f81a3c794524b2abeff976351cb3',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngContractSalesLngList',
|
||||
type: 'form',
|
||||
key: 'aaa9a38647db471f99a49b55e264273a',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngContractSalesLngList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'id',
|
||||
key: '166269879a9848d0b6ad6d16a09b4de9',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
506
src/views/contract/ContractSalesLng/index.vue
Normal file
506
src/views/contract/ContractSalesLng/index.vue
Normal file
@ -0,0 +1,506 @@
|
||||
<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 === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ContractSalesLngModal @register="registerModal" @success="handleSuccess" />
|
||||
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
const modalVisible = ref(false);
|
||||
const logId = ref('')
|
||||
const logPath = ref('/contract/contractSalesLng/datalog');
|
||||
import { DataLog } from '/@/components/pcitc';
|
||||
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||
|
||||
} from 'vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getLngContractPage, deleteLngContract} from '/@/api/contract/ContractSalesLng';
|
||||
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 { getLngContract } from '/@/api/contract/ContractSalesLng';
|
||||
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 ContractSalesLngModal from './components/ContractSalesLngModal.vue';
|
||||
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
|
||||
|
||||
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();
|
||||
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([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"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":"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":"approve","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":false,"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','update', 'approve','submit']);
|
||||
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 = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,update : handleUpdate,approve : handleApprove,delete : handleDelete,}
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
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 visibleApproveProcessRef = ref(false);
|
||||
const taskIdRef = ref('');
|
||||
const visibleFlowRecordModal = ref(false);
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const formName=currentRoute.value.meta?.title;
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getLngContractPage,
|
||||
rowKey: 'id',
|
||||
columns: customConfigColums,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: customSearchFormSchema,
|
||||
fieldMapToTime: [],
|
||||
showResetButton: true,
|
||||
},
|
||||
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' },
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
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,
|
||||
id: record.id,
|
||||
readonly: 1,
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: "查看"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'edit',
|
||||
id: record.id,
|
||||
disabled: 1,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// router.push({
|
||||
// path: '/form/ContractSalesLng/' + record.id + '/viewForm',
|
||||
// query: {
|
||||
// formPath: 'contract/ContractSalesLng',
|
||||
// formName: formName,
|
||||
// formId:currentRoute.value.meta.formId
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
|
||||
btnEvent[code]();
|
||||
}
|
||||
function handleDatalog (record: Recordable) {
|
||||
modalVisible.value = true
|
||||
logId.value = record.id
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: "新建"+formName,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/ContractSalesLng/0/createForm',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: "编辑"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'edit',
|
||||
id: record.id
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/ContractSalesLng/' + record.id + '/updateForm',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
function handleUpdate(record: Recordable) {
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||
query: {
|
||||
formPath: 'contract/ContractSalesLng',
|
||||
formName: "变更"+formName,
|
||||
formId:currentRoute.value.meta.formId,
|
||||
type:'update',
|
||||
id: record.id,
|
||||
processId: processId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
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]);
|
||||
}
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteLngContract(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
function handleRefresh() {
|
||||
reload();
|
||||
}
|
||||
function handleSuccess() {
|
||||
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleView(record: Recordable) {
|
||||
|
||||
dbClickRow(record);
|
||||
|
||||
}
|
||||
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 updateBtn: ActionItem[] = [];
|
||||
let approveBtn: ActionItem[] = [];
|
||||
let hasFlowRecord = false;
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['view', 'copyData'].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 (['update'].includes(button.code)) {
|
||||
updateBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
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.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.approCode == 'YSP') {
|
||||
actionsList = actionsList.concat(updateBtn);
|
||||
}
|
||||
|
||||
// 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 getLngContract(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>
|
||||
@ -71,7 +71,7 @@
|
||||
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
|
||||
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import NP from 'number-precision';
|
||||
@ -441,7 +441,7 @@
|
||||
}
|
||||
onMounted(() => {
|
||||
reload({ searchInfo: { startDate: defaultDate.value[0], endDate: defaultDate.value[1] }});
|
||||
|
||||
// DataFormat.test();
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
|
||||
@ -8,5 +8,6 @@ export const customFormConfig = {
|
||||
'contractFactApprove',
|
||||
'addContractPurPng',
|
||||
'addContractSales',
|
||||
'addContractSalesLng'
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user