Jelajahi Sumber

【update】bo功能调整,增加中文本类型、列表默认排序、同步表结构提示、删除表提示

cfort 2 tahun lalu
induk
melakukan
fa430bdc04

+ 136 - 136
src/business/platform/bo/def/external-panel.vue

@@ -1,31 +1,31 @@
 <template>
-  <ibps-layout ref="layout">
-    <ibps-crud
-      ref="crud"
-      :height="tableHeight"
-      :data="listData"
-      :toolbars="listConfig.toolbars"
-      :search-form="listConfig.searchForm"
-      :pk-key="pkKey"
-      :columns="listConfig.columns"
-      :loading="loading"
-      :show-pagination="false"
-      :selection-type="multiple?'checkbox':'radio'"
-      @selection-change="handleSelectionChange"
-      @action-event="handleAction"
-    >
-      <template slot="dsAliasSelect">
-        <el-select v-model="targetDsAlias" clearable placeholder="请选择">
-          <el-option
-            v-for="item in dsAliasOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
-          />
-        </el-select>
-      </template>
-    </ibps-crud>
-  </ibps-layout>
+    <ibps-layout ref="layout">
+        <ibps-crud
+            ref="crud"
+            :height="tableHeight"
+            :data="listData"
+            :toolbars="listConfig.toolbars"
+            :search-form="listConfig.searchForm"
+            :pk-key="pkKey"
+            :columns="listConfig.columns"
+            :loading="loading"
+            :show-pagination="false"
+            :selection-type="multiple?'checkbox':'radio'"
+            @selection-change="handleSelectionChange"
+            @action-event="handleAction"
+        >
+            <template slot="dsAliasSelect">
+                <el-select v-model="targetDsAlias" clearable placeholder="请选择">
+                    <el-option
+                        v-for="item in dsAliasOptions"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                    />
+                </el-select>
+            </template>
+        </ibps-crud>
+    </ibps-layout>
 </template>
 <script>
 import { queryTable } from '@/api/platform/bo/boDef'
@@ -34,119 +34,119 @@ import ActionUtils from '@/utils/action'
 import SelectionMixin from '@/components/ibps-selector/mixins/selection'
 
 export default {
-  mixins: [SelectionMixin],
-  props: {
-    value: [Object, Array],
-    multiple: Boolean,
-    height: {
-      type: String,
-      default: '400px'
-    }
-  },
-  data() {
-    return {
-      pkKey: 'name', // 主键  如果主键不是pk需要传主键
-      loading: false,
-      listData: [],
-      dsAliasOptions: [],
-      targetDsAlias: '',
-      listConfig: {
-        // 工具栏
-        toolbars: [
-          { key: 'search' }
-        ],
-        // 查询条件
-        searchForm: {
-          labelWidth: 100,
-          forms: [
-            { prop: 'tableName', label: '表名', itemWidth: '200' },
-            { prop: 'dsAlias', label: '数据源', fieldType: 'slot', slotName: 'dsAliasSelect' }
-          ]
-        },
-        // 表格字段配置
-        columns: [
-          { prop: 'name', label: '表名' },
-          { prop: 'comment', label: '描述' }
-        ]
-      }
-    }
-  },
-  computed: {
-    tableHeight() {
-      const h = this.height.substr(0, this.height.length - 2)
-      return parseInt(h) - 10
-    }
-  },
-  watch: {
-    dsAliasOptions: {
-      handler: function(val, oldVal) {
-        this.targetDsAlias = val[0].label
-        this.$emit('callback', val[0])
-      },
-      deer: true
-    }
-  },
-  created() {
-    this.dataSource()
-    this.loadData()
-  },
-  methods: {
-    // 数据源
-    dataSource() {
-      queryDataSource().then(response => {
-        const data = response.data['dataResult']
-        this.dsAliasOptions = data.map(item => {
-          return {
-            label: item.name,
-            value: item.alias
-          }
-        })
-      })
+    mixins: [SelectionMixin],
+    props: {
+        value: [Object, Array],
+        multiple: Boolean,
+        height: {
+            type: String,
+            default: '400px'
+        }
     },
-    /**
-     * 加载数据
-     */
-    loadData() {
-      this.loading = true
-      const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-      this.dsAliasOptions.forEach(item => {
-        params.dsAlias = item.label === this.targetDsAlias ? item.value : this.targetDsAlias
-      })
-      queryTable({
-        dsAlias: params.dsAlias,
-        tableName: params.tableName
-      }).then(response => {
-        this.loading = false
-        ActionUtils.handleListData(this, response.data)
-        this.setSelectRow()
-      }).catch(() => {
-        this.loading = false
-      })
+    data () {
+        return {
+            pkKey: 'name', // 主键  如果主键不是pk需要传主键
+            loading: false,
+            listData: [],
+            dsAliasOptions: [],
+            targetDsAlias: '',
+            listConfig: {
+                // 工具栏
+                toolbars: [
+                    { key: 'search' }
+                ],
+                // 查询条件
+                searchForm: {
+                    labelWidth: 100,
+                    forms: [
+                        { prop: 'tableName', label: '表名', itemWidth: '150' },
+                        { prop: 'dsAlias', label: '数据源', fieldType: 'slot', slotName: 'dsAliasSelect' }
+                    ]
+                },
+                // 表格字段配置
+                columns: [
+                    { prop: 'name', label: '表名' },
+                    { prop: 'comment', label: '描述' }
+                ]
+            }
+        }
     },
-    /**
-     * 查询
-     */
-    search() {
-      this.loadData()
+    computed: {
+        tableHeight () {
+            const h = this.height.substr(0, this.height.length - 2)
+            return parseInt(h) - 10
+        }
     },
-    /**
-     * 重置查询条件
-     */
-    reset() {
-      this.$refs['crud'].handleReset()
+    watch: {
+        dsAliasOptions: {
+            handler: function (val, oldVal) {
+                this.targetDsAlias = val[0].label
+                this.$emit('callback', val[0])
+            },
+            deer: true
+        }
     },
-    /**
-     * 处理按钮事件
-     */
-    handleAction(command, position, selection, data) {
-      switch (command) {
-        case 'search':// 查询
-          this.search()
-          break
-        default:
-          break
-      }
+    created () {
+        this.dataSource()
+        this.loadData()
+    },
+    methods: {
+        // 数据源
+        dataSource () {
+            queryDataSource().then(response => {
+                const data = response.data['dataResult']
+                this.dsAliasOptions = data.map(item => {
+                    return {
+                        label: item.name,
+                        value: item.alias
+                    }
+                })
+            })
+        },
+        /**
+         * 加载数据
+         */
+        loadData () {
+            this.loading = true
+            const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            this.dsAliasOptions.forEach(item => {
+                params.dsAlias = item.label === this.targetDsAlias ? item.value : this.targetDsAlias
+            })
+            queryTable({
+                dsAlias: params.dsAlias,
+                tableName: params.tableName
+            }).then(response => {
+                this.loading = false
+                ActionUtils.handleListData(this, response.data)
+                this.setSelectRow()
+            }).catch(() => {
+                this.loading = false
+            })
+        },
+        /**
+         * 查询
+         */
+        search () {
+            this.loadData()
+        },
+        /**
+         * 重置查询条件
+         */
+        reset () {
+            this.$refs['crud'].handleReset()
+        },
+        /**
+         * 处理按钮事件
+         */
+        handleAction (command, position, selection, data) {
+            switch (command) {
+                case 'search':// 查询
+                    this.search()
+                    break
+                default:
+                    break
+            }
+        }
     }
-  }
 }
 </script>

+ 1 - 1
src/business/platform/bo/def/panel.vue

@@ -62,7 +62,7 @@ export default {
         ]
       },
       pagination: {},
-      sorts: {}
+      sorts: { CREATE_TIME_: 'DESC' }
     }
   },
   computed: {

+ 4 - 0
src/views/platform/bo/boDef/constants/index.js

@@ -65,6 +65,10 @@ export const typeOptions = [
     {
         value: 'clob',
         label: 'text【最大长度为65,535个字符(约64KB)】'
+    },
+    {
+        value: 'mediumtext',
+        label: 'mediumtext【最大长度为16,777,215个字符(约16MB)】'
     }
 ]
 export const formatOptions = [

+ 337 - 338
src/views/platform/bo/boDef/edit/detail/object-attr/edit.vue

@@ -1,150 +1,150 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    class="bo-attr-dialog"
-    top="13vh"
-    width="65%"
-    @open="getFormData"
-    @close="closeDialog"
-  >
-    <el-tabs v-model="activeName" @tab-click="handleClick">
-      <el-tab-pane label="属性信息" name="attInfo">
-        <el-form
-          ref="form"
-          v-loading="dialogLoading"
-          :element-loading-text="$t('common.loading')"
-          :model="form"
-          :rules="rules"
-          :label-width="formLabelWidth"
-          @submit.native.prevent
-        >
-          <el-row>
-            <el-col :span="24">
-              <el-form-item label="名称:" prop="name">
-                <el-input
-                    ref="formNameCont"
-                  v-model="form.name"
-                  v-pinyin="{vm:form,config:{format:'WITHOUT_TONE'},py:[{key:'code',camelCase:true},{key:'fieldName',separator:'_',separatorEnd:true}]}"
-                  @blur="validateFormField"
-                />
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item label="编码" prop="code" class="forms" @keyup.enter.native="handleSave('apply')">
-                <span class="forms-span">
-                  <el-tooltip
-                    class="item"
-                    effect="light"
-                    content="驼峰命名法:sysData、uesrId"
-                    placement="bottom"
-                  >
-                    <ibps-icon name="exclamation-circle" class="forms-icon" @keyup.enter.native="handleSave('apply')" />
-                  </el-tooltip>:
-                </span>
-                <el-input v-model="form.code" :disabled="!form.edit&&isCreateTable==='Y'" @keyup.enter.native="handleSave('apply')"/>
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item label="字段" prop="fieldName" class="forms">
-                <span class="forms-span">
-                  <el-tooltip
-                    class="item"
-                    effect="light"
-                    content="下划线分隔:sys_data_"
-                    placement="bottom"
-                  >
-                    <ibps-icon name="exclamation-circle" class="forms-icon" />
-                  </el-tooltip>:
-                </span>
-                <el-input v-model="form.fieldName" :disabled="!form.edit&&isCreateTable==='Y'"  @keyup.enter.native="handleSave('apply')"/>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item label="描述:" prop="desc">
-                <el-input v-model="form.desc" type="textarea" @keyup.enter.native="handleSave('apply')" />
-              </el-form-item>
-            </el-col>
-            <el-col v-if="false" :span="12">
-              <el-form-item label="是否允许为空:" prop="isNull">
-                <el-radio-group v-model="form.isNull">
-                  <el-radio label="Y">是</el-radio>
-                  <el-radio label="N">否</el-radio>
-                </el-radio-group>
-              </el-form-item>
-            </el-col>
-            <el-col v-if="false" :span="12">
-              <el-form-item label="默认值" prop="defValue" class="forms">
-                <span class="forms-span">
-                  <el-tooltip effect="light" placement="bottom">
-                    <div slot="content">
-                      日期型默认值只支持函数值,例:<br>
-                      oracle的sysdate;<br>
-                      mysql的current_timestamp;<br>
-                      sqlserver的getdate();
-                    </div>
-                    <ibps-icon name="exclamation-circle" class="forms-icon" @keyup.enter.native="handleSave('apply')"/>
-                  </el-tooltip>:
-                </span>
-                <el-input v-model="form.defValue" />
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item label="数据类型:" prop="dataType">
-                <el-select
-                @keyup.enter.native="handleSave('apply')"
-                  v-if="!readonly"
-                  v-model="form.dataType"
-                  placeholder="请选择"
-                  style="width:100%;"
-                  :disabled="!form.edit&&isCreateTable==='Y'"
-                  @change="dataType()"
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        append-to-body
+        class="bo-attr-dialog"
+        top="13vh"
+        width="65%"
+        @open="getFormData"
+        @close="closeDialog"
+    >
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+            <el-tab-pane label="属性信息" name="attInfo">
+                <el-form
+                    ref="form"
+                    v-loading="dialogLoading"
+                    :element-loading-text="$t('common.loading')"
+                    :model="form"
+                    :rules="rules"
+                    :label-width="formLabelWidth"
+                    @submit.native.prevent
                 >
-                  <el-option
-                    v-for="option in typeOptions"
-                    :key="option.value"
-                    :label="option.label"
-                    :value="option.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item v-if="form.dataType==='varchar'||form.dataType==='number'" label="属性长度:" prop="attrLength">
-                <el-input v-model="form.attrLength" />
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item v-if="form.dataType==='date'" label="日期格式:" prop="format">
-                <el-select v-model="form.format" placeholder="请选择" style="width:100%;">
-                  <el-option
-                    v-for="option in formatOptions"
-                    :key="option.value"
-                    :label="option.label"
-                    :value="option.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="12">
-              <el-form-item v-if="form.dataType==='number'" label="小数位数:" prop="precision">
-                <el-input v-model="form.precision" />
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-form>
-      </el-tab-pane>
-    </el-tabs>
-    <div slot="footer" class="el-dialog--center">
-      <ibps-toolbar
-        :actions="toolbars"
-        @action-event="handleActionEvent"
-      />
-    </div>
-  </el-dialog>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="名称:" prop="name">
+                                <el-input
+                                    ref="formNameCont"
+                                    v-model="form.name"
+                                    v-pinyin="{vm:form,config:{format:'WITHOUT_TONE'},py:[{key:'code',camelCase:true},{key:'fieldName',separator:'_',separatorEnd:true}]}"
+                                    @blur="validateFormField"
+                                />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item label="编码" prop="code" class="forms" @keyup.enter.native="handleSave('apply')">
+                                <span class="forms-span">
+                                    <el-tooltip
+                                        class="item"
+                                        effect="light"
+                                        content="驼峰命名法:sysData、uesrId"
+                                        placement="bottom"
+                                    >
+                                        <ibps-icon name="exclamation-circle" class="forms-icon" @keyup.enter.native="handleSave('apply')" />
+                                    </el-tooltip>:
+                                </span>
+                                <el-input v-model="form.code" :disabled="!form.edit&&isCreateTable==='Y'" @keyup.enter.native="handleSave('apply')" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item label="字段" prop="fieldName" class="forms">
+                                <span class="forms-span">
+                                    <el-tooltip
+                                        class="item"
+                                        effect="light"
+                                        content="下划线分隔:sys_data_"
+                                        placement="bottom"
+                                    >
+                                        <ibps-icon name="exclamation-circle" class="forms-icon" />
+                                    </el-tooltip>:
+                                </span>
+                                <el-input v-model="form.fieldName" :disabled="!form.edit&&isCreateTable==='Y'" @keyup.enter.native="handleSave('apply')" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="24">
+                            <el-form-item label="描述:" prop="desc">
+                                <el-input v-model="form.desc" type="textarea" @keyup.enter.native="handleSave('apply')" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col v-if="false" :span="12">
+                            <el-form-item label="是否允许为空:" prop="isNull">
+                                <el-radio-group v-model="form.isNull">
+                                    <el-radio label="Y">是</el-radio>
+                                    <el-radio label="N">否</el-radio>
+                                </el-radio-group>
+                            </el-form-item>
+                        </el-col>
+                        <el-col v-if="false" :span="12">
+                            <el-form-item label="默认值" prop="defValue" class="forms">
+                                <span class="forms-span">
+                                    <el-tooltip effect="light" placement="bottom">
+                                        <div slot="content">
+                                            日期型默认值只支持函数值,例:<br>
+                                            oracle的sysdate;<br>
+                                            mysql的current_timestamp;<br>
+                                            sqlserver的getdate();
+                                        </div>
+                                        <ibps-icon name="exclamation-circle" class="forms-icon" @keyup.enter.native="handleSave('apply')" />
+                                    </el-tooltip>:
+                                </span>
+                                <el-input v-model="form.defValue" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item label="数据类型:" prop="dataType">
+                                <el-select
+                                    v-if="!readonly"
+                                    v-model="form.dataType"
+                                    placeholder="请选择"
+                                    style="width:100%;"
+                                    :disabled="!form.edit&&isCreateTable==='Y'"
+                                    @keyup.enter.native="handleSave('apply')"
+                                    @change="dataType()"
+                                >
+                                    <el-option
+                                        v-for="option in typeOptions"
+                                        :key="option.value"
+                                        :label="option.label"
+                                        :value="option.value"
+                                    />
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item v-if="form.dataType==='varchar'||form.dataType==='number'" label="属性长度:" prop="attrLength">
+                                <el-input v-model="form.attrLength" />
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item v-if="form.dataType==='date'" label="日期格式:" prop="format">
+                                <el-select v-model="form.format" placeholder="请选择" style="width:100%;">
+                                    <el-option
+                                        v-for="option in formatOptions"
+                                        :key="option.value"
+                                        :label="option.label"
+                                        :value="option.value"
+                                    />
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="12">
+                            <el-form-item v-if="form.dataType==='number'" label="小数位数:" prop="precision">
+                                <el-input v-model="form.precision" />
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                </el-form>
+            </el-tab-pane>
+        </el-tabs>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
 </template>
 
 <script>
@@ -152,217 +152,216 @@ import { typeOptions, formatOptions, objectAttrRootData } from '../../../constan
 import { validateInteger, testField } from '@/utils/validate'
 import ActionUtils from '@/utils/action'
 
-const uuid =()=>{
-  return  require('uuid').v1()
+const uuid = () => {
+    return require('uuid').v1()
 }
 
 export default {
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    id: String,
-    title: String,
-    datas: Object,
-    isCreateTable: {
-      type: String,
-      default: 'N'
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        readonly: {
+            type: Boolean,
+            default: false
+        },
+        id: String,
+        title: String,
+        datas: Object,
+        isCreateTable: {
+            type: String,
+            default: 'N'
+        },
+        clear: {
+            type: Boolean,
+            default: false
+        }
     },
-    clear: {
-      type: Boolean,
-      default: false
-    }
-  },
-  data() {
-    return {
-      activeName: 'attInfo',
-      formName: 'form',
-      formLabelWidth: '120px',
-      dialogVisible: this.visible,
-      dialogLoading: false,
-      format: false,
-      apply: true,
-      typeOptions: typeOptions,
-      formatOptions: formatOptions,
-      defaultForm: {},
-      form: objectAttrRootData,
-      rules: {
-        name: [{ required: true, message: this.$t('validate.required') },
-          { min: 1, max: 64, message: '长度不能超过64个字符', trigger: 'blur' }],
-        code: [
-          { required: true, message: this.$t('validate.required') },
-          { validator: testField, trigger: 'blur' }
-        ],
-        fieldName: [
-          { required: true, message: this.$t('validate.required') },
-          { validator: testField, trigger: 'blur' }
-        ],
-        dataType: [{ required: true, message: this.$t('validate.required') }],
-        format: [{ required: true, message: this.$t('validate.required') }],
-        attrLength: [{ required: true, message: this.$t('validate.required') }, { validator: validateInteger, trigger: 'blur' }],
-        precision: [{ required: true, message: this.$t('validate.required') }, { validator: validateInteger, trigger: 'blur' }]
-      },
-      toolbars: [
-        { key: 'save', type: 'success', label: '应用', hidden: () => { return !this.apply } },
-        { key: 'confirm' },
-        { key: 'cancel' }
-      ]
-    }
-  },
-  computed: {
-    formId() {
-      return this.id
+    data () {
+        return {
+            activeName: 'attInfo',
+            formName: 'form',
+            formLabelWidth: '120px',
+            dialogVisible: this.visible,
+            dialogLoading: false,
+            format: false,
+            apply: true,
+            typeOptions: typeOptions,
+            formatOptions: formatOptions,
+            defaultForm: {},
+            form: objectAttrRootData,
+            rules: {
+                name: [{ required: true, message: this.$t('validate.required') },
+                    { min: 1, max: 64, message: '长度不能超过64个字符', trigger: 'blur' }],
+                code: [
+                    { required: true, message: this.$t('validate.required') },
+                    { validator: testField, trigger: 'blur' }
+                ],
+                fieldName: [
+                    { required: true, message: this.$t('validate.required') },
+                    { validator: testField, trigger: 'blur' }
+                ],
+                dataType: [{ required: true, message: this.$t('validate.required') }],
+                format: [{ required: true, message: this.$t('validate.required') }],
+                attrLength: [{ required: true, message: this.$t('validate.required') }, { validator: validateInteger, trigger: 'blur' }],
+                precision: [{ required: true, message: this.$t('validate.required') }, { validator: validateInteger, trigger: 'blur' }]
+            },
+            toolbars: [
+                { key: 'save', type: 'success', label: '应用', hidden: () => { return !this.apply } },
+                { key: 'confirm' },
+                { key: 'cancel' }
+            ]
+        }
     },
-    formData() {
-      return this.datas
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.dialogVisible = this.visible
-      },
-      immediate: true
-    }
-  },
-  created() {
-    this.defaultForm = JSON.parse(JSON.stringify(this.form))
-  },
-  methods: {
-    handleActionEvent({ key }) {
-      switch (key) {
-        case 'save':
-          this.handleSave('apply')
-          break
-        case 'confirm':
-          this.handleSave('confirm')
-          break
-        case 'cancel':
-          this.closeDialog()
-          break
-        default:
-          break
-      }
+    computed: {
+        formId () {
+            return this.id
+        },
+        formData () {
+            return this.datas
+        }
     },
-    dataType() {
-      if (this.form.dataType === 'date') {
-        this.form.format = 'yyyy-MM-dd'
-      }
-      if (this.form.dataType === 'varchar') {
-        this.form.attrLength = '200'
-      }
-      if (this.form.dataType === 'number') {
-        this.form.attrLength = '20'
-      }
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            },
+            immediate: true
+        }
     },
-    handleClick(tab, event) {
-      console.log(tab, event)
+    created () {
+        this.defaultForm = JSON.parse(JSON.stringify(this.form))
     },
-    // 保存数据
-    handleSave(buttonKey) {
-      if ((this.form.code && this.form.code !== this.form.code.trim()) ||
-        (this.form.fieldName && this.form.fieldName !== this.form.fieldName.trim())) {
-        this.$message({
-          message: '编码和字段首尾不能存在空格,请删除后再进行保存操作',
-          type: 'warning'
-        })
-        return
-      }
-       if (this.form.code.length > 17) {
-      	    this.form.code = this.form.code.slice(0, 17)
-      	  }
-      	  if (this.form.fieldName.length > 17) {
-      	    this.form.fieldName = this.form.fieldName.slice(0, 17)
-      	  }
-      this.$refs[this.formName].validate(valid => {
-        if (valid) {
-          this.$emit('callback', this.form, buttonKey)
-          this.$nextTick(() => {
-            if (!this.clear) {
-              this.form = JSON.parse(JSON.stringify(this.defaultForm))
+    methods: {
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'save':
+                    this.handleSave('apply')
+                    break
+                case 'confirm':
+                    this.handleSave('confirm')
+                    break
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        dataType () {
+            if (this.form.dataType === 'date') {
+                this.form.format = 'yyyy-MM-dd'
+            }
+            if (this.form.dataType === 'varchar') {
+                this.form.attrLength = '200'
+            }
+            if (this.form.dataType === 'number') {
+                this.form.attrLength = '20'
+            }
+        },
+        handleClick (tab, event) {
+            console.log(tab, event)
+        },
+        // 保存数据
+        handleSave (buttonKey) {
+            if ((this.form.code && this.form.code !== this.form.code.trim()) || (this.form.fieldName && this.form.fieldName !== this.form.fieldName.trim())) {
+                this.$message({
+                    message: '编码和字段首尾不能存在空格,请删除后再进行保存操作',
+                    type: 'warning'
+                })
+                return
             }
-          })
-          if (buttonKey !== 'apply') {
+            if (this.form.code.length > 17) {
+                this.form.code = this.form.code.slice(0, 17)
+            }
+            if (this.form.fieldName.length > 17) {
+                this.form.fieldName = this.form.fieldName.slice(0, 17)
+            }
+            this.$refs[this.formName].validate(valid => {
+                if (valid) {
+                    this.$emit('callback', this.form, buttonKey)
+                    this.$nextTick(() => {
+                        if (!this.clear) {
+                            this.form = JSON.parse(JSON.stringify(this.defaultForm))
+                        }
+                    })
+                    if (buttonKey !== 'apply') {
+                        this.$nextTick(() => {
+                            if (!this.clear) {
+                                this.closeDialog()
+                            }
+                        })
+                    }
+                } else {
+                    ActionUtils.saveErrorMessage()
+                }
+            })
             this.$nextTick(() => {
-              if (!this.clear) {
-                this.closeDialog()
-              }
+                this.$refs.formNameCont.focus()
             })
-          }
-        } else {
-          ActionUtils.saveErrorMessage()
-        }
-      })
-      this.$nextTick(()=>{
-      	         this.$refs.formNameCont.focus();
-      	      })
-    },
-    // 关闭当前窗口
-    closeDialog() {
-      this.format = false
-      this.$emit('close', false)
-    },
-    /**
-     * 表单验证
-     */
-    formValidate() {
-      if (this.readonly) return
-      this.$nextTick(() => {
-        this.$refs[this.formName].validate(() => {})
-      })
-    },
-    validateFormField() {
-      setTimeout(() => {
-        if (this.$refs['form']) {
-          this.$refs['form'].validateField('code')
-          this.$refs['form'].validateField('fieldName')
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.format = false
+            this.$emit('close', false)
+        },
+        /**
+         * 表单验证
+         */
+        formValidate () {
+            if (this.readonly) return
+            this.$nextTick(() => {
+                this.$refs[this.formName].validate(() => {})
+            })
+        },
+        validateFormField () {
+            setTimeout(() => {
+                if (this.$refs['form']) {
+                    this.$refs['form'].validateField('code')
+                    this.$refs['form'].validateField('fieldName')
+                }
+            }, 50)
+        },
+        /**
+         * 获取表单数据
+         */
+        getFormData () {
+            if (this.$utils.isEmpty(this.formId)) {
+                // 重置表单
+                this.form = JSON.parse(JSON.stringify(this.defaultForm))
+                this.formValidate()
+                this.apply = true
+                return
+            }
+            this.form = JSON.parse(JSON.stringify(this.formData))
+            this.apply = false
+            if (!this.$utils.isEmpty(this.form.format)) {
+                this.format = true
+            }
         }
-      }, 50)
-    },
-    /**
-     * 获取表单数据
-     */
-    getFormData() {
-      if (this.$utils.isEmpty(this.formId)) {
-        // 重置表单
-        this.form = JSON.parse(JSON.stringify(this.defaultForm))
-        this.formValidate()
-        this.apply = true
-        return
-      }
-      this.form = JSON.parse(JSON.stringify(this.formData))
-      this.apply = false
-      if (!this.$utils.isEmpty(this.form.format)) {
-        this.format = true
-      }
     }
-  }
 
 }
 </script>
 <style lang="scss">
-.bo-attr-dialog{
-  .el-dialog__body{
-    padding: 15px 20px;
-    .forms{
-      position: relative;
-      label{
-        width: 90px!important;
-      }
-      .forms-span{
-        position:absolute;
-        left: -40px;
-        top: 0;
-        .forms-icon{
-          color: #337ab7;
+.bo-attr-dialog {
+    .el-dialog__body {
+        padding: 15px 20px;
+        .forms {
+            position: relative;
+            label {
+                width: 90px !important;
+            }
+            .forms-span {
+                position: absolute;
+                left: -40px;
+                top: 0;
+                .forms-icon {
+                    color: #337ab7;
+                }
+            }
         }
-      }
     }
-  }
 }
 </style>

+ 12 - 2
src/views/platform/bo/boDef/list.vue

@@ -388,9 +388,10 @@ export default {
                     break
                 case 'synBoTable': // 同步表结构
                     ActionUtils.selectedRecord(selection).then((id) => {
-                        this.$confirm('是否同步表结构?', '消息', {
-                            confirmButtonText: '确定',
+                        this.$confirm(`<span style="color:#f56c6c; font-size: 18px; font-weight: 600;">同步表结构存在以下问题:</span><br>1.将用当前表编码去模糊查询,并将匹配到的第一个表结构同步到当前表。因此使用前请搜索当前表编码,确保结果只有一个,否则将表结构混乱!<br>2.同步表结构后数据表字段的编码长度将会被改变,涉及到的所有脚本及表单都需要进行调整。<br><span style="color:#f56c6c; font-size: 18px; font-weight: 600;">请谨慎操作!</span>`, '警告', {
+                            confirmButtonText: '确定同步',
                             cancelButtonText: '取消',
+                            dangerouslyUseHTMLString: true,
                             type: 'warning'
                         }).then(() => {
                             this.handlesynBoTable(id)
@@ -430,6 +431,15 @@ export default {
                 rmType: 'all',
                 clean: true
             }).then(response => {
+                const { cause = '' } = response
+                if (cause && cause.includes('请先处理关联后再删除!')) {
+                    this.$confirm(cause, '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        dangerouslyUseHTMLString: true,
+                        type: 'warning'
+                    })
+                }
                 this.loadData()
             })
         },

+ 257 - 258
src/views/platform/bo/boDef/more-versions.vue

@@ -1,49 +1,49 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="70%"
-    top="8vh"
-    class="more-versions-dialog"
-    @open="loadData"
-    @close="closeDialog"
-  >
-    <div style="height: 400px;">
-      <ibps-crud
-        ref="crud"
-        v-loading="dialogLoading"
-        :element-loading-text="$t('common.loading')"
-        :data="listData"
-        :height="height"
-        :pk-key="pkKey"
-        :columns="listConfig.columns"
-        :row-handle="listConfig.rowHandle"
-        :pagination="pagination"
-        :loading="loading"
-        :index-row="false"
-        @action-event="handleAction"
-        @sort-change="handleSortChange"
-        @pagination-change="handlePaginationChange"
-      />
-    </div>
-    <!-- 编辑明细 -->
-    <edit
-      :id="editId"
-      :code="code"
-      :visible="dialogFormVisible"
-      :readonly="readonly"
-      entrance="moreVersions"
-      title="editTitle"
-      @callback="search"
-      @close="visible => dialogFormVisible = visible"
-    />
-    <div slot="footer" class="el-dialog--center">
-      <el-button icon="ibps-icon-close" @click="closeDialog">返回</el-button>
-    </div>
-  </el-dialog>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        append-to-body
+        width="70%"
+        top="8vh"
+        class="more-versions-dialog"
+        @open="loadData"
+        @close="closeDialog"
+    >
+        <div style="height: 400px;">
+            <ibps-crud
+                ref="crud"
+                v-loading="dialogLoading"
+                :element-loading-text="$t('common.loading')"
+                :data="listData"
+                :height="height"
+                :pk-key="pkKey"
+                :columns="listConfig.columns"
+                :row-handle="listConfig.rowHandle"
+                :pagination="pagination"
+                :loading="loading"
+                :index-row="false"
+                @action-event="handleAction"
+                @sort-change="handleSortChange"
+                @pagination-change="handlePaginationChange"
+            />
+        </div>
+        <!-- 编辑明细 -->
+        <edit
+            :id="editId"
+            :code="code"
+            :visible="dialogFormVisible"
+            :readonly="readonly"
+            entrance="moreVersions"
+            title="editTitle"
+            @callback="search"
+            @close="visible => dialogFormVisible = visible"
+        />
+        <div slot="footer" class="el-dialog--center">
+            <el-button icon="ibps-icon-close" @click="closeDialog">返回</el-button>
+        </div>
+    </el-dialog>
 </template>
 <script>
 import ActionUtils from '@/utils/action'
@@ -51,227 +51,226 @@ import { queryVersionsList, remove, genBoTable, setMainVersion } from '@/api/pla
 import { createTabelOptions, statusOptions, boTypeOptions } from './constants'
 import Edit from './edit'
 export default {
-  components: {
-    Edit
-  },
-  props: {
-    code: String,
-    id: String,
-    height: Number,
-    visible: {
-      type: Boolean,
-      default: false
+    components: {
+        Edit
     },
-    searchData: Boolean
-  },
-  data() {
-    return {
-      title: '更多版本',
-      editTitle: '',
-      dialogLoading: false,
-      dialogFormVisible: false,
-      dialogVisible: this.visible,
-      editId: '',
-      readonly: false,
-      pkKey: 'id',
-      loading: false,
-      listData: [],
-      pagination: {},
-      sorts: {},
-      listConfig: {
-        // 表格字段配置
-        columns: [
-          { prop: 'name', label: '名称' },
-          { prop: 'code', label: '编码' },
-          { prop: 'version', label: '版本号' },
-          { prop: 'isMain', label: '主版本', tags: createTabelOptions },
-          { prop: 'status', label: '状态', tags: statusOptions },
-          { prop: 'boType', label: '对象管理', tags: boTypeOptions },
-          { prop: 'isCreateTable', label: '生成表', tags: createTabelOptions }
-        ],
-        rowHandle: {
-          actions: [
-            {
-              key: 'setMainVersion',
-              label: '设置为主版本',
-              icon: 'ibps-icon-cog',
-              hidden: (row, index) => {
-                return row.isMain === 'Y'
-              }
-            },
-            {
-              key: 'genBoTable',
-              label: '生成表',
-              icon: 'ibps-icon-cog',
-              hidden: (row, index) => {
-                return !(row.boType === 'object' && row.isCreateTable === 'N')
-              }
-            },
-            { key: 'edit' },
-            { key: 'remove',
-              hidden: (row, index) => {
-                return row.isMain === 'Y'
-              }
-            },
-            { key: 'detail' }
-          ]
-        }
-      }
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.dialogVisible = this.visible
-      },
-      immediate: true
-    },
-    searchData() {
-      this.search()
-    }
-  },
-  methods: {
-    // 关闭当前窗口
-    closeDialog() {
-      this.$emit('close', false)
+    props: {
+        code: String,
+        id: String,
+        height: Number,
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        searchData: Boolean
     },
-    // 初始化数据
-    loadData() {
-      this.loading = true
-      this.$emit('callback')
-      queryVersionsList(this.getFormatParams()).then(response => {
-        ActionUtils.handleListData(this, response.data)
-        this.loading = false
-      }).catch(() => {
-        this.loading = false
-      })
+    data () {
+        return {
+            title: '更多版本',
+            editTitle: '',
+            dialogLoading: false,
+            dialogFormVisible: false,
+            dialogVisible: this.visible,
+            editId: '',
+            readonly: false,
+            pkKey: 'id',
+            loading: false,
+            listData: [],
+            pagination: {},
+            sorts: {},
+            listConfig: {
+                // 表格字段配置
+                columns: [
+                    { prop: 'name', label: '名称' },
+                    { prop: 'code', label: '编码' },
+                    { prop: 'version', label: '版本号' },
+                    { prop: 'isMain', label: '主版本', tags: createTabelOptions },
+                    { prop: 'status', label: '状态', tags: statusOptions },
+                    { prop: 'boType', label: '对象管理', tags: boTypeOptions },
+                    { prop: 'isCreateTable', label: '生成表', tags: createTabelOptions }
+                ],
+                rowHandle: {
+                    actions: [
+                        {
+                            key: 'setMainVersion',
+                            label: '设置为主版本',
+                            icon: 'ibps-icon-cog',
+                            hidden: (row, index) => {
+                                return row.isMain === 'Y'
+                            }
+                        },
+                        {
+                            key: 'genBoTable',
+                            label: '生成表',
+                            icon: 'ibps-icon-cog',
+                            hidden: (row, index) => {
+                                return !(row.boType === 'object' && row.isCreateTable === 'N')
+                            }
+                        },
+                        { key: 'edit' },
+                        { key: 'remove',
+                            hidden: (row, index) => {
+                                return row.isMain === 'Y'
+                            }
+                        },
+                        { key: 'detail' }
+                    ]
+                }
+            }
+        }
     },
-    /**
-     * 获取格式化参数
-     */
-    getFormatParams() {
-      return ActionUtils.formatParams(
-        {
-          code: this.code
-        }, this.pagination, this.sorts)
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            },
+            immediate: true
+        },
+        searchData () {
+            this.search()
+        }
     },
+    methods: {
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        },
+        // 初始化数据
+        loadData () {
+            this.loading = true
+            this.$emit('callback')
+            queryVersionsList(this.getFormatParams()).then(response => {
+                ActionUtils.handleListData(this, response.data)
+                this.loading = false
+            }).catch(() => {
+                this.loading = false
+            })
+        },
+        /**
+         * 获取格式化参数
+         */
+        getFormatParams () {
+            return ActionUtils.formatParams(
+                {
+                    code: this.code
+                }, this.pagination, this.sorts)
+        },
 
-    /**
-     * 处理分页事件
-     */
-    handlePaginationChange(page) {
-      ActionUtils.setPagination(this.pagination, page)
-      this.loadData()
-    },
-    /**
-     * 处理排序
-     */
-    handleSortChange(sort) {
-      ActionUtils.setSorts(this.sorts, sort)
-      this.loadData()
-    },
-    search() {
-      this.loadData()
-    },
-    handleAction(buttonKey, position, selection, data) {
-      switch (buttonKey) {
-        case 'setMainVersion': // 设置主版本
-          ActionUtils.selectedRecord(selection).then((id) => {
-            this.$confirm('确定设置为主版本吗?', '消息', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-            }).then(() => {
-              this.handleSetMainVersion(id)
-              ActionUtils.success('设置为主版本成功!')
-            }).catch(() => {})
-          }).catch(() => { })
-          break
-        case 'genBoTable': // 生成表
-          ActionUtils.selectedRecord(selection).then((id) => {
-            this.$confirm('确定生成表吗?表名自动添加【T_】业务前缀。', '消息', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-            }).then(() => {
-              this.handleGenBoTable(id)
-              ActionUtils.success('生成表成功!')
-            }).catch(() => {})
-          }).catch(() => { })
-          break
-        case 'edit':// 编辑
-          this.editTitle = '业务对象编辑'
-          ActionUtils.selectedRecord(selection).then((id) => {
-            this.handleEdit(id)
-          }).catch(() => { })
-          break
-        case 'remove':// 删除
-          ActionUtils.removeRecord(selection, '是否确定删除该数据?').then((ids) => {
-            this.handleRemove(ids)
-          }).catch(() => {})
-          break
-        case 'detail':// 明细
-          this.editTitle = '明细业务对象'
-          ActionUtils.selectedRecord(selection).then((id) => {
-            this.handleEdit(id, true)
-          }).catch(() => { })
-          break
-        default:
-          break
-      }
-    },
-    /**
-     * 编辑明细
-     */
-    handleEdit(editId = '', readonly = false) {
-      this.editId = editId || ''
-      this.readonly = readonly
-      this.dialogFormVisible = true
-    },
-    /**
-     * 设置主版本
-     */
-    handleSetMainVersion(id) {
-      setMainVersion({
-        boDefId: id
-      }).then(response => {
-        this.loadData()
-      })
-    },
-    /**
-     * 生成表
-     */
-    handleGenBoTable(id) {
-      genBoTable({
-        boDefId: id
-      }).then(response => {
-        this.loadData()
-      })
-    },
-    handleRemove(id) {
-      remove({
-        boDefIds: id,
-        rmType: 'signle',
-        clean: true
-      }).then(response => {
-        this.loadData()
-      })
-    }
+        /**
+         * 处理分页事件
+         */
+        handlePaginationChange (page) {
+            ActionUtils.setPagination(this.pagination, page)
+            this.loadData()
+        },
+        /**
+         * 处理排序
+         */
+        handleSortChange (sort) {
+            ActionUtils.setSorts(this.sorts, sort)
+            this.loadData()
+        },
+        search () {
+            this.loadData()
+        },
+        handleAction (buttonKey, position, selection, data) {
+            switch (buttonKey) {
+                case 'setMainVersion': // 设置主版本
+                    ActionUtils.selectedRecord(selection).then((id) => {
+                        this.$confirm('确定设置为主版本吗?', '消息', {
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
+                        }).then(() => {
+                            this.handleSetMainVersion(id)
+                            ActionUtils.success('设置为主版本成功!')
+                        }).catch(() => {})
+                    }).catch(() => { })
+                    break
+                case 'genBoTable': // 生成表
+                    ActionUtils.selectedRecord(selection).then((id) => {
+                        this.$confirm('确定生成表吗?表名自动添加【T_】业务前缀。', '消息', {
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
+                        }).then(() => {
+                            this.handleGenBoTable(id)
+                            ActionUtils.success('生成表成功!')
+                        }).catch(() => {})
+                    }).catch(() => { })
+                    break
+                case 'edit':// 编辑
+                    this.editTitle = '业务对象编辑'
+                    ActionUtils.selectedRecord(selection).then((id) => {
+                        this.handleEdit(id)
+                    }).catch(() => { })
+                    break
+                case 'remove':// 删除
+                    ActionUtils.removeRecord(selection, '是否确定删除该数据?').then((ids) => {
+                        this.handleRemove(ids)
+                    }).catch(() => {})
+                    break
+                case 'detail':// 明细
+                    this.editTitle = '明细业务对象'
+                    ActionUtils.selectedRecord(selection).then((id) => {
+                        this.handleEdit(id, true)
+                    }).catch(() => { })
+                    break
+                default:
+                    break
+            }
+        },
+        /**
+         * 编辑明细
+         */
+        handleEdit (editId = '', readonly = false) {
+            this.editId = editId || ''
+            this.readonly = readonly
+            this.dialogFormVisible = true
+        },
+        /**
+         * 设置主版本
+         */
+        handleSetMainVersion (id) {
+            setMainVersion({
+                boDefId: id
+            }).then(response => {
+                this.loadData()
+            })
+        },
+        /**
+         * 生成表
+         */
+        handleGenBoTable (id) {
+            genBoTable({
+                boDefId: id
+            }).then(response => {
+                this.loadData()
+            })
+        },
+        handleRemove (id) {
+            remove({
+                boDefIds: id,
+                rmType: 'signle',
+                clean: true
+            }).then(response => {
+                this.loadData()
+            })
+        }
 
-  }
+    }
 }
 </script>
 <style lang="scss">
-.more-versions-dialog{
-  .toolbar-header{
-    display: none;
-  }
-  .el-dialog__body{
-    padding:0;
-    .container-component,
-    .ibps-container-crud{
-      height: 100%
+    .more-versions-dialog{
+        .toolbar-header{
+            display: none;
+        }
+        .el-dialog__body{
+            padding:0;
+            .container-component, .ibps-container-crud{
+                height: 100%
+            }
+        }
     }
-  }
-}
 </style>