Commit c90560c3 by 王宝涛

feat(chaiche): 更新车辆变更管理功能

- 修改模型定义,将工作时长字段替换为物料状态字段
- 新增已入库数量和本次入库数量字段
- 配置物料状态下拉选择组件及筛选条件
- 移除输入框最大长度限制配置
- 简化查询参数表格配置结构
- 在表格中添加物料状态列
- 实现入库功能按钮及相关事件处理
- 添加表格行选择功能和多选逻辑
- 更新GPS组件配置文件
- 优化工作流权限配置中的字段设置
parent ea1616da
...@@ -12,7 +12,7 @@ export interface MesCheliangBgPageParams extends BasicPageParams { ...@@ -12,7 +12,7 @@ export interface MesCheliangBgPageParams extends BasicPageParams {
gzxm: string; gzxm: string;
gzsc: string; wlzt: string;
cphm: string; cphm: string;
...@@ -50,6 +50,8 @@ export interface MesCheliangBgPageModel { ...@@ -50,6 +50,8 @@ export interface MesCheliangBgPageModel {
bdsl: string; bdsl: string;
gzsc: string; gzsc: string;
wlzt: string;
} }
/** /**
...@@ -124,6 +126,8 @@ export interface MesCheliangBgModel { ...@@ -124,6 +126,8 @@ export interface MesCheliangBgModel {
dhxx: string; dhxx: string;
wlzt: string;
bz: string; bz: string;
createDate: string; createDate: string;
...@@ -155,6 +159,10 @@ export interface MesCheliangBgCpModel { ...@@ -155,6 +159,10 @@ export interface MesCheliangBgCpModel {
sl: string; sl: string;
yrlsl: string;
bcrksl: string;
createDate: string; createDate: string;
modifyDate: string; modifyDate: string;
......
import { MesCheliangBgPageModel, MesCheliangBgPageParams, MesCheliangBgPageResult } from './model/GpsModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/chaiche/gps/page',
List = '/chaiche/gps/list',
Info = '/chaiche/gps/info',
MesCheliangBg = '/chaiche/gps',
}
/**
* @description: 查询MesCheliangBg分页列表
*/
export async function getMesCheliangBgPage(params: MesCheliangBgPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesCheliangBgPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取MesCheliangBg信息
*/
export async function getMesCheliangBg(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesCheliangBgPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增MesCheliangBg
*/
export async function addMesCheliangBg(mesCheliangBg: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.MesCheliangBg,
params: mesCheliangBg,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新MesCheliangBg
*/
export async function updateMesCheliangBg(mesCheliangBg: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.MesCheliangBg,
params: mesCheliangBg,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除MesCheliangBg(批量删除)
*/
export async function deleteMesCheliangBg(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.MesCheliangBg,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: MesCheliangBg分页参数 模型
*/
export interface MesCheliangBgPageParams extends BasicPageParams {
kjsj: string;
tjsj: string;
gzr: string;
sfwgcj: string;
pslb: string;
ghcj: string;
dhch: string;
dhpsxx: string;
dhxx: string;
}
/**
* @description: MesCheliangBg分页返回值模型
*/
export interface MesCheliangBgPageModel {
id: string;
kjsj: string;
tjsj: string;
kjsc: string;
kjhdl: string;
gzr: string;
sfwgcj: string;
pslb: string;
ghcj: string;
dhch: string;
dhpsxx: string;
dhxx: string;
drzcl: string;
}
/**
* @description: MesCheliangBg表类型
*/
export interface MesCheliangBgModel {
id: string;
bglx: string;
cheliangId: string;
gzr: string;
gzxm: string;
cllx: string;
cphm: string;
clzl: string;
clppxh: string;
clys: string;
clls: string;
gzkssj: string;
gzjssj: string;
clqzp1: string;
clqzp2: string;
clhzp1: string;
clhzp2: string;
bdsl: string;
bdzp: string;
gbswzp: string;
gznr: string;
gzsc: string;
sfwgcj: string;
drzcl: string;
kjsj: string;
tjsj: string;
kjsc: string;
kjhdl: string;
yxhm: string;
pslb: string;
ghcj: string;
dhch: string;
dhpsxx: string;
dhxx: string;
wlzt: string;
psqzp: string;
bz: string;
createDate: string;
modifyDate: string;
createUserId: string;
modifyUserId: string;
mesCheliangTlmxList?: MesCheliangTlmxModel;
}
/**
* @description: MesCheliangTlmx表类型
*/
export interface MesCheliangTlmxModel {
id: string;
bgId: string;
kcId: string;
cpId: string;
cpbh: string;
cpmc: string;
dw: string;
kcsl: string;
tlsl: string;
createDate: string;
modifyDate: string;
createUserId: string;
modifyUserId: string;
}
/**
* @description: MesCheliangBg分页返回值结构
*/
export type MesCheliangBgPageResult = BasicFetchResult<MesCheliangBgPageModel>;
...@@ -75,12 +75,18 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -75,12 +75,18 @@ export const searchFormSchema: FormSchema[] = [
}, },
}, },
{ {
field: 'gzsc', field: 'wlzt',
label: '工作时长(h)', label: '物料状态',
defaultValue: undefined, defaultValue: undefined,
component: 'InputNumber', component: 'XjrSelect',
componentProps: { componentProps: {
style: { width: '100%' }, datasourceType: 'dic',
params: { itemId: '2019657322189856770' },
labelField: 'name',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
}, },
}, },
{ {
...@@ -324,6 +330,19 @@ export const columns: BasicColumn[] = [ ...@@ -324,6 +330,19 @@ export const columns: BasicColumn[] = [
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: undefined,
}, },
{
resizable: true,
dataIndex: 'wlzt',
title: '物料状态',
componentType: 'select',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
]; ];
//表头合并配置 //表头合并配置
export const headerMergingData = []; export const headerMergingData = [];
...@@ -662,7 +681,6 @@ export const formProps: FormProps = { ...@@ -662,7 +681,6 @@ export const formProps: FormProps = {
span: 7, span: 7,
defaultValue: '', defaultValue: '',
min: 0, min: 0,
max: 1000000,
step: 1, step: 1,
disabled: false, disabled: false,
showLabel: true, showLabel: true,
...@@ -767,6 +785,46 @@ export const formProps: FormProps = { ...@@ -767,6 +785,46 @@ export const formProps: FormProps = {
span: 8, span: 8,
list: [ list: [
{ {
key: 'cb12104722cc47719a7e688667ee16fd',
field: 'wlzt',
label: '物料状态',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: 7,
placeholder: '请选择下拉选择物料状态',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
datasourceType: 'dic',
params: { itemId: '2019657322189856770' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: false,
tooltipConfig: { visible: false, title: '提示文本' },
itemId: '2019657322189856770',
style: { width: '100%' },
},
},
{
key: 'f89a9cedaa7a4f98958d46860ac84ad6', key: 'f89a9cedaa7a4f98958d46860ac84ad6',
field: 'cphm', field: 'cphm',
label: '车牌号码', label: '车牌号码',
...@@ -1159,7 +1217,6 @@ export const formProps: FormProps = { ...@@ -1159,7 +1217,6 @@ export const formProps: FormProps = {
span: '', span: '',
defaultValue: '', defaultValue: '',
placeholder: '请输入产品id', placeholder: '请输入产品id',
maxlength: null,
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
...@@ -1204,22 +1261,7 @@ export const formProps: FormProps = { ...@@ -1204,22 +1261,7 @@ export const formProps: FormProps = {
{ {
key: '1', key: '1',
title: 'Query Params', title: 'Query Params',
tableInfo: [ tableInfo: [{ name: 'keyword', value: '', required: false, bindType: 'value' }],
{
name: 'keyword',
value: '',
description: null,
required: false,
dataType: null,
type: null,
defaultValue: null,
validateType: null,
error: null,
expression: null,
children: null,
bindType: 'value',
},
],
}, },
{ key: '2', title: 'Header', tableInfo: [] }, { key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' }, { key: '3', title: 'Body' },
...@@ -1276,7 +1318,6 @@ export const formProps: FormProps = { ...@@ -1276,7 +1318,6 @@ export const formProps: FormProps = {
span: '', span: '',
defaultValue: '', defaultValue: '',
placeholder: '请输入物料编码', placeholder: '请输入物料编码',
maxlength: null,
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
...@@ -1307,13 +1348,11 @@ export const formProps: FormProps = { ...@@ -1307,13 +1348,11 @@ export const formProps: FormProps = {
span: '', span: '',
defaultValue: '', defaultValue: '',
min: 0, min: 0,
max: 100,
step: 1, step: 1,
maxlength: null,
disabled: false, disabled: false,
showLabel: true, showLabel: true,
controls: true, controls: true,
required: true, required: false,
subTotal: false, subTotal: false,
isShow: true, isShow: true,
rules: [], rules: [],
...@@ -1324,6 +1363,56 @@ export const formProps: FormProps = { ...@@ -1324,6 +1363,56 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: '98c7516b685e4a758f51282bd1f59496',
title: '已入库数量',
dataIndex: 'yrlsl',
componentType: 'InputNumber',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
min: 0,
step: 1,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: false,
rules: [],
events: {},
placeholder: '请输入已入库已入库数量',
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: '25f2ca82097d4c0c896a81880be44891',
title: '本次入库数量',
dataIndex: 'bcrksl',
componentType: 'InputNumber',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
min: 0,
step: 1,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: false,
rules: [],
events: {},
placeholder: '请输入本次入库数量',
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: 'de3aaca902734b1eba346753ac72d945', key: 'de3aaca902734b1eba346753ac72d945',
title: '单位', title: '单位',
dataIndex: 'dw', dataIndex: 'dw',
...@@ -1334,7 +1423,6 @@ export const formProps: FormProps = { ...@@ -1334,7 +1423,6 @@ export const formProps: FormProps = {
span: '', span: '',
defaultValue: '', defaultValue: '',
placeholder: '请输入单位', placeholder: '请输入单位',
maxlength: null,
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
......
...@@ -191,6 +191,22 @@ export const permissionList = [ ...@@ -191,6 +191,22 @@ export const permissionList = [
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '物料状态',
fieldId: 'wlzt',
isSubTable: false,
showChildren: true,
type: 'select',
key: 'cb12104722cc47719a7e688667ee16fd',
children: [],
options: {},
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '车牌号码', fieldName: '车牌号码',
fieldId: 'cphm', fieldId: 'cphm',
isSubTable: false, isSubTable: false,
...@@ -435,6 +451,36 @@ export const permissionList = [ ...@@ -435,6 +451,36 @@ export const permissionList = [
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'mesCheliangBgCpList', tableName: 'mesCheliangBgCpList',
fieldName: '已入库数量',
fieldId: 'yrlsl',
type: 'InputNumber',
key: '98c7516b685e4a758f51282bd1f59496',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangBgCpList',
fieldName: '本次入库数量',
fieldId: 'bcrksl',
type: 'InputNumber',
key: '25f2ca82097d4c0c896a81880be44891',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangBgCpList',
fieldName: '单位', fieldName: '单位',
fieldId: 'dw', fieldId: 'dw',
type: 'Input', type: 'Input',
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<template #resizeRight> <template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef" <BasicTable @register="registerTable" isMenuTable ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }"
> >
...@@ -131,9 +131,9 @@ ...@@ -131,9 +131,9 @@
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","delete"]); const actionButtons = ref<string[]>(["view","inWarehouse","delete"]);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
const list = [{"buttonId":"2018972431831822336","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2018972431831822337","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2018972431831822338","name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true,"isEnableLock":true},{"buttonId":"2018972431831822339","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}] const list = [{"buttonId":"2018972431831822336","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2018972431831822337","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"isUse":true,"name":"入库","code":"inWarehouse","icon":"ant-design:home-twotone","isDefault":false,"setting":[],"showType":"inline","buttonType":"primary"},{"buttonId":"2018972431831822339","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
return filterButtonAuth(list); return filterButtonAuth(list);
}) })
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {view : handleView,add : handleAdd,edit : handleEdit,delete : handleDelete,} const btnEvent = {view : handleView,add : handleAdd,delete : handleDelete, inWarehouse : handleInWarehouse}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
...@@ -157,6 +157,8 @@ ...@@ -157,6 +157,8 @@
const selectedKeys = ref<string[]>([]);
const selectedRowsData = ref<any[]>([]);
...@@ -190,6 +192,8 @@ ...@@ -190,6 +192,8 @@
selectedKeys.value = [];
selectedRowsData.value = [];
}, },
useSearchForm: true, useSearchForm: true,
...@@ -230,31 +234,13 @@ ...@@ -230,31 +234,13 @@
} }
async function handleEdit(record: Recordable) { function handleInWarehouse(record: Recordable) {
let field = 'id';
try { console.log('handleInWarehouse');
let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit'); console.log(record);
if (hasIn) { // openModal(true, { isUpdate: true, record, });
let res = await handleOpenFormEnableLockeData(
record[field],
formIdComputedRef.value,
);
if (res !== null) {
return;
}
}
let info = {
id: record[field],
isUpdate: true,
};
openModal(true, info);
} catch (error) {}
} }
...@@ -286,10 +272,24 @@ ...@@ -286,10 +272,24 @@
function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows;
}
function customRow(record: Recordable) { function customRow(record: Recordable) {
return { return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
},
ondblclick: () => { ondblclick: () => {
if (record.isCanEdit && hasPermission("ccbg:edit")) { if (record.isCanEdit && hasPermission("ccbg:edit")) {
handleEdit(record); handleEdit(record);
...@@ -301,6 +301,8 @@ ...@@ -301,6 +301,8 @@
function handleSuccess() { function handleSuccess() {
selectedKeys.value = [];
selectedRowsData.value = [];
reload(); reload();
} }
...@@ -383,4 +385,4 @@ ...@@ -383,4 +385,4 @@
</style> </style>
\ No newline at end of file
<template>
<div class="pt-4">
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
:isCamelCase="true"
@model-change="handleChange"
/>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesCheliangBg, getMesCheliangBg, updateMesCheliangBg } from '/@/api/chaiche/gps';
import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
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 RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps),
});
const state = reactive({
formModel: {},
formInfo:{formId:'',formName:''}
});
const { currentRoute } = useRouter();
watch(
() => state.formModel,
(val) => {
emits('update:value', val);
},
{
deep: true,
},
);
onMounted(async () => {
try {
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
if(currentRoute.value.meta){
state.formInfo.formName = currentRoute.value.meta.title&&isString(currentRoute.value.meta.title)?currentRoute.value.meta.title:'';
state.formInfo.formId = currentRoute.value.meta.formId&&isString(currentRoute.value.meta.formId)?currentRoute.value.meta.formId:'';
}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await nextTick();
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} 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(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
}
} catch (error) {}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
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) {
try {
const record = await getMesCheliangBg(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
} catch (error) {
}
}
// 辅助返回表单数据
async function getFieldsValue() {
let values = [];
try {
values = await systemFormRef.value?.getFieldsValue();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateMesCheliangBg(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addMesCheliangBg(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
if (obj.formId) state.formInfo.formId = obj.formId;
if (obj.formName) state.formInfo.formName = obj.formName;
let flowData = await changeWorkFlowForm(cloneDeep(formProps), obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
}
function handleChange(val) {
emits('update:value', val);
}
async function sendMessageForAllIframe() {
try {
if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) {
systemFormRef.value.sendMessageForAllIframe();
}
} catch (error) {}
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFieldsValue,
sendMessageForAllIframe
});
</script>
\ No newline at end of file
<template>
<BasicModal
:height="500"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } 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 isCopy = ref<boolean>(false)
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
rowId: '',
});
provide<Ref<boolean>>('isCopy', isCopy);
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await handleInner(data);
});
const getTitle = computed(() => (state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增'));
async function handleInner(data){
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
isCopy.value = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
footer: state.isView ? null : undefined,defaultFullscreen:true,
});
if (state.isUpdate || state.isView || isCopy.value) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
}
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 || isCopy.value) {
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 || isCopy.value) {
//false 新增
notification.success({
message: 'Tip',
description: isCopy.value ? '复制成功' : t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>
\ No newline at end of file
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [
{
field: 'kjsj',
label: '开机时间',
defaultValue: undefined,
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'tjsj',
label: '停机时间',
defaultValue: undefined,
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'gzr',
label: '工作人',
defaultValue: undefined,
component: 'User',
componentProps: {
suffix: 'ant-design:setting-outlined',
placeholder: '请选择',
},
},
{
field: 'sfwgcj',
label: '是否外购车架',
defaultValue: undefined,
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '2018146494923980802' },
labelField: 'name',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
},
{
field: 'pslb',
label: '破碎类别',
defaultValue: undefined,
component: 'Input',
},
{
field: 'ghcj',
label: '供货厂家',
defaultValue: undefined,
component: 'Input',
},
{
field: 'dhch',
label: '到货车号',
defaultValue: undefined,
component: 'Input',
},
{
field: 'dhpsxx',
label: '到货破碎信息',
defaultValue: undefined,
component: 'Input',
},
{
field: 'dhxx',
label: '到货信息',
defaultValue: undefined,
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'kjsj',
title: '开机时间',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'tjsj',
title: '停机时间',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'kjsc',
title: '开机时长(h)',
componentType: 'number',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'kjhdl',
title: '开机耗电量(kwh)',
componentType: 'number',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'gzr',
title: '工作人',
componentType: 'user',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'sfwgcj',
title: '是否外购车架',
componentType: 'radio',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'pslb',
title: '破碎类别',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'ghcj',
title: '供货厂家',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'dhch',
title: '到货车号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'dhpsxx',
title: '到货破碎信息',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'dhxx',
title: '到货信息',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'drzcl',
title: '当日总产量',
componentType: 'number',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
];
//表头合并配置
export const headerMergingData = [];
//表单事件
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: 'f8d72e4a26a34e808f53439fdb60cdc6',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 12,
list: [
{
key: '7dcf08ec1d9e4363ab1dac2ec6d4d353',
field: 'danXingWenBen3915',
label: '机器编号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入机器编号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: true,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 12,
list: [
{
key: 'c3dc7ab3505b4aceafbd956a0f6e0e0e',
label: '自动获取',
type: 'button',
component: 'Button',
colProps: { span: 24 },
componentProps: {
name: '自动获取',
buttonStyleType: 'primary',
buttonWidth: '',
buttonHeight: '',
datasourceType: 'api',
prefix: '',
suffix: '',
labelField: 'label',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/assoc-selection',
method: 'GET',
apiId: 'ac61f579074c465aaf017d64284a44a3',
outputParams: [
{ name: 'label', tableTitle: 'label' },
{ name: 'value', tableTitle: 'value' },
],
},
dicOptions: [],
disabled: false,
isShow: true,
margin: '10px',
events: {
click:
"formActionType.httpRequest({\n requestType: 'get', //请求方式有: get、post、put、delete\n requestUrl: '/system/dictionary-detail', //请求地址\n params: {\n itemId: '1419276800524423168'\n },//请求参数\n errorMessageMode: 'none' //错误提示方式,默认为none\n})\n// errorMessageMode='message' 错误提示为消息提示\n// errorMessageMode='modal' 显示modal错误弹窗,用于一些比较重要的错误\n// errorMessageMode='none' 一般是调用时明确表示不希望自动弹出错误提示",
},
modal: null,
type: 1,
event: [],
tooltipConfig: { visible: false, title: '提示文本' },
span: 7,
width: '',
height: '',
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: '6b4803efd3bb400baa4c4b9181befec3',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 8,
list: [
{
key: '7eabdfdd3ac84a028c4f01451d9e025d',
field: 'kjsj',
label: '开机时间',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 7,
defaultValue: '',
width: '100%',
placeholder: '请选择开机时间',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '4b4608ce68d945f9b3c4dd1c824990ed',
field: 'tjsj',
label: '停机时间',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 7,
defaultValue: '',
width: '100%',
placeholder: '请选择停机时间',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: 'adde0339922147eeb28256a873512556',
field: 'kjsc',
label: '开机时长(h)',
type: 'number',
component: 'InputNumber',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
placeholder: '请输入开机时长(h)',
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: 'a5afcc07e73141ceb6c01d438a3d9deb',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 8,
list: [
{
key: '43df9e1dbcce4b6b8d4ec516245697f5',
field: 'kjhdl',
label: '开机耗电量(kwh)',
type: 'number',
component: 'InputNumber',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
placeholder: '请输入开机耗电量(kwh)',
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '5764c97901a848bb8c8be56822bb6b1c',
field: 'gzr',
label: '工作人',
type: 'user',
component: 'User',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 7,
width: '100%',
defaultValue: '',
placeholder: '请选择人员',
userType: 0,
prefix: '',
suffix: 'ant-design:setting-outlined',
showLabel: true,
disabled: false,
required: false,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: 'f79eeab71e5f4fc889c5c1f3928a0977',
field: 'sfwgcj',
label: '是否外购车架',
type: 'radio',
component: 'ApiRadioGroup',
colProps: { span: 24 },
componentProps: {
span: 7,
showLabel: true,
disabled: false,
optionType: 'default',
staticOptions: [
{ key: 1, label: 'option 1', value: 'option 1' },
{ key: 2, label: 'option 2', value: 'option 2' },
{ key: 3, label: 'option 3', value: 'option 3' },
],
datasourceType: 'dic',
labelField: 'name',
valueField: 'value',
defaultSelect: null,
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
params: { itemId: '2018146494923980802' },
itemId: '2018146494923980802',
style: {},
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: 'ac2e369650594a0394d01b51dee15aa1',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 8,
list: [
{
key: '713eae175b124f8ca00068f13c14d815',
field: 'pslb',
label: '破碎类别',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入破碎类别',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '58949379c9a44ccc8e81c6ebeda74b02',
field: 'ghcj',
label: '供货厂家',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入供货厂家',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: 'bbd015e4207640399d4722dd828ec45b',
field: 'dhch',
label: '到货车号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入到货车号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: '76c345091afa464f960e058090eea807',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 8,
list: [
{
key: 'f3758f19937945f485a2ab616f72cdb6',
field: 'dhpsxx',
label: '到货破碎信息',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入到货破碎信息',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '42b6ecf016c544169c8d5fd31e56fabf',
field: 'dhxx',
label: '到货信息',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
placeholder: '请输入到货信息',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '630a2ddcad0242909b459f5e967f9d12',
field: 'drzcl',
label: '当日总产量',
type: 'number',
component: 'InputNumber',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 7,
defaultValue: '',
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
placeholder: '请输入当日总产量',
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: '1308d5f5b70a40aaa9b5a4f895ddd280',
field: 'bz',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入备注',
maxlength: 500,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
isShowAi: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'b8f11447d952475085a9b69a48cea544',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 12,
list: [
{
key: '4ebf6db8351d4eefaa64ea6f2f46e27f',
field: 'yxhm',
label: '控制室电脑运行画面',
type: 'upload',
component: 'Upload',
colProps: { span: 24 },
componentProps: {
api: uploadApi,
span: 7,
defaultValue: '',
accept: '.jpg,.jpeg,.png,.bmp',
maxNumber: 5,
maxSize: 5,
showLabel: true,
multiple: true,
disabled: false,
required: false,
isShow: true,
events: {},
listType: 'picture-card',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' },
},
},
],
},
{
span: 12,
list: [
{
key: '74c1ed8078c641e5bff19a11c4b92564',
field: 'psqzp',
label: '破碎前物料照片',
type: 'upload',
component: 'Upload',
colProps: { span: 24 },
componentProps: {
api: '#{upload}#',
span: 7,
defaultValue: '',
accept: '.jpg,.jpeg,.png,.bmp',
maxNumber: 5,
maxSize: 5,
showLabel: true,
multiple: true,
disabled: false,
required: false,
isShow: true,
events: {},
listType: 'picture-card',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' },
},
},
],
},
],
componentProps: {
gutter: 0,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: '393c039b18ad4fc2a008664d1a5cf0e7',
label: '投料明细',
field: 'mesCheliangTlmxList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'mesCheliangTlmxList',
columns: [
{
key: '584bfd36753c4d558d4f6ca2aa874f46',
title: '库存id',
dataIndex: 'kcId',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入库存id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '375c00bf2fc747db913764f1b5d7601e',
title: '物料id',
dataIndex: 'cpId',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入物料id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'fc36252191b442de821813bb0567719e',
title: '物料编号',
dataIndex: 'cpbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入物料编号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '4ad53aafbb344e4d9006652b4229b619',
title: '物料名称',
dataIndex: 'cpmc',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入物料名称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'ef6d5be7b722452c912953c76515a22c',
title: '库存数量',
dataIndex: 'kcsl',
componentType: 'InputNumber',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: true,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
placeholder: '请输入库存数量',
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: 'b9fd374345624f0580dcf8fd6c77d584',
title: '投料数量',
dataIndex: 'tlsl',
componentType: 'InputNumber',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
placeholder: '请输入投料数量',
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showBorder: false,
backgroundStyle: {
isShow: false,
bgColor: '#ffffff',
bgImgUrl: '',
fontColor: '',
borderColor: '',
},
theadStyle: {
isShow: false,
fontSize: 14,
fontColor: '#000000',
bgType: 'color',
gradientDegree: '',
gradientColors: '',
bgImageUrl: '',
bgColor: '',
bgRepeat: 'no-repeat',
},
tbodyStyle: {
isShow: false,
fontSize: 14,
fontColor: '#000000',
bgType: 'color',
gradientDegree: '',
gradientColors: '',
bgImageUrl: '',
bgColor: '',
bgRepeat: 'no-repeat',
},
bordercolor: '#f0f0f0',
bordershowtype: [true, true, true, true],
borderwidth: 1,
showIndex: false,
isShow: true,
multipleHeads: [],
buttonList: [],
topButtonList: [],
isExport: false,
isImport: false,
isDeleteSelected: false,
isListView: false,
viewList: [],
isShowAdd: true,
isShowDelete: true,
hasCheckedCol: false,
checkedColType: 'checkbox',
pageSize: 10,
events: {},
showPagenation: true,
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};
export const permissionList = [
{
required: false,
view: true,
edit: false,
disabled: true,
isSaveTable: true,
tableName: '',
fieldName: '机器编号',
fieldId: 'danXingWenBen3915',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7dcf08ec1d9e4363ab1dac2ec6d4d353',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '自动获取',
isSubTable: false,
showChildren: true,
type: 'button',
key: 'c3dc7ab3505b4aceafbd956a0f6e0e0e',
children: [],
options: {},
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '开机时间',
fieldId: 'kjsj',
isSubTable: false,
showChildren: true,
type: 'date',
key: '7eabdfdd3ac84a028c4f01451d9e025d',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '停机时间',
fieldId: 'tjsj',
isSubTable: false,
showChildren: true,
type: 'date',
key: '4b4608ce68d945f9b3c4dd1c824990ed',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '开机时长(h)',
fieldId: 'kjsc',
isSubTable: false,
showChildren: true,
type: 'number',
key: 'adde0339922147eeb28256a873512556',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '开机耗电量(kwh)',
fieldId: 'kjhdl',
isSubTable: false,
showChildren: true,
type: 'number',
key: '43df9e1dbcce4b6b8d4ec516245697f5',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '工作人',
fieldId: 'gzr',
isSubTable: false,
showChildren: true,
type: 'user',
key: '5764c97901a848bb8c8be56822bb6b1c',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '是否外购车架',
fieldId: 'sfwgcj',
isSubTable: false,
showChildren: true,
type: 'radio',
key: 'f79eeab71e5f4fc889c5c1f3928a0977',
children: [],
options: {},
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '破碎类别',
fieldId: 'pslb',
isSubTable: false,
showChildren: true,
type: 'input',
key: '713eae175b124f8ca00068f13c14d815',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供货厂家',
fieldId: 'ghcj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '58949379c9a44ccc8e81c6ebeda74b02',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '到货车号',
fieldId: 'dhch',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'bbd015e4207640399d4722dd828ec45b',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '到货破碎信息',
fieldId: 'dhpsxx',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f3758f19937945f485a2ab616f72cdb6',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '到货信息',
fieldId: 'dhxx',
isSubTable: false,
showChildren: true,
type: 'input',
key: '42b6ecf016c544169c8d5fd31e56fabf',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日总产量',
fieldId: 'drzcl',
isSubTable: false,
showChildren: true,
type: 'number',
key: '630a2ddcad0242909b459f5e967f9d12',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '备注',
fieldId: 'bz',
isSubTable: false,
showChildren: true,
type: 'textarea',
key: '1308d5f5b70a40aaa9b5a4f895ddd280',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '控制室电脑运行画面',
fieldId: 'yxhm',
isSubTable: false,
showChildren: true,
type: 'upload',
key: '4ebf6db8351d4eefaa64ea6f2f46e27f',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '破碎前物料照片',
fieldId: 'psqzp',
isSubTable: false,
showChildren: true,
type: 'upload',
key: '74c1ed8078c641e5bff19a11c4b92564',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '投料明细',
fieldId: 'mesCheliangTlmxList',
type: 'form',
key: '393c039b18ad4fc2a008664d1a5cf0e7',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '库存id',
fieldId: 'kcId',
type: 'Input',
key: '584bfd36753c4d558d4f6ca2aa874f46',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '物料id',
fieldId: 'cpId',
type: 'Input',
key: '375c00bf2fc747db913764f1b5d7601e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '物料编号',
fieldId: 'cpbh',
type: 'Input',
key: 'fc36252191b442de821813bb0567719e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '物料名称',
fieldId: 'cpmc',
type: 'Input',
key: '4ad53aafbb344e4d9006652b4229b619',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '库存数量',
fieldId: 'kcsl',
type: 'InputNumber',
key: 'ef6d5be7b722452c912953c76515a22c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesCheliangTlmxList',
fieldName: '投料数量',
fieldId: 'tlsl',
type: 'InputNumber',
key: 'b9fd374345624f0580dcf8fd6c77d584',
children: [],
},
],
},
];
<template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef"
>
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" />
<a-button v-else :type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'" :danger="button.buttonType === 'danger'" >
<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="getLessActions(record)"
:dropDownActions="getMoreActions(record)"
/>
</template>
<template v-else-if="column.dataIndex && column?.listStyle">
<span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{
getValue(record, column, 'value')
}}</span>
</template>
</template>
</BasicTable>
</template>
<GpsModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, 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 { getMesCheliangBgPage, deleteMesCheliangBg} from '/@/api/chaiche/gps';
import { ResizePageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置
import { useRouter } from 'vue-router';
import { useModal } from '/@/components/Modal';
import GpsModal from './components/GpsModal.vue';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
const listSpliceNum = ref(3); //操作列最先展示几个
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
const pageParamsInfo = ref<any>({});
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } =
useConcurrentLock();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth, hasPermission } = usePermission();
const filterColumns = filterColumnAuth(columns);
const tableRef = ref();
//展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","delete"]);
const buttonConfigs = computed(()=>{
const list = [{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isEnableLock":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
return filterButtonAuth(list);
})
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 = {view : handleView,add : handleAdd,edit : handleEdit,delete : handleDelete,}
const { currentRoute } = useRouter();
const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string);
provide<Ref<string>>('currentFormId', formIdComputedRef);
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, }] = useTable({
title: 'Gps列表',
api: getMesCheliangBgPage,
rowKey: 'id',
columns: filterColumns,
pagination: {
pageSize: 10,
},
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
fieldMapToTime: [['kjsj', ['kjsjStart', 'kjsjEnd'], 'YYYY-MM-DD HH:mm:ss ', true],
['tjsj', ['tjsjStart', 'tjsjEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
showResetButton: false,
},
bordered:false,
beforeFetch: (params) => {
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' }
return pageParamsInfo.value;
},
afterFetch: (res) => {
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 195,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
},
customRow,
isAdvancedQuery: false,
querySelectOption: JSON.stringify(searchFormSchema),
objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值
});
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
openModal(true, { isUpdate: false, });
}
async function handleEdit(record: Recordable) {
let field = 'id';
try {
let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit');
if (hasIn) {
let res = await handleOpenFormEnableLockeData(
record[field],
formIdComputedRef.value,
);
if (res !== null) {
return;
}
}
let info = {
id: record[field],
isUpdate: true,
};
openModal(true, info);
} catch (error) {}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteMesCheliangBg(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function customRow(record: Recordable) {
return {
ondblclick: () => {
if (record.isCanEdit && hasPermission("gps:edit")) {
handleEdit(record);
}
},
};
}
function handleSuccess() {
reload();
}
function handleFormSuccess() {
handleSuccess();
handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
}
function handleFormCancel() {
handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
}
function handleView(record: Recordable) {
let info={
isView: true,
id: record.id,
}
openModal(true, info);
}
function getLessActions(record: Recordable) {
let list = getActions(record);
return list.slice(0, listSpliceNum.value);
}
function getMoreActions(record: Recordable) {
let list = getActions(record);
return list.slice(listSpliceNum.value);
}
function getActions(record: Recordable):ActionItem[] {
record.isCanEdit = false;
let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => {
if (!record?.workflowData?.processId) {
record.isCanEdit = true;
actionsList.push({
...button,
auth: `gps:${button.code}`,
label: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code]?.bind(null, record),
});
} else {
if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({
auth: `gps:${button.code}`,
label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record),
});
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment