Commit 3b2245b9 authored by 田翔's avatar 田翔

支持附件各种形态

parent 3b85970e
{
"name": "panda-xform",
"version": "1.2.0",
"description": "1.2.0: 增加渲染表单组件",
"version": "1.3.0",
"description": "1.3.0: 支持附件各种形态",
"keywords": [
"panda-xform"
],
......
......@@ -14,15 +14,6 @@ const url = (REACT_APP_ENV || 'dev') !== 'dev' ? `${YOURSELFER_SERVER}/${BASEURL
const NOTHING = [undefined, '', null, void 0]; // void 0 === void 1
/** @End */
// 选择器选项的值查询
/** @Tips: web4版本接口 */
/*export function getSelectName(nodeName) {
return request({
url: `${requestIP}/WorkFlow`,
method: 'get',
});
}*/
// 获取字典的接口
export function getSelectName(nodeName) {
return request({
......@@ -32,14 +23,6 @@ export function getSelectName(nodeName) {
}
// 选择器选项的子节点查询
/** @Tips: web4版本接口 */
/* export function getSelectChildName(nodeName) {
return request({
url: `${requestIP}/WorkChildFlow`,
method: 'get',
});
} */
export function getSelectChildName(nodeName) {
return request({
url: `${BASEURL}/WorkChildFlow`,
......@@ -48,14 +31,6 @@ export function getSelectChildName(nodeName) {
}
// 站点选择器查询
/** @Tips: web4版本接口 */
/*export function getStationListByUserID(name) {
return request({
url: `${requestIP}/GetStationListByUserID`,
method: 'get',
});
}*/
export function getStationListByUserID(id, sysType, isAll) {
return request({
url: `/PandaWorkFlow/WorkFlow/WorkFlow/GetStationListByUserID?userID=${id}${!NOTHING.includes(sysType) ? '&sysType=' + sysType : ''}${!NOTHING.includes(sysType) ? '&isAll=' + isAll : ''}`,
......@@ -64,14 +39,6 @@ export function getStationListByUserID(id, sysType, isAll) {
}
// 人员选择器查询
/** @Tips: web4版本接口 */
/* export function getUserListForRole() {
return request({
url: `${requestIP}/GetUserListForRole`,
method: 'get',
});
} */
export function getUserListForRole() {
return request({
url: `${BASEURL}/GetUserListForRole`,
......@@ -97,12 +64,6 @@ export const getDeptList = (params) => {
}
// 台账的配置查询
/*export function GetAccountConfigInfo(accountName) {
return request({
url: `${requestIP}/GetAccountConfigInfo`,
method: 'get',
});
}*/
export function GetAccountConfigInfo(accountName) {
return request({
url: `${BASEURL}/GetAccountConfigInfo?accountName=${accountName}`,
......@@ -111,12 +72,6 @@ export function GetAccountConfigInfo(accountName) {
}
// 台账的表查询
/*export function GetAccountPageList(pageIndex, pageSize, accountName, info) {
return request({
url: `${requestIP}/GetAccountPageList`,
method: 'get',
});
}*/
export function GetAccountPageList(data) {
return request({
url: `${BASEURL}/GetAccountPageList`,
......@@ -132,14 +87,6 @@ export function GetTableGroupMeta(accountName) {
});
}
// 业务选择器查询
/*export function GetFieldValueFromTable(pageIndex, pageSize, accountName, info) {
return request({
url: `${requestIP}/GetFieldValueFromTable`,
method: 'get',
});
}*/
// NEXT需要增加分页
export function GetFieldValueFromTable(accountName, fieldName, filter) {
return request({
......@@ -149,13 +96,6 @@ export function GetFieldValueFromTable(accountName, fieldName, filter) {
}
// 台账表单的提交
/*export function SubmitAccountData(tableName, key, value, data) {
return request({
url: `${requestIP}/EditTableData?tableName=${tableName}&key=${key}&id=${value}`,
method: 'post',
data: data,
});
}*/
export function SubmitAccountData(tableName, key, value, data) {
return request({
url: `${BASEURL}/EditTableData?tableName=${tableName}&key=${key}&id=${value}`,
......@@ -165,13 +105,6 @@ export function SubmitAccountData(tableName, key, value, data) {
}
// 台账的新增
/*export function AddNewAccountData(data) {
return request({
url: `${requestIP}/`,
method: 'post',
data,
});
}*/
export function AddNewAccountData(data) {
return request({
url: `${BASEURL}/`,
......@@ -245,6 +178,13 @@ export function EditTableDataInfo(data) {
});
}
export function LoadLedgers() {
return request({
url: `PandaOMS/OMS/WorkOrderCenter/GetCM_Ledger_LoadLedgers`,
method: 'get'
})
}
export function DeleteTableDataInfo(data) {
return request({
url: `${BASEURL}/DeleteTableDataInfo`,
......
......@@ -8,7 +8,7 @@ const allSetting = {
const settings = [
{
title: '布局',
title: '布局控件',
widgets: [
{
text: '分组名称',
......@@ -23,7 +23,7 @@ const settings = [
],
},
{
title: '文本',
title: '文本控件',
widgets: [
{
text: '文本',
......@@ -127,7 +127,7 @@ const settings = [
],
},
{
title: '选择器',
title: '选择器控件',
widgets: [
{
text: '值选择器',
......@@ -284,7 +284,7 @@ const settings = [
],
},
{
title: '时间',
title: '时间控件',
show: true,
useCommon: true,
widgets: [
......@@ -346,7 +346,7 @@ const settings = [
],
},
{
title: '附件',
title: '附件控件',
show: true,
useCommon: true,
widgets: [
......@@ -388,7 +388,7 @@ const settings = [
],
},
{
title: '地图',
title: '地图控件',
show: true,
useCommon: true,
widgets: [
......@@ -403,6 +403,55 @@ const settings = [
},
],
},
{
title: '高级控件',
widgets: [
{
text: '关联表单',
name: '关联表单',
schema: {
title: '关联表单',
name: '关联表单',
type: 'string',
widget: 'RelationForm',
},
setting: {
$id: {
title: '字段名称',
type: 'string',
widget: 'FieldNames',
required: true,
displayType: 'row',
labelWidth: 80,
},
title: {
title: '标题',
type: 'string',
widget: 'htmlInput',
displayType: 'row',
labelWidth: 80,
},
source: {
title: '数据来源',
type: 'string',
displayType: 'row',
default: '{}',
widget: 'DataSource',
labelWidth: 80,
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'BooleanSwitch',
displayType: 'row',
labelWidth: 80,
default: false
},
...elementSettings,
},
},
],
},
]
export default settings
\ No newline at end of file
......@@ -4,8 +4,6 @@ import { ConfigProvider } from 'antd'
import widgets from '../widgets'
// import schema from './data'
// console.log('FormRender', widgets)
export const GlobalStore = createContext(null)
const XRender = (props, ref) => {
......@@ -23,13 +21,19 @@ const XRender = (props, ref) => {
const prefixClsWithoutParseForm = getPrefixCls()
const [extraData, setExtraData] = useState({})
const [parseFormData, setParseFormData] = useState({})
const [listData, setListData] = useState([])
const form = useForm()
return (
<GlobalStore.Provider
value={{
extraData,
setExtraData
setExtraData,
parseFormData,
setParseFormData,
listData,
setParseFormData,
}}>
<div className={prefixCls}>
<FormRender
......
This diff is collapsed.
@import '~antd/es/style/themes/default.less';
.relationForm {
padding: 10px;
background: white;
.header {
height: 45px;
line-height: 45px;
position: relative;
// .account-header-title {
// width: 100%;
// text-align: center;
// font-weight: bold;
// font-size: 16px;
// }
.headerBtn {
position: absolute;
right: 0;
top: 7px;
}
}
.@{ant-prefix}-table-thead {
.@{ant-prefix}-table-cell {
background: white;
}
th {
border-bottom: 2px solid #DBE7FB;
text-align: center;
}
}
.@{ant-prefix}-table-body {
tr {
td {
border-bottom: 1px solid #DBE7FB;
border-right: 1px solid #DBE7FB;
}
}
.@{ant-prefix}-table-row {
padding: 4px !important;
}
tr:nth-child(even) {
background: #F6F9FE;
.panda-civ-workflow-table-cell-fix-right {
background-color: #F6F9FEed;
}
}
}
.@{ant-prefix}-table-content {
overflow: auto;
}
}
\ No newline at end of file
import RelationForm from './RelationForm'
const advanced = {
RelationForm
}
export default advanced
\ No newline at end of file
......@@ -5,6 +5,7 @@ import date from './date'
import select from './select'
import file from './file'
import coord from './coord'
import advanced from './advanced'
const widgets = {
Header,
......@@ -14,6 +15,7 @@ const widgets = {
...select,
...file,
...coord,
...advanced,
}
export default widgets
\ No newline at end of file
import React, { useState } from 'react'
import React, { useMemo, useState } from 'react'
import { Button, Form, Input, Select, Space, Modal } from 'antd'
import style from '../../style'
const options = [
{ label: '手动输入', value: '手动输入' },
{ label: '数据字典', value: '数据字典' },
]
import { LoadLedgers } from '../../../../apis/process'
const DataSource = (props) => {
console.log('props', props)
const { value, onChange } = props
const { formData } = props.addons
const { widget } = formData
const [visible, setVisible] = useState(false)
const [options, setOptions] = useState({ accountName: [] })
const [form] = Form.useForm()
const formItems = useMemo(() => {
switch (widget) {
case 'RelationForm':
return [
{
name: '台账名称',
label: '台账名称',
rules: [
{
required: true,
message: '请选择台账名称',
}
],
options: options.accountName,
onFocus: () => {
getAccountName()
}
},
]
case '':
return [
]
default: []
}
return []
}, [widget, options])
const valueShow = useMemo(() => {
return value
}, [value])
const getAccountName = async () => {
const { code, data } = await LoadLedgers()
if (code === 0) {
let accountName = data.root.map(v => {
return {
label: v.name,
value: v.name,
}
})
setOptions({ ...options, accountName })
}
}
const onFocus = () => {
setVisible(true)
......@@ -26,30 +67,37 @@ const DataSource = (props) => {
console.log('e', e)
}
const onOk = () => {
onChange(JSON.stringify(form.getFieldsValue()))
setVisible(false)
}
return (
<>
<Modal
title={`【${formData.$id}】数据来源`}
width='500px'
visible={visible}
onOk={() => setVisible(false)}
onOk={onOk}
onCancel={() => setVisible(false)}
>
<Form
form={form}
>
<Form.Item
name="area"
label="数据来源"
rules={[
{
required: true,
message: 'Missing area',
},
]}
formItems.map((v, i) => {
return (
<Form.Item
name={v.name}
label={v.label}
rules={v.rules}
key={i}
>
<Select options={options} />
<Select onFocus={v.onFocus} options={v.options} />
</Form.Item>
)
})
}
</Form>
</Modal>
<Input value={valueShow} onChange={inputChange} style={style} onClick={onFocus} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment