初始代码

This commit is contained in:
wangmingwei
2026-04-21 17:48:26 +08:00
parent d3631949e9
commit 7f9e424a5c
1822 changed files with 288292 additions and 0 deletions

View File

@@ -0,0 +1,182 @@
<template>
<BasicPopup v-bind="$attrs" @register="registerPopup" :title="title" destroyOnClose>
<template #insertToolbar> </template>
<a-row class="p-10px dynamic-form" :style="{ margin: '0 auto', width: '100%' }">
<!-- 表单 -->
<a-form :colon="false" size="middle" layout="horizontal" labelAlign="right" :labelCol="{ style: { width: '100px' } }" :model="dataForm" ref="formRef">
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_type_code">
<template #label>项目类型编码 </template>
<YunzhupaasInput
v-model:value="dataForm.project_type_code"
placeholder="请输入项目类型编码"
:maxlength="50"
disabled
detailed
allowClear
:style="{ width: '100%' }"
:maskConfig="maskConfig.project_type_code">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_type_name">
<template #label>项目类型名称 </template>
<YunzhupaasInput
v-model:value="dataForm.project_type_name"
placeholder="请输入项目类型名称"
:maxlength="50"
disabled
detailed
allowClear
:style="{ width: '100%' }"
:maskConfig="maskConfig.project_type_name">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="remark">
<template #label>备注 </template> <p>{{ dataForm.remark }}</p>
</a-form-item>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicPopup>
<!-- 有关联表单详情开始 -->
<RelationDetail ref="relationDetailRef" />
<!-- 有关联表单详情结束 -->
</template>
<script lang="ts" setup>
import { getDetailInfo } from './helper/api';
import { getConfigData } from '@/api/onlineDev/visualDev';
import { reactive, toRefs, nextTick, ref, computed, unref, toRaw } from 'vue';
import { BasicPopup, usePopup } from '@/components/Popup';
import { BasicModal, useModal } from '@/components/Modal';
// 有关联表单详情
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { useMessage } from '@/hooks/web/useMessage';
import { CaretRightOutlined } from '@ant-design/icons-vue';
import { buildUUID } from '@/utils/uuid';
import { useI18n } from '@/hooks/web/useI18n';
import { getDataChange } from '@/api/onlineDev/visualDev';
import { getDataInterfaceDataInfoByIds } from '@/api/systemData/dataInterface';
import ExtraRelationInfo from '@/components/yunzhupaas/RelationForm/src/ExtraRelationInfo.vue';
interface State {
dataForm: any;
title: string;
maskConfig: any;
interfaceRes: any;
locationScope: any;
extraOptions: any;
extraData: any;
}
defineOptions({ name: 'Detail' });
const { createMessage, createConfirm } = useMessage();
const [registerPopup, { openPopup, setPopupProps, closePopup }] = usePopup();
const { t } = useI18n();
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
dataForm: {},
title: t('common.detailText', '详情'),
maskConfig: {
project_type_code: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
project_type_name: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
},
interfaceRes: { remark: [], project_type_name: [], project_type_code: [] },
locationScope: {},
extraOptions: {},
extraData: {},
});
const { title, dataForm, maskConfig } = toRefs(state);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.dataForm.id = data.id;
openPopup();
nextTick(() => {
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
closePopup();
}
}
function getData(id) {
getDetailInfo(id).then(res => {
state.dataForm = res.data || {};
nextTick(() => {
changeLoading(false);
});
});
}
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue };
relationDetailRef.value?.init(data);
});
}
function setFormProps(data) {
setPopupProps(data);
}
function changeLoading(loading) {
setFormProps({ loading });
}
function getParamList(key) {
let templateJson: any[] = state.interfaceRes[key];
if (!templateJson || !templateJson.length || !state.dataForm) return templateJson;
for (let i = 0; i < templateJson.length; i++) {
if (templateJson[i].relationField && templateJson[i].sourceType == 1) {
templateJson[i].defaultValue = state.dataForm[templateJson[i].relationField + '_id'] || '';
}
}
return templateJson;
}
</script>

View File

@@ -0,0 +1,362 @@
<template>
<BasicPopup v-bind="$attrs" @register="registerPopup" showOkBtn destroyOnClose
:cancelText="t('common.cancelText','取消')"
:okText="t('common.okText','确定')"
@ok="handleSubmit" :closeFunc="onClose">
<template #title>
<a-space :size="10">
<div class="text-16px font-medium">{{ title }}</div>
<a-space-compact size="small" block v-if="dataForm.id">
<a-tooltip :title="t('common.prevRecord')">
<a-button size="small" :disabled="getPrevDisabled" @click="handlePrev">
<i class="icon-ym icon-ym-caret-left text-10px"></i>
</a-button>
</a-tooltip>
<a-tooltip :title="t('common.nextRecord')">
<a-button size="small" :disabled="getNextDisabled" @click="handleNext">
<i class="icon-ym icon-ym-caret-right text-10px"></i>
</a-button>
</a-tooltip>
</a-space-compact>
</a-space>
</template>
<template #insertToolbar>
<yunzhupaasCheckboxSingle v-model:value="submitType" :label="continueText" v-if="showContinueBtn" />
</template>
<a-row class="p-10px dynamic-form " :style="{ margin: '0 auto', width: '100%' }">
<a-form :colon="false" size="middle" layout= "horizontal"
labelAlign= "right"
:labelCol="{ style: { width: '100px' } }" :model="dataForm" :rules="dataRule" ref="formRef" >
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_type_code" >
<template #label>项目类型编码
</template> <YunzhupaasInput v-model:value="dataForm.project_type_code" @change="changeData('project_type_code',-1)"
placeholder="请输入项目类型编码" :maxlength="50" :allowClear='true' :style='{"width":"100%"}' :maskConfig = "maskConfig.project_type_code" :showCount = "false" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_type_name" >
<template #label>项目类型名称
</template> <YunzhupaasInput v-model:value="dataForm.project_type_name" @change="changeData('project_type_name',-1)"
placeholder="请输入项目类型名称" :maxlength="50" :allowClear='true' :style='{"width":"100%"}' :maskConfig = "maskConfig.project_type_name" :showCount = "false" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="remark" >
<template #label>备注
</template> <YunzhupaasTextarea v-model:value="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入" :maxlength="100" :allowClear='true' :style='{"width":"100%"}' :autoSize='{"minRows":3,"maxRows":4}' :showCount = "false" >
</YunzhupaasTextarea>
</a-form-item>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicPopup>
</template>
<script lang="ts" setup>
import { create, update, getInfo } from './helper/api';
import { reactive, toRefs, nextTick, ref, unref, computed,toRaw, inject } from 'vue';
import { BasicPopup, usePopup } from '@/components/Popup';
import { yunzhupaasRelationForm } from '@/components/yunzhupaas';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useUserStore } from '@/store/modules/user';
import type { FormInstance } from 'ant-design-vue';
import { thousandsFormat , getDateTimeUnit, getTimeUnit} from '@/utils/yunzhupaas';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import dayjs from 'dayjs';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { cloneDeep } from 'lodash-es';
import { buildUUID } from '@/utils/uuid';
import { CaretRightOutlined } from '@ant-design/icons-vue';
interface State {
dataForm: any;
tableRows: any;
dataRule: any;
optionsObj: any;
childIndex: any;
isEdit: any;
interfaceRes: any;
//可选范围默认值
ableAll: any;
//掩码配置
maskConfig:any;
//定位属性
locationScope:any;
extraOptions: any;
title: string;
continueText: string; allList: any[];
currIndex: number;
isContinue: boolean;
submitType: number;
showContinueBtn: boolean;
}
const emit = defineEmits(['reload']);
const getLeftTreeActiveInfo: (() => any) | null = inject('getLeftTreeActiveInfo', null);
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const [registerPopup, { openPopup, setPopupProps }] = usePopup();
const formRef = ref<FormInstance>();
const state = reactive<State>({
dataForm: {
project_type_code:undefined,
project_type_name:undefined,
remark:undefined,
version: 0,
},
tableRows:{
},
dataRule: {
project_type_code: [
{
required: true,
message: t('sys.validate.textRequiredSuffix','不能为空'),
trigger: 'blur'
},
],
project_type_name: [
{
required: true,
message: t('sys.validate.textRequiredSuffix','不能为空'),
trigger: 'blur'
},
],
},
optionsObj:{
},
childIndex: -1,
isEdit: false,
interfaceRes: {"remark":[],"project_type_name":[],"project_type_code":[]},
//可选范围默认值
ableAll:{
},
//掩码配置
maskConfig:{
project_type_code: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
project_type_name: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
},
//定位属性
locationScope:{
},
extraOptions:{
},
title: "",
continueText: "", allList: [],
currIndex: 0,
isContinue: false,
submitType: 0,
showContinueBtn: true ,
});
const { title, continueText, showContinueBtn, dataRule, dataForm, optionsObj, ableAll, maskConfig,submitType } = toRefs(state);
const getPrevDisabled = computed(() => state.currIndex === 0);
const getNextDisabled = computed(() => state.currIndex === state.allList.length - 1);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.submitType = 0;
state.isContinue = false;
state.title = !data.id ? t('common.add2Text','新增') : t('common.editText','编辑');
state.continueText = !data.id ? t('common.continueAndAddText','确定并新增') : t('common.continueText','确定并继续'); setFormProps({ continueLoading: false });
state.dataForm.id = data.id;
openPopup();
state.allList = data.allList;
state.currIndex = state.allList.length && data.id ? state.allList.findIndex((item) => item.id === data.id) : 0;
nextTick(() => {
getForm().resetFields();
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
//初始化options
// 设置默认值
state.dataForm={
project_type_code:undefined,
project_type_name:undefined,
remark:undefined,
version: 0,
};
if (getLeftTreeActiveInfo) state.dataForm = {...state.dataForm, ...(getLeftTreeActiveInfo() || {}) };
state.childIndex = -1;
changeLoading(false);
}
}
function getForm() {
const form = unref(formRef);
if (!form) {
throw new Error('form is null!');
}
return form;
}
function getData(id) {
getInfo(id).then((res) => {
state.dataForm = res.data || {};
state.childIndex = -1;
changeLoading(false);
});
}
async function handleSubmit(type) {
try {
const values = await getForm()?.validate();
if (!values) return;
setFormProps({ confirmLoading: true });
const formMethod = state.dataForm.id ? update : create;
formMethod(state.dataForm)
.then((res) => {
createMessage.success(res.msg);
setFormProps({ confirmLoading: false });
if (state.submitType == 1) {
initData();
state.isContinue = true;
} else {
setFormProps({ open: false });
emit('reload');
}
})
.catch(() => {
setFormProps({ confirmLoading: false });
});
} catch (_) {}
}
function handlePrev() {
state.currIndex--;
handleGetNewInfo();
}
function handleNext() {
state.currIndex++;
handleGetNewInfo();
}
function handleGetNewInfo() {
changeLoading(true);
getForm().resetFields();
const id = state.allList[state.currIndex].id;
getData(id);
}
function setFormProps(data) {
setPopupProps(data);
}
function changeLoading(loading) {
setPopupProps({ loading });
}
async function onClose() {
if (state.isContinue) emit('reload');
return true;
}
function changeData(model, index) {
state.isEdit = false
state.childIndex = index
for (let key in state.interfaceRes) {
if (key != model) {
let faceReList = state.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
let relationField = faceReList[i].relationField;
if(relationField){
let modelAll = relationField.split('-');
let faceMode = '';
let faceMode2 = modelAll.length == 2?modelAll[0].substring(0, modelAll[0].length-4) +modelAll[1]:""
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
if (faceMode == model || faceMode2 == model ) {
let options = 'get' + key + 'Options';
eval(options)(true);
changeData(key, index)
}
}
}
}
}
}
function changeDataFormData(type, data, model,index,defaultValue) {
if(!state.isEdit) {
if (type == 2) {
for (let i = 0; i < state.dataForm[data].length; i++) {
if (index == -1) {
state.dataForm[data][i][model] = defaultValue
} else if (index == i) {
state.dataForm[data][i][model] = defaultValue
}
}
} else {
state.dataForm[data] = defaultValue
}
}
}
function getRelationDate(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue: any = null;
let timeValue = Number(timeValueData);
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue;
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = new Date().getTime();
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).valueOf();
}
}
return timeDataValue;
}
function getRelationTime(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType;
let timeDataValue: any = null;
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00';
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue;
} else {
timeDataValue = timeDataValue + ':00';
}
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = dayjs().format(format);
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget + 3);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).format(format);
}
}
return timeDataValue;
}
</script>

View File

@@ -0,0 +1,34 @@
import { defHttp } from '@/utils/http/axios';
// 获取列表
export function getList(data) {
return defHttp.post({ url: '/api/bcm/BcmProjectType/getList', data });
}
// 新建
export function create(data) {
return defHttp.post({ url:'/api/bcm/BcmProjectType', data });
}
// 修改
export function update(data) {
return defHttp.put({ url: '/api/bcm/BcmProjectType/'+ data.id, data });
}
// 详情(无转换数据)
export function getInfo(id) {
return defHttp.get({ url: '/api/bcm/BcmProjectType/' + id });
}
// 获取(转换数据)
export function getDetailInfo(id) {
return defHttp.get({ url: '/api/bcm/BcmProjectType/detail/' + id });
}
// 删除
export function del(id) {
return defHttp.delete({ url: '/api/bcm/BcmProjectType/' + id });
}
// 批量删除数据
export function batchDelete(data) {
return defHttp.delete({ url: '/api/bcm/BcmProjectType/batchRemove', data });
}
// 导出
export function exportData(data) {
return defHttp.post({ url: '/api/bcm/BcmProjectType/Actions/Export', data });
}

View File

@@ -0,0 +1,214 @@
const columnList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItem69cbe2",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目类型编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"bcm_project_type",
"renderKey":1774504684544,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"project_type_code",
"__vModel__":"project_type_code",
"disabled":false,
"id":"project_type_code",
"placeholder":"请输入项目类型编码",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":50,
"fullName":"项目类型编码",
"label":"项目类型编码",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItembf3850",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目类型名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"bcm_project_type",
"renderKey":1774504743202,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"project_type_name",
"__vModel__":"project_type_name",
"disabled":false,
"id":"project_type_name",
"placeholder":"请输入项目类型名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":50,
"fullName":"项目类型名称",
"label":"项目类型名称",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"textarea",
"clearable":true,
"resizable":true,
"maxlength":100,
"fullName":"备注",
"fullNameI18nCode":[
""
],
"label":"备注",
"sortable":false,
"align":"left",
"autoSize":{
"minRows":3,
"maxRows":4
},
"showCount":false,
"__config__":{
"formId":"formIteme2bc88",
"yunzhupaasKey":"textarea",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"备注",
"trigger":"blur",
"showLabel":true,
"required":false,
"tableName":"bcm_project_type",
"renderKey":1774504772430,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-textarea",
"tag":"YunzhupaasTextarea",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"remark",
"width":null,
"__vModel__":"remark",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"remark",
"placeholder":"请输入",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default columnList

View File

@@ -0,0 +1,2 @@
const searchList = []
export default searchList

View File

@@ -0,0 +1,187 @@
const superQueryJson = [
{
"clearable":true,
"maxlength":50,
"useScan":false,
"suffixIcon":"",
"fullName":"项目类型编码",
"fullNameI18nCode":[
""
],
"addonAfter":"",
"showCount":false,
"__config__":{
"formId":"formItem69cbe2",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目类型编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"bcm_project_type",
"renderKey":1774504684544,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"__vModel__":"project_type_code",
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_type_code",
"placeholder":"请输入项目类型编码",
"prefixIcon":"",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"clearable":true,
"maxlength":50,
"useScan":false,
"suffixIcon":"",
"fullName":"项目类型名称",
"fullNameI18nCode":[
""
],
"addonAfter":"",
"showCount":false,
"__config__":{
"formId":"formItembf3850",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目类型名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"bcm_project_type",
"renderKey":1774504743202,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"__vModel__":"project_type_name",
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_type_name",
"placeholder":"请输入项目类型名称",
"prefixIcon":"",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"clearable":true,
"maxlength":100,
"fullName":"备注",
"fullNameI18nCode":[
""
],
"autoSize":{
"minRows":3,
"maxRows":4
},
"showCount":false,
"__config__":{
"formId":"formIteme2bc88",
"yunzhupaasKey":"textarea",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"备注",
"trigger":"blur",
"showLabel":true,
"required":false,
"tableName":"bcm_project_type",
"renderKey":1774504772430,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-textarea",
"tag":"YunzhupaasTextarea",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"__vModel__":"remark",
"style":{
"width":"100%"
},
"disabled":false,
"id":"remark",
"placeholder":"请输入",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default superQueryJson

View File

@@ -0,0 +1,640 @@
<template>
<div class="yunzhupaas-content-wrapper">
<div class="yunzhupaas-content-wrapper-center">
<div class="yunzhupaas-content-wrapper-search-box" v-if="getSearchList.length">
<BasicForm @register="registerSearchForm" :schemas="getSearchList"
@advanced-change="redoHeight" @submit="handleSearchSubmit" @reset="handleSearchReset"
class="search-form">
</BasicForm>
</div>
<div class="yunzhupaas-content-wrapper-content bg-white">
<BasicTable @register="registerTable" v-bind="getTableBindValue" ref="tableRef"
@columns-change="handleColumnChange">
<template #tableTitle>
<a-button type="primary" preIcon="icon-ym icon-ym-btn-add"
@click="addHandle()"> {{t('common.add2Text','新增')}}</a-button>
</template>
<template #toolbar>
<a-tooltip placement="top">
<template #title>
<span>{{ t('common.superQuery') }}</span>
</template>
<filter-outlined @click="openSuperQuery(true, { columnOptions: superQueryJson })" />
</a-tooltip>
</template>
<template #toolbarAfter>
<ViewList :menuId="route.meta.modelId" :viewList="viewList" @itemClick="handleViewClick" @reload="initViewList" />
<ViewSetting :menuId="route.meta.modelId" :viewList="viewList" :currentView="currentView" @reload="initViewList" />
</template>
<template #bodyCell="{ column, record, index }">
<template v-for="(item, index) in childColumnList" v-if="childColumnList.length">
<template
v-if="column?.id?.includes('-') && item.children && item.children[0] && column.key === item.children[0]?.dataIndex">
<ChildTableColumn :data="record[item.prop]" :head="item.children"
@toggleExpand="toggleExpand(record, item.prop+`Expand`)" @toDetail="toDetail"
:expand="record[item.prop+`Expand`]" :key="index" :showOverflow="true "/>
</template>
</template>
<template v-if="!(record.top || column.id?.includes('-'))">
<template v-if="column.yunzhupaasKey === 'relationForm'">
<p class="link-text"
@click="toDetail(column.modelId, record[column.dataIndex+`_id`], column.propsValue)">
{{ record[column.dataIndex] }}</p>
</template>
<template v-if="column.yunzhupaasKey === 'inputNumber'">
<yunzhupaas-input-number v-model:value="record[column.prop]" :precision="column.precision" :thousands="column.thousands" disabled detailed />
</template>
<template v-if="column.yunzhupaasKey === 'calculate'">
<yunzhupaas-calculate
v-model:value="record[column.prop]"
:isStorage="column.isStorage"
:precision="column.precision"
:thousands="column.thousands"
detailed />
</template>
<template v-if="column.yunzhupaasKey === 'sign'">
<yunzhupaas-sign v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'signature'">
<yunzhupaas-signature v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'rate'">
<yunzhupaas-rate v-model:value="record[column.prop]" :count="column.count" :allowHalf="column.allowHalf" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'slider'">
<yunzhupaas-slider v-model:value="record[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'uploadImg'">
<yunzhupaas-upload-img v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'uploadFile'">
<yunzhupaas-upload-file v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'input'">
<yunzhupaas-input
v-model:value="record[column.prop]"
:useMask="column.useMask"
:maskConfig="column.maskConfig"
:showOverflow="true"
detailed />
</template>
</template>
<template v-if="column.key === 'action' && !record.top">
<TableAction :actions="getTableActions(record)" />
</template>
</template>
</BasicTable>
</div>
</div>
<Form ref="formRef" @reload="reload" />
<Detail ref="detailRef" />
<ExportModal @register="registerExportModal" @download="handleDownload" />
<ImportModal @register="registerImportModal" @reload="reload" />
<PrintSelect @register="registerPrintSelect" @change="handleShowBrowse" />
<PrintBrowse @register="registerPrintBrowse" />
<RelationDetail ref="relationDetailRef" />
<SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
</div>
</template>
<script lang="ts" setup>
import { getList, del, exportData, batchDelete } from './helper/api';
import { getConfigData,getViewList } from '@/api/onlineDev/visualDev';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import { getOrgByOrganizeCondition,getDepartmentSelectAsyncList } from '@/api/permission/organize';
import { ref, reactive, onMounted, toRefs, computed, unref, nextTick, toRaw, provide } from 'vue';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useOrganizeStore } from '@/store/modules/organize';
import { useUserStore } from '@/store/modules/user';
import { BasicModal, useModal } from '@/components/Modal';
import { usePopup } from '@/components/Popup';
import { ScrollContainer } from '@/components/Container';
import { BasicLeftTree, TreeActionType } from '@/components/Tree';
import { BasicForm, useForm } from '@/components/Form';
import { BasicTable, useTable, TableAction, ActionItem, TableActionType, SorterResult } from '@/components/Table';
import { SuperQueryModal } from '@/components/CommonModal';
import Form from './Form.vue';
import Detail from './Detail.vue';
// 有关联表单详情:开始
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 有关联表单详情:结束
import ChildTableColumn from '@/views/common/dynamicModel/list/ChildTableColumn.vue';
import { ExportModal } from '@/components/CommonModal';
import { downloadByUrl } from '@/utils/file/download';
import { ImportModal} from '@/components/CommonModal';
// 打印模板多条生成PrintSelect
import PrintSelect from '@/components/PrintDesign/printSelect/index.vue';
import PrintBrowse from '@/components/PrintDesign/printBrowse/index.vue';
import { useRoute,useRouter } from 'vue-router';
import { FilterOutlined } from '@ant-design/icons-vue';
import { getSearchFormSchemas } from '@/components/FormGenerator/src/helper/transform';
import { cloneDeep } from 'lodash-es';
import columnList from './helper/columnList';
import searchList from './helper/searchList';
import superQueryJson from './helper/superQueryJson';
import { dyOptionsList, systemComponentsList } from '@/components/FormGenerator/src/helper/config';
import { thousandsFormat, getParamList} from '@/utils/yunzhupaas';
import { usePermission } from '@/hooks/web/usePermission';
import ViewSetting from '@/views/common/dynamicModel/list/components/ViewSetting.vue';
import ViewList from '@/views/common/dynamicModel/list/components/ViewList.vue';
interface State {
config: any;
columnList: any[];
printListOptions: any[];
columnBtnsList: any[];
customBtnsList: any[];
treeFieldNames: any;
leftTreeData: any[];
leftTreeLoading: boolean;
treeActiveId: string;
treeActiveNodePath: any;
columns: any[];
complexColumns: any[];
childColumnList: any[];
exportList: any[];
cacheList: any[];
currFlow: any;
isCustomCopy: boolean;
candidateType: number;
currRow: any;
workFlowFormData: any;
expandObj: any;
columnSettingList: any[];
searchSchemas: any[];
treeRelationObj: any;
treeQueryJson: any;
leftTreeActiveInfo: any;
keyword: string;
viewList: any[];
currentView: any;
}
const route = useRoute();
const { hasBtnP } = usePermission();
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const organizeStore = useOrganizeStore();
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
const formRef = ref<any>(null);
const tableRef = ref<Nullable<TableActionType>>(null);
const detailRef = ref<any>(null);
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
config: {},
columnList: [],
printListOptions: [],
columnBtnsList: [],
customBtnsList: [],
treeFieldNames: {
children: 'children' ,
title: 'fullName' ,
key: 'id' ,
isLeaf: 'isLeaf',
},
leftTreeData: [],
leftTreeLoading: false,
treeActiveId: '',
treeActiveNodePath: [],
columns: [],
complexColumns: [], // 复杂表头
childColumnList: [],
exportList: [],
cacheList: [],
currFlow: {},
isCustomCopy: false,
candidateType: 1,
currRow: {},
workFlowFormData: {},
expandObj: {},
columnSettingList: [],
searchSchemas: [],
treeRelationObj: null,
treeQueryJson: {},
leftTreeActiveInfo: {},
keyword: '',
viewList: [],
currentView: {},
});
const defaultSearchInfo = {
menuId: route.meta.modelId as string,
moduleId:'806852213774222853',
superQueryJson: '',
dataType:0,
};
const searchInfo = reactive({
...cloneDeep(defaultSearchInfo),
});
const { childColumnList, searchSchemas, viewList, currentView} = toRefs(state);
const [registerSearchForm, { updateSchema, resetFields, submit: searchFormSubmit, setFieldsValue}] = useForm({
baseColProps: { span: 6 },
showActionButtonGroup: true,
showAdvancedButton: true,
compact: true,
});
const [registerTable, { reload, setLoading, getFetchParams, getSelectRows, getSelectRowKeys, redoHeight,clearSelectedRowKeys }] = useTable({
api: getList,
immediate: false,
clickToRowSelect: false,
tableSetting: { setting: false },
afterFetch: (data) => {
const list = data.map((o) => ({
...o,
...state.expandObj,
}));
state.cacheList = cloneDeep(list);
return list;
},
});
const [registerChildTable] = useTable({
pagination: false,
canResize: false,
showTableSetting: false,
});
provide('getLeftTreeActiveInfo', () => state.leftTreeActiveInfo);
const getHasBatchBtn = computed(() => {
let btnsList =[]
return !!btnsList.length
});
const getColumns = computed(() => {
const columns = state.complexColumns;
return setListValue(state.currentView?.columnList, columns, 'prop');
});
const getSearchList = computed(() => {
const searchSchemas = cloneDeep(state.searchSchemas).map(o => ({ ...o, show: true }));
return setListValue(state.currentView?.searchList, searchSchemas, 'field');
});
const getTableBindValue = computed(() => {
let columns = unref(getColumns);
const defaultSortConfig= [];
const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field);
const data: any = {
pagination: { pageSize: 20 }, //有分页
searchInfo: unref(searchInfo),
defSort: { sidx: sortField.join(',') },
sortFn: (sortInfo: SorterResult | SorterResult[]) => {
if (Array.isArray(sortInfo)) {
const sortList = sortInfo.map(o => (o.order === 'descend' ? '-' : '') + o.field);
return { sidx: sortList.join(',') };
} else {
const { field, order } = sortInfo;
if (field && order) {
// 排序字段
return { sidx: (order === 'descend' ? '-' : '') + field };
} else {
return {};
}
}
},
ellipsis:true ,
columns,
bordered: true,
actionColumn: {
width: 150,
title: t('component.table.action'),
dataIndex: 'action',
},
};
if (unref(getHasBatchBtn)) {
const rowSelection: any = { type: 'checkbox' };
data.rowSelection = rowSelection;
}
return data;
});
function init() {
state.config = {};
searchInfo.menuId = route.meta.modelId as string;
state.columnList = columnList;
setLoading(true);
getSearchSchemas();
getColumnList();
initViewList();
nextTick(() => {
unref(getSearchList)?.length ? searchFormSubmit() : reload({ page: 1 });
});
}
function getSearchSchemas() {
const schemas = getSearchFormSchemas(searchList);
state.searchSchemas = schemas;
schemas.forEach((cur) => {
const config = cur.__config__;
if (dyOptionsList.includes(config.yunzhupaasKey)) {
if (config.dataType === 'dictionary') {
if (!config.dictionaryType) return;
getDictionaryDataSelector(config.dictionaryType).then((res) => {
updateSchema([{ field: cur.field, componentProps: { options: res.data.list } }]);
});
}
if (config.dataType === 'dynamic') {
if (!config.propsUrl) return;
const query = { paramList: getParamList(config.templateJson) };
getDataInterfaceRes(config.propsUrl, query).then((res) => {
const data = Array.isArray(res.data) ? res.data : [];
updateSchema([{ field: cur.field, componentProps: { options: data } }]);
});
}
}
cur.defaultValue = cur.value;
});
}
function getColumnList() {
// 没有开启列表权限
let columnList = state.columnList;
state.exportList = columnList;
let columns = columnList.map((o) => ({
...o,
title: o.labelI18nCode ? t(o.labelI18nCode, o.label) : o.label,
dataIndex: o.prop,
align: o.align,
fixed: o.fixed == 'none' ? false : o.fixed,
sorter: o.sortable ? { multiple: 1 } : o.sortable,
width: o.width || 100,
}));
//添加复杂表头
columns = getComplexColumns(columns);
state.columns = columns.filter((o) => o.prop.indexOf('-') < 0);
//子表表头
getChildComplexColumns(columns);
}
//复杂表头
function getComplexColumns(columns) {
//这里生成复杂表头的配置
let complexHeaderList: any[] = [];
if (!complexHeaderList.length) return columns;
let childColumns: any[] = [];
let firstChildColumns: string[] = [];
for (let i = 0; i < complexHeaderList.length; i++) {
const e = complexHeaderList[i];
e.label = e.fullName;
e.labelI18nCode = e.fullNameI18nCode;
e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode, e.fullName) : e.fullName;
e.align = e.align;
e.dataIndex = e.id;
e.prop = e.id;
e.children = [];
e.yunzhupaasKey = 'complexHeader';
if (e.childColumns?.length) {
childColumns.push(...e.childColumns);
for (let k = 0; k < e.childColumns.length; k++) {
const item = e.childColumns[k];
for (let j = 0; j < columns.length; j++) {
const o = columns[j];
if (o.prop == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
}
}
}
if (e.children.length) firstChildColumns.push(e.children[0].prop);
}
complexHeaderList = complexHeaderList.filter(o => o.children.length);
let list: any[] = [];
for (let i = 0; i < columns.length; i++) {
const e = columns[i];
if (!childColumns.includes(e.prop)) {
list.push(e);
} else {
if (firstChildColumns.includes(e.prop)) {
const item = complexHeaderList.find(o => o.childColumns.includes(e.prop));
list.push(item);
}
}
}
return list;
}
//子表表头
function getChildComplexColumns(columnList) {
let list: any[] = [];
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e);
} else {
let prop = e.prop.split('-')[0];
let vModel = e.prop.split('-')[1];
let label = e.label.split('-')[0];
let childLabel = e.label.replace(label + '-', '');
if (e.fullNameI18nCode && Array.isArray(e.fullNameI18nCode) && e.fullNameI18nCode[0]) label = t(e.fullNameI18nCode[0], label);
let newItem = {
align: 'center',
yunzhupaasKey: 'table',
prop,
label,
title: label,
dataIndex: prop,
children: [],
};
e.dataIndex = vModel;
e.title = e.labelI18nCode ? t(e.labelI18nCode, childLabel) : childLabel;
if (!state.expandObj.hasOwnProperty(prop+`Expand`)) state.expandObj[prop+`Expand`] = false;
if (!list.some((o) => o.prop === prop)) list.push(newItem);
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e);
break;
}
}
}
}
// 行内分组展示
getMergeList(list);
state.complexColumns = list;
state.childColumnList = list.filter((o) => o.yunzhupaasKey === 'table');
// 子表分组展示宽度取100
for (let i = 0; i < state.childColumnList.length; i++) {
const e = state.childColumnList[i];
if (e.children?.length) e.children = e.children.map(o => ({ ...o, width: 100 }));
}
}
function getMergeList(list) {
list.forEach((item) => {
if (item.yunzhupaasKey === 'table' && item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
child.customCell = () => ({
rowspan: 1,
colspan: item.children.length,
class: 'child-table-box',
});
} else {
child.customCell = () => ({
rowspan: 0,
colspan: 0,
});
}
});
}
});
}
function toggleExpand(row, field) {
row[field] = !row[field];
}
// 关联表单查看详情
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue};
relationDetailRef.value?.init(data);
});
}
function handleColumnChange(data) {
state.columnSettingList = data;
}
function getTableActions(record): ActionItem[] {
return [
{
label: t('common.editText','编辑') ,
onClick: updateHandle.bind(null, record),
},
{
label: t('common.delText','删除') ,
color: 'error',
modelConfirm: {
onOk: handleDelete.bind(null, record.id),
},
},
];
}
// 编辑
function updateHandle(record) {
// 不带工作流
const data = {
id: record.id,
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 删除
function handleDelete(id) {
const query={ids:[id] }
batchDelete(query).then((res) => {
createMessage.success(res.msg);
clearSelectedRowKeys();
reload();
});
}
// 新增
function addHandle() {
// 不带流程新增
const data = {
id: '',
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 高级查询
function handleSuperQuery(superQueryJson) {
searchInfo.superQueryJson = superQueryJson;
reload({ page: 1 });
}
function handleSearchReset() {
clearSelectedRowKeys();
if (!state.resetFromTree) updateSearchFormValue();
if (state.resetFromTree) state.resetFromTree = false;
}
function handleSearchSubmit(data) {
clearSelectedRowKeys();
let obj = {
...defaultSearchInfo,
superQueryJson: searchInfo.superQueryJson,
...data,
};
Object.keys(searchInfo).map(key => {
delete searchInfo[key];
});
for (let [key, value] of Object.entries(obj)) {
searchInfo[key.replaceAll('-', '_')] = value;
}
console.log(searchInfo);
reload({ page: 1 });
}
function updateSearchFormValue() {
if (!state.treeActiveId) return searchFormSubmit();
let queryJson: any = {};
let leftTreeActiveInfo: any = {};
const isMultiple = !state.treeRelationObj ? false : state.treeRelationObj.searchMultiple;
//多级左侧树,需要拼父级->转为查询参数
if (state.treeRelationObj && state.treeRelationObj.yunzhupaasKey && ['organizeSelect', 'cascader', 'areaSelect'].includes(state.treeRelationObj.yunzhupaasKey)) {
let currValue = [];
currValue = state.treeActiveNodePath.map(o => o[state.treeFieldNames.key]);
queryJson = { '': isMultiple ? [currValue] : currValue };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [currValue] : currValue };
} else {
queryJson = { '': isMultiple ? [state.treeActiveId] : state.treeActiveId };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [state.treeActiveId] : state.treeActiveId };
}
state.leftTreeActiveInfo = leftTreeActiveInfo;
if(unref(getSearchList)?.length){
// 有搜索列表
setFieldsValue(queryJson);
searchFormSubmit();
}else{
// 无搜索列表
handleSearchSubmit(queryJson);
}
}
function initViewList(currentId = '') {
const query = {
menuId: route.meta.modelId,
};
getViewList(query).then(res => {
const columns : any[]= state.complexColumns;
const searchList: any[] = state.searchSchemas.map(o => ({ label: o.label, id: o.field, show: o.show, labelI18nCode: o.labelI18nCode }));
const columnList: any[] = columns.map(o => ({ label: o.label, id: o.prop, show: true, fixed: o.fixed || 'none', labelI18nCode: o.labelI18nCode }));
state.viewList = (res.data || []).map(o => {
if (o.type == 0) return { ...o, searchList, columnList };
return { ...o, searchList: o.searchList ? JSON.parse(o.searchList) : [], columnList: o.columnList ? JSON.parse(o.columnList) : [] };
});
if (currentId) {
state.currentView = state.viewList.filter(o => o.id === currentId)[0] || state.viewList[0];
} else {
state.currentView = state.viewList.filter(o => o.status === 1)[0] || state.viewList[0];
}
});
}
function handleViewClick(item) {
state.currentView = item;
}
function setListValue(data: any[] = [], defaultData: any[] = [], key) {
let list: any[] = [];
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < defaultData.length; j++) {
if (data[i].show && data[i].id == defaultData[j][key]) list.push(defaultData[j]);
}
}
return list;
}
onMounted(() => {
init();
});
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
import { defHttp } from '@/utils/http/axios';
// 获取列表
export function getList(data) {
return defHttp.post({ url: '/api/bcm/MdmCompany/getList', data });
}
// 新建
export function create(data) {
return defHttp.post({ url:'/api/bcm/MdmCompany', data });
}
// 修改
export function update(data) {
return defHttp.put({ url: '/api/bcm/MdmCompany/'+ data.id, data });
}
// 详情(无转换数据)
export function getInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmCompany/' + id });
}
// 获取(转换数据)
export function getDetailInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmCompany/detail/' + id });
}
// 删除
export function del(id) {
return defHttp.delete({ url: '/api/bcm/MdmCompany/' + id });
}
// 批量删除数据
export function batchDelete(data) {
return defHttp.delete({ url: '/api/bcm/MdmCompany/batchRemove', data });
}
// 导出
export function exportData(data) {
return defHttp.post({ url: '/api/bcm/MdmCompany/Actions/Export', data });
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
const searchList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"showCount":false,
"__config__":{
"formId":"formItem478e5c",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"企业名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_company",
"renderKey":1774506482470,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":8
},
"readonly":false,
"prop":"company_name",
"__vModel__":"company_name",
"searchMultiple":false,
"disabled":false,
"id":"company_name",
"placeholder":"请输入企业名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"searchType":2,
"maxlength":200,
"fullName":"企业名称",
"label":"企业名称",
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"isKeyword":true,
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"radio",
"searchType":1,
"buttonStyle":"solid",
"fullName":"类型",
"fullNameI18nCode":[
""
],
"label":"类型",
"props":{
"label":"fullName",
"value":"id"
},
"optionType":"default",
"__config__":{
"yunzhupaasKey":"radio",
"defaultValue":"ORG",
"dragDisabled":false,
"className":[],
"propsUrl":"",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_company",
"renderKey":1774506487223,
"tagIcon":"icon-ym icon-ym-generator-radio",
"tag":"YunzhupaasRadio",
"formId":"formItemb3f6cd",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"static",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"类型",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"",
"regList":[],
"tableAlign":"left",
"span":8
},
"size":"default",
"prop":"entity_type",
"options":[
{
"fullName":"企业",
"id":"ORG"
},
{
"fullName":"个人",
"id":"IND"
}
],
"__vModel__":"entity_type",
"searchMultiple":false,
"isKeyword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"entity_type",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"direction":"horizontal"
}
]
export default searchList

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,669 @@
<template>
<div class="yunzhupaas-content-wrapper">
<div class="yunzhupaas-content-wrapper-center">
<div class="yunzhupaas-content-wrapper-search-box" v-if="getSearchList.length">
<BasicForm @register="registerSearchForm" :schemas="getSearchList"
@advanced-change="redoHeight" @submit="handleSearchSubmit" @reset="handleSearchReset"
class="search-form">
</BasicForm>
</div>
<div class="yunzhupaas-content-wrapper-content bg-white">
<BasicTable @register="registerTable" v-bind="getTableBindValue" ref="tableRef"
@columns-change="handleColumnChange">
<template #tableTitle>
<a-button type="primary" preIcon="icon-ym icon-ym-btn-add"
@click="addHandle()"> {{t('common.add2Text','新增')}}</a-button>
<a-button type="link" preIcon="icon-ym icon-ym-btn-download"
@click="openExportModal(true, { columnList: state.exportList, selectIds: getSelectRowKeys(), showExportSelected: true })"> {{t('common.exportText','导出')}}</a-button>
</template>
<template #toolbar>
<a-tooltip placement="top">
<template #title>
<span>{{ t('common.superQuery') }}</span>
</template>
<filter-outlined @click="openSuperQuery(true, { columnOptions: superQueryJson })" />
</a-tooltip>
</template>
<template #toolbarAfter>
<ViewList :menuId="route.meta.modelId" :viewList="viewList" @itemClick="handleViewClick" @reload="initViewList" />
<ViewSetting :menuId="route.meta.modelId" :viewList="viewList" :currentView="currentView" @reload="initViewList" />
</template>
<template #bodyCell="{ column, record, index }">
<template v-for="(item, index) in childColumnList" v-if="childColumnList.length">
<template
v-if="column?.id?.includes('-') && item.children && item.children[0] && column.key === item.children[0]?.dataIndex">
<ChildTableColumn :data="record[item.prop]" :head="item.children"
@toggleExpand="toggleExpand(record, item.prop+`Expand`)" @toDetail="toDetail"
:expand="record[item.prop+`Expand`]" :key="index" :showOverflow="true "/>
</template>
</template>
<template v-if="!(record.top || column.id?.includes('-'))">
<template v-if="column.yunzhupaasKey === 'relationForm'">
<p class="link-text"
@click="toDetail(column.modelId, record[column.dataIndex+`_id`], column.propsValue)">
{{ record[column.dataIndex] }}</p>
</template>
<template v-if="column.yunzhupaasKey === 'inputNumber'">
<yunzhupaas-input-number v-model:value="record[column.prop]" :precision="column.precision" :thousands="column.thousands" disabled detailed />
</template>
<template v-if="column.yunzhupaasKey === 'calculate'">
<yunzhupaas-calculate
v-model:value="record[column.prop]"
:isStorage="column.isStorage"
:precision="column.precision"
:thousands="column.thousands"
detailed />
</template>
<template v-if="column.yunzhupaasKey === 'sign'">
<yunzhupaas-sign v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'signature'">
<yunzhupaas-signature v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'rate'">
<yunzhupaas-rate v-model:value="record[column.prop]" :count="column.count" :allowHalf="column.allowHalf" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'slider'">
<yunzhupaas-slider v-model:value="record[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'uploadImg'">
<yunzhupaas-upload-img v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'uploadFile'">
<yunzhupaas-upload-file v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'input'">
<yunzhupaas-input
v-model:value="record[column.prop]"
:useMask="column.useMask"
:maskConfig="column.maskConfig"
:showOverflow="true"
detailed />
</template>
</template>
<template v-if="column.key === 'action' && !record.top">
<TableAction :actions="getTableActions(record)" />
</template>
</template>
</BasicTable>
</div>
</div>
<Form ref="formRef" @reload="reload" />
<Detail ref="detailRef" />
<ExportModal @register="registerExportModal" @download="handleDownload" />
<ImportModal @register="registerImportModal" @reload="reload" />
<PrintSelect @register="registerPrintSelect" @change="handleShowBrowse" />
<PrintBrowse @register="registerPrintBrowse" />
<RelationDetail ref="relationDetailRef" />
<SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
</div>
</template>
<script lang="ts" setup>
import { getList, del, exportData, batchDelete } from './helper/api';
import { getConfigData,getViewList } from '@/api/onlineDev/visualDev';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import { getOrgByOrganizeCondition,getDepartmentSelectAsyncList } from '@/api/permission/organize';
import { ref, reactive, onMounted, toRefs, computed, unref, nextTick, toRaw, provide } from 'vue';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useOrganizeStore } from '@/store/modules/organize';
import { useUserStore } from '@/store/modules/user';
import { BasicModal, useModal } from '@/components/Modal';
import { usePopup } from '@/components/Popup';
import { ScrollContainer } from '@/components/Container';
import { BasicLeftTree, TreeActionType } from '@/components/Tree';
import { BasicForm, useForm } from '@/components/Form';
import { BasicTable, useTable, TableAction, ActionItem, TableActionType, SorterResult } from '@/components/Table';
import { SuperQueryModal } from '@/components/CommonModal';
import Form from './Form.vue';
import Detail from './Detail.vue';
// 有关联表单详情:开始
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 有关联表单详情:结束
import ChildTableColumn from '@/views/common/dynamicModel/list/ChildTableColumn.vue';
import { ExportModal } from '@/components/CommonModal';
import { downloadByUrl } from '@/utils/file/download';
import { ImportModal} from '@/components/CommonModal';
// 打印模板多条生成PrintSelect
import PrintSelect from '@/components/PrintDesign/printSelect/index.vue';
import PrintBrowse from '@/components/PrintDesign/printBrowse/index.vue';
import { useRoute,useRouter } from 'vue-router';
import { FilterOutlined } from '@ant-design/icons-vue';
import { getSearchFormSchemas } from '@/components/FormGenerator/src/helper/transform';
import { cloneDeep } from 'lodash-es';
import columnList from './helper/columnList';
import searchList from './helper/searchList';
import superQueryJson from './helper/superQueryJson';
import { dyOptionsList, systemComponentsList } from '@/components/FormGenerator/src/helper/config';
import { thousandsFormat, getParamList} from '@/utils/yunzhupaas';
import { usePermission } from '@/hooks/web/usePermission';
import ViewSetting from '@/views/common/dynamicModel/list/components/ViewSetting.vue';
import ViewList from '@/views/common/dynamicModel/list/components/ViewList.vue';
interface State {
config: any;
columnList: any[];
printListOptions: any[];
columnBtnsList: any[];
customBtnsList: any[];
treeFieldNames: any;
leftTreeData: any[];
leftTreeLoading: boolean;
treeActiveId: string;
treeActiveNodePath: any;
columns: any[];
complexColumns: any[];
childColumnList: any[];
exportList: any[];
cacheList: any[];
currFlow: any;
isCustomCopy: boolean;
candidateType: number;
currRow: any;
workFlowFormData: any;
expandObj: any;
columnSettingList: any[];
searchSchemas: any[];
treeRelationObj: any;
treeQueryJson: any;
leftTreeActiveInfo: any;
keyword: string;
viewList: any[];
currentView: any;
}
const route = useRoute();
const { hasBtnP } = usePermission();
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const organizeStore = useOrganizeStore();
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
const formRef = ref<any>(null);
const tableRef = ref<Nullable<TableActionType>>(null);
const detailRef = ref<any>(null);
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
config: {},
columnList: [],
printListOptions: [],
columnBtnsList: [],
customBtnsList: [],
treeFieldNames: {
children: 'children' ,
title: 'fullName' ,
key: 'id' ,
isLeaf: 'isLeaf',
},
leftTreeData: [],
leftTreeLoading: false,
treeActiveId: '',
treeActiveNodePath: [],
columns: [],
complexColumns: [], // 复杂表头
childColumnList: [],
exportList: [],
cacheList: [],
currFlow: {},
isCustomCopy: false,
candidateType: 1,
currRow: {},
workFlowFormData: {},
expandObj: {},
columnSettingList: [],
searchSchemas: [],
treeRelationObj: null,
treeQueryJson: {},
leftTreeActiveInfo: {},
keyword: '',
viewList: [],
currentView: {},
});
const defaultSearchInfo = {
menuId: route.meta.modelId as string,
moduleId:'806858527036409349',
superQueryJson: '',
dataType:0,
};
const searchInfo = reactive({
...cloneDeep(defaultSearchInfo),
});
const { childColumnList, searchSchemas, viewList, currentView} = toRefs(state);
const [registerSearchForm, { updateSchema, resetFields, submit: searchFormSubmit, setFieldsValue}] = useForm({
baseColProps: { span: 6 },
showActionButtonGroup: true,
showAdvancedButton: true,
compact: true,
});
const [registerTable, { reload, setLoading, getFetchParams, getSelectRows, getSelectRowKeys, redoHeight,clearSelectedRowKeys }] = useTable({
api: getList,
immediate: false,
clickToRowSelect: false,
tableSetting: { setting: false },
afterFetch: (data) => {
const list = data.map((o) => ({
...o,
...state.expandObj,
}));
state.cacheList = cloneDeep(list);
return list;
},
});
const [registerChildTable] = useTable({
pagination: false,
canResize: false,
showTableSetting: false,
});
provide('getLeftTreeActiveInfo', () => state.leftTreeActiveInfo);
const getHasBatchBtn = computed(() => {
let btnsList =[]
btnsList.push('download')
return !!btnsList.length
});
const getColumns = computed(() => {
const columns = state.complexColumns;
return setListValue(state.currentView?.columnList, columns, 'prop');
});
const getSearchList = computed(() => {
const searchSchemas = cloneDeep(state.searchSchemas).map(o => ({ ...o, show: true }));
return setListValue(state.currentView?.searchList, searchSchemas, 'field');
});
const getTableBindValue = computed(() => {
let columns = unref(getColumns);
const defaultSortConfig= [];
const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field);
const data: any = {
pagination: { pageSize: 20 }, //有分页
searchInfo: unref(searchInfo),
defSort: { sidx: sortField.join(',') },
sortFn: (sortInfo: SorterResult | SorterResult[]) => {
if (Array.isArray(sortInfo)) {
const sortList = sortInfo.map(o => (o.order === 'descend' ? '-' : '') + o.field);
return { sidx: sortList.join(',') };
} else {
const { field, order } = sortInfo;
if (field && order) {
// 排序字段
return { sidx: (order === 'descend' ? '-' : '') + field };
} else {
return {};
}
}
},
ellipsis:true ,
columns,
bordered: true,
actionColumn: {
width: 150,
title: t('component.table.action'),
dataIndex: 'action',
},
};
if (unref(getHasBatchBtn)) {
const rowSelection: any = { type: 'checkbox' };
data.rowSelection = rowSelection;
}
return data;
});
function init() {
state.config = {};
searchInfo.menuId = route.meta.modelId as string;
state.columnList = columnList;
setLoading(true);
getSearchSchemas();
getColumnList();
initViewList();
nextTick(() => {
unref(getSearchList)?.length ? searchFormSubmit() : reload({ page: 1 });
});
}
function getSearchSchemas() {
const schemas = getSearchFormSchemas(searchList);
state.searchSchemas = schemas;
schemas.forEach((cur) => {
const config = cur.__config__;
if (dyOptionsList.includes(config.yunzhupaasKey)) {
if (config.dataType === 'dictionary') {
if (!config.dictionaryType) return;
getDictionaryDataSelector(config.dictionaryType).then((res) => {
updateSchema([{ field: cur.field, componentProps: { options: res.data.list } }]);
});
}
if (config.dataType === 'dynamic') {
if (!config.propsUrl) return;
const query = { paramList: getParamList(config.templateJson) };
getDataInterfaceRes(config.propsUrl, query).then((res) => {
const data = Array.isArray(res.data) ? res.data : [];
updateSchema([{ field: cur.field, componentProps: { options: data } }]);
});
}
}
cur.defaultValue = cur.value;
});
}
function getColumnList() {
// 没有开启列表权限
let columnList = state.columnList;
state.exportList = columnList;
let columns = columnList.map((o) => ({
...o,
title: o.labelI18nCode ? t(o.labelI18nCode, o.label) : o.label,
dataIndex: o.prop,
align: o.align,
fixed: o.fixed == 'none' ? false : o.fixed,
sorter: o.sortable ? { multiple: 1 } : o.sortable,
width: o.width || 100,
}));
//添加复杂表头
columns = getComplexColumns(columns);
state.columns = columns.filter((o) => o.prop.indexOf('-') < 0);
//子表表头
getChildComplexColumns(columns);
}
//复杂表头
function getComplexColumns(columns) {
//这里生成复杂表头的配置
let complexHeaderList: any[] = [];
if (!complexHeaderList.length) return columns;
let childColumns: any[] = [];
let firstChildColumns: string[] = [];
for (let i = 0; i < complexHeaderList.length; i++) {
const e = complexHeaderList[i];
e.label = e.fullName;
e.labelI18nCode = e.fullNameI18nCode;
e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode, e.fullName) : e.fullName;
e.align = e.align;
e.dataIndex = e.id;
e.prop = e.id;
e.children = [];
e.yunzhupaasKey = 'complexHeader';
if (e.childColumns?.length) {
childColumns.push(...e.childColumns);
for (let k = 0; k < e.childColumns.length; k++) {
const item = e.childColumns[k];
for (let j = 0; j < columns.length; j++) {
const o = columns[j];
if (o.prop == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
}
}
}
if (e.children.length) firstChildColumns.push(e.children[0].prop);
}
complexHeaderList = complexHeaderList.filter(o => o.children.length);
let list: any[] = [];
for (let i = 0; i < columns.length; i++) {
const e = columns[i];
if (!childColumns.includes(e.prop)) {
list.push(e);
} else {
if (firstChildColumns.includes(e.prop)) {
const item = complexHeaderList.find(o => o.childColumns.includes(e.prop));
list.push(item);
}
}
}
return list;
}
//子表表头
function getChildComplexColumns(columnList) {
let list: any[] = [];
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e);
} else {
let prop = e.prop.split('-')[0];
let vModel = e.prop.split('-')[1];
let label = e.label.split('-')[0];
let childLabel = e.label.replace(label + '-', '');
if (e.fullNameI18nCode && Array.isArray(e.fullNameI18nCode) && e.fullNameI18nCode[0]) label = t(e.fullNameI18nCode[0], label);
let newItem = {
align: 'center',
yunzhupaasKey: 'table',
prop,
label,
title: label,
dataIndex: prop,
children: [],
};
e.dataIndex = vModel;
e.title = e.labelI18nCode ? t(e.labelI18nCode, childLabel) : childLabel;
if (!state.expandObj.hasOwnProperty(prop+`Expand`)) state.expandObj[prop+`Expand`] = false;
if (!list.some((o) => o.prop === prop)) list.push(newItem);
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e);
break;
}
}
}
}
// 行内分组展示
getMergeList(list);
state.complexColumns = list;
state.childColumnList = list.filter((o) => o.yunzhupaasKey === 'table');
// 子表分组展示宽度取100
for (let i = 0; i < state.childColumnList.length; i++) {
const e = state.childColumnList[i];
if (e.children?.length) e.children = e.children.map(o => ({ ...o, width: 100 }));
}
}
function getMergeList(list) {
list.forEach((item) => {
if (item.yunzhupaasKey === 'table' && item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
child.customCell = () => ({
rowspan: 1,
colspan: item.children.length,
class: 'child-table-box',
});
} else {
child.customCell = () => ({
rowspan: 0,
colspan: 0,
});
}
});
}
});
}
function toggleExpand(row, field) {
row[field] = !row[field];
}
// 关联表单查看详情
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue};
relationDetailRef.value?.init(data);
});
}
function handleColumnChange(data) {
state.columnSettingList = data;
}
function getTableActions(record): ActionItem[] {
return [
{
label: t('common.editText','编辑') ,
onClick: updateHandle.bind(null, record),
},
{
label: t('common.delText','删除') ,
color: 'error',
modelConfirm: {
onOk: handleDelete.bind(null, record.id),
},
},
{
label: t('common.detailText','详情') ,
onClick: goDetail.bind(null, record),
},
];
}
// 编辑
function updateHandle(record) {
// 不带工作流
const data = {
id: record.id,
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 删除
function handleDelete(id) {
const query={ids:[id] }
batchDelete(query).then((res) => {
createMessage.success(res.msg);
clearSelectedRowKeys();
reload();
});
}
// 查看详情
function goDetail(record) {
// 不带流程
const data = {
id: record.id,
};
detailRef.value?.init(data);
}
// 新增
function addHandle() {
// 不带流程新增
const data = {
id: '',
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 导出
function handleDownload(data) {
let query = { ...getFetchParams(), ...data };
exportData(query)
.then((res) => {
setExportModalProps({ confirmLoading: false });
if (!res.data.url) return;
downloadByUrl({ url: res.data.url });
closeExportModal();
})
.catch(() => {
setExportModalProps({ confirmLoading: false });
});
}
// 高级查询
function handleSuperQuery(superQueryJson) {
searchInfo.superQueryJson = superQueryJson;
reload({ page: 1 });
}
function handleSearchReset() {
clearSelectedRowKeys();
if (!state.resetFromTree) updateSearchFormValue();
if (state.resetFromTree) state.resetFromTree = false;
}
function handleSearchSubmit(data) {
clearSelectedRowKeys();
let obj = {
...defaultSearchInfo,
superQueryJson: searchInfo.superQueryJson,
...data,
};
Object.keys(searchInfo).map(key => {
delete searchInfo[key];
});
for (let [key, value] of Object.entries(obj)) {
searchInfo[key.replaceAll('-', '_')] = value;
}
console.log(searchInfo);
reload({ page: 1 });
}
function updateSearchFormValue() {
if (!state.treeActiveId) return searchFormSubmit();
let queryJson: any = {};
let leftTreeActiveInfo: any = {};
const isMultiple = !state.treeRelationObj ? false : state.treeRelationObj.searchMultiple;
//多级左侧树,需要拼父级->转为查询参数
if (state.treeRelationObj && state.treeRelationObj.yunzhupaasKey && ['organizeSelect', 'cascader', 'areaSelect'].includes(state.treeRelationObj.yunzhupaasKey)) {
let currValue = [];
currValue = state.treeActiveNodePath.map(o => o[state.treeFieldNames.key]);
queryJson = { '': isMultiple ? [currValue] : currValue };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [currValue] : currValue };
} else {
queryJson = { '': isMultiple ? [state.treeActiveId] : state.treeActiveId };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [state.treeActiveId] : state.treeActiveId };
}
state.leftTreeActiveInfo = leftTreeActiveInfo;
if(unref(getSearchList)?.length){
// 有搜索列表
setFieldsValue(queryJson);
searchFormSubmit();
}else{
// 无搜索列表
handleSearchSubmit(queryJson);
}
}
function initViewList(currentId = '') {
const query = {
menuId: route.meta.modelId,
};
getViewList(query).then(res => {
const columns : any[]= state.complexColumns;
const searchList: any[] = state.searchSchemas.map(o => ({ label: o.label, id: o.field, show: o.show, labelI18nCode: o.labelI18nCode }));
const columnList: any[] = columns.map(o => ({ label: o.label, id: o.prop, show: true, fixed: o.fixed || 'none', labelI18nCode: o.labelI18nCode }));
state.viewList = (res.data || []).map(o => {
if (o.type == 0) return { ...o, searchList, columnList };
return { ...o, searchList: o.searchList ? JSON.parse(o.searchList) : [], columnList: o.columnList ? JSON.parse(o.columnList) : [] };
});
if (currentId) {
state.currentView = state.viewList.filter(o => o.id === currentId)[0] || state.viewList[0];
} else {
state.currentView = state.viewList.filter(o => o.status === 1)[0] || state.viewList[0];
}
});
}
function handleViewClick(item) {
state.currentView = item;
}
function setListValue(data: any[] = [], defaultData: any[] = [], key) {
let list: any[] = [];
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < defaultData.length; j++) {
if (data[i].show && data[i].id == defaultData[j][key]) list.push(defaultData[j]);
}
}
return list;
}
onMounted(() => {
init();
});
</script>

View File

@@ -0,0 +1,402 @@
<template>
<BasicPopup v-bind="$attrs" @register="registerPopup" :title="title" destroyOnClose>
<template #insertToolbar>
</template>
<a-row class="p-10px dynamic-form " :style="{ margin: '0 auto', width: '100%' }">
<!-- 表单 -->
<a-form :colon="false" size="middle" layout= "horizontal"
labelAlign= "right"
:labelCol="{ style: { width: '100px' } }" :model="dataForm" ref="formRef" >
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="12" class="ant-col-item" >
<a-form-item
name="contract_type_code" >
<template #label>合同类型编码
</template> <YunzhupaasInput v-model:value="dataForm.contract_type_code"
placeholder="请输入合同类型编码" :maxlength="25" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.contract_type_code" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="12" class="ant-col-item" >
<a-form-item
name="contract_type_name" >
<template #label>合同类型名称
</template> <YunzhupaasInput v-model:value="dataForm.contract_type_name"
placeholder="请输入合同类型名称" :maxlength="50" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.contract_type_name" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_type" >
<template #label>项目类型
</template> <p>{{ dataForm.project_type }} </p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="18" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="合同财务性质分类" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="6" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="contract_mode" >
<p>{{ dataForm.contract_mode }} </p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:合同财务性质分类,主要是将合同分为收入类合同、支出类合同。合同财务性质分类主要影响合同财务管理。收入类合同通常会导致企业资产增加的经济活动相关,如销售商品、提供服务等。支出类合同通常会导致企业资产减少或负情增加的经济活动相关,如采购材料、租赁设备、支付劳务费用等。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="16" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启动合同清单 —— 材料清单" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_list_enabled" >
<p>{{ dataForm.cl_list_enabled }} </p>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_list_alias" >
<YunzhupaasInput v-model:value="dataForm.cl_list_alias"
placeholder="别名" :maxlength="10" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.cl_list_alias" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_lst_seq" >
<YunzhupaasInputNumber v-model:value="dataForm.cl_lst_seq"
placeholder="序号" disabled
detailed :style='{"width":"100%"}' :step="1" :controls="false" >
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:启用合同清单——材料清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供材料清单的维护。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="16" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启动合同清单 —— 租赁清单" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_list_enabled" >
<p>{{ dataForm.zl_list_enabled }} </p>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_list_alias" >
<YunzhupaasInput v-model:value="dataForm.zl_list_alias"
placeholder="别名" :maxlength="10" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.zl_list_alias" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_lst_seq" >
<YunzhupaasInputNumber v-model:value="dataForm.zl_lst_seq"
placeholder="序号" disabled
detailed :style='{"width":"100%"}' :step="1" :controls="false" >
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:启用合同清单——租赁清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供材料清单的维护。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="16" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启动合同清单 —— 劳务清单" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_list_enabled" >
<p>{{ dataForm.rg_list_enabled }} </p>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_list_alias" >
<YunzhupaasInput v-model:value="dataForm.rg_list_alias"
placeholder="别名" :maxlength="10" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.rg_list_alias" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_lst_seq" >
<YunzhupaasInputNumber v-model:value="dataForm.rg_lst_seq"
placeholder="序号" disabled
detailed :style='{"width":"100%"}' :step="1" :controls="false" >
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:启用合同清单——劳务清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供劳务资源清单的维护。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="16" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启动合同清单 —— 工程量清单" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_list_enabled" >
<p>{{ dataForm.gcl_list_enabled }} </p>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_list_alias" >
<YunzhupaasInput v-model:value="dataForm.gcl_list_alias"
placeholder="别名" :maxlength="10" disabled
detailed allowClear :style='{"width":"100%"}' :maskConfig = "maskConfig.gcl_list_alias" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_lst_seq" >
<YunzhupaasInputNumber v-model:value="dataForm.gcl_lst_seq"
placeholder="序号" disabled
detailed :style='{"width":"100%"}' :step="1" :controls="false" >
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:启用合同清单——工程量清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供工程量清单的维护。该清单一般不会与材料清单、租赁清单、劳务清单一起使用,但系统不做强控制。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启用在线合同模板" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="contract_temp_enabled" >
<p>{{ dataForm.contract_temp_enabled }} </p>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20" >
<a-row :gutter="15">
<a-col :span="16" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":16,"line-height":15,"font-style":"normal","text-align":"left"}' content="启用工作流程,审核合同签订的内容" >
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="workflow_enabled" >
<p>{{ dataForm.workflow_enabled }} </p>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="workflow_temp_id" >
<p>{{ dataForm.workflow_temp_id }} </p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":15,"font-style":"normal","text-align":"left"}' content="说明:启用工作流程后,在合同在起草或者内容变更后,需要提交工作流进行合同内容的审核。未启用工作流时,提交合同,可直接生效合同内容。" >
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicPopup>
<!-- 有关联表单详情开始 -->
<RelationDetail ref="relationDetailRef" />
<!-- 有关联表单详情结束 -->
</template>
<script lang="ts" setup>
import { getDetailInfo } from './helper/api';
import { getConfigData } from '@/api/onlineDev/visualDev';
import { reactive, toRefs, nextTick, ref, computed, unref ,toRaw} from 'vue';
import { BasicPopup, usePopup } from '@/components/Popup';
import { BasicModal, useModal } from '@/components/Modal';
// 有关联表单详情
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { useMessage } from '@/hooks/web/useMessage';
import { CaretRightOutlined } from '@ant-design/icons-vue';
import { buildUUID } from '@/utils/uuid';
import { useI18n } from '@/hooks/web/useI18n';
import { getDataChange } from '@/api/onlineDev/visualDev';
import { getDataInterfaceDataInfoByIds } from '@/api/systemData/dataInterface';
import ExtraRelationInfo from '@/components/yunzhupaas/RelationForm/src/ExtraRelationInfo.vue';
interface State {
dataForm: any;
title: string;
maskConfig: any;
interfaceRes: any;
locationScope: any;
extraOptions: any;
extraData: any;
}
defineOptions({ name: 'Detail' });
const { createMessage, createConfirm } = useMessage();
const [registerPopup, { openPopup, setPopupProps, closePopup }] = usePopup();
const { t } = useI18n();
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
dataForm:{},
title: t('common.detailText','详情'),
maskConfig:{
contract_type_code: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
contract_type_name: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
cl_list_alias: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
zl_list_alias: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
rg_list_alias: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
gcl_list_alias: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
}
,
interfaceRes: {"project_type":[],"contract_mode":[],"workflow_enabled":[],"rg_list_alias":[],"rg_list_enabled":[],"cl_list_alias":[],"zl_list_enabled":[],"zl_list_alias":[],"contract_type_code":[],"cl_lst_seq":[],"workflow_temp_id":[],"gcl_list_enabled":[],"contract_temp_enabled":[],"contract_type_name":[],"rg_lst_seq":[],"gcl_lst_seq":[],"gcl_list_alias":[],"zl_lst_seq":[],"cl_list_enabled":[]},
locationScope:{
}
,
extraOptions: {
}
,
extraData: {
}
,
});
const { title, dataForm, maskConfig } = toRefs(state);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.dataForm.id = data.id;
openPopup();
nextTick(() => {
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
closePopup();
}
}
function getData(id) {
getDetailInfo(id).then((res) => {
state.dataForm = res.data || {};
nextTick(() => {
changeLoading(false);
});
});
}
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue};
relationDetailRef.value?.init(data);
});
}
function setFormProps(data) {
setPopupProps(data);
}
function changeLoading(loading) {
setFormProps({ loading });
}
function getParamList(key) {
let templateJson: any[] = state.interfaceRes[key];
if (!templateJson || !templateJson.length || !state.dataForm) return templateJson;
for (let i = 0; i < templateJson.length; i++) {
if (templateJson[i].relationField && templateJson[i].sourceType == 1) {
templateJson[i].defaultValue = state.dataForm[templateJson[i].relationField + '_id'] || '';
}
}
return templateJson;
}
</script>

View File

@@ -0,0 +1,998 @@
<template>
<BasicPopup
v-bind="$attrs"
@register="registerPopup"
showOkBtn
destroyOnClose
:cancelText="t('common.cancelText', '取消')"
:okText="t('common.okText', '确定')"
@ok="handleSubmit"
:closeFunc="onClose">
<template #title>
<a-space :size="10">
<div class="text-16px font-medium">{{ title }}</div>
<a-space-compact size="small" block v-if="dataForm.id">
<a-tooltip :title="t('common.prevRecord')">
<a-button size="small" :disabled="getPrevDisabled" @click="handlePrev">
<i class="icon-ym icon-ym-caret-left text-10px"></i>
</a-button>
</a-tooltip>
<a-tooltip :title="t('common.nextRecord')">
<a-button size="small" :disabled="getNextDisabled" @click="handleNext">
<i class="icon-ym icon-ym-caret-right text-10px"></i>
</a-button>
</a-tooltip>
</a-space-compact>
</a-space>
</template>
<template #insertToolbar>
<yunzhupaasCheckboxSingle v-model:value="submitType" :label="continueText" v-if="showContinueBtn" />
</template>
<a-row class="p-10px dynamic-form" :style="{ margin: '0 auto', width: '100%' }">
<a-form
:colon="false"
size="middle"
layout="horizontal"
labelAlign="right"
:labelCol="{ style: { width: '100px' } }"
:model="dataForm"
:rules="dataRule"
ref="formRef">
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="12" class="ant-col-item">
<a-form-item name="contract_type_code">
<template #label>合同类型编码 </template>
<YunzhupaasInput
v-model:value="dataForm.contract_type_code"
@change="changeData('contract_type_code', -1)"
placeholder="请输入合同类型编码"
:maxlength="25"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.contract_type_code"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="12" class="ant-col-item">
<a-form-item name="contract_type_name">
<template #label>合同类型名称 </template>
<YunzhupaasInput
v-model:value="dataForm.contract_type_name"
@change="changeData('contract_type_name', -1)"
placeholder="请输入合同类型名称"
:maxlength="50"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.contract_type_name"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_type">
<template #label>项目类型 </template>
<YunzhupaasSelect
v-model:value="dataForm.project_type"
@change="changeData('project_type', -1)"
placeholder="请选择合同模式"
:templateJson="state.interfaceRes.project_type"
:allowClear="true"
:style="{ width: '100%' }"
:showSearch="false"
:options="optionsObj.project_typeOptions"
:fieldNames="optionsObj.project_typeProps">
</YunzhupaasSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="18" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="合同财务性质分类">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="6" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="contract_mode">
<YunzhupaasSelect
v-model:value="dataForm.contract_mode"
@change="changeData('contract_mode', -1)"
placeholder="请选择"
:templateJson="state.interfaceRes.contract_mode"
:allowClear="true"
:style="{ width: '100%' }"
:showSearch="false"
:options="optionsObj.contract_modeOptions"
:fieldNames="optionsObj.contract_modeProps">
</YunzhupaasSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:合同财务性质分类,主要是将合同分为收入类合同、支出类合同。合同财务性质分类主要影响合同财务管理。收入类合同通常会导致企业资产增加的经济活动相关,如销售商品、提供服务等。支出类合同通常会导致企业资产减少或负情增加的经济活动相关,如采购材料、租赁设备、支付劳务费用等。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="dataForm.cl_list_enabled==1?16:22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启动合同清单 —— 材料清单">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_list_enabled">
<YunzhupaasSwitch v-model:value="dataForm.cl_list_enabled" @change="changeData('cl_list_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" v-if="dataForm.cl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_list_alias">
<YunzhupaasInput
v-model:value="dataForm.cl_list_alias"
@change="changeData('cl_list_alias', -1)"
placeholder="别名"
:maxlength="10"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.cl_list_alias"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" v-if="dataForm.cl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="cl_lst_seq">
<YunzhupaasInputNumber
v-model:value="dataForm.cl_lst_seq"
@change="changeData('cl_lst_seq', -1)"
placeholder="序号"
:style="{ width: '100%' }"
:step="1"
:controls="false">
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:启用合同清单——材料清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供材料清单的维护。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="dataForm.zl_list_enabled==1?16:22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启动合同清单 —— 租赁清单">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_list_enabled">
<YunzhupaasSwitch v-model:value="dataForm.zl_list_enabled" @change="changeData('zl_list_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" v-if="dataForm.zl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_list_alias">
<YunzhupaasInput
v-model:value="dataForm.zl_list_alias"
@change="changeData('zl_list_alias', -1)"
placeholder="别名"
:maxlength="10"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.zl_list_alias"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" v-if="dataForm.zl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="zl_lst_seq">
<YunzhupaasInputNumber
v-model:value="dataForm.zl_lst_seq"
@change="changeData('zl_lst_seq', -1)"
placeholder="序号"
:style="{ width: '100%' }"
:step="1"
:controls="false">
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:启用合同清单——租赁清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供材料清单的维护。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="dataForm.rg_list_enabled==1?16:22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启动合同清单 —— 劳务清单">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" >
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_list_enabled">
<YunzhupaasSwitch v-model:value="dataForm.rg_list_enabled" @change="changeData('rg_list_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" v-if="dataForm.rg_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_list_alias">
<YunzhupaasInput
v-model:value="dataForm.rg_list_alias"
@change="changeData('rg_list_alias', -1)"
placeholder="别名"
:maxlength="10"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.rg_list_alias"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" v-if="dataForm.rg_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="rg_lst_seq">
<YunzhupaasInputNumber
v-model:value="dataForm.rg_lst_seq"
@change="changeData('rg_lst_seq', -1)"
placeholder="序号"
:style="{ width: '100%' }"
:step="1"
:controls="false">
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:启用合同清单——劳务清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供劳务资源清单的维护。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="dataForm.gcl_list_enabled==1?16:22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启动合同清单 —— 工程量清单">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_list_enabled">
<YunzhupaasSwitch v-model:value="dataForm.gcl_list_enabled" @change="changeData('gcl_list_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" v-if="dataForm.gcl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_list_alias">
<YunzhupaasInput
v-model:value="dataForm.gcl_list_alias"
@change="changeData('gcl_list_alias', -1)"
placeholder="别名"
:maxlength="10"
:allowClear="true"
:style="{ width: '100%' }"
:maskConfig="maskConfig.gcl_list_alias"
:showCount="false">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item" v-if="dataForm.gcl_list_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="gcl_lst_seq">
<YunzhupaasInputNumber
v-model:value="dataForm.gcl_lst_seq"
@change="changeData('gcl_lst_seq', -1)"
placeholder="序号"
:style="{ width: '100%' }"
:step="1"
:controls="false">
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:启用合同清单——工程量清单,主要是用于控制该类型合同,在起草或者清单维护时,能提供工程量清单的维护。该清单一般不会与材料清单、租赁清单、劳务清单一起使用,但系统不做强控制。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启用在线合同模板">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="contract_temp_enabled">
<YunzhupaasSwitch v-model:value="dataForm.contract_temp_enabled" @change="changeData('contract_temp_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-card class="mb-20">
<a-row :gutter="15">
<a-col :span="dataForm.workflow_enabled==1?16:22" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 16,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="启用工作流程,审核合同签订的内容">
</YunzhupaasText>
</a-form-item>
</a-col>
<a-col :span="2" class="ant-col-item">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="workflow_enabled">
<YunzhupaasSwitch v-model:value="dataForm.workflow_enabled" @change="changeData('workflow_enabled', -1)"> </YunzhupaasSwitch>
</a-form-item>
</a-col>
<a-col :span="4" class="ant-col-item" v-if="dataForm.workflow_enabled==1">
<a-form-item :labelCol="{ style: { width: '0px' } }" name="workflow_temp_id">
<YunzhupaasSelect
v-model:value="dataForm.workflow_temp_id"
@change="changeData('workflow_temp_id', -1)"
placeholder="请选择"
:templateJson="state.interfaceRes.workflow_temp_id"
:allowClear="true"
:style="{ width: '100%' }"
:showSearch="false"
:options="optionsObj.workflow_temp_idOptions"
:fieldNames="optionsObj.workflow_temp_idProps">
</YunzhupaasSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item>
<YunzhupaasText
:textStyle="{
color: '#000000',
'font-weight': 'normal',
'text-decoration': 'none',
'font-size': 12,
'line-height': 15,
'font-style': 'normal',
'text-align': 'left',
}"
content="说明:启用工作流程后,在合同在起草或者内容变更后,需要提交工作流进行合同内容的审核。未启用工作流时,提交合同,可直接生效合同内容。">
</YunzhupaasText>
</a-form-item>
</a-col>
</a-row>
</a-card>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicPopup>
</template>
<script lang="ts" setup>
import { create, update, getInfo } from './helper/api';
import { reactive, toRefs, nextTick, ref, unref, computed, toRaw, inject } from 'vue';
import { BasicPopup, usePopup } from '@/components/Popup';
import { yunzhupaasRelationForm } from '@/components/yunzhupaas';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useUserStore } from '@/store/modules/user';
import type { FormInstance } from 'ant-design-vue';
import { thousandsFormat, getDateTimeUnit, getTimeUnit } from '@/utils/yunzhupaas';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import dayjs from 'dayjs';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { cloneDeep } from 'lodash-es';
import { buildUUID } from '@/utils/uuid';
import { CaretRightOutlined } from '@ant-design/icons-vue';
interface State {
dataForm: any;
tableRows: any;
dataRule: any;
optionsObj: any;
childIndex: any;
isEdit: any;
interfaceRes: any;
//可选范围默认值
ableAll: any;
//掩码配置
maskConfig: any;
//定位属性
locationScope: any;
extraOptions: any;
title: string;
continueText: string;
allList: any[];
currIndex: number;
isContinue: boolean;
submitType: number;
showContinueBtn: boolean;
}
const emit = defineEmits(['reload']);
const getLeftTreeActiveInfo: (() => any) | null = inject('getLeftTreeActiveInfo', null);
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const [registerPopup, { openPopup, setPopupProps }] = usePopup();
const formRef = ref<FormInstance>();
const state = reactive<State>({
dataForm: {
contract_type_code: undefined,
contract_type_name: undefined,
project_type: 'SOFT',
contract_mode: 'revenue',
cl_list_enabled: 0,
cl_list_alias: '材料清单',
cl_lst_seq: 1,
zl_list_enabled: 0,
zl_list_alias: '租赁清单',
zl_lst_seq: 1,
rg_list_enabled: 0,
rg_list_alias: '劳务清单',
rg_lst_seq: 1,
gcl_list_enabled: 0,
gcl_list_alias: '工程量清单',
gcl_lst_seq: 1,
contract_temp_enabled: 0,
workflow_enabled: 0,
workflow_temp_id: '',
version: 0,
},
tableRows: {},
dataRule: {
contract_type_code: [
{
required: true,
message: t('sys.validate.textRequiredSuffix', '不能为空'),
trigger: 'blur',
},
],
contract_type_name: [
{
required: true,
message: t('sys.validate.textRequiredSuffix', '不能为空'),
trigger: 'blur',
},
],
project_type: [
{
required: true,
message: t('sys.validate.arrayRequiredPrefix ', '请至少选择一个'),
trigger: 'change',
},
],
},
optionsObj: {
project_typeOptions: [],
project_typeProps: { label: 'project_type_name', value: 'project_type_code' },
contract_modeOptions: [
{ fullName: '收入类合同', id: 'revenue' },
{ fullName: '支付类合同', id: 'payment' },
],
contract_modeProps: { label: 'fullName', value: 'id' },
workflow_temp_idOptions: [
{ fullName: '选项一', id: '1' },
{ fullName: '选项二', id: '2' },
],
workflow_temp_idProps: { label: 'fullName', value: 'id' },
},
childIndex: -1,
isEdit: false,
interfaceRes: {
project_type: [],
contract_mode: [],
workflow_enabled: [],
rg_list_alias: [],
rg_list_enabled: [],
cl_list_alias: [],
zl_list_enabled: [],
zl_list_alias: [],
contract_type_code: [],
cl_lst_seq: [],
workflow_temp_id: [],
gcl_list_enabled: [],
contract_temp_enabled: [],
contract_type_name: [],
rg_lst_seq: [],
gcl_lst_seq: [],
gcl_list_alias: [],
zl_lst_seq: [],
cl_list_enabled: [],
},
//可选范围默认值
ableAll: {},
//掩码配置
maskConfig: {
contract_type_code: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
contract_type_name: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
cl_list_alias: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
zl_list_alias: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
rg_list_alias: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
gcl_list_alias: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
},
//定位属性
locationScope: {},
extraOptions: {},
title: '',
continueText: '',
allList: [],
currIndex: 0,
isContinue: false,
submitType: 0,
showContinueBtn: true,
});
const { title, continueText, showContinueBtn, dataRule, dataForm, optionsObj, ableAll, maskConfig, submitType } = toRefs(state);
const getPrevDisabled = computed(() => state.currIndex === 0);
const getNextDisabled = computed(() => state.currIndex === state.allList.length - 1);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.submitType = 0;
state.isContinue = false;
state.title = !data.id ? t('common.add2Text', '新增') : t('common.editText', '编辑');
state.continueText = !data.id ? t('common.continueAndAddText', '确定并新增') : t('common.continueText', '确定并继续');
setFormProps({ continueLoading: false });
state.dataForm.id = data.id;
openPopup();
state.allList = data.allList;
state.currIndex = state.allList.length && data.id ? state.allList.findIndex(item => item.id === data.id) : 0;
nextTick(() => {
getForm().resetFields();
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
//初始化options
getproject_typeOptions();
// 设置默认值
state.dataForm = {
contract_type_code: undefined,
contract_type_name: undefined,
project_type: 'SOFT',
contract_mode: 'revenue',
cl_list_enabled: 0,
cl_list_alias: '材料清单',
cl_lst_seq: 1,
zl_list_enabled: 0,
zl_list_alias: '租赁清单',
zl_lst_seq: 1,
rg_list_enabled: 0,
rg_list_alias: '劳务清单',
rg_lst_seq: 1,
gcl_list_enabled: 0,
gcl_list_alias: '工程量清单',
gcl_lst_seq: 1,
contract_temp_enabled: 0,
workflow_enabled: 0,
workflow_temp_id: '',
version: 0,
};
if (getLeftTreeActiveInfo) state.dataForm = { ...state.dataForm, ...(getLeftTreeActiveInfo() || {}) };
state.childIndex = -1;
changeLoading(false);
}
}
function getForm() {
const form = unref(formRef);
if (!form) {
throw new Error('form is null!');
}
return form;
}
function getData(id) {
getInfo(id).then(res => {
state.dataForm = res.data || {};
getproject_typeOptions();
state.childIndex = -1;
changeLoading(false);
});
}
async function handleSubmit(type) {
try {
const values = await getForm()?.validate();
if (!values) return;
setFormProps({ confirmLoading: true });
const formMethod = state.dataForm.id ? update : create;
formMethod(state.dataForm)
.then(res => {
createMessage.success(res.msg);
setFormProps({ confirmLoading: false });
if (state.submitType == 1) {
initData();
state.isContinue = true;
} else {
setFormProps({ open: false });
emit('reload');
}
})
.catch(() => {
setFormProps({ confirmLoading: false });
});
} catch (_) {}
}
function handlePrev() {
state.currIndex--;
handleGetNewInfo();
}
function handleNext() {
state.currIndex++;
handleGetNewInfo();
}
function handleGetNewInfo() {
changeLoading(true);
getForm().resetFields();
const id = state.allList[state.currIndex].id;
getData(id);
}
function setFormProps(data) {
setPopupProps(data);
}
function changeLoading(loading) {
setPopupProps({ loading });
}
async function onClose() {
if (state.isContinue) emit('reload');
return true;
}
function changeData(model, index) {
state.isEdit = false;
state.childIndex = index;
for (let key in state.interfaceRes) {
if (key != model) {
let faceReList = state.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) {
let relationField = faceReList[i].relationField;
if (relationField) {
let modelAll = relationField.split('-');
let faceMode = '';
let faceMode2 = modelAll.length == 2 ? modelAll[0].substring(0, modelAll[0].length - 4) + modelAll[1] : '';
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
if (faceMode == model || faceMode2 == model) {
let options = 'get' + key + 'Options';
eval(options)(true);
changeData(key, index);
}
}
}
}
}
}
function changeDataFormData(type, data, model, index, defaultValue) {
if (!state.isEdit) {
if (type == 2) {
for (let i = 0; i < state.dataForm[data].length; i++) {
if (index == -1) {
state.dataForm[data][i][model] = defaultValue;
} else if (index == i) {
state.dataForm[data][i][model] = defaultValue;
}
}
} else {
state.dataForm[data] = defaultValue;
}
}
}
//数据选项--远端数据初始化方法
function getproject_typeOptions(isClear = false) {
const index = state.childIndex;
let templateJsonList = JSON.parse(JSON.stringify(state.interfaceRes.project_type));
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField && json.sourceType == 1) {
let relationFieldAll = json.relationField.split('-');
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
if (relationFieldAll[0].endsWith('List')) {
val =
state.dataForm[relationFieldAll[0]] && state.dataForm[relationFieldAll[0]].length
? state.dataForm[relationFieldAll[0]][index][relationFieldAll[1]]
: '';
} else {
val =
state.dataForm[relationFieldAll[0] + 'List'] && state.dataForm[relationFieldAll[0] + 'List'].length
? state.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]]
: '';
}
} else {
val = state.dataForm[relationFieldAll];
}
json.defaultValue = val ? val : '';
}
}
let template = {
paramList: templateJsonList,
};
getDataInterfaceRes('797165402772733957', template).then(res => {
let data = res.data;
state.optionsObj.project_typeOptions = data;
if (index == -1) return;
if (isClear) {
changeDataFormData(1, 'List', 'project_type', index, '');
}
});
}
function getRelationDate(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue: any = null;
let timeValue = Number(timeValueData);
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue;
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = new Date().getTime();
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).valueOf();
}
}
return timeDataValue;
}
function getRelationTime(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType;
let timeDataValue: any = null;
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00';
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue;
} else {
timeDataValue = timeDataValue + ':00';
}
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = dayjs().format(format);
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget + 3);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).format(format);
}
}
return timeDataValue;
}
</script>
<style scoped>
.mb-20 {
margin-bottom: 1rem;
background-color: #F5F7FA;
}
</style>

View File

