king
2025-05-08 400fee62fb40006a9839f1c3a8244b82566b5057
src/menu/datasource/verifycard/settingform/index.jsx
@@ -38,11 +38,24 @@
    const { config, setting } = this.props
    let menu = window.GLOB.customMenu
    let modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces)
    let modules = []
    let ismain = false
    if (menu.Template === 'BaseTable') {
      ismain = config.name === '主表'
    }
    if (config.type === 'interface') {
      menu.components.forEach(item => {
        if (item.type === 'module' && item.subtype === 'account') {
          modules.push({
            value: item.uuid,
            label: item.name
          })
        }
      })
    } else {
      modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces)
    }
    modules.unshift({
@@ -105,6 +118,9 @@
          if (values.interType === 'system' && values.onload === 'false') {
            values.sync = 'false'
          }
          if (values.interType === 'system' && values.database === 'sso') {
            values.sync = 'false'
          }
          // 数据源前端验证
          if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) {
@@ -145,10 +161,10 @@
    let tableName = this.props.form.getFieldValue('tableName') || '表名'
    if (type === 'flowstart') {
      _sql = _sql + `\n/* select a.*, w.remark as remark_w, w.statusname  as statusname_w,w.status as status_w,w.works_flow_param,w.modifydate as modifydate_w  from (select * from ${tableName} where status=0 and deleted=0 $@ and createuserid=@userid@ @$) a
      _sql = _sql + `\n/* select a.*, w.remark as remark_w, w.statusname  as statusname_w,w.status as status_w,w.works_flow_param,w.works_flow_detail_id,w.modifydate as modifydate_w  from (select * from ${tableName} where status=0 and deleted=0 $@ and createuserid=@userid@ @$) a
    inner join (select * from  s_my_works_flow  where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */`
    } else if (type === 'flowcheck') {
      _sql = _sql + `\n/* select a.*, w.remark as remark_w, w.statusname  as statusname_w,w.status as status_w,w.works_flow_param,w.modifydate as modifydate_w
      _sql = _sql + `\n/* select a.*, w.remark as remark_w, w.statusname  as statusname_w,w.status as status_w,w.works_flow_param,w.works_flow_detail_id,w.modifydate as modifydate_w
    from (select * from ${tableName} where status=0 and deleted=0 ) a
    inner join (select * from  s_my_works_flow  where works_flow_code=@works_flow_code@ and status>0 and status<888 and deleted=0) w 
    on a.id=w.works_flow_id 
@@ -189,7 +205,7 @@
  }
  render() {
    const { columns, config } = this.props
    const { columns, config, hasMainSearch } = this.props
    const { getFieldDecorator } = this.props.form
    const { setting, modules, innerRules, innertip, MenuType, visible } = this.state
@@ -264,7 +280,7 @@
                </Radio.Group>)}
              </Form.Item>
            </Col>
            {setting.interType === 'outer' ? <Col span={8}>
            {setting.interType === 'outer' ? <Col span={8} className="compact">
              <Form.Item label={
                <Tooltip placement="topLeft" title="业务系统指同一sso下的其他业务系统,外部系统指不同sso下的其他业务系统。">
                  <QuestionCircleOutlined className="mk-form-tip" />
@@ -284,6 +300,7 @@
                  <Radio value="false">业务</Radio>
                  <Radio value="true">单点</Radio>
                  <Radio value="external">外部</Radio>
                  <Radio value="custom">自定义</Radio>
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
@@ -332,7 +349,7 @@
                })(<KeyInterface type="develop"/>)}
              </Form.Item>
            </Col> : null}
            {setting.interType === 'outer' && setting.sysInterface === 'false' ? <Col className="outer-interface" span={24}>
            {setting.interType === 'outer' && (setting.sysInterface === 'false' || setting.sysInterface === 'custom') ? <Col className="outer-interface" span={24}>
              <Form.Item label={<Tooltip placement="topLeft" title="正式系统接口地址,为空时使用接口地址。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  正式地址
@@ -354,6 +371,18 @@
                })(<KeyInterface type="product"/>)}
              </Form.Item>
            </Col> : null}
            {setting.interType === 'outer' && setting.sysInterface === 'custom' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}>
              <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={
                <Tooltip placement="topLeft" title="外部接口入参及出参的自定义处理。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  自定义脚本
                </Tooltip>
              }>
                {getFieldDecorator('js_script', {
                  initialValue: setting.js_script || ''
                })(<CodeMirror mode="text/javascript" theme="cobalt" />)}
              </Form.Item>
            </Col> : null}
            {setting.interType === 'outer' ? <Col span={8}>
              <Form.Item label="外部函数">
                {getFieldDecorator('outerFunc', {
@@ -362,7 +391,7 @@
              </Form.Item>
            </Col> : null}
            {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}>
              {window.GLOB.process ? <span className="process-btn" onClick={this.addProcess}>工作流</span> : null}
              {window.GLOB.process && !['invoice', 'invTable'].includes(config.subtype) ? <span className="process-btn" onClick={this.addProcess}>工作流</span> : null}
              <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={
                <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 ''。`}>
                  <QuestionCircleOutlined className="mk-form-tip" />
@@ -396,21 +425,21 @@
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            <Col span={8}>
            {!['invTable'].includes(config.subtype) ? <Col span={8}>
              <Form.Item label="主键">
                {getFieldDecorator('primaryKey', {
                  initialValue: setting.primaryKey || ''
                })(
                  <Select>
                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                    {columns.map((option, i) =>
                      <Select.Option key={i} value={option.field}>
                        {option.label}
                        {`${option.label}(${option.field})`}
                      </Select.Option>
                    )}
                  </Select>
                )}
              </Form.Item>
            </Col>
            </Col> : null}
            {/* 数组数据,需设置排序规则 */}
            {config.format === 'array' ? <Col span={8}>
              <Form.Item label={
@@ -425,6 +454,10 @@
                    {
                      required: true,
                      message: '请输入默认排序!'
                    },
                    {
                      pattern: /^[^'+]+$/,
                      message: '排序中不可使用\'与+'
                    }
                  ]
                })(<Input placeholder={'ID asc, UID desc'} autoComplete="off" />)}
@@ -441,7 +474,7 @@
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}>
            {!['balcony', 'menubar', 'commonbar', 'tabbar', 'invTable'].includes(config.subtype) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title={'该组件如果受其他组件控制,请选项相应的组件,没有时选“无”。'}>
                  <QuestionCircleOutlined className="mk-form-tip" />
@@ -502,16 +535,27 @@
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            {setting.interType === 'system' ? <Col span={8}>
              <Form.Item label="数据库">
                {getFieldDecorator('database', {
                  initialValue: setting.database || 'local'
                })(
                <Radio.Group>
                  <Radio value="local">本地</Radio>
                  <Radio value="sso">单点</Radio>
                </Radio.Group>)}
              </Form.Item>
            </Col> : null}
            {/* 1、不分页且不存在上级模块 */}
            {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}>
            {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard', 'invoice', 'invTable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据,注:如菜单未使用后端缓存,则查询语句大于8000字符时无效。'}>
                <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据。'}>
                  <QuestionCircleOutlined className="mk-form-tip" />
                  同步查询
                </Tooltip>
              }>
                {getFieldDecorator('sync', {
                  initialValue: setting.sync || 'true'
                  initialValue: setting.sync || 'false'
                })(
                  <Radio.Group>
                    <Radio value="true">是</Radio>
@@ -520,7 +564,7 @@
                )}
              </Form.Item>
            </Col> : null}
            {!['navbar', 'balcony', 'menubar'].includes(config.type) && !['basetable'].includes(config.subtype) ? <Col span={8}>
            {!['navbar', 'balcony', 'menubar'].includes(config.type) && !['basetable', 'invoice', 'invTable'].includes(config.subtype) ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title={config.type === 'interface' ? '单独搜索组件可作为公共数据源的搜索条件。' : '优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}>
                  <QuestionCircleOutlined className="mk-form-tip" />
@@ -531,7 +575,7 @@
                  initialValue: setting.useMSearch || 'true'
                })(
                  <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'useMSearch')}}>
                    <Radio value="true">使用</Radio>
                    <Radio value="true">使用{!hasMainSearch ? <Tooltip placement="top" title="无可使用的外部搜索条件"><span className="mk-dot"></span></Tooltip> : null}</Radio>
                    <Radio value="false">不使用</Radio>
                  </Radio.Group>
                )}
