客户组
This commit is contained in:
@ -3,10 +3,12 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/sales/customerGroup/page',
|
||||
// Page = '/sales/customerGroup/page',
|
||||
List = '/sales/customerGroup/list',
|
||||
Info = '/sales/customerGroup/info',
|
||||
LngCustomerGroup = '/sales/customerGroup',
|
||||
|
||||
Page = '/magic-api/sales/customerGroupPage',
|
||||
|
||||
|
||||
|
||||
|
||||
121
src/api/supplier/Supplier/index.ts
Normal file
121
src/api/supplier/Supplier/index.ts
Normal file
@ -0,0 +1,121 @@
|
||||
import { LngSupplierPageModel, LngSupplierPageParams, LngSupplierPageResult } from './model/SupplierModel';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/supplier/supplier/page',
|
||||
List = '/supplier/supplier/list',
|
||||
Info = '/supplier/supplier/info',
|
||||
LngSupplier = '/supplier/supplier',
|
||||
|
||||
|
||||
|
||||
Enable = '/supplier/supplier/enable',
|
||||
Disable= '/supplier/supplier/disable',
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询LngSupplier分页列表
|
||||
*/
|
||||
export async function getLngSupplierPage(params: LngSupplierPageParams, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngSupplierPageResult>(
|
||||
{
|
||||
url: Api.Page,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取LngSupplier信息
|
||||
*/
|
||||
export async function getLngSupplier(id: String, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngSupplierPageModel>(
|
||||
{
|
||||
url: Api.Info,
|
||||
params: { id },
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 新增LngSupplier
|
||||
*/
|
||||
export async function addLngSupplier(lngSupplier: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.LngSupplier,
|
||||
params: lngSupplier,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新LngSupplier
|
||||
*/
|
||||
export async function updateLngSupplier(lngSupplier: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.put<boolean>(
|
||||
{
|
||||
url: Api.LngSupplier,
|
||||
params: lngSupplier,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除LngSupplier(批量删除)
|
||||
*/
|
||||
export async function deleteLngSupplier(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.delete<boolean>(
|
||||
{
|
||||
url: Api.LngSupplier,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 启用数据LngSupplier
|
||||
*/
|
||||
export async function enableLngSupplier(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.Enable,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @description: 作废数据LngSupplier
|
||||
*/
|
||||
export async function disableLngSupplier(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.Disable,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
226
src/api/supplier/Supplier/model/SupplierModel.ts
Normal file
226
src/api/supplier/Supplier/model/SupplierModel.ts
Normal file
@ -0,0 +1,226 @@
|
||||
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||
|
||||
/**
|
||||
* @description: LngSupplier分页参数 模型
|
||||
*/
|
||||
export interface LngSupplierPageParams extends BasicPageParams {
|
||||
suName: string;
|
||||
|
||||
suSname: string;
|
||||
|
||||
natureCode: string;
|
||||
|
||||
typeCode: string;
|
||||
|
||||
classCode: string;
|
||||
|
||||
dI: string;
|
||||
|
||||
valid: string;
|
||||
|
||||
approCode: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplier分页返回值模型
|
||||
*/
|
||||
export interface LngSupplierPageModel {
|
||||
id: string;
|
||||
|
||||
suName: string;
|
||||
|
||||
suSname: string;
|
||||
|
||||
natureCode: string;
|
||||
|
||||
typeCode: string;
|
||||
|
||||
classCode: string;
|
||||
|
||||
dI: string;
|
||||
|
||||
valid: string;
|
||||
|
||||
approCode: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplier表类型
|
||||
*/
|
||||
export interface LngSupplierModel {
|
||||
id: number;
|
||||
|
||||
suMcode: string;
|
||||
|
||||
suCode: string;
|
||||
|
||||
suName: string;
|
||||
|
||||
suSname: string;
|
||||
|
||||
dI: string;
|
||||
|
||||
natureCode: string;
|
||||
|
||||
parentName: string;
|
||||
|
||||
creditNo: string;
|
||||
|
||||
tiNo: string;
|
||||
|
||||
representative: string;
|
||||
|
||||
amtReg: string;
|
||||
|
||||
addrReg: string;
|
||||
|
||||
addrMail: string;
|
||||
|
||||
dateEstab: string;
|
||||
|
||||
dateEntry: string;
|
||||
|
||||
classCode: string;
|
||||
|
||||
typeCode: string;
|
||||
|
||||
orgCode: string;
|
||||
|
||||
valid: string;
|
||||
|
||||
approCode: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
|
||||
lngSupplierBankList?: LngSupplierBankModel;
|
||||
|
||||
lngSupplierContactList?: LngSupplierContactModel;
|
||||
|
||||
lngSupplierDocList?: LngSupplierDocModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplierBank表类型
|
||||
*/
|
||||
export interface LngSupplierBankModel {
|
||||
id: number;
|
||||
|
||||
suCode: string;
|
||||
|
||||
bankCode: string;
|
||||
|
||||
accountName: string;
|
||||
|
||||
account: string;
|
||||
|
||||
defaultSign: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplierContact表类型
|
||||
*/
|
||||
export interface LngSupplierContactModel {
|
||||
id: number;
|
||||
|
||||
suCode: string;
|
||||
|
||||
contactName: string;
|
||||
|
||||
tel: string;
|
||||
|
||||
addrMail: string;
|
||||
|
||||
email: string;
|
||||
|
||||
position: string;
|
||||
|
||||
valid: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplierDoc表类型
|
||||
*/
|
||||
export interface LngSupplierDocModel {
|
||||
id: number;
|
||||
|
||||
suCode: string;
|
||||
|
||||
docTypeCode: string;
|
||||
|
||||
docNo: string;
|
||||
|
||||
dateFrom: string;
|
||||
|
||||
dateTo: string;
|
||||
|
||||
sort: number;
|
||||
|
||||
valid: string;
|
||||
|
||||
note: string;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: LngSupplier分页返回值结构
|
||||
*/
|
||||
export type LngSupplierPageResult = BasicFetchResult<LngSupplierPageModel>;
|
||||
138
src/components/Form/src/components/UploadList.vue
Normal file
138
src/components/Form/src/components/UploadList.vue
Normal file
@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div>
|
||||
<Upload v-if="!disabled" style="margin-bottom: 10px;" :file-list="dataFile" :showUploadList="false"
|
||||
v-model:value="tableId" v-model:tableName="tableName" v-model:columnName="columnName"
|
||||
:btnTip="btnTip" @change="changeUplod" :multiple="true" :dataDelete="true"
|
||||
:showDownloadIcon="false"/>
|
||||
<a-table :columns="columns" :data-source="dataFile" >
|
||||
<template #bodyCell="{ column,record,index, text }">
|
||||
<template v-if="column.dataIndex === 'fileOrg'">
|
||||
<a @click="handleDownload(record)">{{record.fileOrg}}</a>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'docDesc' && !disabled">
|
||||
<a-input :placeholder="t('请输入附件说明')" :disabled="disabled" v-model:value="record.docDesc" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('delete', record, index)">删除</a>
|
||||
<ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('up', record, index)" />
|
||||
<ArrowDownOutlined class="btn" @click="btnCheck('down', record, index)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import Upload from '/@/components/Form/src/components/Upload.vue';
|
||||
import {ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { nextTick, ref, watch, computed } from 'vue';
|
||||
const dataFile = ref([]);
|
||||
const { t } = useI18n();
|
||||
const columns = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
|
||||
{ title: t('附件名称'), dataIndex: 'fileOrg', sorter: true},
|
||||
{ title: t('附件说明'), dataIndex: 'docDesc', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', sorter: true},
|
||||
]);
|
||||
const tableId = ref<string>();
|
||||
const tableName = ref<string>();
|
||||
const columnName = ref<string>();
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
disabled: Boolean,
|
||||
tableName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
columnName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
maxNumber: Number,
|
||||
accept: String,
|
||||
name: String,
|
||||
multiple: Boolean,
|
||||
maxSize: Number,
|
||||
|
||||
btnTip: {
|
||||
type: String,
|
||||
default: '上传'
|
||||
},
|
||||
tip: String,
|
||||
fileList: Array,
|
||||
});
|
||||
const emit = defineEmits(['update:value', 'change', 'click', 'update:tableName', 'update:columnName']);
|
||||
function changeUplod (val) {
|
||||
dataFile.value = []
|
||||
val.forEach(v => {
|
||||
v.fileOrg = v.fileOrg || v.fileName,
|
||||
v.filePath = v.filePath || v.fileUrl,
|
||||
v.fileSize = v.fileSize
|
||||
dataFile.value.push(v)
|
||||
})
|
||||
console.log(val, 532, dataFile.value)
|
||||
}
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
const btnCheck = (btn, record, index) => {
|
||||
if (btn == 'delete') {
|
||||
dataFile.value.splice(index, 1)
|
||||
}
|
||||
if (btn == 'up') {
|
||||
if (index === 0) {
|
||||
return
|
||||
}
|
||||
dataFile.value[index] = dataFile.value.splice(index-1, 1, dataFile.value[index])[0];
|
||||
}
|
||||
if (btn == 'down') {
|
||||
if (index === dataFile.value.length - 1) {
|
||||
return
|
||||
}
|
||||
dataFile.value[index] = dataFile.value.splice(index+1, 1, dataFile.value[index])[0];
|
||||
}
|
||||
|
||||
}
|
||||
const getFileList = () => {
|
||||
return dataFile.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
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.fileList,
|
||||
async (val) => {
|
||||
dataFile.value = val || []
|
||||
tableId.value = props.value
|
||||
tableName.value = props.tableName
|
||||
columnName.value = props.columnName
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
defineExpose({
|
||||
getFileList
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.btn {
|
||||
color: #5e95ff;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@ -1,511 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="listType === 'dragger'">
|
||||
<a-upload-dragger
|
||||
:file-list="fileList"
|
||||
:maxCount="maxNumber"
|
||||
:accept="accept"
|
||||
:name="name"
|
||||
:disabled="disabled"
|
||||
:multiple="multiple"
|
||||
:beforeUpload="beforeUpload"
|
||||
listType="picture"
|
||||
:show-upload-list="{ showDownloadIcon, showPreviewIcon, showRemoveIcon }"
|
||||
@remove="handleRemove"
|
||||
@download="handleDownload"
|
||||
@preview="handlePreview"
|
||||
@drop="handleClick"
|
||||
@click="handleClick"
|
||||
class="list-upload dragger-upload"
|
||||
:style="style"
|
||||
>
|
||||
<div class="dragger-text">
|
||||
<Icon icon="ep:upload-filled" color="#5e95ff" :size="24" />
|
||||
<div class="mt-2 text-xs">点击或将文件拖拽到这里上传</div>
|
||||
</div>
|
||||
<div class="dragger-tip">{{ tip }}</div>
|
||||
</a-upload-dragger>
|
||||
</div>
|
||||
<div v-else-if="listType === 'picture'">
|
||||
<a-upload
|
||||
:file-list="fileList"
|
||||
:maxCount="maxNumber"
|
||||
:accept="accept"
|
||||
:name="name"
|
||||
:disabled="disabled"
|
||||
:multiple="multiple"
|
||||
:beforeUpload="beforeUpload"
|
||||
:listType="listType"
|
||||
:show-upload-list="{ showDownloadIcon, showPreviewIcon, showRemoveIcon }"
|
||||
@remove="handleRemove"
|
||||
@download="handleDownload"
|
||||
@preview="handlePreview"
|
||||
@click="handleClick"
|
||||
class="list-upload"
|
||||
:style="style"
|
||||
>
|
||||
<plus-outlined />
|
||||
</a-upload>
|
||||
</div>
|
||||
<a-upload
|
||||
:file-list="fileListWithHeader"
|
||||
:maxCount="maxNumber"
|
||||
:accept="accept"
|
||||
:name="name"
|
||||
:disabled="disabled"
|
||||
:multiple="multiple"
|
||||
:beforeUpload="beforeUpload"
|
||||
:listType="listType"
|
||||
:show-upload-list="showUploadList"
|
||||
@remove="handleRemove"
|
||||
@download="handleDownload"
|
||||
@preview="handlePreview"
|
||||
@click="handleClick"
|
||||
v-else
|
||||
>
|
||||
<plus-outlined v-if="listType == 'picture-card'" />
|
||||
<div :style="style" v-else>
|
||||
<a-button :loading="loading" :disabled="loading" v-if="!disabled">
|
||||
<upload-outlined />
|
||||
{{ btnTip || '点击上传' }}
|
||||
</a-button>
|
||||
<!-- <div v-if="VITE_GLOB_UPLOAD_ALERT_TIP?.trim()" style="color: red; margin-top: 8px">
|
||||
{{ VITE_GLOB_UPLOAD_ALERT_TIP }}
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<template #itemRender="{ file, actions }">
|
||||
<template v-if="file.__header && showDownloadIcon">
|
||||
<!-- <div class="file-list-header" style="display: flex; align-items: center; padding: 4px 0">
|
||||
<input type="checkbox" :checked="isAllSelected" @change="toggleSelectAll" style="margin-right: 8px" />全选
|
||||
<a-button type="primary" size="small" :disabled="!selectedIds.length" @click="handleBatchDownload" style="margin-left: 8px">批量打包下载</a-button>
|
||||
</div> -->
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-space class="file-space">
|
||||
<!-- <input v-if="showDownloadIcon" type="checkbox" :checked="selectedIds.includes(file.id)" @change="(e) => toggleSelectOne(file.id, e)" style="margin-right: 8px" /> -->
|
||||
<PaperClipOutlined />
|
||||
<span class="file-name-span" @click="actions.preview">{{ file.name }}</span>
|
||||
<a-tooltip v-if="showDownloadIcon" title="下载">
|
||||
<span @click="actions.download" class="file-outlined-span"><DownloadOutlined /></span>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="!disabled && showRemoveIcon" title="删除">
|
||||
<span @click="actions.remove" class="file-outlined-span"><DeleteOutlined /></span>
|
||||
</a-tooltip>
|
||||
<!-- <a-tooltip v-if="'.doc,.docx,.xls,.xlsx,.pdf'.includes(file.fileType)" title="编辑文档">
|
||||
<span @click="editFile(file)" class="file-outlined-span"><EditOutlined /></span>
|
||||
</a-tooltip> -->
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-upload>
|
||||
<a-modal :bodyStyle="bodyStyle" :width="800" :visible="previewVisible" :title="previewTitle" :footer="null" @cancel="handleCancel"> <iframe v-if="previewVisible" :src="previewFile" class="iframe-box"></iframe>; </a-modal>
|
||||
<a-modal wrap-class-name="full-modal" width="100%" :visible="wpsPreviewVisible" :title="previewTitle" :footer="null" @cancel="handleCancelWps">
|
||||
<div v-if="wpsPreviewVisible" id="office-container"></div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, ref, watch, computed } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { UploadOutlined, PlusOutlined, DownloadOutlined, DeleteOutlined, EditOutlined, PaperClipOutlined } from '@ant-design/icons-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { deleteSingleFile, getAppToken, getFileList, parseDownloadUrl, getZipFiles } from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { uploadMultiApi } from '/@/api/sys/upload';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import WebOfficeSDK from '/@/assets/libs/open-jssdk-v0.1.3.es.js';
|
||||
import { getToken } from '/@/utils/auth';
|
||||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
const { VITE_GLOB_UPLOAD_ALERT_TIP } = getAppEnvConfig();
|
||||
|
||||
const { createSuccessModal } = useMessage();
|
||||
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
tableName: String,
|
||||
columnName: String,
|
||||
maxNumber: Number,
|
||||
accept: String,
|
||||
name: String,
|
||||
disabled: Boolean,
|
||||
multiple: Boolean,
|
||||
maxSize: Number,
|
||||
api: Function,
|
||||
style: Object,
|
||||
listType: {
|
||||
type: String,
|
||||
default: 'text'
|
||||
},
|
||||
tip: String,
|
||||
showPreviewIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showRemoveIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showDownloadIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showUploadList: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
fileList: Array,
|
||||
btnTip: String
|
||||
});
|
||||
|
||||
const fileList = ref<any[]>([]);
|
||||
const list = ref<any[]>([]);
|
||||
const { notification } = useMessage();
|
||||
const tableId = ref<string>(props.value);
|
||||
const tableName = ref<string>(props.tableName);
|
||||
const columnName = ref<string>(props.columnName);
|
||||
|
||||
const bindValues = (data:any)=>{
|
||||
if(data){
|
||||
tableId.value = data.tableId;
|
||||
tableName.value = data.tableName;
|
||||
columnName.value = data.columnName;
|
||||
}else{
|
||||
tableId.value = props.value || '';
|
||||
tableName.value = props.tableName || '';
|
||||
columnName.value = props.columnName || '';
|
||||
}
|
||||
}
|
||||
const deleteFlag = ref(false);
|
||||
const emit = defineEmits(['update:value', 'change', 'click','update:tableName', 'update:columnName']);
|
||||
const loading = ref(false);
|
||||
|
||||
const previewVisible = ref(false);
|
||||
const wpsPreviewVisible = ref(false);
|
||||
const previewFile = ref('');
|
||||
const previewTitle = ref('');
|
||||
watch(
|
||||
() => props.fileList,
|
||||
async (val) => {
|
||||
console.log(val, 43)
|
||||
if (val) {
|
||||
fileList.value = props.fileList
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName || x.fileOrg;
|
||||
x.url = x.fileUrl || x.filePath;
|
||||
x.thumbUrl = x.thUrl || x.filePath;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.fileType =x.fileType || ('.' + x.filePath.split('?')[0]?.split('.')?.pop())
|
||||
});
|
||||
}
|
||||
bindValues(fileList.value[0]);
|
||||
} else {
|
||||
bindValues(undefined);
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.value,
|
||||
async (val) => {
|
||||
if (val) {
|
||||
fileList.value = await getFileList({tableName: props.tableName, columnName: props.columnName,tableId: props.value});
|
||||
if (fileList.value.length) {
|
||||
fileList.value.forEach((x) => {
|
||||
x.name = x.fileName;
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
});
|
||||
}
|
||||
bindValues(fileList.value[0]);
|
||||
} else {
|
||||
bindValues(undefined);
|
||||
}
|
||||
if (!val) {
|
||||
fileList.value = [];
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => list.value,
|
||||
async (val) => {
|
||||
if (deleteFlag.value) return;
|
||||
if (val.length) {
|
||||
let arr: any[] = val.filter((o) => {
|
||||
return !o.status;
|
||||
});
|
||||
if (arr.length <= 0) return;
|
||||
try {
|
||||
let res = await uploadMultiApi(
|
||||
{
|
||||
name: 'file',
|
||||
file: arr
|
||||
},
|
||||
tableId.value, tableName.value, columnName.value
|
||||
);
|
||||
let fileArr = res||[]
|
||||
fileArr.forEach((x) => {
|
||||
x.status = 'done'; //没有则不会展示下载按钮
|
||||
x.url = x.fileUrl;
|
||||
x.thumbUrl = x.thUrl;
|
||||
x.fileSize = x.fileSize
|
||||
x.name = x.fileOrg;
|
||||
});
|
||||
bindValues(res[0]);
|
||||
fileList.value = [...fileList.value, ...fileArr]
|
||||
emit('update:value', tableId.value);
|
||||
emit('update:tableName', tableName.value);
|
||||
emit('update:columnName', columnName.value);
|
||||
emit('change', fileList.value);
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const bodyStyle = { height: '500px' };
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
if (props.maxSize && file.size / 1024 / 1024 > props.maxSize) {
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: `文件大小不能超过${props.maxSize}MB!`
|
||||
});
|
||||
return false || Upload.LIST_IGNORE;
|
||||
}
|
||||
if (props.maxNumber && fileList.value.length + list.value.length === props.maxNumber!) {
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: `文件数量不能超过${props.maxNumber}个!`
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
list.value = [...list.value, file];
|
||||
deleteFlag.value = false;
|
||||
loading.value = true;
|
||||
return Upload.LIST_IGNORE;
|
||||
};
|
||||
function handleClick() {
|
||||
list.value = [];
|
||||
}
|
||||
const handleRemove = async (info) => {
|
||||
const id = info.response ? info.response.data.id : info.id;
|
||||
const index = fileList.value.findIndex((x) => x.id === id);
|
||||
fileList.value.splice(index, 1);
|
||||
emit('update:value', tableId.value);
|
||||
emit('change', fileList.value);
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: '删除成功!'
|
||||
});
|
||||
};
|
||||
|
||||
const handleDownload = (info) => {
|
||||
console.log(info, 434)
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : (info.presignedUrl || info.fileUrl));
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName });
|
||||
};
|
||||
|
||||
const handleCancelWps = () => {
|
||||
wpsPreviewVisible.value = false;
|
||||
previewTitle.value = '';
|
||||
};
|
||||
|
||||
const refreshToken = async () => {
|
||||
return getToken();
|
||||
};
|
||||
|
||||
const editFile = async (file) => {
|
||||
wpsPreviewVisible.value = true;
|
||||
previewTitle.value = file.name || file.fileName;
|
||||
let appToken = await getAppToken({ _w_fileid: file.id });
|
||||
let containerNode = document.getElementById('office-container');
|
||||
containerNode.style.height = 'calc(100vh - 50px)';
|
||||
containerNode.style.width = '100%';
|
||||
let webOfficeSdk = WebOfficeSDK.config({
|
||||
mount: containerNode,
|
||||
url: appToken.wpsUrl + '&_w_tokentype=1',
|
||||
refreshToken: refreshToken
|
||||
});
|
||||
webOfficeSdk.setToken({
|
||||
token: appToken.token,
|
||||
timeout: 10 * 60 * 1000
|
||||
});
|
||||
|
||||
/*await webOfficeSdk.ready();
|
||||
const app = webOfficeSdk.Application;
|
||||
// 获取总页数
|
||||
const totalPages = await app.ActiveDocument.Range.Information(
|
||||
app.Enum.WdInformation.wdNumberOfPagesInDocument
|
||||
);
|
||||
console.log("总页数为:", totalPages);*/
|
||||
};
|
||||
|
||||
const handlePreview = async (file) => {
|
||||
// const fileUrl = file.presignedUrl|| file.response?.data?.fileUrl || file.fileUrl;
|
||||
// console.log(fileUrl, 'fileUrl', file)
|
||||
// window.open(fileUrl)
|
||||
|
||||
const fileUrl = file.presignedUrl|| file.response?.data?.fileUrl || file.fileUrl;
|
||||
const fileName = file.response?.data?.fileOrg || file.fileOrg;
|
||||
let fileFullUrl = fileUrl.includes('http://') || fileUrl.includes('https://') ? fileUrl : location.origin + getAppEnvConfig().VITE_GLOB_API_URL + fileUrl;
|
||||
fileFullUrl+="&fullfilename="+fileName;
|
||||
previewFile.value = getAppEnvConfig().VITE_GLOB_UPLOAD_PREVIEW + encodeURIComponent(Base64.encode(fileFullUrl));
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
previewVisible.value = false;
|
||||
previewTitle.value = '';
|
||||
};
|
||||
|
||||
const selectedIds = ref<string[]>([]);
|
||||
const isAllSelected = computed(() => fileList.value.length > 0 && selectedIds.value.length === fileList.value.length);
|
||||
const fileListWithHeader = computed(() => {
|
||||
// 只在有文件时插入头部
|
||||
if (fileList.value.length) {
|
||||
return [{ __header: true, uid: '__header__' }, ...fileList.value];
|
||||
}
|
||||
return fileList.value;
|
||||
});
|
||||
function toggleSelectAll(e: Event) {
|
||||
const checked = (e.target as HTMLInputElement).checked;
|
||||
selectedIds.value = checked ? fileList.value.map((f) => f.id) : [];
|
||||
}
|
||||
function toggleSelectOne(id: string, e: Event) {
|
||||
const checked = (e.target as HTMLInputElement).checked;
|
||||
if (checked) {
|
||||
selectedIds.value = [...selectedIds.value, id];
|
||||
} else {
|
||||
selectedIds.value = selectedIds.value.filter((item) => item !== id);
|
||||
}
|
||||
}
|
||||
async function handleBatchDownload() {
|
||||
if (!selectedIds.value.length) return;
|
||||
// getZipFiles 返回下载url
|
||||
let formName = '';
|
||||
try {
|
||||
formName = (route.query.formName as string) || '';
|
||||
// 获取当前页面得form name
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
}
|
||||
const res = await getZipFiles({ fileIds: selectedIds.value.join(','), insertionFileName: formName });
|
||||
if (!res) {
|
||||
notification.error({
|
||||
message: 'Tip',
|
||||
description: '批量下载失败,请稍后重试!'
|
||||
});
|
||||
return;
|
||||
} else if (res.type === 'async') {
|
||||
createSuccessModal({ title: 'Tip', content: res.msg });
|
||||
return;
|
||||
} else if (res.type === 'synced') {
|
||||
downloadByUrl({ url: res.url, fileName: res.name || 'files.zip' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.list-upload {
|
||||
:deep(.ant-upload) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
background: #fafafa;
|
||||
border: 1px dashed #d9d9d9;
|
||||
}
|
||||
|
||||
:deep(.anticon-plus) {
|
||||
font-size: 20px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.dragger-tip {
|
||||
background: rgb(0 0 0 / 60%);
|
||||
color: #fff;
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
display: none;
|
||||
padding: 8px 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dragger-text {
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
&:hover .dragger-tip {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&:hover .dragger-text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.ant-upload) {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.iframe-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.file-name-span {
|
||||
margin-right: 16px;
|
||||
color: #1890ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-outlined-span {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-space:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.file-space {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.full-modal {
|
||||
.ant-modal {
|
||||
max-width: 100%;
|
||||
top: 0;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.ant-modal-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh);
|
||||
}
|
||||
.ant-modal-body {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -284,26 +284,7 @@
|
||||
<span style="font-size: 12px;font-weight: normal;">(上传公司财报等附件)</span>
|
||||
</div>
|
||||
</template>
|
||||
<Upload v-if="!isDisable" style="margin-bottom: 10px;" :file-list="dataFile" :showUploadList="false"
|
||||
v-model:value="formState.filePath" v-model:tableName="tableName" v-model:columnName="columnName"
|
||||
:btnTip="btnTip" @change="changeUplod" :multiple="true" :dataDelete="true"
|
||||
:showDownloadIcon="false"
|
||||
/>
|
||||
<a-table :columns="columnsFile" :data-source="dataFile" >
|
||||
<template #bodyCell="{ column,record,index, text }">
|
||||
<template v-if="column.dataIndex === 'fileOrg'">
|
||||
<a @click="handleDownload(record)">{{record.fileOrg}}</a>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'docDesc' && !isDisable">
|
||||
<a-input :placeholder="t('请输入附件说明')" :disabled="isDisable" v-model:value="record.docDesc" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('file', 'delete', record, index)">删除</a>
|
||||
<ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('file', 'up', record, index)" />
|
||||
<ArrowDownOutlined class="btn" @click="btnCheck('file', 'down', record, index)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<UploadList ref="uploadFile" :disabled="isDisable" :file-list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName"/>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -332,15 +313,14 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import Upload from '/@/components/Form/src/components/Upload.vue';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
|
||||
const tableName = '1';
|
||||
const columnName = '1'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
const uploadFile = ref()
|
||||
const props = defineProps({
|
||||
disabled: false,
|
||||
id: ''
|
||||
@ -427,12 +407,6 @@
|
||||
{ title: t('备注'), dataIndex: 'note', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', sorter: true},
|
||||
]);
|
||||
const columnsFile = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
|
||||
{ title: t('附件名称'), dataIndex: 'fileOrg', sorter: true},
|
||||
{ title: t('附件说明'), dataIndex: 'docDesc', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', sorter: true},
|
||||
]);
|
||||
const dataCertificate= reactive([]);
|
||||
const dataBank= reactive([]);
|
||||
const dataFile = ref([]);
|
||||
@ -468,8 +442,6 @@
|
||||
idx>-1 && columnsBank.value.splice(idx, 1)
|
||||
let idx1 = columnsContact.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx1>-1 && columnsContact.value.splice(idx1, 1)
|
||||
let idx2 = columnsFile.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columnsFile.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -483,11 +455,6 @@
|
||||
}
|
||||
|
||||
});
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
async function getList(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
@ -588,24 +555,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 附件
|
||||
if (type == 'file') {
|
||||
if (btn == 'delete') {
|
||||
dataFile.value.splice(index, 1)
|
||||
}
|
||||
if (btn == 'up') {
|
||||
if (index === 0) {
|
||||
return
|
||||
}
|
||||
dataFile.value[index] = dataFile.value.splice(index-1, 1, dataFile.value[index])[0];
|
||||
}
|
||||
if (btn == 'down') {
|
||||
if (index === dataFile.value.length - 1) {
|
||||
return
|
||||
}
|
||||
dataFile.value[index] = dataFile.value.splice(index+1, 1, dataFile.value[index])[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
const handleSuccessCertificate = (val) => {
|
||||
// 编辑
|
||||
@ -633,16 +582,6 @@
|
||||
}
|
||||
dataBank.push(val)
|
||||
}
|
||||
function changeUplod (val) {
|
||||
dataFile.value = []
|
||||
val.forEach(v => {
|
||||
v.fileOrg = v.fileOrg || v.fileName,
|
||||
v.filePath = v.filePath || v.fileUrl,
|
||||
v.fileSize = v.fileSize
|
||||
dataFile.value.push(v)
|
||||
})
|
||||
console.log(val, 532, dataFile.value)
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
}
|
||||
@ -677,23 +616,16 @@
|
||||
arrCertificate.forEach(v => {
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||
v.dateTo = v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): '';
|
||||
(v.fileList || []).forEach(i => {
|
||||
i.id = ''
|
||||
})
|
||||
})
|
||||
let arrUploadList = JSON.parse(JSON.stringify(dataFile.value))
|
||||
arrUploadList.forEach(v => {
|
||||
v.id= ''
|
||||
})
|
||||
let file = await uploadFile.value.getFileList()
|
||||
let obj = {
|
||||
...formState,
|
||||
lngCustomerBankList: dataBank,
|
||||
lngCustomerDocList: arrCertificate,
|
||||
lngCustomerContactList: dataContact,
|
||||
lngFileUploadList: arrUploadList
|
||||
lngFileUploadList: file
|
||||
|
||||
}
|
||||
console.log(arrCertificate, 'arrCertificate')
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngCustomer :updateLngCustomer
|
||||
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<SimpleForm
|
||||
class="formViewStyle"
|
||||
ref="systemFormRef"
|
||||
:formProps="data.formDataProps"
|
||||
:formModel="{}"
|
||||
:isWorkFlow="props.fromPage!=FromPageType.MENU">
|
||||
<template #dateFrom="{ formModel }">
|
||||
<FormItem label="起始日期" :label-col="{ span: 5, offset: 0 }" labelAlign="right" name="dateFrom" class="dateStyle">
|
||||
<a-date-picker v-model:value="formModel.dateFrom" format="YYYY-MM-DD" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择" />
|
||||
<a-date-picker v-model:value="formModel.dateFrom" :disabled="isView" format="YYYY-MM-DD" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择" />
|
||||
</FormItem>
|
||||
</template>
|
||||
<template #dateTo="{ formModel }">
|
||||
<FormItem label="结束日期" labelAlign="right" name="dateTo" class="dateStyle">
|
||||
<a-date-picker v-model:value="formModel.dateTo" format="YYYY-MM-DD" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择" />
|
||||
<a-date-picker v-model:value="formModel.dateTo" :disabled="isView" format="YYYY-MM-DD" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择" />
|
||||
</FormItem>
|
||||
</template>
|
||||
</template>
|
||||
</SimpleForm>
|
||||
|
||||
<a-card :bordered="false" >
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
@ -27,15 +27,6 @@
|
||||
<a-button v-if="!isView" type="primary" style="margin-bottom: 10px;" @click="handleAdd">新增组成员</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'natureCode'">
|
||||
{{ (optionSelect.natureCodeList.find(v=>v.code == record.natureCode) || {}).name }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'typeCode'">
|
||||
{{ (optionSelect.typeCodeList.find(v=>v.code == record.typeCode) || {}).name }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'classCode'">
|
||||
{{ (optionSelect.classCodeList.find(v=>v.code == record.classCode) || {}).name }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a @click="btnCheck(record, index)">删除</a>
|
||||
</template>
|
||||
@ -62,7 +53,7 @@
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import customerListModal from './customerListModal.vue';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
const { t } = useI18n();
|
||||
@ -99,11 +90,6 @@
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 120},
|
||||
]);
|
||||
const dataList = ref([])
|
||||
const optionSelect = reactive({
|
||||
natureCodeList: [],
|
||||
classCodeList: [],
|
||||
typeCodeList: []
|
||||
})
|
||||
const isView = ref(false)
|
||||
|
||||
const disabledDateStart = (startValue) => {
|
||||
@ -144,15 +130,19 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
dataList.value = [...dataList.value, ...arr]
|
||||
dataList.value = unique([...dataList.value, ...arr], 'cuCode')
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
|
||||
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
|
||||
optionSelect.typeCodeList = await getDictionary('LNG_CU_TYP')
|
||||
|
||||
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()]
|
||||
}
|
||||
onMounted(async () => {
|
||||
getOption()
|
||||
isView.value = currentRoute.value?.fullPath.includes('viewForm')
|
||||
if (isView.value) {
|
||||
let idx = columns.value.findIndex(v =>v.dataIndex=='operation')
|
||||
@ -231,7 +221,9 @@
|
||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||
async function setFormDataFromId(rowId, skipUpdate) {
|
||||
try {
|
||||
const record = await getLngCustomerGroup(rowId);
|
||||
let record = await getLngCustomerGroup(rowId);
|
||||
record.dateFrom = record.dateFrom ? dayjs(record.dateFrom) : null
|
||||
record.dateTo = record.dateTo ? dayjs(record.dateTo) : null
|
||||
if (skipUpdate) {
|
||||
return record;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ export const searchFormSchema: FormSchema[] = [
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
style: { width: '100%' },
|
||||
allowClear: true,
|
||||
getPopupContainer: () => document.body,
|
||||
},
|
||||
},
|
||||
@ -47,7 +48,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'typeCode',
|
||||
dataIndex: 'typeName',
|
||||
title: '类型',
|
||||
componentType: 'select',
|
||||
align: 'left',
|
||||
|
||||
@ -99,12 +99,12 @@
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: customSearchFormSchema,
|
||||
fieldMapToTime: [['dateFrom', ['dateFromStart', 'dateFromEnd'], 'YYYY-MM-DD HH:mm:ss ', true],
|
||||
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true],
|
||||
['dateTo', ['dateToStart', 'dateToEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
|
||||
showResetButton: true,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
clearSelectedRowKeys()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export const customFormConfig = {
|
||||
codeList: ['addCustomer'],
|
||||
codeList: ['addCustomer','addSupplier'],
|
||||
router: [
|
||||
{code: 'addCustomer', src: ''}
|
||||
]
|
||||
|
||||
224
src/views/supplier/Supplier/components/Form.vue
Normal file
224
src/views/supplier/Supplier/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 { addLngSupplier, getLngSupplier, updateLngSupplier, deleteLngSupplier } from '/@/api/supplier/Supplier';
|
||||
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 getLngSupplier(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 updateLngSupplier(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 addLngSupplier(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 deleteLngSupplier([id]);
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
validate,
|
||||
add,
|
||||
update,
|
||||
setFormDataFromId,
|
||||
setDisabledForm,
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
getFormModel,
|
||||
handleDelete
|
||||
});
|
||||
</script>
|
||||
110
src/views/supplier/Supplier/components/SupplierModal.vue
Normal file
110
src/views/supplier/Supplier/components/SupplierModal.vue
Normal file
@ -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>
|
||||
649
src/views/supplier/Supplier/components/config.ts
Normal file
649
src/views/supplier/Supplier/components/config.ts
Normal file
@ -0,0 +1,649 @@
|
||||
import { FormProps, FormSchema } from '/@/components/Form';
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
|
||||
export const formConfig = {
|
||||
useCustomConfig: false,
|
||||
};
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'suName',
|
||||
label: '供应商名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'suSname',
|
||||
label: '供应商简称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'natureCode',
|
||||
label: '企业性质',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'typeCode',
|
||||
label: '供应商类型',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'classCode',
|
||||
label: '供应商分类',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'dI',
|
||||
label: '国内/国外',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'valid',
|
||||
label: '有效',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'approCode',
|
||||
label: '审批状态',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
dataIndex: 'suName',
|
||||
title: '供应商名称',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'suSname',
|
||||
title: '供应商简称',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'natureCode',
|
||||
title: '企业性质',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'typeCode',
|
||||
title: '供应商类型',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'classCode',
|
||||
title: '供应商分类',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'dI',
|
||||
title: '国内/国外',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'valid',
|
||||
title: '有效',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'approCode',
|
||||
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: 'd81094df82fb4e96b522550db9578362',
|
||||
field: 'suName',
|
||||
label: '供应商名称',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '8c44576691ca4a64a8ef655450d083a2',
|
||||
field: 'suSname',
|
||||
label: '供应商简称',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '3a276e29935a478fbd42b26de605c8a2',
|
||||
field: 'natureCode',
|
||||
label: '企业性质',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'd0c91d9c36d14e12ad0fa70303764686',
|
||||
field: 'typeCode',
|
||||
label: '供应商类型',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '8406bf5e2d494c9688b4fe8f85b00664',
|
||||
field: 'classCode',
|
||||
label: '供应商分类',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '37934fa8fb1548d49bb84c65952758bd',
|
||||
field: 'dI',
|
||||
label: '国内/国外',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '6aacf45ab3f54c27a1035459ec3c2af8',
|
||||
field: 'valid',
|
||||
label: '有效',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
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,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '1e38e53b22ee4516b4902cf9c7c81b36',
|
||||
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: '请输入审批状态',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: false,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '84239f0e60ca426d97c2c41108530eb8',
|
||||
label: '表格组件',
|
||||
field: 'lngSupplierDocList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngSupplierDocList',
|
||||
columns: [
|
||||
{
|
||||
key: 'e245025ad9a04516aafb44be7a6d9e95',
|
||||
title: '单行文本',
|
||||
dataIndex: 'docNo',
|
||||
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: '7a75094560724f2695291535fc71948a',
|
||||
label: '表格组件',
|
||||
field: 'lngSupplierBankList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngSupplierBankList',
|
||||
columns: [
|
||||
{
|
||||
key: 'de9c89f69619499087c2c46c9d4a51ad',
|
||||
title: '单行文本',
|
||||
dataIndex: 'bankCode',
|
||||
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: 'e111478f9ea0423e96cd81dc4e6fff06',
|
||||
label: '表格组件',
|
||||
field: 'lngSupplierContactList',
|
||||
type: 'form',
|
||||
component: 'SubForm',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
mainKey: 'lngSupplierContactList',
|
||||
columns: [
|
||||
{
|
||||
key: 'bb968e41e5a644258f96dd2985aa30c7',
|
||||
title: '单行文本',
|
||||
dataIndex: 'contactName',
|
||||
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: [],
|
||||
};
|
||||
603
src/views/supplier/Supplier/components/createForm.vue
Normal file
603
src/views/supplier/Supplier/components/createForm.vue
Normal file
@ -0,0 +1,603 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
<div class="page-bg-wrap formViewStyle">
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<a-card title="供应商基本信息" :bordered="false" >
|
||||
<div>
|
||||
<h4>基本信息</h4>
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="供应商编码" name="cuCode">
|
||||
<a-input v-model:value="formState.suCode" disabled />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="集团编码" name="cuMcode">
|
||||
<a-input v-model:value="formState.suMcode" :disabled="isDisable" placeholder="请输入集团编码" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="企业性质" name="natureCode">
|
||||
<a-select v-model:value="formState.natureCode" :disabled="isDisable" placeholder="请选择企业性质" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.natureCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="供应商名称" name="cuName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-input v-model:value="formState.suName" :disabled="isDisable" placeholder="请输入供应商名称" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="供应商简称" name="cuSname">
|
||||
<a-input v-model:value="formState.suSname" :disabled="isDisable" placeholder="请输入供应商简称" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="国内/国际" name="dI">
|
||||
<a-select v-model:value="formState.dI" :disabled="isDisable" placeholder="请选择国内/国际" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.dIList" :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="parentNname">
|
||||
<a-input v-model:value="formState.parentNname" :disabled="isDisable" placeholder="请输入母公司名称" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="统一社会信用代码" name="creditNo">
|
||||
<a-input v-model:value="formState.creditNo" :disabled="isDisable" placeholder="请输入统一社会信用代码" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="纳税人识别号" name="tiNo">
|
||||
<a-input v-model:value="formState.tiNo" :disabled="isDisable" placeholder="请输入纳税人识别号" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="法定代表人" name="representative">
|
||||
<a-input v-model:value="formState.representative" :disabled="isDisable" placeholder="请输入法定代表人" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="成立日期" name="dateEstab">
|
||||
<a-date-picker v-model:value="formState.dateEstab" :disabled="isDisable" style="width: 100%" placeholder="请选择成立日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="准入时间" name="dateEntry">
|
||||
<a-date-picker v-model:value="formState.dateEntry" :disabled="isDisable" style="width: 100%" placeholder="请选择准入时间" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="注册资本(万元)" name="amtReg">
|
||||
<a-input-number v-model:value="formState.amtReg" :disabled="isDisable" :min="0" style="width: 100%" placeholder="请输入注册资本"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="注册地址" name="addrReg" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.addrReg" :disabled="isDisable" placeholder="请输入注册地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="通讯地址" name="addrMail" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.addrMail" :disabled="isDisable" placeholder="请输入通讯地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="供应商类型" name="typeCode">
|
||||
<a-select v-model:value="formState.typeCode" :disabled="isDisable" placeholder="请选择供应商类型" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.typeCodeList" :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="classCode">
|
||||
<a-select v-model:value="formState.classCode" :disabled="isDisable" placeholder="请选择供应商分类" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.classCodeList" :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="valid">
|
||||
<a-select v-model:value="formState.valid" disabled style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.validList" :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-col :span="24">
|
||||
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注,最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" >
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-left: 8px;">资质证书信息</span>
|
||||
<span style="font-size: 12px;font-weight: normal;">(需上传证书营业执照,危险化学品许可证/燃气经营许可证/危险化学品道路运输许可证等证书。)</span>
|
||||
</div>
|
||||
</template>
|
||||
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('certificate')">新增证书</a-button>
|
||||
<a-table :columns="columnsCertificate" :data-source="dataCertificate" >
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'dateFrom'">
|
||||
{{ record.dateFrom ? dayjs(record.dateFrom).format('YYYY-MM-DD') : ''}}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'dateTo'">
|
||||
{{ record.dateTo ? dayjs(record.dateTo).format('YYYY-MM-DD') : ''}}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'docTypeCode'">
|
||||
{{ (optionSelect.docCpList.find(v=>v.code == record.docTypeCode) || {}).fullName }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record, index)">编辑</a>
|
||||
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</a>
|
||||
<a style="margin-right: 10px" @click="btnCheck('certificate', 'view', record)">查看</a>
|
||||
<ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('certificate', 'up', record, index)" />
|
||||
<ArrowDownOutlined class="btn" @click="btnCheck('certificate', 'down', record, index)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
<a-card :bordered="false" >
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-left: 8px;">银行账户信息</span>
|
||||
<span style="font-size: 12px;font-weight: normal;">(至少填写一条银行信息)</span>
|
||||
</div>
|
||||
</template>
|
||||
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('bank')">新增银行账户</a-button>
|
||||
<a-table :columns="columnsBank" :data-source="dataBank" >
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'defaultSign'">
|
||||
{{ (optionSelect.signList.find(v=>v.code == record.defaultSign) || {}).name }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('bank', 'edit', record, index)">编辑</a>
|
||||
<a style="margin-right: 10px" @click="btnCheck('bank', 'delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
<a-card :bordered="false" >
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-left: 8px;">联系人信息</span>
|
||||
<span style="font-size: 12px;font-weight: normal;">(至少填写一条联系人信息)</span>
|
||||
</div>
|
||||
</template>
|
||||
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('contact')">新增联系人</a-button>
|
||||
<a-table :columns="columnsContact" :data-source="dataContact" >
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('contact', 'edit', record, index)">编辑</a>
|
||||
<a style="margin-right: 10px" @click="btnCheck('contact', 'delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
<a-card :bordered="false" >
|
||||
<template #title>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span style="margin-left: 8px;">附件信息</span>
|
||||
<span style="font-size: 12px;font-weight: normal;">(上传公司财报等附件)</span>
|
||||
</div>
|
||||
</template>
|
||||
<UploadList ref="uploadFile" :disabled="isDisable" :file-list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName"/>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</div>
|
||||
</a-spin>
|
||||
<certificateModal @register="registerCertificate" @success="handleSuccessCertificate" />
|
||||
<contactModal @register="registerContact" @success="handleSuccessContact" />
|
||||
<bankModal @register="registerBank" @success="handleSuccessBank"/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useRouter } from 'vue-router';
|
||||
import { FromPageType } 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 { CheckCircleOutlined, StopOutlined, CloseOutlined, UploadOutlined, SaveOutlined, DownloadOutlined,ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDocCpList, getDictionary } from '/@/api/sales/Supplier';
|
||||
import certificateModal from '/@/views/sales/Supplier/components/certificateModal.vue';
|
||||
import contactModal from '/@/views/sales/Supplier/components/contactModal.vue';
|
||||
import bankModal from '/@/views/sales/Supplier/components/bankModal.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { addLngSupplier,updateLngSupplier,getLngSupplier } from '/@/api/supplier/Supplier';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
|
||||
const tableName = '1';
|
||||
const columnName = '1'
|
||||
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
const uploadFile = ref()
|
||||
const props = defineProps({
|
||||
disabled: false,
|
||||
id: ''
|
||||
|
||||
});
|
||||
const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
const isDisable = ref(false);
|
||||
const { formPath } = currentRoute.value.query;
|
||||
const pathArr = [];
|
||||
|
||||
const tabStore = useMultipleTabStore();
|
||||
const formProps = ref(null);
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const pageType = ref(currentRoute.value.query?.type);
|
||||
const pageId = ref(currentRoute.value.query?.id)
|
||||
|
||||
const spinning = ref(false);
|
||||
const curIdx = ref(null)
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const formState = reactive({
|
||||
valid: 'Y',
|
||||
approCode: 'WTJ',
|
||||
tSign: 'N',
|
||||
});
|
||||
|
||||
const [registerCertificate, { openModal:openModalCertificate }] = useModal();
|
||||
const [registerContact, { openModal:openModalContact }] = useModal();
|
||||
const [registerBank, { openModal:openModalBank}] = useModal();
|
||||
|
||||
|
||||
const rules: Record<string, Rule[]> = {
|
||||
cuSname: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
cuMcode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dI: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
cuName: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
natureCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
classCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
prepaySign: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
onlineSign: [{ required: true, message: "该项为必填项", trigger: 'change'}],
|
||||
tSign: [{ required: false, message: "该项为必填项", trigger: 'change'}],
|
||||
};
|
||||
const layout = {
|
||||
labelCol: { span: 9 },
|
||||
wrapperCol: { span: 15 },
|
||||
}
|
||||
|
||||
const columnsCertificate = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
|
||||
{ title: t('资质证书名称'), dataIndex: 'docTypeCode', sorter: true, width:200},
|
||||
{ title: t('有效期开始'), dataIndex: 'dateFrom', sorter: true, width: 140},
|
||||
{ title: t('有效期结束'), dataIndex: 'dateTo', sorter: true, width: 140},
|
||||
{ title: t('备注'), dataIndex: 'note', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 220},
|
||||
]);
|
||||
const columnsBank = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
|
||||
{ title: t('银行名称'), dataIndex: 'bankCode', sorter: true},
|
||||
{ title: t('联行号'), dataIndex: 'code', sorter: true},
|
||||
{ title: t('账号名称'), dataIndex: 'accountName', sorter: true},
|
||||
{ title: t('银行账号'), dataIndex: 'account', sorter: true},
|
||||
{ title: t('默认银行'), dataIndex: 'defaultSign', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', sorter: true},
|
||||
]);
|
||||
const columnsContact = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
|
||||
{ title: t('姓名'), dataIndex: 'contactName', sorter: true},
|
||||
{ title: t('联系电话'), dataIndex: 'tel', sorter: true},
|
||||
{ title: t('电子邮箱'), dataIndex: 'email', sorter: true},
|
||||
{ title: t('通讯地址'), dataIndex: 'addrMail', sorter: true},
|
||||
{ title: t('职位'), dataIndex: 'position', sorter: true},
|
||||
{ title: t('备注'), dataIndex: 'note', sorter: true},
|
||||
{ title: t('操作'), dataIndex: 'operation', sorter: true},
|
||||
]);
|
||||
const dataCertificate= reactive([]);
|
||||
const dataBank= reactive([]);
|
||||
const dataFile = ref([]);
|
||||
const dataContact= reactive([]);
|
||||
let optionSelect= reactive({
|
||||
natureCodeList: [],
|
||||
dIList: [],
|
||||
validList: [],
|
||||
approCodeList: [],
|
||||
classCodeList: [],
|
||||
typeCodeList: [],
|
||||
signList: [],
|
||||
docCpList: []
|
||||
});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getList(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
if (val) {
|
||||
let idx = columnsBank.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx>-1 && columnsBank.value.splice(idx, 1)
|
||||
let idx1 = columnsContact.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx1>-1 && columnsContact.value.splice(idx1, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getList(pageId.value)
|
||||
}
|
||||
|
||||
});
|
||||
async function getList(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngSupplier(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataBank, formState.lngSupplierBankList || [])
|
||||
Object.assign(dataCertificate, formState.lngSupplierDocList || [])
|
||||
Object.assign(dataContact, formState.lngSupplierContactList || [])
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
formState.dateEntry = formState.dateEntry ? dayjs(formState.dateEntry) : null
|
||||
formState.dateEstab = formState.dateEstab ? dayjs(formState.dateEstab) : null
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
|
||||
optionSelect.dIList = await getDictionary('LNG_NATURE')
|
||||
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
|
||||
optionSelect.typeCodeList = await getDictionary('LNG_SU_TYP')
|
||||
optionSelect.signList = await getDictionary('LNG_YN')
|
||||
optionSelect.validList = await getDictionary('LNG_VALID')
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.docCpList = await getDocCpList({'valid': 'Y'})
|
||||
}
|
||||
const handleAdd = (val)=> {
|
||||
curIdx.value = null
|
||||
if (val ==='certificate') {
|
||||
openModalCertificate(true,{isUpdate: false, list: dataCertificate});
|
||||
}
|
||||
if (val ==='contact'){
|
||||
openModalContact(true, {});
|
||||
}
|
||||
if (val == 'bank'){
|
||||
openModalBank(true,{isUpdate: false})
|
||||
}
|
||||
|
||||
}
|
||||
const btnCheck = (type, btn, record, index) => {
|
||||
console.log(index, 555, type, )
|
||||
curIdx.value = null
|
||||
btn=='edit' && (curIdx.value = index)
|
||||
// 证书
|
||||
if (type == 'certificate') {
|
||||
if (btn == 'edit' || btn == 'view') {
|
||||
openModalCertificate(true, {record: record,isUpdate: true, btnType: btn, list: dataCertificate});
|
||||
console.log(record, 'record', dataCertificate)
|
||||
}
|
||||
if (btn == 'delete') {
|
||||
dataCertificate.splice(index, 1)
|
||||
}
|
||||
if (btn == 'up') {
|
||||
if (index === 0) {
|
||||
return
|
||||
}
|
||||
dataCertificate[index] = dataCertificate.splice(index-1, 1, dataCertificate[index])[0];
|
||||
}
|
||||
if (btn == 'down') {
|
||||
if (index === dataCertificate.length - 1) {
|
||||
return
|
||||
}
|
||||
dataCertificate[index] = dataCertificate.splice(index+1, 1, dataCertificate[index])[0];
|
||||
}
|
||||
}
|
||||
|
||||
// 联系人
|
||||
if (type == 'contact') {
|
||||
if (btn == 'edit') {
|
||||
openModalContact(true, {record: record,isUpdate: true});
|
||||
}
|
||||
if (btn == 'delete') {
|
||||
dataContact.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
// 银行
|
||||
if (type == 'bank') {
|
||||
if (btn == 'edit') {
|
||||
openModalBank(true, {record: record,isUpdate: true});
|
||||
}
|
||||
if (btn == 'delete') {
|
||||
dataBank.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
const handleSuccessCertificate = (val) => {
|
||||
// 编辑
|
||||
if (curIdx.value != null) {
|
||||
dataCertificate[curIdx.value] = {...val}
|
||||
return
|
||||
}
|
||||
let idx =dataCertificate.findIndex(v => v.docTypeCode == val.docTypeCode)
|
||||
if (idx <0) {
|
||||
dataCertificate.push(val)
|
||||
}
|
||||
console.log(dataCertificate, 'dataCertificate')
|
||||
}
|
||||
const handleSuccessContact = (val)=> {
|
||||
if (curIdx.value != null) {
|
||||
dataContact[curIdx.value] = {...val}
|
||||
return
|
||||
}
|
||||
dataContact.push(val)
|
||||
}
|
||||
const handleSuccessBank = (val) => {
|
||||
if (curIdx.value != null) {
|
||||
dataBank[curIdx.value] = {...val}
|
||||
return
|
||||
}
|
||||
dataBank.push(val)
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
}
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
if (!dataBank.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: '请添加银行信息'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!dataCertificate.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: '请添加资质证书'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!dataContact.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: '请添加联系人'
|
||||
})
|
||||
return
|
||||
}
|
||||
let arrCertificate = JSON.parse(JSON.stringify(dataCertificate))
|
||||
arrCertificate.forEach(v => {
|
||||
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||
v.dateTo = v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): '';
|
||||
})
|
||||
let file = await uploadFile.value.getFileList()
|
||||
let obj = {
|
||||
...formState,
|
||||
lngSupplierBankList: dataBank,
|
||||
lngSupplierDocList: arrCertificate,
|
||||
lngSupplierContactList: dataContact,
|
||||
lngFileUploadList: file
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngSupplier :updateLngSupplier
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
// 新增保存
|
||||
// data?.id && (formState.id = data.id)
|
||||
// data?.suCode && (Object.assign(formState, {cuCode: data?.suCode}))
|
||||
if (data?.id) {
|
||||
getList(data?.id)
|
||||
}
|
||||
// 同意保存不提示
|
||||
if (!type) {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: data?.id ? t('新增成功!') : t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
// formRef.value.resetFields();
|
||||
return data?.id ? data : obj
|
||||
// setTimeout(() => {
|
||||
// bus.emit(FORM_LIST_MODIFIED, { path: formPath });
|
||||
// close();
|
||||
// }, 1000);
|
||||
|
||||
} finally {
|
||||
spinning.value = false;
|
||||
}
|
||||
|
||||
} catch (errorInfo) {
|
||||
spinning.value = false;
|
||||
console.log(errorInfo, 'errorInfo')
|
||||
errorInfo?.errorFields?.length && notification.warning({
|
||||
message: 'Tip',
|
||||
description: '请完善信息'
|
||||
});
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleSubmit,
|
||||
getFormValue
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.rateStyle {
|
||||
position: absolute;
|
||||
right: -25px;
|
||||
top:4px;
|
||||
}
|
||||
.btn {
|
||||
color: #5e95ff;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
209
src/views/supplier/Supplier/components/workflowPermission.ts
Normal file
209
src/views/supplier/Supplier/components/workflowPermission.ts
Normal file
@ -0,0 +1,209 @@
|
||||
export const permissionList = [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '供应商名称',
|
||||
fieldId: 'suName',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'd81094df82fb4e96b522550db9578362',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '供应商简称',
|
||||
fieldId: 'suSname',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '8c44576691ca4a64a8ef655450d083a2',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '企业性质',
|
||||
fieldId: 'natureCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '3a276e29935a478fbd42b26de605c8a2',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '供应商类型',
|
||||
fieldId: 'typeCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: 'd0c91d9c36d14e12ad0fa70303764686',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '供应商分类',
|
||||
fieldId: 'classCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '8406bf5e2d494c9688b4fe8f85b00664',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '国内/国外',
|
||||
fieldId: 'dI',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '37934fa8fb1548d49bb84c65952758bd',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '有效',
|
||||
fieldId: 'valid',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '6aacf45ab3f54c27a1035459ec3c2af8',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '审批状态',
|
||||
fieldId: 'approCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '1e38e53b22ee4516b4902cf9c7c81b36',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierDocList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngSupplierDocList',
|
||||
type: 'form',
|
||||
key: '84239f0e60ca426d97c2c41108530eb8',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierDocList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'docNo',
|
||||
key: 'e245025ad9a04516aafb44be7a6d9e95',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierBankList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngSupplierBankList',
|
||||
type: 'form',
|
||||
key: '7a75094560724f2695291535fc71948a',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierBankList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'bankCode',
|
||||
key: 'de9c89f69619499087c2c46c9d4a51ad',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierContactList',
|
||||
fieldName: '表格组件',
|
||||
fieldId: 'lngSupplierContactList',
|
||||
type: 'form',
|
||||
key: 'e111478f9ea0423e96cd81dc4e6fff06',
|
||||
children: [
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSubTable: true,
|
||||
isSaveTable: false,
|
||||
showChildren: false,
|
||||
tableName: 'lngSupplierContactList',
|
||||
fieldName: '单行文本',
|
||||
fieldId: 'contactName',
|
||||
key: 'bb968e41e5a644258f96dd2985aa30c7',
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
462
src/views/supplier/Supplier/index.vue
Normal file
462
src/views/supplier/Supplier/index.vue
Normal file
@ -0,0 +1,462 @@
|
||||
<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>
|
||||
<SupplierModal @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('/supplier/supplier/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 { getLngSupplierPage, deleteLngSupplier} from '/@/api/supplier/Supplier';
|
||||
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 { getLngSupplier,enableLngSupplier,disableLngSupplier } from '/@/api/supplier/Supplier';
|
||||
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 SupplierModal from './components/SupplierModal.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';
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
defineEmits(['register']);
|
||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||
|
||||
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||
const customConfigColums =ref(filterColumns);
|
||||
const customSearchFormSchema =ref(searchFormSchema);
|
||||
|
||||
const tableRef = ref();
|
||||
//所有按钮
|
||||
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"启用","code":"enable","icon":"ant-design:form-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"作废","code":"disable","icon":"ant-design:stop-outlined","isDefault":true,"type":"dashed"},{"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":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||
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,enable : handleEnable,disable : handleDisable,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,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='供应商';
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getLngSupplierPage,
|
||||
rowKey: 'id',
|
||||
columns: customConfigColums,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: customSearchFormSchema,
|
||||
fieldMapToTime: [],
|
||||
showResetButton: false,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
},
|
||||
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
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/Supplier/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'supplier/Supplier',
|
||||
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'
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/Supplier/0/createForm',
|
||||
query: {
|
||||
formPath: 'supplier/Supplier',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/Supplier/' + record.id + '/updateForm',
|
||||
query: {
|
||||
formPath: 'supplier/Supplier',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
}
|
||||
|
||||
function handleEnable() {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('请选择需要启用的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let ids = selectedKeys.value;
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认启用?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
enableLngSupplier(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('启用成功!'),
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
|
||||
}
|
||||
function handleDisable() {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('请选择需要禁用的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
let ids = selectedKeys.value;
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认禁用?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
disableLngSupplier(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('禁用成功!'),
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteLngSupplier(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 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 (button.code === 'flowRecord') hasFlowRecord = true;
|
||||
});
|
||||
if (record.workflowData?.enabled) {
|
||||
//与工作流有关联的表单
|
||||
if (record.workflowData.status) {
|
||||
actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
} else {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
} else {
|
||||
if (!record.workflowData?.processId) {
|
||||
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
}
|
||||
return actionsList;
|
||||
}
|
||||
function handleStartwork(record: Recordable) {
|
||||
const { processId, schemaId } = record.workflowData;
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleFlowRecord(record: Recordable) {
|
||||
if (record.workflowData) {
|
||||
visibleFlowRecordModal.value = true;
|
||||
processIdRef.value = record.workflowData?.processId;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLaunchProcess(record: Recordable) {
|
||||
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
|
||||
if(schemaId){
|
||||
if(record.workflowData?.draftId){
|
||||
let res = await getDraftInfo(record.workflowData.draftId);
|
||||
if (isValidJSON(res.formData)) {
|
||||
localStorage.setItem('draftsJsonStr', res.formData);
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/'+record.workflowData.draftId+'/createFlow'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const result = await getLngSupplier(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>
|
||||
Reference in New Issue
Block a user