@@ -0,0 +1,34 @@
import { defHttp } from '@/utils/http/axios';
// 获取列表
export function getList(data) {
return defHttp.post({ url: '/api/bcm/MdmContractType/getList', data });
}
// 新建
export function create(data) {
return defHttp.post({ url:'/api/bcm/MdmContractType', data });
}
// 修改
export function update(data) {
return defHttp.put({ url: '/api/bcm/MdmContractType/'+ data.id, data });
}
// 详情(无转换数据)
export function getInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmContractType/' + id });
}
// 获取(转换数据)
export function getDetailInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmContractType/detail/' + id });
}
// 删除
export function del(id) {
return defHttp.delete({ url: '/api/bcm/MdmContractType/' + id });
}
// 批量删除数据
export function batchDelete(data) {
return defHttp.delete({ url: '/api/bcm/MdmContractType/batchRemove', data });
}
// 导出
export function exportData(data) {
return defHttp.post({ url: '/api/bcm/MdmContractType/Actions/Export', data });
}

View File

@@ -0,0 +1,600 @@
const columnList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItem49f65f",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"合同类型编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_contract_type",
"renderKey":1774838784995,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":12
},
"readonly":false,
"prop":"contract_type_code",
"__vModel__":"contract_type_code",
"disabled":false,
"id":"contract_type_code",
"placeholder":"请输入合同类型编码",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":25,
"fullName":"合同类型编码",
"label":"合同类型编码",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItema51d1e",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"合同类型名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_contract_type",
"renderKey":1774838789410,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":12
},
"readonly":false,
"prop":"contract_type_name",
"__vModel__":"contract_type_name",
"disabled":false,
"id":"contract_type_name",
"placeholder":"请输入合同类型名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":50,
"fullName":"合同类型名称",
"label":"合同类型名称",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"select",
"filterable":false,
"clearable":true,
"resizable":true,
"multiple":false,
"fullName":"项目类型",
"fullNameI18nCode":[
""
],
"label":"项目类型",
"sortable":false,
"align":"left",
"props":{
"label":"project_type_name",
"value":"project_type_code"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"SOFT",
"dragDisabled":false,
"className":[],
"propsUrl":"797165402772733957",
"templateJson":[],
"showLabel":true,
"required":true,
"tableName":"mdm_contract_type",
"renderKey":1774840899305,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItemac75d7",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dynamic",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"项目类型",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"项目类型列表",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"project_type",
"width":null,
"options":[],
"__vModel__":"project_type",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_type",
"placeholder":"请选择合同模式",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"select",
"filterable":false,
"clearable":true,
"resizable":true,
"multiple":false,
"fullName":"合同模式",
"fullNameI18nCode":[
""
],
"label":"合同模式",
"sortable":false,
"align":"left",
"props":{
"label":"fullName",
"value":"id"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"revenue",
"dragDisabled":false,
"className":[],
"propsUrl":"",
"templateJson":[],
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774839981641,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItemb30132",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"static",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"合同模式",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"",
"regList":[],
"tableAlign":"left",
"span":6
},
"prop":"contract_mode",
"width":null,
"options":[
{
"fullName":"收入类合同",
"id":"revenue"
},
{
"fullName":"支付类合同",
"id":"payment"
}
],
"__vModel__":"contract_mode",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"contract_mode",
"placeholder":"请选择",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"材料清单",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"材料清单",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItemef29e9",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"材料清单",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840487884,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"cl_list_enabled",
"width":null,
"__vModel__":"cl_list_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"cl_list_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"劳务清单",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"劳务清单",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItemc48550",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"劳务清单",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840557640,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"rg_list_enabled",
"width":null,
"__vModel__":"rg_list_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"rg_list_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"工程量清单",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"工程量清单",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItem477d28",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"工程量清单",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840573827,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"gcl_list_enabled",
"width":null,
"__vModel__":"gcl_list_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"gcl_list_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"租赁清单",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"租赁清单",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItem061f70",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"租赁清单",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840537386,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"zl_list_enabled",
"width":null,
"__vModel__":"zl_list_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"zl_list_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"工作流程",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"工作流程",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItem43b97d",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"工作流程",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840790597,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"workflow_enabled",
"width":null,
"__vModel__":"workflow_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"workflow_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"switch",
"resizable":true,
"activeValue":1,
"inactiveValue":0,
"fullName":"在线合同模板",
"inactiveTxt":"N",
"fullNameI18nCode":[
""
],
"label":"在线合同模板",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItem098126",
"yunzhupaasKey":"switch",
"visibility":[
"pc",
"app"
],
"defaultValue":0,
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"在线合同模板",
"trigger":"change",
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774840646431,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-switch",
"tag":"YunzhupaasSwitch",
"regList":[],
"tableAlign":"left",
"span":2
},
"prop":"contract_temp_enabled",
"width":null,
"__vModel__":"contract_temp_enabled",
"fixed":"none",
"disabled":false,
"activeTxt":"Y",
"id":"contract_temp_enabled",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default columnList

View File

@@ -0,0 +1,223 @@
const searchList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"showCount":false,
"__config__":{
"formId":"formItem49f65f",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"合同类型编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_contract_type",
"renderKey":1774838784995,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":12
},
"readonly":false,
"prop":"contract_type_code",
"__vModel__":"contract_type_code",
"searchMultiple":false,
"disabled":false,
"id":"contract_type_code",
"placeholder":"请输入合同类型编码",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"searchType":2,
"maxlength":25,
"fullName":"合同类型编码",
"label":"合同类型编码",
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"isKeyword":false,
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"showCount":false,
"__config__":{
"formId":"formItema51d1e",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"合同类型名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_contract_type",
"renderKey":1774838789410,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":12
},
"readonly":false,
"prop":"contract_type_name",
"__vModel__":"contract_type_name",
"searchMultiple":false,
"disabled":false,
"id":"contract_type_name",
"placeholder":"请输入合同类型名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"searchType":2,
"maxlength":50,
"fullName":"合同类型名称",
"label":"合同类型名称",
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"isKeyword":true,
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"select",
"filterable":false,
"clearable":true,
"searchType":1,
"multiple":false,
"fullName":"合同模式",
"fullNameI18nCode":[
""
],
"label":"合同模式",
"props":{
"label":"fullName",
"value":"id"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"revenue",
"dragDisabled":false,
"className":[],
"propsUrl":"",
"templateJson":[],
"showLabel":false,
"required":false,
"tableName":"mdm_contract_type",
"renderKey":1774839981641,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItemb30132",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"static",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"合同模式",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"",
"regList":[],
"tableAlign":"left",
"span":6
},
"prop":"contract_mode",
"options":[
{
"fullName":"收入类合同",
"id":"revenue"
},
{
"fullName":"支付类合同",
"id":"payment"
}
],
"__vModel__":"contract_mode",
"searchMultiple":false,
"isKeyword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"contract_mode",
"placeholder":"请选择",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default searchList

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,705 @@
<template>
<div class="yunzhupaas-content-wrapper">
<div class="yunzhupaas-content-wrapper-left">
<BasicLeftTree v-bind="getLeftTreeBindValue" ref="leftTreeRef" @reload="getTreeView()"
@select="handleLeftTreeSelect" />
</div>
<div class="yunzhupaas-content-wrapper-center">
<div class="yunzhupaas-content-wrapper-search-box" v-if="getSearchList.length">
<BasicForm @register="registerSearchForm" :schemas="getSearchList"
@advanced-change="redoHeight" @submit="handleSearchSubmit" @reset="handleSearchReset"
class="search-form">
</BasicForm>
</div>
<div class="yunzhupaas-content-wrapper-content bg-white">
<BasicTable @register="registerTable" v-bind="getTableBindValue" ref="tableRef"
@columns-change="handleColumnChange">
<template #tableTitle>
<a-button type="primary" preIcon="icon-ym icon-ym-btn-add"
@click="addHandle()"> {{t('common.add2Text','新增')}}</a-button>
</template>
<template #toolbar>
<a-tooltip placement="top">
<template #title>
<span>{{ t('common.superQuery') }}</span>
</template>
<filter-outlined @click="openSuperQuery(true, { columnOptions: superQueryJson })" />
</a-tooltip>
</template>
<template #toolbarAfter>
<ViewList :menuId="route.meta.modelId" :viewList="viewList" @itemClick="handleViewClick" @reload="initViewList" />
<ViewSetting :menuId="route.meta.modelId" :viewList="viewList" :currentView="currentView" @reload="initViewList" />
</template>
<template #bodyCell="{ column, record, index }">
<template v-for="(item, index) in childColumnList" v-if="childColumnList.length">
<template
v-if="column?.id?.includes('-') && item.children && item.children[0] && column.key === item.children[0]?.dataIndex">
<ChildTableColumn :data="record[item.prop]" :head="item.children"
@toggleExpand="toggleExpand(record, item.prop+`Expand`)" @toDetail="toDetail"
:expand="record[item.prop+`Expand`]" :key="index" :showOverflow="true "/>
</template>
</template>
<template v-if="!(record.top || column.id?.includes('-'))">
<template v-if="column.yunzhupaasKey === 'relationForm'">
<p class="link-text"
@click="toDetail(column.modelId, record[column.dataIndex+`_id`], column.propsValue)">
{{ record[column.dataIndex] }}</p>
</template>
<template v-if="column.yunzhupaasKey === 'inputNumber'">
<yunzhupaas-input-number v-model:value="record[column.prop]" :precision="column.precision" :thousands="column.thousands" disabled detailed />
</template>
<template v-if="column.yunzhupaasKey === 'calculate'">
<yunzhupaas-calculate
v-model:value="record[column.prop]"
:isStorage="column.isStorage"
:precision="column.precision"
:thousands="column.thousands"
detailed />
</template>
<template v-if="column.yunzhupaasKey === 'sign'">
<yunzhupaas-sign v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'signature'">
<yunzhupaas-signature v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'rate'">
<yunzhupaas-rate v-model:value="record[column.prop]" :count="column.count" :allowHalf="column.allowHalf" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'slider'">
<yunzhupaas-slider v-model:value="record[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'uploadImg'">
<yunzhupaas-upload-img v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'uploadFile'">
<yunzhupaas-upload-file v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'input'">
<yunzhupaas-input
v-model:value="record[column.prop]"
:useMask="column.useMask"
:maskConfig="column.maskConfig"
:showOverflow="true"
detailed />
</template>
</template>
<template v-if="column.key === 'action' && !record.top">
<TableAction :actions="getTableActions(record)" />
</template>
</template>
</BasicTable>
</div>
</div>
<Form ref="formRef" @reload="reload" />
<Detail ref="detailRef" />
<ExportModal @register="registerExportModal" @download="handleDownload" />
<ImportModal @register="registerImportModal" @reload="reload" />
<PrintSelect @register="registerPrintSelect" @change="handleShowBrowse" />
<PrintBrowse @register="registerPrintBrowse" />
<RelationDetail ref="relationDetailRef" />
<SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
</div>
</template>
<script lang="ts" setup>
import { getList, del, exportData, batchDelete } from './helper/api';
import { getConfigData,getViewList } from '@/api/onlineDev/visualDev';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import { getOrgByOrganizeCondition,getDepartmentSelectAsyncList } from '@/api/permission/organize';
import { ref, reactive, onMounted, toRefs, computed, unref, nextTick, toRaw, provide } from 'vue';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useOrganizeStore } from '@/store/modules/organize';
import { useUserStore } from '@/store/modules/user';
import { BasicModal, useModal } from '@/components/Modal';
import { usePopup } from '@/components/Popup';
import { ScrollContainer } from '@/components/Container';
import { BasicLeftTree, TreeActionType } from '@/components/Tree';
import { BasicForm, useForm } from '@/components/Form';
import { BasicTable, useTable, TableAction, ActionItem, TableActionType, SorterResult } from '@/components/Table';
import { SuperQueryModal } from '@/components/CommonModal';
import Form from './Form.vue';
import Detail from './Detail.vue';
// 有关联表单详情:开始
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 有关联表单详情:结束
import ChildTableColumn from '@/views/common/dynamicModel/list/ChildTableColumn.vue';
import { ExportModal } from '@/components/CommonModal';
import { downloadByUrl } from '@/utils/file/download';
import { ImportModal} from '@/components/CommonModal';
// 打印模板多条生成PrintSelect
import PrintSelect from '@/components/PrintDesign/printSelect/index.vue';
import PrintBrowse from '@/components/PrintDesign/printBrowse/index.vue';
import { useRoute,useRouter } from 'vue-router';
import { FilterOutlined } from '@ant-design/icons-vue';
import { getSearchFormSchemas } from '@/components/FormGenerator/src/helper/transform';
import { cloneDeep } from 'lodash-es';
import columnList from './helper/columnList';
import searchList from './helper/searchList';
import superQueryJson from './helper/superQueryJson';
import { dyOptionsList, systemComponentsList } from '@/components/FormGenerator/src/helper/config';
import { thousandsFormat, getParamList} from '@/utils/yunzhupaas';
import { usePermission } from '@/hooks/web/usePermission';
import ViewSetting from '@/views/common/dynamicModel/list/components/ViewSetting.vue';
import ViewList from '@/views/common/dynamicModel/list/components/ViewList.vue';
interface State {
config: any;
columnList: any[];
printListOptions: any[];
columnBtnsList: any[];
customBtnsList: any[];
treeFieldNames: any;
leftTreeData: any[];
leftTreeLoading: boolean;
treeActiveId: string;
treeActiveNodePath: any;
columns: any[];
complexColumns: any[];
childColumnList: any[];
exportList: any[];
cacheList: any[];
currFlow: any;
isCustomCopy: boolean;
candidateType: number;
currRow: any;
workFlowFormData: any;
expandObj: any;
columnSettingList: any[];
searchSchemas: any[];
treeRelationObj: any;
treeQueryJson: any;
leftTreeActiveInfo: any;
keyword: string;
viewList: any[];
currentView: any;
}
const route = useRoute();
const { hasBtnP } = usePermission();
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const organizeStore = useOrganizeStore();
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
const leftTreeRef = ref<Nullable<TreeActionType>>(null);
const formRef = ref<any>(null);
const tableRef = ref<Nullable<TableActionType>>(null);
const detailRef = ref<any>(null);
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
config: {},
columnList: [],
printListOptions: [],
columnBtnsList: [],
customBtnsList: [],
treeFieldNames: {
children: 'children' ,
title: 'project_type_name' ,
key: 'project_type_code' ,
isLeaf: 'isLeaf',
},
leftTreeData: [],
leftTreeLoading: false,
treeActiveId: '',
treeActiveNodePath: [],
columns: [],
complexColumns: [], // 复杂表头
childColumnList: [],
exportList: [],
cacheList: [],
currFlow: {},
isCustomCopy: false,
candidateType: 1,
currRow: {},
workFlowFormData: {},
expandObj: {},
columnSettingList: [],
searchSchemas: [],
treeRelationObj: null,
treeQueryJson: {},
leftTreeActiveInfo: {},
keyword: '',
viewList: [],
currentView: {},
});
const defaultSearchInfo = {
menuId: route.meta.modelId as string,
moduleId:'808252366691240901',
superQueryJson: '',
dataType:0,
};
const searchInfo = reactive({
...cloneDeep(defaultSearchInfo),
});
const { childColumnList, searchSchemas, viewList, currentView} = toRefs(state);
const [registerSearchForm, { updateSchema, resetFields, submit: searchFormSubmit, setFieldsValue}] = useForm({
baseColProps: { span: 6 },
showActionButtonGroup: true,
showAdvancedButton: true,
compact: true,
});
const [registerTable, { reload, setLoading, getFetchParams, getSelectRows, getSelectRowKeys, redoHeight,clearSelectedRowKeys }] = useTable({
api: getList,
immediate: false,
clickToRowSelect: false,
tableSetting: { setting: false },
afterFetch: (data) => {
const list = data.map((o) => ({
...o,
...state.expandObj,
}));
state.cacheList = cloneDeep(list);
return list;
},
});
const [registerChildTable] = useTable({
pagination: false,
canResize: false,
showTableSetting: false,
});
provide('getLeftTreeActiveInfo', () => state.leftTreeActiveInfo);
const getHasBatchBtn = computed(() => {
let btnsList =[]
return !!btnsList.length
});
const getLeftTreeBindValue = computed(() => {
const key = +new Date();
const data: any = {
title: '项目类型',
showSearch: true, //异步的时候为false
fieldNames: state.treeFieldNames,
defaultExpandAll: true, //异步的时候为false
treeData: state.leftTreeData,
loading: state.leftTreeLoading,
key,
};
return data;
});
const getColumns = computed(() => {
const columns = state.complexColumns;
return setListValue(state.currentView?.columnList, columns, 'prop');
});
const getSearchList = computed(() => {
const searchSchemas = cloneDeep(state.searchSchemas).map(o => ({ ...o, show: true }));
return setListValue(state.currentView?.searchList, searchSchemas, 'field');
});
const getTableBindValue = computed(() => {
let columns = unref(getColumns);
const defaultSortConfig= [];
const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field);
const data: any = {
pagination: { pageSize: 20 }, //有分页
searchInfo: unref(searchInfo),
defSort: { sidx: sortField.join(',') },
sortFn: (sortInfo: SorterResult | SorterResult[]) => {
if (Array.isArray(sortInfo)) {
const sortList = sortInfo.map(o => (o.order === 'descend' ? '-' : '') + o.field);
return { sidx: sortList.join(',') };
} else {
const { field, order } = sortInfo;
if (field && order) {
// 排序字段
return { sidx: (order === 'descend' ? '-' : '') + field };
} else {
return {};
}
}
},
ellipsis:true ,
columns,
bordered: true,
actionColumn: {
width: 150,
title: t('component.table.action'),
dataIndex: 'action',
},
};
if (unref(getHasBatchBtn)) {
const rowSelection: any = { type: 'checkbox' };
data.rowSelection = rowSelection;
}
return data;
});
function init() {
state.config = {};
searchInfo.menuId = route.meta.modelId as string;
state.columnList = columnList;
setLoading(true);
getSearchSchemas();
getColumnList();
initViewList();
// 有左侧树
getTreeView(true);
}
// 有左侧树
async function getTreeView(isInit = false) {
state.leftTreeLoading = true;
state.leftTreeData = [];
// 数据接口
let treeTemplateJson: any[] = []
const query = { paramList: getParamList(treeTemplateJson) };
getDataInterfaceRes('797165402772733957',query).then((res) => {
state.leftTreeData = Array.isArray(res.data) ? res.data : [];
state.leftTreeLoading = false;
nextTick(() => {
if (isInit){
unref(getSearchList)?.length? searchFormSubmit() : reload({ page: 1 });
}
});
});
}
function getSearchSchemas() {
// 有左侧树,有关联字段
if (!state.treeRelationObj) {
for (let i = 0; i < superQueryJson.length; i++) {
const e = superQueryJson[i];
if (e.id === 'project_type') {
state.treeRelationObj = { ...e, searchMultiple: false, yunzhupaasKey: e.__config__.yunzhupaasKey };
break;
}
}
}
const schemas = getSearchFormSchemas(searchList);
state.searchSchemas = schemas;
schemas.forEach((cur) => {
const config = cur.__config__;
if (dyOptionsList.includes(config.yunzhupaasKey)) {
if (config.dataType === 'dictionary') {
if (!config.dictionaryType) return;
getDictionaryDataSelector(config.dictionaryType).then((res) => {
updateSchema([{ field: cur.field, componentProps: { options: res.data.list } }]);
});
}
if (config.dataType === 'dynamic') {
if (!config.propsUrl) return;
const query = { paramList: getParamList(config.templateJson) };
getDataInterfaceRes(config.propsUrl, query).then((res) => {
const data = Array.isArray(res.data) ? res.data : [];
updateSchema([{ field: cur.field, componentProps: { options: data } }]);
});
}
}
cur.defaultValue = cur.value;
});
}
function getColumnList() {
// 没有开启列表权限
let columnList = state.columnList;
state.exportList = columnList;
let columns = columnList.map((o) => ({
...o,
title: o.labelI18nCode ? t(o.labelI18nCode, o.label) : o.label,
dataIndex: o.prop,
align: o.align,
fixed: o.fixed == 'none' ? false : o.fixed,
sorter: o.sortable ? { multiple: 1 } : o.sortable,
width: o.width || 100,
}));
//添加复杂表头
columns = getComplexColumns(columns);
state.columns = columns.filter((o) => o.prop.indexOf('-') < 0);
//子表表头
getChildComplexColumns(columns);
}
//复杂表头
function getComplexColumns(columns) {
//这里生成复杂表头的配置
let complexHeaderList: any[] = [];
if (!complexHeaderList.length) return columns;
let childColumns: any[] = [];
let firstChildColumns: string[] = [];
for (let i = 0; i < complexHeaderList.length; i++) {
const e = complexHeaderList[i];
e.label = e.fullName;
e.labelI18nCode = e.fullNameI18nCode;
e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode, e.fullName) : e.fullName;
e.align = e.align;
e.dataIndex = e.id;
e.prop = e.id;
e.children = [];
e.yunzhupaasKey = 'complexHeader';
if (e.childColumns?.length) {
childColumns.push(...e.childColumns);
for (let k = 0; k < e.childColumns.length; k++) {
const item = e.childColumns[k];
for (let j = 0; j < columns.length; j++) {
const o = columns[j];
if (o.prop == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
}
}
}
if (e.children.length) firstChildColumns.push(e.children[0].prop);
}
complexHeaderList = complexHeaderList.filter(o => o.children.length);
let list: any[] = [];
for (let i = 0; i < columns.length; i++) {
const e = columns[i];
if (!childColumns.includes(e.prop)) {
list.push(e);
} else {
if (firstChildColumns.includes(e.prop)) {
const item = complexHeaderList.find(o => o.childColumns.includes(e.prop));
list.push(item);
}
}
}
return list;
}
//子表表头
function getChildComplexColumns(columnList) {
let list: any[] = [];
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e);
} else {
let prop = e.prop.split('-')[0];
let vModel = e.prop.split('-')[1];
let label = e.label.split('-')[0];
let childLabel = e.label.replace(label + '-', '');
if (e.fullNameI18nCode && Array.isArray(e.fullNameI18nCode) && e.fullNameI18nCode[0]) label = t(e.fullNameI18nCode[0], label);
let newItem = {
align: 'center',
yunzhupaasKey: 'table',
prop,
label,
title: label,
dataIndex: prop,
children: [],
};
e.dataIndex = vModel;
e.title = e.labelI18nCode ? t(e.labelI18nCode, childLabel) : childLabel;
if (!state.expandObj.hasOwnProperty(prop+`Expand`)) state.expandObj[prop+`Expand`] = false;
if (!list.some((o) => o.prop === prop)) list.push(newItem);
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e);
break;
}
}
}
}
// 行内分组展示
getMergeList(list);
state.complexColumns = list;
state.childColumnList = list.filter((o) => o.yunzhupaasKey === 'table');
// 子表分组展示宽度取100
for (let i = 0; i < state.childColumnList.length; i++) {
const e = state.childColumnList[i];
if (e.children?.length) e.children = e.children.map(o => ({ ...o, width: 100 }));
}
}
function getMergeList(list) {
list.forEach((item) => {
if (item.yunzhupaasKey === 'table' && item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
child.customCell = () => ({
rowspan: 1,
colspan: item.children.length,
class: 'child-table-box',
});
} else {
child.customCell = () => ({
rowspan: 0,
colspan: 0,
});
}
});
}
});
}
function toggleExpand(row, field) {
row[field] = !row[field];
}
// 关联表单查看详情
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue};
relationDetailRef.value?.init(data);
});
}
function handleColumnChange(data) {
state.columnSettingList = data;
}
function getTableActions(record): ActionItem[] {
return [
{
label: t('common.editText','编辑') ,
onClick: updateHandle.bind(null, record),
},
{
label: t('common.delText','删除') ,
color: 'error',
modelConfirm: {
onOk: handleDelete.bind(null, record.id),
},
},
// {
// label: t('common.detailText','详情') ,
// onClick: goDetail.bind(null, record),
// },
];
}
// 编辑
function updateHandle(record) {
// 不带工作流
const data = {
id: record.id,
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 删除
function handleDelete(id) {
const query={ids:[id] }
batchDelete(query).then((res) => {
createMessage.success(res.msg);
clearSelectedRowKeys();
reload();
});
}
// 查看详情
function goDetail(record) {
// 不带流程
const data = {
id: record.id,
};
detailRef.value?.init(data);
}
// 新增
function addHandle() {
// 不带流程新增
const data = {
id: '',
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
function handleLeftTreeSelect(id, _node, nodePath) {
if (state.treeActiveId == id) return;
state.treeActiveId = id;
state.treeActiveNodePath = nodePath;
// 有搜索
state.resetFromTree = true;
resetFields();
updateSearchFormValue();
}
// 高级查询
function handleSuperQuery(superQueryJson) {
searchInfo.superQueryJson = superQueryJson;
reload({ page: 1 });
}
function handleSearchReset() {
clearSelectedRowKeys();
if (!state.resetFromTree) updateSearchFormValue();
if (state.resetFromTree) state.resetFromTree = false;
}
function handleSearchSubmit(data) {
clearSelectedRowKeys();
let obj = {
...defaultSearchInfo,
superQueryJson: searchInfo.superQueryJson,
...data,
};
Object.keys(searchInfo).map(key => {
delete searchInfo[key];
});
for (let [key, value] of Object.entries(obj)) {
searchInfo[key.replaceAll('-', '_')] = value;
}
console.log(searchInfo);
reload({ page: 1 });
}
function updateSearchFormValue() {
if (!state.treeActiveId) return searchFormSubmit();
let queryJson: any = {};
let leftTreeActiveInfo: any = {};
const isMultiple = !state.treeRelationObj ? false : state.treeRelationObj.searchMultiple;
//多级左侧树,需要拼父级->转为查询参数
if (state.treeRelationObj && state.treeRelationObj.yunzhupaasKey && ['organizeSelect', 'cascader', 'areaSelect'].includes(state.treeRelationObj.yunzhupaasKey)) {
let currValue = [];
currValue = state.treeActiveNodePath.map(o => o[state.treeFieldNames.key]);
queryJson = { 'project_type': isMultiple ? [currValue] : currValue };
leftTreeActiveInfo = { 'project_type': state.treeRelationObj.multiple ? [currValue] : currValue };
} else {
queryJson = { 'project_type': isMultiple ? [state.treeActiveId] : state.treeActiveId };
leftTreeActiveInfo = { 'project_type': state.treeRelationObj.multiple ? [state.treeActiveId] : state.treeActiveId };
}
state.leftTreeActiveInfo = leftTreeActiveInfo;
if(unref(getSearchList)?.length){
// 有搜索列表
setFieldsValue(queryJson);
searchFormSubmit();
}else{
// 无搜索列表
handleSearchSubmit(queryJson);
}
}
function initViewList(currentId = '') {
const query = {
menuId: route.meta.modelId,
};
getViewList(query).then(res => {
const columns : any[]= state.complexColumns;
const searchList: any[] = state.searchSchemas.map(o => ({ label: o.label, id: o.field, show: o.show, labelI18nCode: o.labelI18nCode }));
const columnList: any[] = columns.map(o => ({ label: o.label, id: o.prop, show: true, fixed: o.fixed || 'none', labelI18nCode: o.labelI18nCode }));
state.viewList = (res.data || []).map(o => {
if (o.type == 0) return { ...o, searchList, columnList };
return { ...o, searchList: o.searchList ? JSON.parse(o.searchList) : [], columnList: o.columnList ? JSON.parse(o.columnList) : [] };
});
if (currentId) {
state.currentView = state.viewList.filter(o => o.id === currentId)[0] || state.viewList[0];
} else {
state.currentView = state.viewList.filter(o => o.status === 1)[0] || state.viewList[0];
}
});
}
function handleViewClick(item) {
state.currentView = item;
}
function setListValue(data: any[] = [], defaultData: any[] = [], key) {
let list: any[] = [];
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < defaultData.length; j++) {
if (data[i].show && data[i].id == defaultData[j][key]) list.push(defaultData[j]);
}
}
return list;
}
onMounted(() => {
init();
});
</script>

View File

@@ -0,0 +1,231 @@
<template>
<BasicDrawer v-bind="$attrs" @register="registerDrawer" :title="title" width="800px" showFooter :showOkBtn="false">
<template #insertFooter> </template>
<a-row class="p-10px dynamic-form">
<!-- 表单 -->
<a-form :colon="false" size="middle" layout="horizontal" labelAlign="right" :labelCol="{ style: { width: '100px' } }" :model="dataForm" ref="formRef">
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_code">
<template #label>项目编码 </template>
<YunzhupaasInput
v-model:value="dataForm.project_code"
placeholder="请输入项目编码"
:maxlength="30"
disabled
detailed
allowClear
:style="{ width: '100%' }"
:maskConfig="maskConfig.project_code">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_name">
<template #label>项目名称 </template>
<YunzhupaasInput
v-model:value="dataForm.project_name"
placeholder="请输入项目名称"
:maxlength="50"
disabled
detailed
allowClear
:style="{ width: '100%' }"
:maskConfig="maskConfig.project_name">
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="parent_project_id">
<template #label>上级项目 </template> <p>{{ dataForm.parent_project_id }}</p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="org_id">
<template #label>归属组织 </template> <p>{{ dataForm.org_id }}</p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_type">
<template #label>项目类型 </template> <p>{{ dataForm.project_type }}</p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_start_date">
<template #label>启动日期 </template> <p>{{ dataForm.project_start_date }}</p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="project_state_id">
<template #label>项目状态 </template> <p>{{ dataForm.project_state_id }}</p>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="seq_num">
<template #label>顺序号 </template>
<YunzhupaasInputNumber
v-model:value="dataForm.seq_num"
placeholder="请输入顺序号"
disabled
detailed
:style="{ width: '100%' }"
:step="1"
:controls="false">
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item">
<a-form-item name="remark">
<template #label>备注 </template> <p>{{ dataForm.remark }}</p>
</a-form-item>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicDrawer>
<!-- 有关联表单详情开始 -->
<RelationDetail ref="relationDetailRef" />
<!-- 有关联表单详情结束 -->
</template>
<script lang="ts" setup>
import { getDetailInfo } from './helper/api';
import { getConfigData } from '@/api/onlineDev/visualDev';
import { reactive, toRefs, nextTick, ref, computed, unref, toRaw } from 'vue';
import { BasicModal, useModal } from '@/components/Modal';
import { BasicDrawer, useDrawer } from '@/components/Drawer';
// 有关联表单详情
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { useMessage } from '@/hooks/web/useMessage';
import { CaretRightOutlined } from '@ant-design/icons-vue';
import { buildUUID } from '@/utils/uuid';
import { useI18n } from '@/hooks/web/useI18n';
import { getDataChange } from '@/api/onlineDev/visualDev';
import { getDataInterfaceDataInfoByIds } from '@/api/systemData/dataInterface';
import ExtraRelationInfo from '@/components/yunzhupaas/RelationForm/src/ExtraRelationInfo.vue';
interface State {
dataForm: any;
title: string;
maskConfig: any;
interfaceRes: any;
locationScope: any;
extraOptions: any;
extraData: any;
}
defineOptions({ name: 'Detail' });
const { createMessage, createConfirm } = useMessage();
const [registerDrawer, { openDrawer, setDrawerProps, closeDrawer }] = useDrawer();
const { t } = useI18n();
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
dataForm: {},
title: t('common.detailText', '详情'),
maskConfig: {
project_code: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
project_name: {
prefixType: 1,
useUnrealMask: false,
maskType: 1,
unrealMaskLength: 1,
prefixLimit: 0,
suffixLimit: 0,
filler: '*',
prefixSpecifyChar: '',
suffixType: 1,
ignoreChar: '',
suffixSpecifyChar: '',
},
},
interfaceRes: {
project_type: [],
org_id: [],
project_state_id: [],
project_code: [],
remark: [],
project_name: [],
parent_project_id: [],
seq_num: [],
project_start_date: [],
},
locationScope: {},
extraOptions: {},
extraData: {},
});
const { title, dataForm, maskConfig } = toRefs(state);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.dataForm.id = data.id;
openDrawer();
nextTick(() => {
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
closeDrawer();
}
}
function getData(id) {
getDetailInfo(id).then(res => {
state.dataForm = res.data || {};
nextTick(() => {
changeLoading(false);
});
});
}
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue };
relationDetailRef.value?.init(data);
});
}
function setFormProps(data) {
setDrawerProps(data);
}
function changeLoading(loading) {
setFormProps({ loading });
}
function getParamList(key) {
let templateJson: any[] = state.interfaceRes[key];
if (!templateJson || !templateJson.length || !state.dataForm) return templateJson;
for (let i = 0; i < templateJson.length; i++) {
if (templateJson[i].relationField && templateJson[i].sourceType == 1) {
templateJson[i].defaultValue = state.dataForm[templateJson[i].relationField + '_id'] || '';
}
}
return templateJson;
}
</script>