@@ -562,6 +606,23 @@
                  <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'onload')}}>
                    <Radio value="true">加载</Radio>
                    <Radio value="false">不加载</Radio>
                  </Radio.Group>
                )}
              </Form.Item>
            </Col> : null}
            {setting.interType === 'system' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="使用后端sql脚本时有效。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  事务
                </Tooltip>
              }>
                {getFieldDecorator('transact', {
                  initialValue: setting.transact || 'false'
                })(
                  <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'transact')}}>
                    <Radio value="true">启用</Radio>
                    <Radio value="false">禁用</Radio>
                  </Radio.Group>
                )}
              </Form.Item>
@@ -618,7 +679,7 @@
            </Col> : null}
            {config.subtype === 'dualdatacard' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="子表在主表中的数据集名称。">
                <Tooltip placement="topLeft" title="子表在主表中的数据集名称,使用 sub_data_string 时数据以 JSON 字符串形式返回(字段集中需添加 sub_data_string 字段)。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  子表字段
                </Tooltip>
@@ -628,7 +689,7 @@
                  rules: [
                    {
                      required: true,
                      message: '请输入默认排序!'
                      message: '请输入子表字段!'
                    }
                  ]
                })(<Input placeholder={''} autoComplete="off" />)}
@@ -639,10 +700,10 @@
                {getFieldDecorator('subKey', {
                  initialValue: setting.subKey || ''
                })(
                  <Select>
                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                    {this.props.subColumns.map((option, i) =>
                      <Select.Option key={i} value={option.field}>
                        {option.label}
                        {`${option.label}(${option.field})`}
                      </Select.Option>
                    )}
                  </Select>
@@ -654,14 +715,26 @@
                {getFieldDecorator('subBID', {
                  initialValue: setting.subBID || ''
                })(
                  <Select>
                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                    {this.props.subColumns.map((option, i) =>
                      <Select.Option key={i} value={option.field}>
                        {option.label}
                        {`${option.label}(${option.field})`}
                      </Select.Option>
                    )}
                  </Select>
                )}
              </Form.Item>
            </Col> : null}
            {setting.onload !== 'false' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="可延迟初始化数据的加载时间,单位毫秒(ms)。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  延时加载
                </Tooltip>
              }>
                {getFieldDecorator('delay', {
                  initialValue: setting.delay,
                })(<InputNumber min={0} max={60000} precision={0} />)}
              </Form.Item>
            </Col> : null}
          </Row>
@@ -670,8 +743,7 @@
          wrapClassName="mk-flow-type"
          visible={visible}
          width={400}
          maskClosable={false}
          closable={false}
          onCancel={() => this.setState({visible: false})}
          footer={[
            <Button key="cancel" className="mk-green" onClick={() => this.execAddProcess('flowstart')}>发起</Button>,
            <Button key="confirm" className="mk-primary" onClick={() => this.execAddProcess('flowcheck')}>审批</Button>