View File

@@ -0,0 +1,521 @@
<template>
<BasicDrawer v-bind="$attrs" @register="registerDrawer" width="800px" showFooter
:cancelText="t('common.cancelText','取消')"
:okText="t('common.okText','确定')"
@ok="handleSubmit" :closeFunc="onClose">
<template #title>
<a-space :size="10">
<div class="text-16px font-medium">{{ title }}</div>
<a-space-compact size="small" block v-if="dataForm.id">
<a-tooltip :title="t('common.prevRecord')">
<a-button size="small" :disabled="getPrevDisabled" @click="handlePrev">
<i class="icon-ym icon-ym-caret-left text-10px"></i>
</a-button>
</a-tooltip>
<a-tooltip :title="t('common.nextRecord')">
<a-button size="small" :disabled="getNextDisabled" @click="handleNext">
<i class="icon-ym icon-ym-caret-right text-10px"></i>
</a-button>
</a-tooltip>
</a-space-compact>
</a-space>
</template>
<template #insertFooter>
<div class="float-left mt-5px">
<yunzhupaasCheckboxSingle v-model:value="submitType" :label="continueText" />
</div>
</template>
<a-row class="p-10px dynamic-form ">
<!-- 表单 -->
<a-form :colon="false" size="middle" layout= "horizontal"
labelAlign= "right"
:labelCol="{ style: { width: '100px' } }" :model="dataForm" :rules="dataRule" ref="formRef" >
<a-row :gutter="15">
<!-- 具体表单 -->
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_code" >
<template #label>项目编码
</template> <YunzhupaasInput v-model:value="dataForm.project_code" @change="changeData('project_code',-1)"
placeholder="请输入项目编码" :maxlength="30" :allowClear='true' :style='{"width":"100%"}' :maskConfig = "maskConfig.project_code" :showCount = "false" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_name" >
<template #label>项目名称
</template> <YunzhupaasInput v-model:value="dataForm.project_name" @change="changeData('project_name',-1)"
placeholder="请输入项目名称" :maxlength="50" :allowClear='true' :style='{"width":"100%"}' :maskConfig = "maskConfig.project_name" :showCount = "false" >
</YunzhupaasInput>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="parent_project_id" >
<template #label>上级项目
</template> <YunzhupaasTreeSelect v-model:value="dataForm.parent_project_id" @change="changeData('parent_project_id',-1)"
placeholder="请选择上级项目" :templateJson="state.interfaceRes.parent_project_id" :allowClear='true' :style='{"width":"100%"}' :showSearch='false' :options="optionsObj.parent_project_idOptions" :fieldNames="optionsObj.parent_project_idProps"
>
</YunzhupaasTreeSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="org_id" >
<template #label>归属组织
</template> <YunzhupaasOrganizeSelect v-model:value="dataForm.org_id" @change="changeData('org_id',-1)"
placeholder="请选择归属组织" :allowClear='true' :style='{"width":"100%"}' :showSearch='false' selectType="all" >
</YunzhupaasOrganizeSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_type" >
<template #label>项目类型
</template> <YunzhupaasSelect v-model:value="dataForm.project_type" @change="changeData('project_type',-1)"
placeholder="请选择项目类型" :templateJson="state.interfaceRes.project_type" :allowClear='true' :style='{"width":"100%"}' :showSearch='false' :options="optionsObj.project_typeOptions" :fieldNames="optionsObj.project_typeProps"
>
</YunzhupaasSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_start_date" >
<template #label>启动日期
</template> <YunzhupaasDatePicker v-model:value="dataForm.project_start_date" @change="changeData('project_start_date',-1)"
placeholder="请选择启动日期" :allowClear='true' :style='{"width":"100%"}' format="yyyy-MM-dd" :startTime="getRelationDate(false,1,1,'','')" :endTime="getRelationDate(false,1,1,'','')" >
</YunzhupaasDatePicker>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="project_state_id" >
<template #label>项目状态
</template> <YunzhupaasSelect v-model:value="dataForm.project_state_id" @change="changeData('project_state_id',-1)"
placeholder="请选择项目状态" :templateJson="state.interfaceRes.project_state_id" :allowClear='true' :style='{"width":"100%"}' :showSearch='false' :options="optionsObj.project_state_idOptions" :fieldNames="optionsObj.project_state_idProps"
>
</YunzhupaasSelect>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="seq_num" >
<template #label>顺序号
</template> <YunzhupaasInputNumber v-model:value="dataForm.seq_num" @change="changeData('seq_num',-1)"
placeholder="请输入顺序号" :style='{"width":"100%"}' :step="1" :controls="false" >
</YunzhupaasInputNumber>
</a-form-item>
</a-col>
<a-col :span="24" class="ant-col-item" >
<a-form-item
name="remark" >
<template #label>备注
</template> <YunzhupaasTextarea v-model:value="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入备注" :maxlength="200" :allowClear='true' :style='{"width":"100%"}' :autoSize='{"minRows":4,"maxRows":4}' :showCount = "true" >
</YunzhupaasTextarea>
</a-form-item>
</a-col>
<!-- 表单结束 -->
</a-row>
</a-form>
</a-row>
</BasicDrawer>
</template>
<script lang="ts" setup>
import { create, update, getInfo } from './helper/api';
import { reactive, toRefs, nextTick, ref, unref, computed,toRaw, inject } from 'vue';
import { BasicDrawer, useDrawer } from '@/components/Drawer';
import { yunzhupaasRelationForm } from '@/components/yunzhupaas';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useUserStore } from '@/store/modules/user';
import type { FormInstance } from 'ant-design-vue';
import { thousandsFormat , getDateTimeUnit, getTimeUnit} from '@/utils/yunzhupaas';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import dayjs from 'dayjs';
// 表单权限
import { usePermission } from '@/hooks/web/usePermission';
import { cloneDeep } from 'lodash-es';
import { buildUUID } from '@/utils/uuid';
import { CaretRightOutlined } from '@ant-design/icons-vue';
interface State {
dataForm: any;
tableRows: any;
dataRule: any;
optionsObj: any;
childIndex: any;
isEdit: any;
interfaceRes: any;
//可选范围默认值
ableAll: any;
//掩码配置
maskConfig:any;
//定位属性
locationScope:any;
extraOptions: any;
title: string;
continueText: string; allList: any[];
currIndex: number;
isContinue: boolean;
submitType: number;
showContinueBtn: boolean;
}
const emit = defineEmits(['reload']);
const getLeftTreeActiveInfo: (() => any) | null = inject('getLeftTreeActiveInfo', null);
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const [registerDrawer, { openDrawer, setDrawerProps }] = useDrawer();
const formRef = ref<FormInstance>();
const state = reactive<State>({
dataForm: {
project_code:undefined,
project_name:undefined,
parent_project_id:'',
org_id: userInfo.organizeIdList?userInfo.organizeIdList:'',
project_type:'',
project_start_date:undefined,
project_state_id:'',
seq_num:undefined,
remark:undefined,
},
tableRows:{
},
dataRule: {
project_code: [
{
required: true,
message: t('sys.validate.textRequiredSuffix','不能为空'),
trigger: 'blur'
},
],
project_name: [
{
required: true,
message: t('sys.validate.textRequiredSuffix','不能为空'),
trigger: 'blur'
},
],
},
optionsObj:{
parent_project_idOptions:[],
parent_project_idProps:{"label":"project_name","value":"project_id" ,"children":"children" },
project_typeOptions:[],
project_typeProps:{"label":"project_type_name","value":"project_type_id" },
project_state_idOptions:[],
project_state_idProps:{"label":"fullName","value":"enCode" },
},
childIndex: -1,
isEdit: false,
interfaceRes: {"project_type":[],"org_id":[],"project_state_id":[],"project_code":[],"remark":[],"project_name":[],"parent_project_id":[],"seq_num":[],"project_start_date":[]},
//可选范围默认值
ableAll:{
},
//掩码配置
maskConfig:{
project_code: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
project_name: {"prefixType":1,"useUnrealMask":false,"maskType":1,"unrealMaskLength":1,"prefixLimit":0,"suffixLimit":0,"filler":"*","prefixSpecifyChar":"","suffixType":1,"ignoreChar":"","suffixSpecifyChar":""} ,
},
//定位属性
locationScope:{
},
extraOptions:{
},
title: "",
continueText: "", allList: [],
currIndex: 0,
isContinue: false,
submitType: 0,
showContinueBtn: true ,
});
const { title, continueText, showContinueBtn, dataRule, dataForm, optionsObj, ableAll, maskConfig,submitType } = toRefs(state);
const getPrevDisabled = computed(() => state.currIndex === 0);
const getNextDisabled = computed(() => state.currIndex === state.allList.length - 1);
// 表单权限
const { hasFormP } = usePermission();
defineExpose({ init });
function init(data) {
state.submitType = 0;
state.isContinue = false;
state.title = !data.id ? t('common.add2Text','新增') : t('common.editText','编辑');
state.continueText = !data.id ? t('common.continueAndAddText','确定并新增') : t('common.continueText','确定并继续'); setFormProps({ continueLoading: false });
state.dataForm.id = data.id;
openDrawer();
state.allList = data.allList;
state.currIndex = state.allList.length && data.id ? state.allList.findIndex((item) => item.id === data.id) : 0;
nextTick(() => {
getForm().resetFields();
setTimeout(initData, 0);
});
}
function initData() {
changeLoading(true);
if (state.dataForm.id) {
getData(state.dataForm.id);
} else {
//初始化options
getparent_project_idOptions();
getproject_typeOptions();
getproject_state_idOptions();
// 设置默认值
state.dataForm={
project_code:undefined,
project_name:undefined,
parent_project_id:'',
org_id: userInfo.organizeIdList?userInfo.organizeIdList:'',
project_type:'',
project_start_date:undefined,
project_state_id:'',
seq_num:undefined,
remark:undefined,
};
if (getLeftTreeActiveInfo) state.dataForm = {...state.dataForm, ...(getLeftTreeActiveInfo() || {}) };
state.childIndex = -1;
changeLoading(false);
}
}
function getForm() {
const form = unref(formRef);
if (!form) {
throw new Error('form is null!');
}
return form;
}
function getData(id) {
getInfo(id).then((res) => {
state.dataForm = res.data || {};
getparent_project_idOptions();
getproject_typeOptions();
getproject_state_idOptions();
state.childIndex = -1;
changeLoading(false);
});
}
async function handleSubmit(type) {
try {
const values = await getForm()?.validate();
if (!values) return;
setFormProps({ confirmLoading: true });
const formMethod = state.dataForm.id ? update : create;
formMethod(state.dataForm)
.then((res) => {
createMessage.success(res.msg);
setFormProps({ confirmLoading: false });
if (state.submitType == 1) {
initData();
state.isContinue = true;
} else {
setFormProps({ open: false });
emit('reload');
}
})
.catch(() => {
setFormProps({ confirmLoading: false });
});
} catch (_) {}
}
function handlePrev() {
state.currIndex--;
handleGetNewInfo();
}
function handleNext() {
state.currIndex++;
handleGetNewInfo();
}
function handleGetNewInfo() {
changeLoading(true);
getForm().resetFields();
const id = state.allList[state.currIndex].id;
getData(id);
}
function setFormProps(data) {
setDrawerProps(data);
}
function changeLoading(loading) {
setDrawerProps({ loading });
}
async function onClose() {
if (state.isContinue) emit('reload');
return true;
}
function changeData(model, index) {
state.isEdit = false
state.childIndex = index
for (let key in state.interfaceRes) {
if (key != model) {
let faceReList = state.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
let relationField = faceReList[i].relationField;
if(relationField){
let modelAll = relationField.split('-');
let faceMode = '';
let faceMode2 = modelAll.length == 2?modelAll[0].substring(0, modelAll[0].length-4) +modelAll[1]:""
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
if (faceMode == model || faceMode2 == model ) {
let options = 'get' + key + 'Options';
eval(options)(true);
changeData(key, index)
}
}
}
}
}
}
function changeDataFormData(type, data, model,index,defaultValue) {
if(!state.isEdit) {
if (type == 2) {
for (let i = 0; i < state.dataForm[data].length; i++) {
if (index == -1) {
state.dataForm[data][i][model] = defaultValue
} else if (index == i) {
state.dataForm[data][i][model] = defaultValue
}
}
} else {
state.dataForm[data] = defaultValue
}
}
}
//数据选项--远端数据初始化方法
function getparent_project_idOptions(isClear = false) {
const index = state.childIndex
let templateJsonList = JSON.parse(JSON.stringify(state.interfaceRes.parent_project_id))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if(json.relationField&&json.sourceType ==1){
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if(relationFieldAll.length>1 && index>-1){
if(relationFieldAll[0].endsWith("List")){
val = state.dataForm[relationFieldAll[0]]&&state.dataForm[relationFieldAll[0]].length?
state.dataForm[relationFieldAll[0]][index][relationFieldAll[1]]:''
}else{
val = state.dataForm[relationFieldAll[0]+'List']&&state.dataForm[relationFieldAll[0]+'List'].length?
state.dataForm[relationFieldAll[0]+'List'][index][relationFieldAll[1]]:''
}
}else {
val = state.dataForm[relationFieldAll]
}
json.defaultValue = val ? val : '';
}
}
let template ={
paramList:templateJsonList
}
getDataInterfaceRes('797177453981204485',template).then(res => {
let data = res.data
state.optionsObj.parent_project_idOptions = data
if(index==-1) return
if(isClear){
changeDataFormData(1,'List','parent_project_id',index,'')
}
})
}
//数据选项--远端数据初始化方法
function getproject_typeOptions(isClear = false) {
const index = state.childIndex
let templateJsonList = JSON.parse(JSON.stringify(state.interfaceRes.project_type))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if(json.relationField&&json.sourceType ==1){
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if(relationFieldAll.length>1 && index>-1){
if(relationFieldAll[0].endsWith("List")){
val = state.dataForm[relationFieldAll[0]]&&state.dataForm[relationFieldAll[0]].length?
state.dataForm[relationFieldAll[0]][index][relationFieldAll[1]]:''
}else{
val = state.dataForm[relationFieldAll[0]+'List']&&state.dataForm[relationFieldAll[0]+'List'].length?
state.dataForm[relationFieldAll[0]+'List'][index][relationFieldAll[1]]:''
}
}else {
val = state.dataForm[relationFieldAll]
}
json.defaultValue = val ? val : '';
}
}
let template ={
paramList:templateJsonList
}
getDataInterfaceRes('797165402772733957',template).then(res => {
let data = res.data
state.optionsObj.project_typeOptions = data
if(index==-1) return
if(isClear){
changeDataFormData(1,'List','project_type',index,'')
}
})
}
//数据选项--数据字典初始化方法
function getproject_state_idOptions() {
getDictionaryDataSelector('797036777536749573').then(res => {
state.optionsObj.project_state_idOptions = res.data.list
})
}
function getRelationDate(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue: any = null;
let timeValue = Number(timeValueData);
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue;
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = new Date().getTime();
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).valueOf();
}
}
return timeDataValue;
}
function getRelationTime(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType;
let timeDataValue: any = null;
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00';
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue;
} else {
timeDataValue = timeDataValue + ':00';
}
} else if (timeType == 2) {
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = dayjs().format(format);
} else if (timeType == 4 || timeType == 5) {
const type = getTimeUnit(timeTarget + 3);
const method = timeType == 4 ? 'subtract' : 'add';
timeDataValue = dayjs()[method](timeValue, type).format(format);
}
}
return timeDataValue;
}
</script>

View File

@@ -0,0 +1,34 @@
import { defHttp } from '@/utils/http/axios';
// 获取列表
export function getList(data) {
return defHttp.post({ url: '/api/bcm/MdmProject/getList', data });
}
// 新建
export function create(data) {
return defHttp.post({ url:'/api/bcm/MdmProject', data });
}
// 修改
export function update(data) {
return defHttp.put({ url: '/api/bcm/MdmProject/'+ data.id, data });
}
// 详情(无转换数据)
export function getInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmProject/' + id });
}
// 获取(转换数据)
export function getDetailInfo(id) {
return defHttp.get({ url: '/api/bcm/MdmProject/detail/' + id });
}
// 删除
export function del(id) {
return defHttp.delete({ url: '/api/bcm/MdmProject/' + id });
}
// 批量删除数据
export function batchDelete(data) {
return defHttp.delete({ url: '/api/bcm/MdmProject/batchRemove', data });
}
// 导出
export function exportData(data) {
return defHttp.post({ url: '/api/bcm/MdmProject/Actions/Export', data });
}

View File

@@ -0,0 +1,475 @@
const columnList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItem36dc22",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_project",
"renderKey":1774508650570,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"project_code",
"__vModel__":"project_code",
"disabled":false,
"id":"project_code",
"placeholder":"请输入项目编码",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":30,
"fullName":"项目编码",
"label":"项目编码",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"align":"left",
"showCount":false,
"__config__":{
"formId":"formItemd2b645",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_project",
"renderKey":1774508651244,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"project_name",
"__vModel__":"project_name",
"disabled":false,
"id":"project_name",
"placeholder":"请输入项目名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"resizable":true,
"maxlength":50,
"fullName":"项目名称",
"label":"项目名称",
"sortable":false,
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"width":null,
"useMask":false,
"showPassword":false,
"fixed":"none",
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"treeSelect",
"filterable":false,
"clearable":true,
"resizable":true,
"multiple":false,
"fullName":"上级项目",
"fullNameI18nCode":[
""
],
"label":"上级项目",
"sortable":false,
"align":"left",
"props":{
"children":"children",
"label":"project_name",
"value":"project_id"
},
"__config__":{
"yunzhupaasKey":"treeSelect",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"797177453981204485",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509368149,
"tagIcon":"icon-ym icon-ym-generator-tree",
"tag":"YunzhupaasTreeSelect",
"formId":"formItem503db0",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dynamic",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"上级项目",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"项目结构树",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"parent_project_id",
"width":null,
"options":[],
"__vModel__":"parent_project_id",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"parent_project_id",
"placeholder":"请选择上级项目",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"organizeSelect",
"filterable":false,
"clearable":true,
"resizable":true,
"ableIds":[],
"multiple":false,
"fullName":"归属组织",
"fullNameI18nCode":[
""
],
"label":"归属组织",
"sortable":false,
"align":"left",
"__config__":{
"formId":"formItem0f5baf",
"yunzhupaasKey":"organizeSelect",
"visibility":[
"pc",
"app"
],
"defaultValue":[],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"归属组织",
"trigger":"change",
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509431105,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-company",
"defaultCurrent":true,
"tag":"YunzhupaasOrganizeSelect",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"org_id",
"width":null,
"__vModel__":"org_id",
"fixed":"none",
"style":{
"width":"100%"
},
"selectType":"all",
"disabled":false,
"id":"org_id",
"placeholder":"请选择归属组织",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"select",
"filterable":false,
"clearable":true,
"resizable":true,
"multiple":false,
"fullName":"项目类型",
"fullNameI18nCode":[
""
],
"label":"项目类型",
"sortable":false,
"align":"left",
"props":{
"label":"project_type_name",
"value":"project_type_id"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"797165402772733957",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509499767,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItemb4a566",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dynamic",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"项目类型",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"项目类型列表",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"project_type",
"width":null,
"options":[],
"__vModel__":"project_type",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_type",
"placeholder":"请选择项目类型",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"datePicker",
"clearable":true,
"resizable":true,
"format":"yyyy-MM-dd",
"fullName":"启动日期",
"fullNameI18nCode":[
""
],
"label":"启动日期",
"sortable":false,
"align":"left",
"__config__":{
"yunzhupaasKey":"datePicker",
"endRelationField":"",
"defaultValue":null,
"dragDisabled":false,
"className":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509542390,
"tagIcon":"icon-ym icon-ym-generator-date",
"startRelationField":"",
"defaultCurrent":false,
"tag":"YunzhupaasDatePicker",
"formId":"formItem27f6a6",
"visibility":[
"pc",
"app"
],
"noShow":false,
"endTimeTarget":1,
"tipLabel":"",
"tableFixed":"none",
"startTimeType":1,
"endTimeRule":false,
"label":"启动日期",
"trigger":"change",
"startTimeRule":false,
"startTimeValue":null,
"endTimeValue":null,
"endTimeType":1,
"layout":"colFormItem",
"startTimeTarget":1,
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"project_start_date",
"width":null,
"__vModel__":"project_start_date",
"fixed":"none",
"style":{
"width":"100%"
},
"startTime":null,
"disabled":false,
"id":"project_start_date",
"placeholder":"请选择启动日期",
"endTime":null,
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"yunzhupaasKey":"select",
"filterable":false,
"clearable":true,
"resizable":true,
"multiple":false,
"fullName":"项目状态",
"fullNameI18nCode":[
""
],
"label":"项目状态",
"sortable":false,
"align":"left",
"props":{
"label":"fullName",
"value":"enCode"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509577696,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItem4ff05a",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dictionary",
"dictionaryType":"797036777536749573",
"tipLabel":"",
"tableFixed":"none",
"label":"项目状态",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"project_state_id",
"width":null,
"options":[],
"__vModel__":"project_state_id",
"fixed":"none",
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_state_id",
"placeholder":"请选择项目状态",
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default columnList

View File

@@ -0,0 +1,133 @@
const searchList = [
{
"yunzhupaasKey":"input",
"useScan":false,
"suffixIcon":"",
"fullNameI18nCode":[
""
],
"showCount":false,
"__config__":{
"formId":"formItemd2b645",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_project",
"renderKey":1774508651244,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"prop":"project_name",
"__vModel__":"project_name",
"searchMultiple":false,
"disabled":false,
"id":"project_name",
"placeholder":"请输入项目名称",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
},
"clearable":true,
"searchType":2,
"maxlength":50,
"fullName":"项目名称",
"label":"项目名称",
"addonAfter":"",
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"isKeyword":true,
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"prefixIcon":"",
"labelI18nCode":""
},
{
"yunzhupaasKey":"organizeSelect",
"filterable":false,
"clearable":true,
"searchType":1,
"ableIds":[],
"multiple":false,
"fullName":"归属组织",
"fullNameI18nCode":[
""
],
"label":"归属组织",
"__config__":{
"formId":"formItem0f5baf",
"yunzhupaasKey":"organizeSelect",
"visibility":[
"pc",
"app"
],
"defaultValue":[],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"归属组织",
"trigger":"change",
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509431105,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-company",
"defaultCurrent":true,
"tag":"YunzhupaasOrganizeSelect",
"regList":[],
"tableAlign":"left",
"span":24
},
"prop":"org_id",
"__vModel__":"org_id",
"searchMultiple":true,
"isKeyword":false,
"style":{
"width":"100%"
},
"selectType":"all",
"disabled":false,
"id":"org_id",
"placeholder":"请选择归属组织",
"value":[],
"labelI18nCode":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default searchList

View File

@@ -0,0 +1,513 @@
const superQueryJson = [
{
"clearable":true,
"maxlength":30,
"useScan":false,
"suffixIcon":"",
"fullName":"项目编码",
"fullNameI18nCode":[
""
],
"addonAfter":"",
"showCount":false,
"__config__":{
"formId":"formItem36dc22",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目编码",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_project",
"renderKey":1774508650570,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"__vModel__":"project_code",
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_code",
"placeholder":"请输入项目编码",
"prefixIcon":"",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"clearable":true,
"maxlength":50,
"useScan":false,
"suffixIcon":"",
"fullName":"项目名称",
"fullNameI18nCode":[
""
],
"addonAfter":"",
"showCount":false,
"__config__":{
"formId":"formItemd2b645",
"yunzhupaasKey":"input",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"项目名称",
"trigger":"blur",
"showLabel":true,
"required":true,
"tableName":"mdm_project",
"renderKey":1774508651244,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-input",
"unique":true,
"tag":"YunzhupaasInput",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"maskConfig":{
"prefixType":1,
"useUnrealMask":false,
"maskType":1,
"unrealMaskLength":1,
"prefixLimit":0,
"suffixLimit":0,
"filler":"*",
"prefixSpecifyChar":"",
"suffixType":1,
"ignoreChar":"",
"suffixSpecifyChar":""
},
"__vModel__":"project_name",
"useMask":false,
"showPassword":false,
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_name",
"placeholder":"请输入项目名称",
"prefixIcon":"",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"filterable":false,
"clearable":true,
"multiple":false,
"fullName":"上级项目",
"fullNameI18nCode":[
""
],
"props":{
"children":"children",
"label":"project_name",
"value":"project_id"
},
"__config__":{
"yunzhupaasKey":"treeSelect",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"797177453981204485",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509368149,
"tagIcon":"icon-ym icon-ym-generator-tree",
"tag":"YunzhupaasTreeSelect",
"formId":"formItem503db0",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dynamic",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"上级项目",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"项目结构树",
"regList":[],
"tableAlign":"left",
"span":24
},
"options":[],
"__vModel__":"parent_project_id",
"style":{
"width":"100%"
},
"disabled":false,
"id":"parent_project_id",
"placeholder":"请选择上级项目",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"filterable":false,
"clearable":true,
"ableIds":[],
"multiple":false,
"fullName":"归属组织",
"fullNameI18nCode":[
""
],
"__config__":{
"formId":"formItem0f5baf",
"yunzhupaasKey":"organizeSelect",
"visibility":[
"pc",
"app"
],
"defaultValue":[],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"归属组织",
"trigger":"change",
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509431105,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-company",
"defaultCurrent":true,
"tag":"YunzhupaasOrganizeSelect",
"regList":[],
"tableAlign":"left",
"span":24
},
"__vModel__":"org_id",
"style":{
"width":"100%"
},
"selectType":"all",
"disabled":false,
"id":"org_id",
"placeholder":"请选择归属组织",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"filterable":false,
"clearable":true,
"multiple":false,
"fullName":"项目类型",
"fullNameI18nCode":[
""
],
"props":{
"label":"project_type_name",
"value":"project_type_id"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"797165402772733957",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509499767,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItemb4a566",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dynamic",
"dictionaryType":"",
"tipLabel":"",
"tableFixed":"none",
"label":"项目类型",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"项目类型列表",
"regList":[],
"tableAlign":"left",
"span":24
},
"options":[],
"__vModel__":"project_type",
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_type",
"placeholder":"请选择项目类型",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"clearable":true,
"format":"yyyy-MM-dd",
"fullName":"启动日期",
"fullNameI18nCode":[
""
],
"__config__":{
"yunzhupaasKey":"datePicker",
"endRelationField":"",
"defaultValue":null,
"dragDisabled":false,
"className":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509542390,
"tagIcon":"icon-ym icon-ym-generator-date",
"startRelationField":"",
"defaultCurrent":false,
"tag":"YunzhupaasDatePicker",
"formId":"formItem27f6a6",
"visibility":[
"pc",
"app"
],
"noShow":false,
"endTimeTarget":1,
"tipLabel":"",
"tableFixed":"none",
"startTimeType":1,
"endTimeRule":false,
"label":"启动日期",
"trigger":"change",
"startTimeRule":false,
"startTimeValue":null,
"endTimeValue":null,
"endTimeType":1,
"layout":"colFormItem",
"startTimeTarget":1,
"regList":[],
"tableAlign":"left",
"span":24
},
"__vModel__":"project_start_date",
"style":{
"width":"100%"
},
"startTime":null,
"disabled":false,
"id":"project_start_date",
"placeholder":"请选择启动日期",
"endTime":null,
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"filterable":false,
"clearable":true,
"multiple":false,
"fullName":"项目状态",
"fullNameI18nCode":[
""
],
"props":{
"label":"fullName",
"value":"enCode"
},
"__config__":{
"yunzhupaasKey":"select",
"defaultValue":"",
"dragDisabled":false,
"className":[],
"propsUrl":"",
"templateJson":[],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509577696,
"tagIcon":"icon-ym icon-ym-generator-select",
"tag":"YunzhupaasSelect",
"formId":"formItem4ff05a",
"visibility":[
"pc",
"app"
],
"noShow":false,
"dataType":"dictionary",
"dictionaryType":"797036777536749573",
"tipLabel":"",
"tableFixed":"none",
"label":"项目状态",
"trigger":"change",
"layout":"colFormItem",
"useCache":true,
"propsName":"",
"regList":[],
"tableAlign":"left",
"span":24
},
"options":[],
"__vModel__":"project_state_id",
"style":{
"width":"100%"
},
"disabled":false,
"id":"project_state_id",
"placeholder":"请选择项目状态",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"controls":false,
"fullName":"顺序号",
"fullNameI18nCode":[
""
],
"thousands":false,
"isAmountChinese":false,
"addonAfter":"",
"__config__":{
"formId":"formItem28643a",
"yunzhupaasKey":"inputNumber",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"顺序号",
"trigger":[
"blur",
"change"
],
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509649106,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-number",
"tag":"YunzhupaasInputNumber",
"regList":[],
"tableAlign":"left",
"span":24
},
"__vModel__":"seq_num",
"style":{
"width":"100%"
},
"step":1,
"disabled":false,
"id":"seq_num",
"placeholder":"请输入顺序号",
"addonBefore":"",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
},
{
"clearable":true,
"maxlength":200,
"fullName":"备注",
"fullNameI18nCode":[
""
],
"autoSize":{
"minRows":4,
"maxRows":4
},
"showCount":true,
"__config__":{
"formId":"formItem793976",
"yunzhupaasKey":"textarea",
"visibility":[
"pc",
"app"
],
"noShow":false,
"tipLabel":"",
"tableFixed":"none",
"dragDisabled":false,
"className":[],
"label":"备注",
"trigger":"blur",
"showLabel":true,
"required":false,
"tableName":"mdm_project",
"renderKey":1774509685351,
"layout":"colFormItem",
"tagIcon":"icon-ym icon-ym-generator-textarea",
"tag":"YunzhupaasTextarea",
"regList":[],
"tableAlign":"left",
"span":24
},
"readonly":false,
"__vModel__":"remark",
"style":{
"width":"100%"
},
"disabled":false,
"id":"remark",
"placeholder":"请输入备注",
"on":{
"change":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}",
"blur":"({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"
}
}
]
export default superQueryJson

View File

@@ -0,0 +1,680 @@
<template>
<div class="yunzhupaas-content-wrapper">
<div class="yunzhupaas-content-wrapper-center">
<div class="yunzhupaas-content-wrapper-search-box" v-if="getSearchList.length">
<BasicForm @register="registerSearchForm" :schemas="getSearchList"
@advanced-change="redoHeight" @submit="handleSearchSubmit" @reset="handleSearchReset"
class="search-form">
</BasicForm>
</div>
<div class="yunzhupaas-content-wrapper-content bg-white">
<a-tabs v-model:activeKey="state.tabActiveKey" class="yunzhupaas-content-wrapper-tabs yunzhupaas-content-wrapper-tabs-header"
destroyInactiveTabPane @change="onTabChange">
<a-tab-pane v-for="item in state.tabList" :key="item.id" :tab="item.fullName"></a-tab-pane>
</a-tabs>
<BasicTable @register="registerTable" v-bind="getTableBindValue" ref="tableRef"
@columns-change="handleColumnChange">
<template #tableTitle>
<a-button type="primary" preIcon="icon-ym icon-ym-btn-add"
@click="addHandle()"> {{t('common.add2Text','新增')}}</a-button>
</template>
<template #toolbar>
<a-tooltip placement="top">
<template #title>
<span>{{ t('common.superQuery') }}</span>
</template>
<filter-outlined @click="openSuperQuery(true, { columnOptions: superQueryJson })" />
</a-tooltip>
</template>
<template #toolbarAfter>
<ViewList :menuId="route.meta.modelId" :viewList="viewList" @itemClick="handleViewClick" @reload="initViewList" />
<ViewSetting :menuId="route.meta.modelId" :viewList="viewList" :currentView="currentView" @reload="initViewList" />
</template>
<template #bodyCell="{ column, record, index }">
<template v-for="(item, index) in childColumnList" v-if="childColumnList.length">
<template
v-if="column?.id?.includes('-') && item.children && item.children[0] && column.key === item.children[0]?.dataIndex">
<ChildTableColumn :data="record[item.prop]" :head="item.children"
@toggleExpand="toggleExpand(record, item.prop+`Expand`)" @toDetail="toDetail"
:expand="record[item.prop+`Expand`]" :key="index" :showOverflow="true "/>
</template>
</template>
<template v-if="!(record.top || column.id?.includes('-'))">
<template v-if="column.yunzhupaasKey === 'relationForm'">
<p class="link-text"
@click="toDetail(column.modelId, record[column.dataIndex+`_id`], column.propsValue)">
{{ record[column.dataIndex] }}</p>
</template>
<template v-if="column.yunzhupaasKey === 'inputNumber'">
<yunzhupaas-input-number v-model:value="record[column.prop]" :precision="column.precision" :thousands="column.thousands" disabled detailed />
</template>
<template v-if="column.yunzhupaasKey === 'calculate'">
<yunzhupaas-calculate
v-model:value="record[column.prop]"
:isStorage="column.isStorage"
:precision="column.precision"
:thousands="column.thousands"
detailed />
</template>
<template v-if="column.yunzhupaasKey === 'sign'">
<yunzhupaas-sign v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'signature'">
<yunzhupaas-signature v-model:value="record[column.prop]" detailed />
</template>
<template v-if="column.yunzhupaasKey === 'rate'">
<yunzhupaas-rate v-model:value="record[column.prop]" :count="column.count" :allowHalf="column.allowHalf" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'slider'">
<yunzhupaas-slider v-model:value="record[column.prop]" :min="column.min" :max="column.max" :step="column.step" disabled />
</template>
<template v-if="column.yunzhupaasKey === 'uploadImg'">
<yunzhupaas-upload-img v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'uploadFile'">
<yunzhupaas-upload-file v-model:value="record[column.prop]" disabled detailed simple v-if="record[column.prop]?.length" />
</template>
<template v-if="column.yunzhupaasKey === 'input'">
<yunzhupaas-input
v-model:value="record[column.prop]"
:useMask="column.useMask"
:maskConfig="column.maskConfig"
:showOverflow="true"
detailed />
</template>
</template>
<template v-if="column.key === 'action' && !record.top">
<TableAction :actions="getTableActions(record)" />
</template>
</template>
</BasicTable>
</div>
</div>
<Form ref="formRef" @reload="reload" />
<Detail ref="detailRef" />
<ExportModal @register="registerExportModal" @download="handleDownload" />
<ImportModal @register="registerImportModal" @reload="reload" />
<PrintSelect @register="registerPrintSelect" @change="handleShowBrowse" />
<PrintBrowse @register="registerPrintBrowse" />
<RelationDetail ref="relationDetailRef" />
<SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
</div>
</template>
<script lang="ts" setup>
import { getList, del, exportData, batchDelete } from './helper/api';
import { getConfigData,getViewList } from '@/api/onlineDev/visualDev';
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
import { getOrgByOrganizeCondition,getDepartmentSelectAsyncList } from '@/api/permission/organize';
import { ref, reactive, onMounted, toRefs, computed, unref, nextTick, toRaw, provide } from 'vue';
import { useMessage } from '@/hooks/web/useMessage';
import { useI18n } from '@/hooks/web/useI18n';
import { useOrganizeStore } from '@/store/modules/organize';
import { useUserStore } from '@/store/modules/user';
import { BasicModal, useModal } from '@/components/Modal';
import { usePopup } from '@/components/Popup';
import { ScrollContainer } from '@/components/Container';
import { BasicLeftTree, TreeActionType } from '@/components/Tree';
import { BasicForm, useForm } from '@/components/Form';
import { BasicTable, useTable, TableAction, ActionItem, TableActionType, SorterResult } from '@/components/Table';
import { SuperQueryModal } from '@/components/CommonModal';
import Form from './Form.vue';
import Detail from './Detail.vue';
// 有关联表单详情:开始
import RelationDetail from '@/views/common/dynamicModel/list/detail/index.vue';
// 有关联表单详情:结束
import ChildTableColumn from '@/views/common/dynamicModel/list/ChildTableColumn.vue';
import { ExportModal } from '@/components/CommonModal';
import { downloadByUrl } from '@/utils/file/download';
import { ImportModal} from '@/components/CommonModal';
// 打印模板多条生成PrintSelect
import PrintSelect from '@/components/PrintDesign/printSelect/index.vue';
import PrintBrowse from '@/components/PrintDesign/printBrowse/index.vue';
import { useBaseStore } from '@/store/modules/base';
import { useRoute,useRouter } from 'vue-router';
import { FilterOutlined } from '@ant-design/icons-vue';
import { getSearchFormSchemas } from '@/components/FormGenerator/src/helper/transform';
import { cloneDeep } from 'lodash-es';
import columnList from './helper/columnList';
import searchList from './helper/searchList';
import superQueryJson from './helper/superQueryJson';
import { dyOptionsList, systemComponentsList } from '@/components/FormGenerator/src/helper/config';
import { thousandsFormat, getParamList} from '@/utils/yunzhupaas';
import { usePermission } from '@/hooks/web/usePermission';
import ViewSetting from '@/views/common/dynamicModel/list/components/ViewSetting.vue';
import ViewList from '@/views/common/dynamicModel/list/components/ViewList.vue';
interface State {
config: any;
columnList: any[];
printListOptions: any[];
columnBtnsList: any[];
customBtnsList: any[];
treeFieldNames: any;
leftTreeData: any[];
leftTreeLoading: boolean;
treeActiveId: string;
treeActiveNodePath: any;
columns: any[];
complexColumns: any[];
childColumnList: any[];
exportList: any[];
cacheList: any[];
currFlow: any;
isCustomCopy: boolean;
candidateType: number;
currRow: any;
workFlowFormData: any;
expandObj: any;
columnSettingList: any[];
searchSchemas: any[];
treeRelationObj: any;
treeQueryJson: any;
leftTreeActiveInfo: any;
keyword: string;
tabActiveKey: any;
tabList: any[];
tabQueryJson: any;
viewList: any[];
currentView: any;
}
const route = useRoute();
const { hasBtnP } = usePermission();
const { createMessage, createConfirm } = useMessage();
const { t } = useI18n();
const organizeStore = useOrganizeStore();
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const baseStore = useBaseStore();
const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
const formRef = ref<any>(null);
const tableRef = ref<Nullable<TableActionType>>(null);
const detailRef = ref<any>(null);
const relationDetailRef = ref<any>(null);
const state = reactive<State>({
config: {},
columnList: [],
printListOptions: [],
columnBtnsList: [],
customBtnsList: [],
treeFieldNames: {
children: 'children' ,
title: 'fullName' ,
key: 'id' ,
isLeaf: 'isLeaf',
},
leftTreeData: [],
leftTreeLoading: false,
treeActiveId: '',
treeActiveNodePath: [],
columns: [],
complexColumns: [], // 复杂表头
childColumnList: [],
exportList: [],
cacheList: [],
currFlow: {},
isCustomCopy: false,
candidateType: 1,
currRow: {},
workFlowFormData: {},
expandObj: {},
columnSettingList: [],
searchSchemas: [],
treeRelationObj: null,
treeQueryJson: {},
leftTreeActiveInfo: {},
keyword: '',
tabActiveKey: '',
tabList: [],
tabQueryJson: {},
viewList: [],
currentView: {},
});
const defaultSearchInfo = {
menuId: route.meta.modelId as string,
moduleId:'806868519370098181',
superQueryJson: '',
dataType:0,
};
const searchInfo = reactive({
...cloneDeep(defaultSearchInfo),
});
const { childColumnList, searchSchemas, viewList, currentView} = toRefs(state);
const [registerSearchForm, { updateSchema, resetFields, submit: searchFormSubmit, setFieldsValue}] = useForm({
baseColProps: { span: 6 },
showActionButtonGroup: true,
showAdvancedButton: true,
compact: true,
});
const [registerTable, { reload, setLoading, getFetchParams, getSelectRows, getSelectRowKeys, redoHeight,clearSelectedRowKeys }] = useTable({
api: getList,
immediate: false,
clickToRowSelect: false,
tableSetting: { setting: false },
afterFetch: (data) => {
const list = data.map((o) => ({
...o,
...state.expandObj,
}));
state.cacheList = cloneDeep(list);
return list;
},
});
const [registerChildTable] = useTable({
pagination: false,
canResize: false,
showTableSetting: false,
});
provide('getLeftTreeActiveInfo', () => state.leftTreeActiveInfo);
const getHasBatchBtn = computed(() => {
let btnsList =[]
return !!btnsList.length
});
const getColumns = computed(() => {
const columns = state.complexColumns;
return setListValue(state.currentView?.columnList, columns, 'prop');
});
const getSearchList = computed(() => {
const searchSchemas = cloneDeep(state.searchSchemas).map(o => ({ ...o, show: true }));
return setListValue(state.currentView?.searchList, searchSchemas, 'field');
});
const getTableBindValue = computed(() => {
let columns = unref(getColumns);
const defaultSortConfig= [];
const sortField = defaultSortConfig.map(o => (o.sort === 'desc' ? '-' : '') + o.field);
const data: any = {
pagination: { pageSize: 20 }, //有分页
searchInfo: unref(searchInfo),
defSort: { sidx: sortField.join(',') },
sortFn: (sortInfo: SorterResult | SorterResult[]) => {
if (Array.isArray(sortInfo)) {
const sortList = sortInfo.map(o => (o.order === 'descend' ? '-' : '') + o.field);
return { sidx: sortList.join(',') };
} else {
const { field, order } = sortInfo;
if (field && order) {
// 排序字段
return { sidx: (order === 'descend' ? '-' : '') + field };
} else {
return {};
}
}
},
ellipsis:true ,
columns,
bordered: true,
actionColumn: {
width: 150,
title: t('component.table.action'),
dataIndex: 'action',
},
};
if (unref(getHasBatchBtn)) {
const rowSelection: any = { type: 'checkbox' };
data.rowSelection = rowSelection;
}
return data;
});
function init() {
state.config = {};
searchInfo.menuId = route.meta.modelId as string;
state.columnList = columnList;
setLoading(true);
getSearchSchemas();
getColumnList();
initViewList();
getTabList();
}
function getSearchSchemas() {
const schemas = getSearchFormSchemas(searchList);
state.searchSchemas = schemas;
schemas.forEach((cur) => {
const config = cur.__config__;
if (dyOptionsList.includes(config.yunzhupaasKey)) {
if (config.dataType === 'dictionary') {
if (!config.dictionaryType) return;
getDictionaryDataSelector(config.dictionaryType).then((res) => {
updateSchema([{ field: cur.field, componentProps: { options: res.data.list } }]);
});
}
if (config.dataType === 'dynamic') {
if (!config.propsUrl) return;
const query = { paramList: getParamList(config.templateJson) };
getDataInterfaceRes(config.propsUrl, query).then((res) => {
const data = Array.isArray(res.data) ? res.data : [];
updateSchema([{ field: cur.field, componentProps: { options: data } }]);
});
}
}
cur.defaultValue = cur.value;
});
}
function getColumnList() {
// 没有开启列表权限
let columnList = state.columnList;
state.exportList = columnList;
let columns = columnList.map((o) => ({
...o,
title: o.labelI18nCode ? t(o.labelI18nCode, o.label) : o.label,
dataIndex: o.prop,
align: o.align,
fixed: o.fixed == 'none' ? false : o.fixed,
sorter: o.sortable ? { multiple: 1 } : o.sortable,
width: o.width || 100,
}));
//添加复杂表头
columns = getComplexColumns(columns);
state.columns = columns.filter((o) => o.prop.indexOf('-') < 0);
//子表表头
getChildComplexColumns(columns);
}
//标签初始化
async function getTabList() {
// 字典
const data = (await baseStore.getDicDataSelector('797036777536749573'))
const options = data.map(o => ({ ...o, id: o.enCode }));
state.tabList = [...state.tabList,...options]
state.tabList.unshift({ fullName: '全部', id: '' });
state.tabActiveKey = state.tabList[0].id || '';
state.tabQueryJson = { project_state_id : state.tabList[0].id };
nextTick(() => {
unref(getSearchList)?.length? searchFormSubmit() : reload({ page: 1 });
});
}
//复杂表头
function getComplexColumns(columns) {
//这里生成复杂表头的配置
let complexHeaderList: any[] = [];
if (!complexHeaderList.length) return columns;
let childColumns: any[] = [];
let firstChildColumns: string[] = [];
for (let i = 0; i < complexHeaderList.length; i++) {
const e = complexHeaderList[i];
e.label = e.fullName;
e.labelI18nCode = e.fullNameI18nCode;
e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode, e.fullName) : e.fullName;
e.align = e.align;
e.dataIndex = e.id;
e.prop = e.id;
e.children = [];
e.yunzhupaasKey = 'complexHeader';
if (e.childColumns?.length) {
childColumns.push(...e.childColumns);
for (let k = 0; k < e.childColumns.length; k++) {
const item = e.childColumns[k];
for (let j = 0; j < columns.length; j++) {
const o = columns[j];
if (o.prop == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
}
}
}
if (e.children.length) firstChildColumns.push(e.children[0].prop);
}
complexHeaderList = complexHeaderList.filter(o => o.children.length);
let list: any[] = [];
for (let i = 0; i < columns.length; i++) {
const e = columns[i];
if (!childColumns.includes(e.prop)) {
list.push(e);
} else {
if (firstChildColumns.includes(e.prop)) {
const item = complexHeaderList.find(o => o.childColumns.includes(e.prop));
list.push(item);
}
}
}
return list;
}
//子表表头
function getChildComplexColumns(columnList) {
let list: any[] = [];
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e);
} else {
let prop = e.prop.split('-')[0];
let vModel = e.prop.split('-')[1];
let label = e.label.split('-')[0];
let childLabel = e.label.replace(label + '-', '');
if (e.fullNameI18nCode && Array.isArray(e.fullNameI18nCode) && e.fullNameI18nCode[0]) label = t(e.fullNameI18nCode[0], label);
let newItem = {
align: 'center',
yunzhupaasKey: 'table',
prop,
label,
title: label,
dataIndex: prop,
children: [],
};
e.dataIndex = vModel;
e.title = e.labelI18nCode ? t(e.labelI18nCode, childLabel) : childLabel;
if (!state.expandObj.hasOwnProperty(prop+`Expand`)) state.expandObj[prop+`Expand`] = false;
if (!list.some((o) => o.prop === prop)) list.push(newItem);
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e);
break;
}
}
}
}
// 行内分组展示
getMergeList(list);
state.complexColumns = list;
state.childColumnList = list.filter((o) => o.yunzhupaasKey === 'table');
// 子表分组展示宽度取100
for (let i = 0; i < state.childColumnList.length; i++) {
const e = state.childColumnList[i];
if (e.children?.length) e.children = e.children.map(o => ({ ...o, width: 100 }));
}
}
function getMergeList(list) {
list.forEach((item) => {
if (item.yunzhupaasKey === 'table' && item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
child.customCell = () => ({
rowspan: 1,
colspan: item.children.length,
class: 'child-table-box',
});
} else {
child.customCell = () => ({
rowspan: 0,
colspan: 0,
});
}
});
}
});
}
function toggleExpand(row, field) {
row[field] = !row[field];
}
// 关联表单查看详情
function toDetail(modelId, id, propsValue) {
if (!id) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
const formConf = JSON.parse(res.data.formData);
formConf.popupType = 'general';
formConf.hasPrintBtn = false;
formConf.customBtns = [];
const data = { id, formConf, modelId, propsValue};
relationDetailRef.value?.init(data);
});
}
function handleColumnChange(data) {
state.columnSettingList = data;
}
function getTableActions(record): ActionItem[] {
return [
{
label: t('common.editText','编辑') ,
onClick: updateHandle.bind(null, record),
},
{
label: t('common.delText','删除') ,
color: 'error',
modelConfirm: {
onOk: handleDelete.bind(null, record.id),
},
},
{
label: t('common.detailText','详情') ,
onClick: goDetail.bind(null, record),
},
];
}
// 编辑
function updateHandle(record) {
// 不带工作流
const data = {
id: record.id,
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 删除
function handleDelete(id) {
const query={ids:[id] }
batchDelete(query).then((res) => {
createMessage.success(res.msg);
clearSelectedRowKeys();
reload();
});
}
// 查看详情
function goDetail(record) {
// 不带流程
const data = {
id: record.id,
};
detailRef.value?.init(data);
}
// 新增
function addHandle() {
// 不带流程新增
const data = {
id: '',
menuId: searchInfo.menuId,
allList: state.cacheList,
};
formRef.value?.init(data);
}
// 高级查询
function handleSuperQuery(superQueryJson) {
searchInfo.superQueryJson = superQueryJson;
reload({ page: 1 });
}
function handleSearchReset() {
clearSelectedRowKeys();
if (!state.resetFromTree) updateSearchFormValue();
if (state.resetFromTree) state.resetFromTree = false;
}
function handleSearchSubmit(data) {
clearSelectedRowKeys();
let obj = {
...defaultSearchInfo,
superQueryJson: searchInfo.superQueryJson,
...data,
...state.tabQueryJson,
};
Object.keys(searchInfo).map(key => {
delete searchInfo[key];
});
for (let [key, value] of Object.entries(obj)) {
searchInfo[key.replaceAll('-', '_')] = value;
}
console.log(searchInfo);
reload({ page: 1 });
}
function onTabChange(val) {
state.tabQueryJson = { project_state_id : val }; //这个key是取json中的tabConfig.relationFiled
unref(getSearchList).length?searchFormSubmit():resetFields()
}
function updateSearchFormValue() {
if (!state.treeActiveId) return searchFormSubmit();
let queryJson: any = {};
let leftTreeActiveInfo: any = {};
const isMultiple = !state.treeRelationObj ? false : state.treeRelationObj.searchMultiple;
//多级左侧树,需要拼父级->转为查询参数
if (state.treeRelationObj && state.treeRelationObj.yunzhupaasKey && ['organizeSelect', 'cascader', 'areaSelect'].includes(state.treeRelationObj.yunzhupaasKey)) {
let currValue = [];
currValue = state.treeActiveNodePath.map(o => o[state.treeFieldNames.key]);
queryJson = { '': isMultiple ? [currValue] : currValue };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [currValue] : currValue };
} else {
queryJson = { '': isMultiple ? [state.treeActiveId] : state.treeActiveId };
leftTreeActiveInfo = { '': state.treeRelationObj.multiple ? [state.treeActiveId] : state.treeActiveId };
}
state.leftTreeActiveInfo = leftTreeActiveInfo;
if(unref(getSearchList)?.length){
// 有搜索列表
setFieldsValue(queryJson);
searchFormSubmit();
}else{
// 无搜索列表
handleSearchSubmit(queryJson);
}
}
function initViewList(currentId = '') {
const query = {
menuId: route.meta.modelId,
};
getViewList(query).then(res => {
const columns : any[]= state.complexColumns;
const searchList: any[] = state.searchSchemas.map(o => ({ label: o.label, id: o.field, show: o.show, labelI18nCode: o.labelI18nCode }));
const columnList: any[] = columns.map(o => ({ label: o.label, id: o.prop, show: true, fixed: o.fixed || 'none', labelI18nCode: o.labelI18nCode }));
state.viewList = (res.data || []).map(o => {
if (o.type == 0) return { ...o, searchList, columnList };
return { ...o, searchList: o.searchList ? JSON.parse(o.searchList) : [], columnList: o.columnList ? JSON.parse(o.columnList) : [] };
});
if (currentId) {
state.currentView = state.viewList.filter(o => o.id === currentId)[0] || state.viewList[0];
} else {
state.currentView = state.viewList.filter(o => o.status === 1)[0] || state.viewList[0];
}
});
}
function handleViewClick(item) {
state.currentView = item;
}
function setListValue(data: any[] = [], defaultData: any[] = [], key) {
let list: any[] = [];
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < defaultData.length; j++) {
if (data[i].show && data[i].id == defaultData[j][key]) list.push(defaultData[j]);
}
}
return list;
}
onMounted(() => {
init();
});
</script>