Просмотр исходного кода

feat: 移动端表格渲染问题【腾讯文档】金标达-低代码平台二次开发记录表
https://docs.qq.com/sheet/DYkRxZWhkV1pNR3hu

johnsen 9 месяцев назад
Родитель
Сommit
b2c160a7d8

+ 2 - 0
.gitignore

@@ -1,3 +1,5 @@
 dist/
 node_modules/
 *.git
+.history
+.vscode

+ 1 - 1
.vscode/settings.json

@@ -24,7 +24,7 @@
     "source.fixAll": true,
     "source.fixAll.eslint": true
   },
-  "editor.formatOnSave": true,
+  "editor.formatOnSave": false,
   //  "rvest.vs-code-prettier-eslint"
   "editor.defaultFormatter":{
     "editor.defaultFormatter": "rvest.vs-code-prettier-eslint",

+ 12 - 0
src/api/platform/data/dataTemplate.js

@@ -178,6 +178,18 @@ export function queryDataTable(params, isLoading = true) {
   })
 }
 
+/**
+ * 获取数据(通过ID转换为名称)
+ * @param {*} params
+ */
+export function transferByIds(params) {
+  return request({
+    url: DATA_URL() + '/data/template/transferByIds',
+    method: 'post',
+    data: params
+  })
+}
+
 /**
  * 获取列表数据
  * @param {*} params

+ 16 - 0
src/business/platform/data/constants/buttons.js

@@ -27,6 +27,20 @@ const buttons = {
     scope: ['toolbar', 'contextmenu'],
     contextmenu: 'all'
   },
+  'openTask': {
+    label: '编制',
+    type: 'success',
+    icon: 'ibps-icon-add',
+    scope: ['toolbar'],
+    contextmenu: 'all'
+  },
+  'consult': {
+    label: '表单',
+    type: 'primary',
+    icon: 'ibps-icon-table',
+    scope: ['manage'],
+    contextmenu: 'sub'
+  },
   'remove': {
     label: '删除',
     type: 'danger',
@@ -175,6 +189,8 @@ const buttons = {
 export default buttons
 
 function hasButtonPermission(type, action) {
+  // console.log('type===>', type)
+  if (!buttons[type]) return false
   var positions = buttons[type]['scope']
   if (!positions) { return false }
   return positions.indexOf(action) > -1

+ 15 - 15
src/business/platform/data/data-template/field-formatter.vue

@@ -12,7 +12,7 @@
 </template>
 <script>
 import fecha from '@/utils/fecha'
-import { buildLabelTitle } from '../templaterender/utils/index'
+import { buildLabelTitle } from '@/business/platform/data/templaterender/utils/index'
 
 import { getAreaData } from '@/api/platform/cat/area'
 import { findByTypeKey as getDictionaryData } from '@/api/platform/cat/dictionary'
@@ -60,7 +60,7 @@ export default {
       default: '&nbsp;'
     },
     fieldType: String,
-    fieldOptions:Object,
+    fieldOptions: Object,
     tem: Object,
     tag: String
   },
@@ -262,7 +262,7 @@ export default {
       } else {
         if (type === 'user' || type === 'employee') {
           this.userList.forEach((item, i) => {
-            if(id.includes(item.userId)){
+            if (id.includes(item.userId)) {
               this.label += item.userName + ','
               // SELECTOR_CACHE[key] = item.NAME_ + ','
             }
@@ -293,7 +293,7 @@ export default {
             })
         } else if (type === 'position') {
           this.deptList.forEach((item, i) => {
-            if(id.includes(item.positionId)){
+            if (id.includes(item.positionId)) {
               this.label += item.positionName + ','
               // SELECTOR_CACHE[key] = item.NAME_ + ','
             }
@@ -311,7 +311,7 @@ export default {
           //   })
         } else if (type === 'role') {
           this.roleList.forEach((item, i) => {
-            if(id.includes(item.ID_)){
+            if (id.includes(item.ID_)) {
               this.label += item.NAME_ + ','
               // SELECTOR_CACHE[key] = item.NAME_ + ','
             }
@@ -375,7 +375,7 @@ export default {
       this.formatterDataTemplateValue(value, dialog)
       // }
     },
-    exp(data,dataTitle) {
+    exp(data, dataTitle) {
       const d = dataTitle.split(/(\$[0-9a-zA-Z._]+#[0-9A-Fa-f]*)/g)
       const rtn = []
 
@@ -383,19 +383,19 @@ export default {
         let a = n
         if (/^\$(_widget_)/.test(n)) {
           // 对字段进行处理
-          const f = n.replace("$_widget_", "").split("#")
-          a = data[f[0]] || ""
+          const f = n.replace('$_widget_', '').split('#')
+          a = data[f[0]] || ''
         }
         rtn.push(a)
-      });
+      })
 
-      return rtn.join("")
+      return rtn.join('')
     },
     // 处理对话框id值
     formatterDataTemplateValue: function(value, key) {
       this.label = ''
       value.split(',').forEach(id => {
-        if(key){
+        if (key) {
           getDataById({ id: id, key: key }).then(response => {
             const responseData = response.data
             const data = responseData.data[0]
@@ -403,19 +403,19 @@ export default {
             const variables = response.data
             if (this.$utils.isNotEmpty(data)) {
               // TODO 多个字段组合处理
-              const a = this.exp(data,variables['title'].name)
+              const a = this.exp(data, variables['title'].name)
               const val = variables['title'] || ''
-              this.label += this.$utils.isNotEmpty(a) ? a  : ''
+              this.label += this.$utils.isNotEmpty(a) ? a : ''
             }
           }).catch((e) => {
             console.error(e)
           })
-        }else{
+        } else {
           const labelKeys = buildLabelTitle(this.tem)
           const a = this.handleLabel(this.data, labelKeys)
           this.label += this.$utils.isNotEmpty(a) ? a : ''
         }
-        
+
         // getDataById({ id: id, key: key })
         //   .then(response => {
         //     const responseData = response.data

+ 8 - 8
src/business/platform/data/data-template/template.vue

@@ -243,7 +243,7 @@ export default {
         const checked = this.checkbox[0]
 
         this.labelKeys = buildLabelTitle(this.tem)
-        const a = this.dataList.length>0&& this.childrenIndex!=-1 ?this.handleLabel(this.dataList[this.childrenIndex]):''
+        const a = this.dataList.length > 0 && this.childrenIndex != -1 ? this.handleLabel(this.dataList[this.childrenIndex]) : ''
 
         return this.$utils.isNotEmpty(checked)
           ? this.cacheData[checked]
@@ -289,11 +289,11 @@ export default {
       },
       deep: true
     },
-    valueKey:{
+    valueKey: {
       handler(val, oldVal) {
         this.initData()
       },
-      deep: true,
+      deep: true
       // immediate: true
     }
   },
@@ -317,7 +317,7 @@ export default {
         // if (this.cacheData[v]) {
         //   this.checkedValue.push(v)
         // } else {
-          this.getDataInfo(v)
+        this.getDataInfo(v)
         // }
       })
       this.checkbox = data || []
@@ -361,10 +361,10 @@ export default {
               key = data[this.valueKey]
             }
             this.cacheData[key] = data
-            if(data[this.valueKey]){
+            if (data[this.valueKey]) {
               this.checkedValue.push(data[this.valueKey])
             }
-            
+
             this.emitInitData(this.getSelectedData(this.checkedValue))
           }
         })
@@ -422,7 +422,7 @@ export default {
             dl.map(d => {
               this.cacheData[d[this.valueKey]] = d
               // const objName = Object.keys(d)
-              const fb = {...d}
+              const fb = { ...d }
               fb.showlabel = {}
               if (typeof this.tem.display_columns !== 'undefined') {
                 const keyName = this.dataList.findIndex(t => t.id_ == d.id_)
@@ -443,7 +443,7 @@ export default {
                   this.dataList.push(fb)
                 } else {
                 }
-              }else{
+              } else {
                 let b = {}
                 let key = ''
                 for (const k in d) {

+ 80 - 66
src/business/platform/data/utils/JTemplate.js

@@ -1,84 +1,98 @@
-
 /**
  * 数据模版--封装自定义代码扩展接口
- *
- * <pre>
- * 作者:hugh zhuang
- * 邮箱:3378340995@qq.com
- * 日期:2017-10-01-下午3:29:34
- * 版权:广州流辰信息技术有限公司
- * </pre>
  */
 import _ from 'lodash'
+import Vue from 'vue'
+import request from '@/utils/request'
+import dialog from '@/utils/dialog'
+import common from '@/utils/common'
+const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
+import store from '@/store'
+import router from '@/router'
+
 // 定义全局
 var JTemplate
 if (!window.JTemplate) {
-  JTemplate = window.JTemplate = {}
+    JTemplate = window.JTemplate = {}
 } else {
-  JTemplate = window.JTemplate
+    JTemplate = window.JTemplate
 }
 /**
-   * 封装自定义代码扩展接口
-   */
+ * 封装自定义代码扩展接口
+ */
 _.extend(JTemplate, {
-  // 已经初始化
-  _isInitialization: false,
-  _isLoadJavaScriptFile: false,
-  // 初始化表单
-  _init: function(template) {
-    if (this._isInitialization) return
-    this.template = template
-
-    this._isInitialization = true
-  },
-
-  // 模版加载
-  _onLoad: function(form) {
-    // if (Utils.isNotEmpty(this.javaScriptFiles)) {
-    //   this._loadJavaScriptFile()
-    // }
-    if (_.isFunction(this.onLoad)) {
-      this.onLoad(form)
-    }
-  },
+    // 已经初始化
+    _isInitialization: false,
+    _isLoadJavaScriptFile: false,
+    // 初始化表单
+    _init: function (template) {
+        if (this._isInitialization) return
+        this.$template = template
+        this.$vue = Vue
+        this.$request = request
+        this.$dialog = dialog
+        this.$common = common
+        this.$router = router
+        this.$store = store
+        this.$import = _import
+        this._ = _
+        this._isInitialization = true
+    },
 
-  // 加载按钮
-  _onLoadActions: function(form, actions) {
-    if (_.isFunction(this.onLoadActions)) {
-      this.onLoadActions(form, actions)
-    }
-  },
+    // 页面加载
+    _onLoad: function (template) {
+        this._init(template)
+        if (_.isFunction(this.onLoad)) {
+            this.onLoad(template)
+        }
+    },
 
-  // 表单校验
-  _customFormatter: function(form, data) {
-    if (_.isFunction(this.customFormatter)) {
-      return this.customFormatter(form, data)
-    }
-    return true
-  },
-
-  // 提交前事件
-  _beforeSubmit: function(form, action, postData) {
-    if (_.isFunction(this.beforeSubmit)) {
-      return this.beforeSubmit(action, postData, form)
-    }
-  },
+    // 加载按钮
+    _onLoadActions: function (template, action, button, type, row) {
+        if (_.isFunction(this.onLoadActions)) {
+            return this.onLoadActions(template, action, button, type, row)
+        }
+    },
+    // 按钮提交前事件
+    _beforeSubmit: function (template, action, position, selection, data, callback) {
+        if (_.isFunction(this.beforeSubmit)) {
+            return this.beforeSubmit(template, action, position, selection, data, callback)
+        }
+        if (_.isFunction(callback)) {
+            const flag = true
+            callback(flag)
+        }
+    },
 
-  // 提交后事件
-  _afterSubmit: function(form, action, postData) {
-    if (_.isFunction(this.afterSubmit)) {
-      return this.afterSubmit(action, postData, form)
+    // 按钮提交后事件
+    _afterSubmit: function (template, action, position, selection, data, callback) {
+        if (_.isFunction(this.afterSubmit)) {
+            return this.afterSubmit(template, action, position, selection, data, callback)
+        }
+        if (_.isFunction(callback)) {
+            const flag = true
+            callback(flag)
+        }
+    },
+    // 单元格自定义格式
+    _customFormatter: function (template, name, value, rowData, column) {
+        if (_.isFunction(this.customFormatter)) {
+            return this.customFormatter(template, name, value, rowData, column)
+        }
+    },
+    // 清理所有自定义事件
+    cleanEvents: function () {
+        this.onLoad = null
+        this.onLoadActions = null
+        this.onValidate = null
+        this.afterSubButton = null
+        this.beforeSubButton = null
+        this.summaryMethod = null
+        this.afterSubmit = null
+        this.beforeSubmit = null
+        this.customFormatter = null
+        this._isInitialization = false
     }
-  },
-  // 清理所有自定义事件
-  cleanEvents: function() {
-    this.onLoad = null
-    this.onLoadActions = null
-    this.onValidate = null
-    this.afterSubButton = null
-    this.beforeSubButton = null
-    this._isInitialization = false
-  }
 })
 
 export default JTemplate

+ 101 - 97
src/business/platform/data/utils/index.js

@@ -1,16 +1,18 @@
-import { getByKey, getById } from "@/api/platform/data/dataTemplate";
-import { getFormDataByFormKey } from "@/api/platform/form/formDef";
-import FormOptions from "@/business/platform/form/constants/formOptions";
-import Utils from "@/utils/util";
-import { Dialog } from "vant";
+import { getByKey, getBuildDataById } from '@/api/platform/data/dataTemplate'
+import { getFormDataByFormKey } from '@/api/platform/form/formDef'
+import FormOptions from '@/business/platform/form/constants/formOptions'
+import Utils from '@/utils/util'
+import { Dialog } from 'vant'
 
 var TemplateUtils = {
   getById(id, params, resolve, reject) {
-    getById({
-      dataTemplateId: id
+    getBuildDataById({
+      dataTemplateId: id,
+      ...params,
+      _t: Date.parse(new Date())
     })
       .then(response => {
-        const dataTemplate = Utils.parseData(response.data);
+        const dataTemplate = Utils.parseData(response.data)
         this.buildData(
           {
             dataTemplate: dataTemplate,
@@ -18,20 +20,20 @@ var TemplateUtils = {
           },
           resolve,
           reject
-        );
+        )
       })
       .catch(e => {
         // TODO 异常
-        console.error(e);
-        reject(e);
-      });
+        console.error(e)
+        reject(e)
+      })
   },
   getByKey(key, params, resolve, reject) {
     getByKey({
       dataTemplateKey: key
     })
       .then(response => {
-        const dataTemplate = Utils.parseData(response.data);
+        const dataTemplate = Utils.parseData(response.data)
         this.buildData(
           {
             dataTemplate: dataTemplate,
@@ -39,13 +41,13 @@ var TemplateUtils = {
           },
           resolve,
           reject
-        );
+        )
       })
       .catch(e => {
         // TODO 异常
-        console.error(e);
-        reject(e);
-      });
+        console.error(e)
+        reject(e)
+      })
   },
   /**
    * 数据源数据,转字段数据
@@ -53,51 +55,51 @@ var TemplateUtils = {
    */
   datasets2Fields(datasets) {
     if (Utils.isEmpty(datasets)) {
-      return [];
+      return []
     }
-    const fields = [];
-    let dataset = {};
+    const fields = []
+    let dataset = {}
     for (var _i = 0, _len = datasets.length; _i < _len; _i++) {
-      dataset = datasets[_i];
-      if (dataset.attrType === "column") {
-        fields.push(dataset);
+      dataset = datasets[_i]
+      if (dataset.attrType === 'column') {
+        fields.push(dataset)
       }
     }
-    return fields;
+    return fields
   },
   buildData({ dataTemplate, fields }, resolve, reject) {
     if (dataTemplate.templates) {
-      let template = {};
-      if (dataTemplate.showType === "compose") {
+      let template = {}
+      if (dataTemplate.showType === 'compose') {
         // 如果是组合
-        var tpl = {};
-        if (dataTemplate.composeType === "treeList") {
-          tpl = dataTemplate.templates[1];
-        } else if (dataTemplate.composeType === "listTree") {
-          tpl = dataTemplate.templates[0];
+        var tpl = {}
+        if (dataTemplate.composeType === 'treeList') {
+          tpl = dataTemplate.templates[1]
+        } else if (dataTemplate.composeType === 'listTree') {
+          tpl = dataTemplate.templates[0]
         }
         if (!tpl) {
-          Dialog.alert("未设置模版!");
-          return;
+          Dialog.alert('未设置模版!')
+          return
         }
 
-        if (tpl.dataTemplate["bind_template"] === "Y") {
-          this.getByKey(tpl.attrs["bind_template_key"]);
+        if (tpl.dataTemplate['bind_template'] === 'Y') {
+          this.getByKey(tpl.attrs['bind_template_key'])
         } else {
-          template = tpl;
+          template = tpl
         }
       } else {
         // 不是组合
-        template = dataTemplate.templates[0];
+        template = dataTemplate.templates[0]
         this.buildTemplateData(
           {
             dataTemplate: dataTemplate,
-            key: dataTemplate.type + "_" + dataTemplate.showType,
+            key: dataTemplate.type + '_' + dataTemplate.showType,
             template: template,
             fields: fields
           },
           resolve
-        );
+        )
 
         // conditions = template.filter_conditions
 
@@ -113,16 +115,16 @@ var TemplateUtils = {
     }
   },
   buildTemplateData({ dataTemplate, key, template, fields }, resolve) {
-    const conditions = template.filter_conditions;
+    const conditions = template.filter_conditions
 
-    const dynamicParams = this.buildDynamicParams(conditions);
-    const data = { ...dataTemplate };
-    data["templates"] = null;
+    const dynamicParams = this.buildDynamicParams(conditions)
+    const data = { ...dataTemplate }
+    data['templates'] = null
 
-    data.dynamicParams = dynamicParams;
-    data[key] = template;
-    data["fields"] = fields;
-    this.initFelds(data, resolve);
+    data.dynamicParams = dynamicParams
+    data[key] = template
+    data['fields'] = fields
+    this.initFelds(data, resolve)
   },
   initFelds(data, resolve) {
     if (data.attrs && Utils.isNotEmpty(data.attrs.form_key)) {
@@ -130,78 +132,78 @@ var TemplateUtils = {
         formKey: data.attrs.form_key
       })
         .then(response => {
-          const formData = Utils.parseData(response.data);
-          const fields = this.buildFelds(formData.fields, data.fields);
-          data.fields = fields;
-          resolve(data);
+          const formData = Utils.parseData(response.data)
+          const fields = this.buildFelds(formData.fields, data.fields)
+          data.fields = fields
+          resolve(data)
         })
-        .catch(() => {});
+        .catch(() => {})
     } else {
-      resolve(data);
+      resolve(data)
     }
   },
   buildFelds(fields, datasets) {
-    const fieldMap = {};
-    const columns = this.getColumns(fields);
+    const fieldMap = {}
+    const columns = this.getColumns(fields)
 
     columns.forEach(field => {
       if (Utils.isNotEmpty(field.field_name)) {
-        fieldMap[field.field_name.toLowerCase()] = field;
+        fieldMap[field.field_name.toLowerCase()] = field
       }
-    });
-    const rtn = [];
+    })
+    const rtn = []
     datasets.forEach(dataset => {
-      let field = fieldMap[dataset.name];
+      let field = fieldMap[dataset.name]
       if (Utils.isNotEmpty(dataset.name)) {
-        field = fieldMap[dataset.name.toLowerCase()];
+        field = fieldMap[dataset.name.toLowerCase()]
       }
       if (Utils.isNotEmpty(field)) {
         dataset.field_name = Utils.isNotEmpty(field.name)
           ? field.name.toLowerCase()
-          : field.name;
-        dataset.form_field_name = field.name;
-        dataset.field_type = field.field_type;
-        dataset.field_options = field.field_options;
+          : field.name
+        dataset.form_field_name = field.name
+        dataset.field_type = field.field_type
+        dataset.field_options = field.field_options
       }
-      rtn.push(dataset);
-    });
-    return rtn;
+      rtn.push(dataset)
+    })
+    return rtn
   },
   /**
    * 获取所有字段
    * @param {*} columns
    */
   getColumns(columns) {
-    const formColumns = [];
+    const formColumns = []
     const traverse = fields => {
       fields.forEach(field => {
         if (FormOptions.t.NESTED_FIELD_TYPES.includes(field.field_type)) {
-          const childColumns = field.field_options.columns;
+          const childColumns = field.field_options.columns
           childColumns.forEach(child => {
-            traverse(child.fields);
-          });
+            traverse(child.fields)
+          })
         } else {
-          formColumns.push(field);
+          formColumns.push(field)
         }
-      });
-    };
-    traverse(columns);
-    return formColumns;
+      })
+    }
+    traverse(columns)
+    return formColumns
   },
   buildDynamicParams(conditions) {
-    const dynamicParams = {};
+    const dynamicParams = {}
     if (Utils.isNotEmpty(conditions)) {
-      return dynamicParams;
+      return dynamicParams
     }
-    const filterConditions = Utils.isNotEmpty(conditions) ? conditions[0] : {};
-    const filter = filterConditions.filter;
+    const filterConditions = Utils.isNotEmpty(conditions) ? conditions[0] : {}
+    const filter = filterConditions.filter
     if (filter) {
-      this._createDynamicParams(dynamicParams, filter);
+      this._createDynamicParams(dynamicParams, filter)
     }
-    return dynamicParams;
+    return dynamicParams
   },
   _createDynamicParams(dynamicParams, filter) {}
-};
+}
 
 /**
  * 通过模版key 获取数据模版
@@ -209,37 +211,39 @@ var TemplateUtils = {
  */
 export function loadDataTemplateByKey(key, params) {
   return new Promise((resolve, reject) => {
-    TemplateUtils.getByKey(key, params, resolve, reject);
-  });
+    TemplateUtils.getByKey(key, params, resolve, reject)
+  })
 }
 
 export function loadDataTemplateById(id, params) {
   return new Promise((resolve, reject) => {
-    TemplateUtils.getById(id, params, resolve, reject);
-  });
+    TemplateUtils.getById(id, params, resolve, reject)
+  })
 }
 
 export function getDataTemplateListTemplate(dataTemplate) {
-  if (dataTemplate.showType === "compose") {
+  if (dataTemplate.showType === 'compose') {
     // 如果是组合
   } else {
     //
-    const type = dataTemplate.type;
-    const showType = dataTemplate.showType;
-    return dataTemplate[type + "_" + showType];
+    console.log('dataTemplate===>', JSON.parse(JSON.stringify(dataTemplate)))
+    const type = dataTemplate.type
+    const showType = dataTemplate.showType
+    console.log(type, showType)
+    return dataTemplate[type + '_' + showType]
   }
 }
 
 /**
  * 构建数据模版字段
  */
-export function buildDataTemplateFields(fields, key = "name") {
+export function buildDataTemplateFields(fields, key = 'name') {
   if (Utils.isEmpty(fields)) {
-    return {};
+    return {}
   }
-  const res = {};
+  const res = {}
   fields.forEach(field => {
-    res[field[key]] = field;
-  });
-  return res;
+    res[field[key]] = field
+  })
+  return res
 }

+ 41 - 52
src/business/platform/form/dynamic-form/form-table.vue

@@ -41,10 +41,9 @@
           :key="i"
           :name="collapseNameKey+i"
           :test="collapseNameKey+i"
-          :is-link="isLink"
         >
           <template #title>
-            <div class="van-cell table-cell">
+            <div class="col-title">
               <div class="van-cell__title">
                 <i v-if="required" class="van-cell--required" /><van-tag v-if="dataModel.length !== 1" round type="primary">{{ i+1 }}</van-tag> {{ field.label }}
               </div>
@@ -105,8 +104,8 @@
               </div>
             </div>
           </template>
-          <template #icon>
-            <div class="ibps-pl-15 table-cell-icon"><van-icon :name="activeCollapseNames.includes(collapseNameKey+i) ? 'arrow-down': 'arrow-up'" /></div>
+          <template #right-icon>
+            <div class="expand">{{ activeCollapseNames.includes(collapseNameKey+i) ? '收起': '展开' }}</div>
           </template>
           <!--子表字段-->
           <ibps-dynamic-form-table-block
@@ -143,29 +142,11 @@
                 :is-link="false"
               >
                 <template #title>
-                  <div class="van-cell table-cell">
+                  <div class="col-title">
                     <div class="van-cell__title">
                       <i v-if="required" class="van-cell--required" /> {{ field.label }}
                     </div>
                     <div class="van-cell__value">
-
-                      <!-- 工具栏-->
-                      <!-- <template
-                        v-for="(button,j) in toolbarButtons"
-                      >
-                        <van-button
-                          v-if="button.key !== 'remove'"
-                          :key="j"
-                          :type="button.type"
-                          size="mini"
-                          plain
-                          class="ibps-mr-5"
-                          @click.stop="handleActionEvent(button)"
-                        >
-                          {{ button.label }}
-                        </van-button>
-                      </template> -->
-
                       <template v-for="(button,j) in (getShowBtnByRemove().length<=num?getShowBtnByRemove():getShowBtnByRemove().slice(0,num-1)) ">
                         <van-tag
                           :key="j"
@@ -207,6 +188,9 @@
                     </div>
                   </div>
                 </template>
+                <!-- <template #right-icon>
+                  <div class="expand">{{ activeCollapseNames.includes(collapseNameKey+'0') ? '收起': '展开' }}</div>
+                </template> -->
               </van-collapse-item>
             </template>
 
@@ -310,19 +294,20 @@ export default {
     descPosition: String
   },
   data() {
-    const activeCollapseNames = []
-    let val = []
-    if (this.$utils.isNotEmpty(this.value)) {
-      val = this.value || []
-      this.value.forEach((e, i) => {
-        activeCollapseNames.push(COLLAPSE_NAME_KEY + i)
-      })
-    }
+    // const activeCollapseNames = []
+    // let val = []
+    // if (this.$utils.isNotEmpty(this.value)) {
+    //   console.log('this.value==>', JSON.parse(JSON.stringify(this.value)))
+    //   val = this.value || []
+    //   this.value.forEach((e, i) => {
+    //     activeCollapseNames.push(COLLAPSE_NAME_KEY + i)
+    //   })
+    // }
 
     return {
-      activeCollapseNames: activeCollapseNames,
+      activeCollapseNames: [],
       collapseNameKey: COLLAPSE_NAME_KEY,
-      dataModel: val,
+      dataModel: [],
       fieldRights: {}, // 子表配置权限
       tableRights: FormOptions.t.PERMISSIONS.EDIT, // 子表权限
       columnsRights: {}, // 子表字段权限
@@ -956,7 +941,7 @@ export default {
 </script>
 <style lang="scss">
   .ibps-table-wrapper{
-    padding: 10px 0;
+    // padding: 10px 0;
     // background-color: #f2efef;
     .btn-pop,.btn-pop-top{
       position: absolute;
@@ -992,25 +977,29 @@ export default {
       display: flex;
       align-items: center;
     }
-
-    .van-collapse-item__title {
-      padding:0 ;
-      background-color: #f8f8f8;
-      .table-cell{
-        background-color: #f8f8f8;
-        // padding-right: 0;
-      }
-      .van-cell__title{
-        font-size: 12px;
-        color: #999;
-      }
-        .van-cell__right-icon{
-          margin-top: 8px;
-        }
-    }
-    .van-collapse-item__content{
-      padding:0
+    .expand {
+      color: #1989fa;
+      cursor: pointer;
     }
 
+    // .van-collapse-item__title {
+    //   padding:0 ;
+    //   background-color: #f8f8f8;
+    //   .table-cell{
+    //     background-color: #f8f8f8;
+    //     // padding-right: 0;
+    //   }
+    //   .van-cell__title{
+    //     font-size: 12px;
+    //     color: #999;
+    //   }
+    //     .van-cell__right-icon{
+    //       margin-top: 8px;
+    //     }
+    // }
+    // .van-collapse-item__content{
+    //   padding:0
+    // }
+
   }
 </style>

+ 50 - 0
src/business/platform/form/utils/dateFormatUtil.js

@@ -0,0 +1,50 @@
+const DateFormatUtil = {
+  $dp: {
+    has: {},
+    dateFmt: 'yyyy-MM-dd',
+    // 日期控件类型 timePicker 时间选择器 datePicker
+    datePckerType: 'datePicker',
+    // 日期时间类型
+    dateType: 'datetime'
+  },
+  dealFmt(dateFmt) {
+    this.$dp.dateFmt = dateFmt
+    this._setHas(/w/)
+    this._setHas(/WW|W/)
+    this._setHas(/DD|D/)
+    this._setHas(/yyyy|yyy|yy|y/)
+    this._setHas(/MMMM|MMM|MM|M/)
+    this._setHas(/dd|d/)
+    this._setHas(/HH|H/)
+    this._setHas(/mm|m/)
+    this._setHas(/ss|s/)
+    // 年月日
+    this.$dp.has.sd = !!((this.$dp.has.y || this.$dp.has.M || this.$dp.has.d))
+    // 时分秒
+    this.$dp.has.st = !!((this.$dp.has.H || this.$dp.has.m || this.$dp.has.s))
+    if (this.$dp.has.sd) { // 有年月日
+      this.$dp.datePckerType = 'datePicker'
+      if (this.$dp.has.st) { // 有日期有时间
+        this.$dp.dateType = 'datetime'
+      } else { // 只有日期没有时间
+        if (this.$dp.has.y && !this.$dp.has.M && !this.$dp.has.d) { // 只有年
+          this.$dp.dateType = 'year'
+        } else if (this.$dp.has.M && !this.$dp.has.d) { // 有月没日
+          this.$dp.dateType = 'month'
+        } else {
+          this.$dp.dateType = 'date'
+        }
+      }
+    } else { // 只有时间
+      this.$dp.datePckerType = 'timePicker'
+      this.$dp.dateType = 'time'
+    }
+    return this.$dp
+  },
+  _setHas(re) {
+    var p = (re + '').slice(1, 2)
+    this.$dp.has[p] = re.exec(this.$dp.dateFmt) ? (this.$dp.has.minUnit = p, true) : false
+  }
+}
+
+export default DateFormatUtil

+ 30 - 49
src/business/platform/org/selector/index.vue

@@ -1,6 +1,28 @@
 <template>
     <div class="van-cell ibps-p-0">
-        <van-field
+        <div class="van-field__control" v-if="islistShow">
+            <van-tag
+                v-for="(item,index) in selectedData.slice(0,num) "
+                :key="item[valueKey]"
+                class="ibps-tag-span ibps-mr-8"
+                :color="color"
+                :text-color="textColor"
+                :plain="plain"
+            >
+                <template #default>
+                    <div :class="multiple?'ibps-ellipsis':''">{{ item[labelKey] }}</div>
+                    <div v-if="editable" class="ibps-tag-close"><van-icon name="clear" @click.stop="removeData(index)" /></div>
+                </template>
+            </van-tag>
+            <van-tag
+                v-if="selectedData.length>num"
+                :color="color"
+                :text-color="textColor"
+                :plain="plain"
+            >+{{ selectedData.length-num }}</van-tag>
+        </div>
+        <template v-else>
+            <van-field
             ref="input"
             v-model="inputValue"
             :label="label"
@@ -14,7 +36,6 @@
             :is-link="isLink"
             :error="error"
             :error-message="errorMessage"
-
             :arrow-direction="arrowDirection"
             :label-class="labelClass"
             :label-width="labelWidth"
@@ -37,35 +58,7 @@
                 <!-- {{selectedData}} -->
                 <!-- <div style="display:none">{{ $utils.isEmpty(selectedData) }}</div> -->
                 <template v-if="selectedData==[]">
-                    <template v-if="editable">
-                        <!-- <van-icon
-              slot="left-icon"
-              name="add-o"
-              class="van-cell__left-icon"
-            /> -->
-                        <!-- <div class="van-field__body">
-              <input :placeholder="defaultPlaceholder" class="van-field__control" readonly>
-            </div> -->
-                        <van-tag
-                            v-for="(item,index) in selectedData.slice(0,num) "
-                            :key="item[valueKey]"
-                            class="ibps-tag-span ibps-mr-8"
-                            :color="color"
-                            :text-color="textColor"
-                            :plain="plain"
-                        >
-                            <template #default>
-                                <div :class="multiple?'ibps-ellipsis':''">{{ item[labelKey] }}</div>
-                                <div v-if="editable" class="ibps-tag-close"><van-icon name="clear" @click.stop="removeData(index)" /></div>
-                            </template>
-                        </van-tag>
-                        <van-tag
-                            v-if="selectedData.length>num"
-                            :color="color"
-                            :text-color="textColor"
-                            :plain="plain"
-                        >+{{ selectedData.length-num }}</van-tag>
-                    </template>
+                   
                 </template>
                 <template v-else>
                     <div class="van-field__control">
@@ -97,28 +90,24 @@
                 <van-icon name="arrow" class="ibps-gray-b2" @click="onClick" />
             </template>
         </van-field>
-
-        <!-- <template v-if="editable">  // 下一版本初始化数据自己处理-->
+        </template>
+         <!-- <template v-if="editable">  // 下一版本初始化数据自己处理-->
         <!--用户选择器 -->
         <employee-selector
             v-if="type ==='employee' || type ==='user'"
             :show-popup="showPopup"
             :value="selectedValue"
             :multiple="multiple"
-
             :custom-party-type-options="customPartyTypeOptions"
             :current-org-id="currentOrgId"
             :party-type-id="partyTypeId"
             :script="script"
             :party-type-scope="partyTypeScope"
             :is-use-scope="true"
-
             :left-text="leftText"
             :value-key="valueKey"
             :label-key="labelKey"
-
             :filter="fieldOptions && fieldOptions.filter"
-
             @init-data="initData"
             @cancel="onCancel"
             @confirm="onConfirm"
@@ -132,20 +121,16 @@
             :show-popup="showPopup"
             :value="selectedValue"
             :multiple="multiple"
-
             :left-text="leftText"
             :value-key="valueKey"
             :label-key="labelKey"
-
             :current-org-id="currentOrgId"
             :party-type-id="partyTypeId"
             :script="script"
             :is-use-scope="true"
-
             :other-filter="fieldOptions &&fieldOptions.other_filter"
             :other-filter-include-sub="fieldOptions &&fieldOptions.other_filter_include_sub"
             :other-filter-condition="fieldOptions &&fieldOptions.other_filter_condition"
-
             @init-data="initData"
             @cancel="onCancel"
             @confirm="onConfirm"
@@ -158,20 +143,16 @@
             :show-popup="showPopup"
             :value="selectedValue"
             :multiple="multiple"
-
             :left-text="leftText"
             :value-key="valueKey"
             :label-key="labelKey"
-
             :current-org-id="currentOrgId"
             :party-type-id="partyTypeId"
             :script="script"
             :is-use-scope="true"
-
             :other-filter="fieldOptions &&fieldOptions.other_filter"
             :other-filter-include-sub="fieldOptions &&fieldOptions.other_filter_include_sub"
             :other-filter-condition="fieldOptions &&fieldOptions.other_filter_condition"
-
             @init-data="initData"
             @cancel="onCancel"
             @confirm="onConfirm"
@@ -184,20 +165,16 @@
             :show-popup="showPopup"
             :value="selectedValue"
             :multiple="multiple"
-
             :left-text="leftText"
             :value-key="valueKey"
             :label-key="labelKey"
-
             :current-org-id="currentOrgId"
             :party-type-id="partyTypeId"
             :script="script"
             :is-use-scope="true"
-
             :other-filter="fieldOptions &&fieldOptions.other_filter"
             :other-filter-include-sub="fieldOptions &&fieldOptions.other_filter_include_sub"
             :other-filter-condition="fieldOptions &&fieldOptions.other_filter_condition"
-
             @init-data="initData"
             @cancel="onCancel"
             @confirm="onConfirm"
@@ -227,6 +204,10 @@ export default {
     mixins: [FieldMixin],
     props: {
         multiple: Boolean,
+        islistShow: {
+            type: Boolean,
+            default: false
+        },
         type: { // 选择器类型 user:用户选择器,org:组织选择器,position:岗位选择器,role:角色选择器
             type: String,
             required: true

+ 2 - 5
src/components/ibps-more-search/index.vue

@@ -18,6 +18,7 @@
           :forms="searchForms.forms"
           :input-align="searchForms.inputAlign"
         >
+        <!-- 默认只有 文本 下拉 日期 其余走插槽-->
           <div
             v-for="(form,i) in slotForms()"
             :key="form.slotName+i"
@@ -93,11 +94,7 @@ export default {
   methods: {
     slotForms() {
       const forms = this.searchForms ? this.searchForms.forms || [] : []
-      return forms.filter((form) => {
-        if (form.slotName) {
-          return form
-        }
-      })
+      return forms.filter((form) => form.slotName)
     },
     cancel() {
       this.close()

+ 1 - 2
src/components/ibps-more-search/search-field.vue

@@ -71,12 +71,11 @@
 
         <!-- 日期 -->
         <ibps-date-picker
-          v-else-if="item.fieldType==='datePicker'"
+          v-else-if="item.fieldType==='datePicker' || item.fieldType==='date'"
           :key="i"
           v-model="params[item.modelValue]"
           placeholder="请选择"
           :input-align="inputAlign"
-
           :name="item.prop"
           :type="getFieldOptions(item,'datefmt_type','custom')"
           :format="getFieldOptions(item,'datefmt','yyyy-MM-dd')"

+ 29 - 29
src/main.js

@@ -1,53 +1,53 @@
 // 全局css样式
-import "normalize.css";
-import "vant/lib/index.less";
-import "vant/lib/icon/local.css";
-import "@/assets/fonts/ibps-icon.scss";
+import 'normalize.css'
+import 'vant/lib/index.less'
+import 'vant/lib/icon/local.css'
+import '@/assets/fonts/ibps-icon.scss'
 
-import Vue from "vue";
+import Vue from 'vue'
 // 移动端调试
 // import Vconsole from 'vconsole'
 // const vConsole = new Vconsole()
 // Vue.use(vConsole)
 
-import App from "./App";
-import router from "./router";
-import store from "./store";
-import "./errorLog"; // error log 错误日志
-import i18n from "./i18n"; // Internationalization 国际化
-import utils from "./utils/util"; // utils 帮助类
-import common from "./utils/common"; // 通用请求
-import methCommon from "./utils/meth.js"
-import env from "@/env";
-import ActionUtils from "@/utils/action";
+import App from './App'
+import router from './router'
+import store from './store'
+import './errorLog' // error log 错误日志
+import i18n from './i18n' // Internationalization 国际化
+import utils from './utils/util' // utils 帮助类
+import common from './utils/common' // 通用请求
+import methCommon from './utils/meth.js'
+import env from '@/env'
+import ActionUtils from '@/utils/action'
 // 核心插件
 import ibps from './plugins/ibps'
 
-import Vant from "vant";
+import Vant from 'vant'
 
 // 核心插件
 Vue.use(ibps)
-Vue.use(Vant); // 导入vant
-Vue.prototype.$action = ActionUtils; // 全局action
-Vue.prototype.$utils = utils; // 全局帮助类
-Vue.prototype.$common = common; // 通用请求
+Vue.use(Vant) // 导入vant
+Vue.prototype.$action = ActionUtils // 全局action
+Vue.prototype.$utils = utils // 全局帮助类
+Vue.prototype.$common = common // 通用请求
 Vue.prototype.$methCommon = methCommon
 // 基础路径
-Vue.prototype.$baseUrl = process.env.VUE_APP_PUBLIC_PATH || "/";
+Vue.prototype.$baseUrl = process.env.VUE_APP_PUBLIC_PATH || '/'
 // 当前环境
-Vue.prototype.$nodeEnv = process.env.NODE_ENV;
+Vue.prototype.$nodeEnv = process.env.NODE_ENV
 // 当前环境变量
-Vue.prototype.$env = env;
+Vue.prototype.$env = env
 
-import * as filters from "./filters"; // global filters 全局过滤
+import * as filters from './filters' // global filters 全局过滤
 // register global utility filters. 注册全局过滤器
 Object.keys(filters).forEach(key => {
-  Vue.filter(key, filters[key]);
-});
+  Vue.filter(key, filters[key])
+})
 /**
  *  日志输出开关
  */
-Vue.config.productionTip = false;
+Vue.config.productionTip = false
 /**
  *  创建实例
  */
@@ -57,7 +57,7 @@ new Vue({
   i18n,
   async created() {
     // 加载接口配置
-    await this.$store.dispatch("ibps/api/load");
+    await this.$store.dispatch('ibps/api/load')
   },
   render: h => h(App)
-}).$mount("#app");
+}).$mount('#app')

+ 10 - 10
src/utils/action.js

@@ -251,6 +251,7 @@ const action = {
     vm[paginationKey] = pagination
     // 处理结果类型
     vm[resultTypeKey] = this.handleResultType(vm, options)
+    console.log('vm[resultTypeKey]===>', vm[dataResultKey], vm[pageResultKey], vm[resultKey])
     vm[resultMessageKey] = null
   },
   /**
@@ -414,25 +415,24 @@ const action = {
  * @param {} page 分页
  * @param {} sorts 排序
  */
-  formatParams: function(params, pagination, sorts) {
+  formatParams: function(params, page, sorts) {
     const results = {}
     if (params) {
       results.parameters = Object.keys(params).map((k) => {
-        return {
+        return k === 'arg' ? params[k] : {
           'key': k,
-          'value': params[k] ? params[k] : ''
+          'value': params[k]
         }
       })
     }
-    if (pagination) {
-      const requestPage = {
-        'pageNo': pagination.page || common.PAGE,
-        'limit': pagination.limit || common.LIMIT
+    if (page) {
+      results.requestPage = {
+        'pageNo': page.page || common.PAGE,
+        'limit': page.limit || common.LIMIT
       }
-      if (Utils.isNotEmpty(pagination.totalCount)) { // mock 数据时候要传
-        requestPage['totalCount'] = pagination.totalCount
+      if (Utils.isNotEmpty(page.totalCount)) { // mock 数据时候要传
+        results.requestPage['totalCount'] = page.totalCount
       }
-      results.requestPage = requestPage
     }
     if (sorts) {
       results.sorts = Object.keys(sorts).map((k) => {

+ 13 - 13
src/utils/request.js

@@ -117,19 +117,19 @@ service.interceptors.request.use(async config => {
     showFullScreenLoading(config.loading)
   }
   // GET 方法做防缓存/参数加密
-  if (config.method.toUpperCase() === 'GET') {
-    if (ENCRYPT_GET_PARAMS) {
-      config.params = {
-        _p: Utils.isNotEmpty(config.params) ? encryptByAes(JSON.stringify(config.params), 'get') : undefined,
-        _t: Date.parse(new Date()) / 1000
-      }
-    } else {
-      config.params = {
-        ...config.params,
-        _t: Date.parse(new Date()) / 1000
-      }
-    }
-  }
+  // if (config.method.toUpperCase() === 'GET') {
+  //   if (ENCRYPT_GET_PARAMS) {
+  //     config.params = {
+  //       _p: Utils.isNotEmpty(config.params) ? encryptByAes(JSON.stringify(config.params), 'get') : undefined,
+  //       _t: Date.parse(new Date()) / 1000
+  //     }
+  //   } else {
+  //     config.params = {
+  //       ...config.params,
+  //       _t: Date.parse(new Date()) / 1000
+  //     }
+  //   }
+  // }
 
   // 判断是否需要token
   if (setting.whiteApiList.indexOf(config.url) !== -1) {

+ 0 - 0
src/views/platform/bpmn/test/index.vue


+ 2 - 2
src/views/platform/data/components/search-field/index.vue

@@ -130,7 +130,7 @@
     v-else-if="item.fieldType==='selector'|| item.fieldType==='currentUser'|| item.fieldType==='currentOrg'"
     v-model="parameter[item.modelValue]"
     label=" "
-    :placeholder="item.options.placeholder"
+    :placeholder="item.placeholder"
     :store="fieldOptions.store||'json'"
     :type="fieldOptions.selector_type||'user'"
     :multiple="!single"
@@ -465,7 +465,7 @@ export default {
       return this.parameter
     },
     resetForm() {
-      this.parameter = JSON.parse(JSON.stringify(this.defaultData))
+      this.parameter = {...JSON.parse(JSON.stringify(this.defaultData))}
       return this.parameter
     },
     formatDate(value) {

+ 720 - 0
src/views/platform/data/dataTemplate/field-formatter.vue

@@ -0,0 +1,720 @@
+<template>
+  <div>
+    <!-- 数据字典 -->
+    <ibps-dictionary
+      v-if="newFieldType === 'dictionary'"
+      :value="label"
+      :multiple="$utils.toBoolean(newFieldOptions.multiple, true)"
+      :readonly="true"
+    />
+    <!-- 选择器 -->
+  <ibps-selector
+    v-else-if="
+      newFieldType === 'selector' ||
+      newFieldType === 'currentUser' ||
+      newFieldType === 'currentOrg'
+    "
+    v-model="label"
+    :store="newFieldOptions.store || 'id'"
+    :type="newFieldOptions.selector_type || 'user'"
+    :multiple="$utils.toBoolean(newFieldOptions.multiple, true)"
+    :field-options="newFieldOptions"
+    :filter="newFieldOptions.filter"
+    :readonly="true"
+    :islistShow="true"
+  />
+  <div v-else-if="hasCustomFormatter(descField.name)" v-html="customFormatter(descField.name, label, data, descField)" />
+    <span v-else class="ibps-data-template-data" v-html="label || '/'" />
+  </div>
+</template>
+<script>
+import fecha from '@/utils/fecha'
+
+import { getAreaData } from '@/api/platform/cat/area'
+import { findByTypeKey as getDictionaryData } from '@/api/platform/cat/dictionary'
+import { get as getUserById } from '@/api/platform/org/employee'
+import { get as getOrgById } from '@/api/platform/org/org'
+import { get as getPositionById } from '@/api/platform/org/position'
+import { get as getRoleById } from '@/api/platform/org/role'
+import { get as getAttachmentById } from '@/api/platform/file/attachment'
+import {
+  transferByIds as getDataById,
+  queryLinkageData as getLinkDataByKey
+} from '@/api/platform/data/dataTemplate'
+// import {
+//   loadDataTemplateByKey,
+//   getDataTemplateListTemplate,
+//   buildDataTemplateFields
+// } from '@/business/platform/data/utils'
+var WorldDistricts = null
+var DICTIONARY_CACHE = {}
+var ATTACHMENT_CACHE = {}
+var SELECTOR_CACHE = {}
+
+// var DATA_KEY = {
+//   ID: '#id#',
+//   TITLE: '#title#'
+// }
+
+export default {
+  props: {
+    labelKey: {
+      // 展示的字段
+      type: String
+    },
+    data: {
+      type: Object,
+      default: () => {}
+    },
+    templateFields: {
+      // 跟vee冲突
+      type: Object,
+      default: () => {}
+    },
+    defaultValue: {
+      type: String,
+      default: '&nbsp;'
+    },
+    // 列属性字段 当same为N时取自身的fieldType
+    descField: Object,
+    // 展示字段类型
+    fieldType: String,
+    fieldOptions: Object,
+    tem: Object,
+    tag: String
+  },
+  data() {
+    const { roleList, deptList, userList } = this.$store.getters
+    return {
+      roleList,
+      deptList,
+      userList,
+      label: '',
+      newFieldType: '',
+      newFieldOptions: ''
+    }
+  },
+  watch: {
+    data() {
+      this.initData()
+    },
+    labelKey() {
+      this.initData()
+    }
+  },
+  mounted: function() {
+    this.initData()
+  },
+  methods: {
+    initData() {
+      if (!this.labelKey) return
+      const value = this.data[this.labelKey]
+      if (this.$utils.isEmpty(value)) {
+        this.label = this.defaultValue
+        return
+      }
+      var field = this.templateFields[this.labelKey]
+      // console.log('field==>', field, this.labelKey)
+      if (!field) {
+        this.label = value
+        return
+      }
+      // console.log('this.descField===>', this.descField, this.descField.field_type, this.fieldType)
+      const fieldType = this.descField.same === 'N' ? this.descField.field_type : this.fieldType
+      const fieldOptions = this.descField.same === 'N' ? this.descField.field_options : this.fieldOptions
+      this.newFieldType = fieldType
+      this.newFieldOptions = fieldOptions
+      // 不转化值数组
+      // newFieldType === 'selector' ||
+      // newFieldType === 'currentUser' ||
+      // newFieldType === 'currentOrg'
+      const noFormateValueTypes = ['selector', 'currentUser', 'currentOrg']
+      if (
+        this.$utils.isEmpty(value) ||
+        this.$utils.isEmpty(fieldType) ||
+        this.$utils.isEmpty(fieldOptions) ||
+        noFormateValueTypes.includes(fieldType)
+      ) {
+        console.log('===>', this.labelKey)
+        this.label = value
+        
+        return
+      }
+      // 数据格式
+      this.dataFormatter(value, fieldType, fieldOptions, this.labelKey)
+    },
+    /**
+     * 脚本渲染函数
+     * @param name 
+     * @param value 当前行值
+     * @param rowData 
+     * @param column 
+     */
+    customFormatter (name, value, rowData, column) {
+      return JTemplate._customFormatter(this, name, value, rowData, column)
+    },
+     // 自定义格式数据事件
+     hasCustomFormatter: function (name) {
+        const customFormatterResult = JTemplate._customFormatter(this, name)
+        if (typeof customFormatterResult !== 'undefined' && customFormatterResult) {
+            return true
+        }
+        return false
+    },
+    dataFormatter(value, fieldType, fieldOptions) {
+      if (String(this.tag) === 'Y') {
+        this.formatterCustomDialog(value, fieldOptions)
+        return
+      }
+      // console.log('fieldType==>', fieldType)
+      switch (fieldType) {
+        case 'hidden':
+        case 'text':
+        case 'textarea':
+        case 'editor':
+        case 'autoNumber':
+          this.label = value
+          break
+        case 'number': // 数字,格式化千分位等
+          this.label = this.formatterNumber(value, fieldOptions)
+          break
+        case 'datePicker': // 日期格式
+        case 'currentDate':
+        case 'currentTime':
+          this.formatterDate(value, fieldOptions)
+          break
+        case 'select': // 下拉,单选,多选
+        case 'radio':
+        case 'checkbox':
+          this.label = this.formatterOptions(
+            value,
+            fieldOptions['options'],
+            'val'
+          )
+          this.tag = true
+          break
+        case 'switch': // 开关
+          this.label = this.formatterOptions(
+            value,
+            this.getSwitchOptions(fieldOptions),
+            'val'
+          )
+          break
+        case 'dictionary': // 数据字典
+          this.formatterDictionary(value, fieldOptions)
+          break
+        case 'customDialog': // TODO 自定义对话框
+        this.formatterSelectorData(
+          value,
+          'position'
+        )
+          break
+        case 'linkdata': // TODO 关联数据
+          this.formatterLinkdata(value, fieldOptions)
+          break
+        case 'selector': // 选择器
+        case 'currentUser':
+        case 'currentOrg':
+        case 'currentPosition':
+          this.formatterSelector(value, fieldOptions)
+          break
+        case 'attachment': // 附件
+          this.formatterAttachment(value, fieldOptions)
+          break
+        case 'address': // 地址
+          this.formatterAddress(value, fieldOptions)
+          break
+        default:
+          this.label = value
+          break
+      }
+    },
+    /**
+     * 格式化数字
+     */
+    formatterNumber(value, fieldOptions) {
+      return value
+    },
+    /**
+     * 格式化日期
+     */
+    formatterDate(value, fieldOptions) {
+      // console.log(value, fieldOptions)
+      const format = fieldOptions['datefmt'] || 'yyyy-MM-dd HH:mm:ss'
+      this.label = fecha.format(fecha.parse(value, format), format)
+    },
+    getSwitchOptions(fieldOptions) {
+      const options = []
+      const activeValue = fieldOptions.active_value
+      const activeText = this.$utils.isNotEmpty(fieldOptions.active_text)
+        ? fieldOptions.active_text
+        : activeValue
+      const inactiveValue = fieldOptions.inactive_value
+      const inactiveText = this.$utils.isNotEmpty(fieldOptions.inactive_text)
+        ? fieldOptions.inactive_text
+        : inactiveValue
+
+      options.push({
+        val: activeValue,
+        label: activeText
+      })
+      options.push({
+        val: inactiveValue,
+        label: inactiveText
+      })
+      return options
+    },
+    /**
+     * 格式化数据字典
+     */
+    formatterDictionary(value, fieldOptions) {
+      const key = fieldOptions['dictionary']
+      if (DICTIONARY_CACHE[key]) {
+        this.label = this.formatterOptions(
+          value,
+          DICTIONARY_CACHE[key],
+          'key',
+          'name'
+        )
+      } else {
+        getDictionaryData({
+          typeKey: key
+        })
+          .then(response => {
+            const data = response.data
+            DICTIONARY_CACHE[key] = data
+            this.label = this.formatterOptions(value, data, 'key', 'name')
+          })
+          .catch(e => {
+            DICTIONARY_CACHE[key] = []
+            // 异常
+            console.error(e)
+          })
+      }
+    },
+    /**
+     * 格式化选择器
+     */
+    formatterSelector(value, fieldOptions) {
+      // console.log('222222222')
+      const store = fieldOptions['store'] || 'json'
+      if (store === 'json') {
+        this.label = this.formatterJson(value, 'name')
+      } else if (store === 'id') {
+        this.formatterSelectorData(
+          value,
+          fieldOptions['selector_type'] || 'user'
+        )
+      } else {
+        this.label = value
+      }
+    },
+    /**
+     * 格式化选择器的数据
+     */
+    formatterSelectorData(id, type) {
+      var key = type + ':' + id
+      var nameKey = 'name'
+      if (SELECTOR_CACHE[key]) {
+        this.label = SELECTOR_CACHE[key]
+      } else {
+        if (type === 'user' || type === 'employee') {
+          let lab = ''
+          this.userList.forEach((item, i) => {
+            if (id.includes(item.userId)) {
+              lab += item.userName + ','
+              // SELECTOR_CACHE[key] = item.NAME_ + ','
+            }
+          })
+          this.label = lab.replace(/,$/, '')
+          if (!this.label) {
+            getUserById({ employeeId: id })
+              .then(response => {
+                const data = response.data
+                data[nameKey] = data['name']
+                if (data) {
+                  SELECTOR_CACHE[key] = data[nameKey]
+                  this.label = data[nameKey]
+                }
+              })
+              .catch(e => {
+                console.error(e)
+              })
+          }
+        } else if (type === 'org') {
+          getOrgById({ orgId: id })
+            .then(response => {
+              const data = response.data
+              if (data) {
+                this.label = data[nameKey]
+                SELECTOR_CACHE[key] = data[nameKey]
+              }
+            })
+            .catch(e => {
+              console.error(e)
+            })
+        } else if (type === 'position') {
+          // console.log('this.deptList===>', this.deptList)
+          let lab = ''
+          this.deptList.forEach((item, i) => {
+            // console.log('item===>', id)
+            if (id.includes(item.positionId)) {
+              lab += item.positionName + ','
+              // SELECTOR_CACHE[key] = item.NAME_ + ','
+            }
+          })
+          this.label = lab.replace(/,$/, '')
+          console.log()
+          if (!this.label) {
+            getPositionById({ positionId: id })
+              .then(response => {
+                const data = response.data
+                if (data) {
+                  this.label = data[nameKey]
+                  SELECTOR_CACHE[key] = data[nameKey]
+                }
+              })
+              .catch(e => {
+                console.error(e)
+              })
+          }
+        } else if (type === 'role') {
+          let lab = ''
+          this.roleList.forEach((item, i) => {
+            if (id.includes(item.ID_)) {
+              lab += item.NAME_ + ','
+              // SELECTOR_CACHE[key] = item.NAME_ + ','
+            }
+          })
+          if (!lab) {
+            getRoleById({ roleId: id })
+              .then(response => {
+                const data = response.data
+                if (data) {
+                  this.label = data[nameKey]
+                  SELECTOR_CACHE[key] = data[nameKey]
+                }
+              })
+              .catch(e => {
+                console.error(e)
+              })
+          } else {
+            this.label = lab
+          }
+        }
+      }
+    },
+
+    /**
+     * 格式化附件
+     */
+    formatterAttachment(value, fieldOptions) {
+      const store = fieldOptions['store'] || 'json'
+      if (store === 'json') {
+        this.label = this.formatterJson(value, 'fileName')
+      } else if (store === 'id' || store === 'path') {
+        this.formatterAttachmentData(value, store)
+      }
+    },
+    /**
+     * 附件数据处理
+     */
+    formatterAttachmentData(id, type = 'id') {
+      if (ATTACHMENT_CACHE[id]) {
+        this.label = ATTACHMENT_CACHE[id]
+      } else {
+        getAttachmentById({ attachmentId: id, type: type })
+          .then(response => {
+            const data = response.data
+            if (this.$utils.isEmpty(data)) return
+            this.label = data['fileName']
+            ATTACHMENT_CACHE[id] = data['fileName']
+          })
+          .catch(e => {
+            console.error(e)
+          })
+      }
+    },
+    /**
+     * 格式化自定义对话框
+     */
+    formatterCustomDialog(value, fieldOptions) {
+      console.log('this.labelKey--->', this.labelKey)
+      const dialog = fieldOptions['dialog']
+      // const store = fieldOptions['store_mode'] || 'id'
+
+      // if (store === 'json') {
+      //   this.label = this.formatterJson(value, 'name')
+      // } else if (store === 'id') {
+      //   // id需要查询数据库。返回名称
+      this.formatterDataTemplateValue(value, dialog)
+      // }
+    },
+    exp(data, dataTitle) {
+      const d = dataTitle.split(/(\$[0-9a-zA-Z._]+#[0-9A-Fa-f]*)/g)
+      const rtn = []
+
+      d.forEach(n => {
+        let a = n
+        if (/^\$(_widget_)/.test(n)) {
+          // 对字段进行处理
+          const f = n.replace('$_widget_', '').split('#')
+          a = data[f[0]] || ''
+        }
+        rtn.push(a)
+      })
+
+      return rtn.join('')
+    },
+    // 处理对话框id值
+    formatterDataTemplateValue: function (value, key) {
+      // console.log('格式化自定义对话框===>', value)
+      this.label = ''
+      value.split('-').forEach(id => {
+        if (key) {
+          getDataById({ id: id, key: key }).then(response => {
+            const responseData = response.data
+            const data = responseData.data[0]
+            // const data = response.data
+            const variables = response.data
+            if (this.$utils.isNotEmpty(data)) {
+              // TODO 多个字段组合处理
+              const a = this.exp(data, variables['title'].name)
+              // const val = variables['title'] || ''
+              this.label += this.$utils.isNotEmpty(a) ? a : ''
+            }
+          }).catch((e) => {
+            console.error(e)
+          })
+        } else {
+          const labelKeys = buildLabelTitle(this.tem)
+          const a = this.handleLabel(this.data, labelKeys)
+          this.label += this.$utils.isNotEmpty(a) ? a : ''
+        }
+      })
+
+      //   // getDataById({ id: id, key: key })
+      //   //   .then(response => {
+      //   //     const responseData = response.data
+      //   //     const data = responseData.data[0]
+      //   //     // const data = response.data
+      //   //     const variables = response.variables
+      //   //     if (this.$utils.isNotEmpty(data)) {
+      //   //       // TODO 多个字段组合处理
+      //   //       const val = data[variables['title']] || ''
+      //   //       this.label += this.$utils.isNotEmpty(val) ? val + ',' : ''
+      //   //     }
+      //   //   })
+      //   //   .catch(e => {
+      //   //     console.error(e)
+      //   //   })
+      // })
+    },
+    handleLabel(data, labelKeys) {
+      const config = labelKeys
+      if (typeof config === 'function') {
+        return config(data)
+      } else if (typeof config === 'string') {
+        return data[config]
+      } else if (typeof config === 'undefined') {
+        const dataProp = data['name']
+        return dataProp === undefined ? '' : dataProp
+      }
+    },
+    formatterLinkdata(value, fieldOptions) {
+      const linkConfig = fieldOptions['link_config'] || {}
+      const __key = fieldOptions['linkdata']
+      const __linkKey = linkConfig.id || 'id_'
+      const __linkText = linkConfig.text || 'name_'
+      this.label = this.getLinkdataValue(__key, __linkKey, __linkText, value)
+    },
+    getLinkdataValue(key, __linkKey, __linkText, value) {
+      if (this.$utils.isEmpty(key)) {
+        return value
+      }
+      // TODO: 有问题
+      getLinkDataByKey({
+        key: key
+      })
+        .then(response => {
+          const data = response.data
+          if (this.$utils.isNotEmpty(data)) {
+            const arrayValue = value.split(',')
+            const rtn = []
+            for (var d = 0; d < data.length; d++) {
+              const item = data[d]
+              const v = arrayValue.find(val => {
+                return val === item[__linkKey]
+              })
+              if (v) {
+                rtn.push(item[__linkText] || '')
+              }
+            }
+            this.label += rtn.join(',')
+          }
+        })
+        .catch(e => {
+          console.error(e)
+        })
+    },
+    /**
+     * 格式化地址
+     */
+    formatterAddress(value, fieldOptions) {
+      const store = fieldOptions['store'] || 'stringKey'
+      if (store === 'stringKey') {
+        let jsonValue = {}
+        try {
+          jsonValue = JSON.parse(value)
+        } catch (e) {
+          this.label = value
+          return
+        }
+        if (this.$utils.isEmpty(jsonValue)) {
+          this.label = value
+          return
+        }
+        this.label =
+          this.getAddressData(fieldOptions, jsonValue, 'country') +
+          this.getAddressData(fieldOptions, jsonValue, 'province') +
+          this.getAddressData(fieldOptions, jsonValue, 'city') +
+          this.getAddressData(fieldOptions, jsonValue, 'district') +
+          (jsonValue.street ? jsonValue.street : '')
+      }
+    },
+    // ====================地址展示处理================
+    getTextValue: function(data, value) {
+      if (this.$utils.isEmpty(value) || this.$utils.isEmpty(data)) {
+        return value || ''
+      }
+      if (data[value]) {
+        return data[value]
+      }
+      return value || ''
+    },
+    getTop: function(fieldOptions) {
+      return fieldOptions['top'] ? fieldOptions['top'] : 'country'
+    },
+    getLevel: function(fieldOptions) {
+      return fieldOptions['level'] ? fieldOptions['level'] : 'district'
+    },
+    getTopval: function(fieldOptions) {
+      var top = this.getTop(fieldOptions)
+      var rtnVal = '0'
+      var topval = fieldOptions['topval']
+      if (this.$utils.isEmpty(topval)) {
+        return rtnVal
+      }
+      if (top === 'province') {
+        rtnVal = topval['country']
+      } else if (top === 'city') {
+        rtnVal = topval['province']
+      } else if (top === 'district') {
+        rtnVal = topval['city']
+      }
+      return rtnVal
+    },
+    getAddressData(fieldOptions, v, type) {
+      // TODO: 获取地址信息
+      getAreaData().then(response => {
+        WorldDistricts = response.data
+      })
+      if (this.$utils.isEmpty(v)) {
+        return ''
+      }
+      var top = this.getTop(fieldOptions)
+      var topval = this.getTopval(fieldOptions)
+      var topval1
+      if (type === 'country' && v.country) {
+        topval = top === 'country' ? topval : 0
+        if (this.$utils.isEmpty(topval)) {
+          return ''
+        }
+        return this.getTextValue(WorldDistricts[topval], v.country)
+      } else if (type === 'province' && v.province) {
+        topval1 = this.$utils.isNotEmpty(v.country) ? v.country : null
+        if (this.$utils.isEmpty(topval1) && top === 'province') {
+          topval1 = topval
+        }
+        if (this.$utils.isEmpty(topval1)) {
+          return ''
+        }
+        return this.getTextValue(WorldDistricts[topval1], v.province)
+      } else if (type === 'city' && v.city) {
+        topval1 = this.$utils.isNotEmpty(v.province) ? v.province : null
+        if (this.$utils.isEmpty(topval1) && top === 'city') {
+          topval1 = topval
+        }
+        if (this.$utils.isEmpty(topval1)) {
+          return ''
+        }
+        return WorldDistricts[topval1]
+          ? WorldDistricts[topval1][v.city] || ''
+          : ''
+      } else if (type === 'district' && v.district) {
+        topval1 = this.$utils.isNotEmpty(v.city) ? v.city : null
+        if (this.$utils.isEmpty(topval1) && top === 'district') {
+          topval1 = topval
+        }
+        if (this.$utils.isEmpty(topval1)) {
+          return ''
+        }
+        return WorldDistricts[topval1]
+          ? WorldDistricts[topval1][v.district] || ''
+          : ''
+      } else {
+        return ''
+      }
+    },
+    // ====================地址展示处理END================
+    /**
+     * 格式化选项
+     */
+    formatterOptions(value, options, valueKey = 'value', labelKey = 'label') {
+      const optionObj = {}
+      options.map(option => {
+        optionObj[option[valueKey]] = option[labelKey]
+      })
+      const aryValue = value.split(',')
+      const res = aryValue.map(v => {
+        return optionObj[v] || v
+      })
+      return res.join(',')
+    },
+    /**
+     * 格式json 数据
+     */
+    formatterJson(value, key) {
+      let aryValue = []
+      try {
+        aryValue = JSON.parse(value)
+      } catch (e) {
+        return value
+      }
+      if (this.$utils.isEmpty(aryValue)) {
+        return ''
+      }
+      if (typeof aryValue !== 'object') {
+        return aryValue
+      }
+      const res = aryValue.map(val => {
+        return val[key] || ''
+      })
+      return res.join(',')
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.ibps-data-template-data {
+  word-break: break-all;
+  word-wrap: break-word;
+}
+::v-deep .van-cell__title {
+    width: 65%;
+
+    .van-cell__label {
+      overflow-wrap: break-word;
+    }
+  }
+</style>

+ 526 - 166
src/views/platform/data/template-list.vue

@@ -25,7 +25,7 @@
           v-if="$utils.isNotEmpty(queryColumns) && queryColumns.length > 1"
           #left
         >
-          <div style="width:100px;">
+          <div style="width: 100px">
             <ibps-select
               v-model="queryKey"
               :options="queryColumns"
@@ -121,7 +121,7 @@
             <van-checkbox-group v-model="checkedIds">
               <van-cell
                 border
-                style="padding:15px 16px"
+                style="padding: 15px 16px"
                 @click="onClick(item, index)"
               >
                 <template slot="icon">
@@ -134,14 +134,21 @@
                 </template>
                 <!--标题-->
                 <template #title>
+                  <!-- {{ labelField['name'] }} 地点 -->
+                  <!-- {{ item }}  -->
+                  <!-- 默认第一行数据作为标题 -->
                   <field-formatter
+                    v-if="labelField"
                     class="titles"
                     :label-key="labelField['name']"
                     :data="item"
+                    :descField="labelField"
+                    :field-options="comFieldOptions(labelField['name'])"
+                    :field-type="comFieldType(labelField['name'])"
                     :template-fields="templateFields"
                   />
                 </template>
-                <!--描述展示-->
+                <!--描述展示 剩余数据作为描述-->
                 <template #label>
                   <template v-if="$utils.isNotEmpty(descFields)">
                     <!-- v-if="descField&&descField['name']&&item[descField['name']]" -->
@@ -150,17 +157,22 @@
                       :key="descField['name']"
                       class="van-card-list__desc"
                     >
-                      <span
-class="van-card-list__desc__title desc"
-                        >{{ descField['label'] }}:</span
-                      >
-                      <field-formatter
-                        :label-key="descField['name']"
-                        :data="item"
-                        :template-fields="templateFields"
-                        class="desc"
-                        default-value
-                      />
+                    <van-row class="delayShow">
+                      <van-col span="6">{{ descField['label'] }}:</van-col>
+                      <van-col span="17">
+                        <field-formatter
+                          :label-key="descField['name']"
+                          :data="item"
+                          :field-options="comFieldOptions(descField['name'])"
+                          :field-type="comFieldType(descField['name'])"
+                          :template-fields="templateFields"
+                          :descField="descField"
+                          class="desc"
+                          default-value
+                        />
+                      </van-col>
+                    </van-row>
+
                     </div>
                   </template>
                 </template>
@@ -198,7 +210,7 @@ class="van-card-list__desc__title desc"
         type="info"
         icon="plus"
         size="large"
-        style="border-radius: 100%; width: 50px;"
+        style="border-radius: 100%; width: 50px"
         @click="handleAction(addButton)"
       />
     </div>
@@ -216,19 +228,18 @@ class="van-card-list__desc__title desc"
       :search-forms="searchForms"
       @callback="onSearch"
       @close="callback => (popupShow = callback)"
-      @resetForm="resetForm"
+      @reset-form="resetForm"
     >
       <template
         v-for="(slotForm, index) in slotForms"
         :slot="slotForm.slotName"
-        slot-scope="scopeType"
       >
         <search-field
-          ref="moreSearchField"
           :key="slotForm.prop + index"
+          ref="moreSearchField"
           input-align="left"
           :forms="searchForms.forms"
-          :item="scopeType.item"
+          :item="slotForm"
         />
       </template>
     </ibps-more-search>
@@ -288,8 +299,11 @@ import storage from '@/utils/storage'
 import IbpsMoreSearch from '@/components/ibps-more-search'
 import IbpsListResultPage from '@/components/ibps-list-result-page'
 import IbpsToolbar from '@/components/ibps-toolbar'
-import FieldFormatter from '@/business/platform/data/data-template/field-formatter'
+import FieldFormatter from './dataTemplate/field-formatter'
 import JTemplate from '@/business/platform/data/utils/JTemplate' // 自定义脚本
+import FormOptions from '@/business/platform/form/constants/formOptions'
+import DateFormatUtil from '@/business/platform/form/utils/dateFormatUtil'
+import FormUtils from '@/business/platform/form/utils/formUtil'
 // import DropMenu from './components/dropMenu'
 
 import SearchField from './components/search-field'
@@ -331,7 +345,6 @@ export default {
       async: false,
       rootIndex: 0,
       filterCondition: '',
-
       fieldsList: [],
       display: false,
       chooseResult: [],
@@ -344,56 +357,76 @@ export default {
       listData: [],
       pagination: {},
       sorts: {},
-
       loading: false,
       finished: false,
       refreshing: false,
       resultType: 'init',
       errorType: null,
       resultMessage: null,
-
       idKey: '',
-      labelField: '',
+      labelField: null,
       descFields: [],
-
       dataTemplate: '',
-
       queryColumns: [],
       queryKey: '',
       queryName: '',
-
       isTree: false,
       templateId: '',
       templateKey: '',
       formKey: '',
-
+      template: '',
       templateFields: {}, // 模版字段
-
       editButtons: '', // 编辑按钮
       functionButtons: [], // 功能按钮
-
       checkMode: false,
       checkedIds: [],
-
       toolbars: [],
       manages: [],
-
       defaultToolbars: [],
       defaultManages: [],
-
       isInitialization: false,
-
+      columnsAttrs:[],
       // 表单
       formrenderVisible: false,
-      formrenderParams: {}
+      formrenderParams: {},
+      defaultFilterListCol: ['di_dian_']
     }
   },
   computed: {
+    fields () {
+      if (this.$utils.isEmpty(this.dataTemplate)) {
+        return {}
+      }
+      const fields = {}
+      if (this.dataTemplate.datasets && this.dataTemplate.datasets.length > 0) {
+        this.dataTemplate.datasets.forEach(dataset => {
+          if (dataset.parentId !== '0') {
+            fields[dataset.name] = dataset
+          }
+        })
+      }
+      return fields
+    },
+    ownsDeptInfo() {
+      return this.$store.getters.mainPosition ? this.$store.getters.mainPosition : this.$store.getters.position ? this.$store.getters.position[0] : {id: ''}
+    },
     toolbarButtons() {
       return this.toolbars.length > 4
         ? this.toolbars.slice(0, 4)
         : this.toolbars
     },
+    comFieldOptions() {
+      return function(fieldLabel) {
+        const fieldOptions = this.templateFields[fieldLabel] && this.templateFields[fieldLabel].field_options
+        return this.$utils.isNotEmpty(fieldOptions) ? fieldOptions : {}
+      }
+    },
+    comFieldType() {
+      return function(fieldLabel) {
+        const fieldType = this.templateFields[fieldLabel] && this.templateFields[fieldLabel].field_type
+        return this.$utils.isNotEmpty(fieldType) ? fieldType : ''
+      }
+    },
     moreToolbarButtons() {
       return this.toolbars.length > 4
         ? this.toolbars.slice(4, this.toolbars.length)
@@ -405,6 +438,7 @@ export default {
     addButton() {
       for (let i = 0; i < this.defaultToolbars.length; i++) {
         const button = this.defaultToolbars[i]
+        // console.log('button===>', button)
         if (button.button_type === 'add') {
           return button
         }
@@ -425,7 +459,7 @@ export default {
       return !!(
         tmpDef &&
         tmpDef.attrs &&
-        (tmpDef.attrs.mobile_script || tmpDef.attrs.script)
+        (tmpDef.attrs.mobile_script)
       )
     }
   },
@@ -476,9 +510,21 @@ export default {
           : ''
       }
     },
-
+    initUI () {
+      this.initialization = false
+      if (!this.initialization) {
+        this.initJTemplate()
+        this.initialization = true
+        setTimeout(() => {
+          this.loadScript()
+        }, 10)
+      }
+    },
     loadDataTemplate(id) {
-      const params = {}
+      const params = {
+        isFilterForm: false,
+        isRightsFilter: true
+      }
       loadDataTemplateById(id, params)
         .then(data => {
           this.initFormData(data)
@@ -490,6 +536,7 @@ export default {
     initFormData(data) {
       this.title = data['name']
       this.dataTemplate = data
+      // console.log('this.$store---->', this.$store.getters.mainPosition)
       // 初始化脚本
       if (!this.isInitialization) {
         this.initJTemplate()
@@ -500,21 +547,27 @@ export default {
       }
       i18n.setTitle(this.title)
       const template = getDataTemplateListTemplate(data)
+      this.template = template
       this.templateFields = buildDataTemplateFields(data.fields)
+      // console.log('this.templateFields===>', this.dataTemplate)
       this.buildKey(data, template)
       this.loadData()
       this.initFilterText()
     },
-    buildKey(dataTemplate, template) {
+    async buildKey(dataTemplate, template) {
       this.idKey = dataTemplate['unique']
       this.templateKey = dataTemplate['key']
       this.formKey = dataTemplate['attrs']['form_key']
-
+      template['query_columns'] = template['query_columns'].filter(t => t.isAppShow !== 'N')
       this.buildQuerycolumns(template['query_columns'])
-
-      const fieldsList = template['display_columns']
+      
+      let fieldsList = template['display_columns']
         ? template['display_columns']
         : []
+        console.log('fieldsList--->', fieldsList)
+        // 设置表格列的过滤
+        fieldsList=fieldsList.filter(t => !this.defaultFilterListCol.includes(t.name) && t.field_type !== "hidden" && t.isAppShow !== "N")
+      
       if (this.$utils.isNotEmpty(fieldsList)) {
         this.fieldsList = fieldsList.map(i => {
           return { name: i.label }
@@ -522,6 +575,7 @@ export default {
       } else {
         this.$toast('显示字段不能为空!请在PC端中配置。')
       }
+      // 默认显示字段列表
       this.initOptions(fieldsList)
       const colums = []
       const chooseResult = storage.get('chooseFields')
@@ -535,17 +589,20 @@ export default {
           }
         }
       }
+      // 显示的列字段
       const displayColumns = colums
       const filterActions = this.$utils.isNotEmpty(
         template['filter_conditions']
       )
         ? template['filter_conditions']
         : []
+      
       if (this.$utils.isNotEmpty(filterActions)) {
         this.rangeData[this.rootIndex].options = filterActions.map(i => {
           return { text: i.label, value: i.key }
         })
       }
+      console.log('filterActions---->', this.rangeData[this.rootIndex].options)
       this.initFilter(filterActions, this.rootIndex)
 
       if (dataTemplate.showType === 'tree') {
@@ -559,38 +616,60 @@ export default {
         this.isTree = false
         if (this.$utils.isNotEmpty(displayColumns)) {
           // 显示字段顺序预处理
-          const arr = []
-          for (var i = 0; i < displayColumns.length; i++) {
-            for (var l = 0; l < fieldsList.length; l++) {
-              if (displayColumns[i].label === fieldsList[l].label) {
-                arr[l] = fieldsList[l]
-              }
+          // const arr = []
+          // for (var i = 0; i < displayColumns.length; i++) {
+          //   for (var l = 0; l < fieldsList.length; l++) {
+          //     if (displayColumns[i].label === fieldsList[l].label) {
+          //       arr[l] = fieldsList[l]
+          //     }
+          //   }
+          // }
+          const columns = [];
+          const labelMap = new Map();
+          // 创建映射:label -> 字段对象(保留原始索引)
+          fieldsList.forEach((t, i) => {
+            labelMap.set(t.label, { data: t, index: i });
+          })
+          // 单次遍历匹配
+          for (const item of displayColumns) {
+            const match = labelMap.get(item.label);
+            if (match && match.data) {
+              columns[match.index] = match.data;
             }
           }
-          const columns = arr.filter(e => {
-            if (e !== '' && e !== undefined) {
-              return e
-            }
-          })
-
-          this.labelField = columns[0] || {}
-          this.descFields = columns.filter((e, i) => {
-            return i > 0
+          const titleCol = columns.find(t => t.isTitle === 'Y')
+          // 列表标题无设置则默认第一列
+          this.labelField = titleCol || columns[0]
+          this.columnsAttrs = columns
+          const notTitleCols = columns.filter((e, i) => {
+            return this.labelField.label !== e.label && !this.defaultFilterListCol.includes(e.name)
           })
+          console.log('notTitleCols===>', notTitleCols)
+          this.descFields = notTitleCols
         }
         this.editButtons = template['buttons']['edit_buttons']
         this.functionButtons = template['buttons']['function_buttons']
+        // 按钮设置
         this.initToolbarAction()
       }
     },
-    onSearch() {
+    getDatefmt(fieldOptions) {
+      if (fieldOptions['datefmt_type'] && fieldOptions['datefmt_type'] !== 'custom') {
+        return FormOptions.t.DATE_FORMATS[fieldOptions['datefmt_type']] || FormOptions.t.DATE_FORMATS['date']
+      }
+      return fieldOptions['datefmt'] || FormOptions.t.DATE_FORMATS['date']
+    },
+    onSearch(params = {}) {
+      // console.log('params===>', params)
       this.stateActive = false
       ActionUtils.initListData(this)
       this.checkedIds = []
       const moreSearchField = this.$refs.moreSearchField
+      // console.log('moreSearchField===>', moreSearchField.length)
       if (moreSearchField) {
         for (var i = 0; i < moreSearchField.length; i++) {
           const obj = moreSearchField[i].getParams()
+          // console.log('obj--->', obj, moreSearchField[i])
           for (var j in obj) {
             if (moreSearchField[i].item.prop === j) {
               this.paramsForm[j] = obj[j]
@@ -598,12 +677,16 @@ export default {
           }
         }
       }
-      this.searchParams = Object.assign({}, this.paramsForm)
-
+      this.searchParams = {
+        ...this.paramsForm,
+        ...params
+      }
+      // console.log('params-->', JSON.parse(JSON.stringify(this.searchParams)))
       this.loadData()
     },
     resetForm() {
       const moreSearchField = this.$refs.moreSearchField
+      // console.log('defdefdef==>', moreSearchField)
       if (!moreSearchField) return
       for (var i = 0; i < moreSearchField.length; i++) {
         const def = moreSearchField[i].resetForm()
@@ -619,7 +702,43 @@ export default {
     onLoad() {
       this.loadData()
     },
+    /**
+     * {
+        "label": "岗位/分组",
+        "name": "wei_hu_gang_wei_",
+        "rights": [
+            {
+                "type": "all"
+            }
+        ],
+        "noRightStyle": "",
+        "align": "left",
+        "vertical": "middle",
+        "sortable": true,
+        "width": "100",
+        "same": "N",
+        "field_type": "customDialog",
+        "field_options": {
+            "store": "id",
+            "multiple": "Y",
+            "dialog": "sbbqdhk",
+            "datefmt_type": "date",
+            "datefmt": "yyyy-MM-dd",
+            "selector_type": "user",
+            "number_type": "orig",
+            "options": [
+                {
+                    "val": "",
+                    "label": ""
+                }
+            ],
+            "storeSeparator": ",",
+            "dictionary": ""
+        }
+      }
+     */
     loadData() {
+      const customDialogCols = this.columnsAttrs.filter(t => t.field_type === 'customDialog')
       if (this.$utils.isEmpty(this.templateKey)) {
         return
       }
@@ -639,6 +758,9 @@ export default {
       } else {
         Object.assign(params, this.searchParams)
       }
+      // 默认添加本部门和状态待处理
+      params['Q^bian_zhi_bu_men_^SL'] = this.ownsDeptInfo.id
+      params['Q^shi_fou_guo_shen_^SL'] = '待处理'
       // 加载数据
       queryDataByKey(ActionUtils.formatParams(params, this.pagination))
         .then(response => {
@@ -657,6 +779,10 @@ export default {
             this.finished = true
           } else {
             if (!this.finished) {
+              // 如果又自定义对话框
+              if (customDialogCols.length > 0) {
+
+              }
               // 处理数据
               ActionUtils.handleListData(this, responseData)
             }
@@ -670,12 +796,15 @@ export default {
     initOptions(list) {
       list.forEach((val, index) => {
         if (this.configKey === '') {
-          if (index < 2) {
-            this.chooseResult.push(val.label)
-          }
+          this.chooseResult.push(val.label)
         }
       })
     },
+    /**
+     * 
+     * @param list 条件过滤数组{label,value}
+     * @param index 第几条
+     */
     initFilter(list, index) {
       if (this.$utils.isNotEmpty(list)) {
         if (!this.$utils.isNotEmpty(this.defaultValue)) {
@@ -830,7 +959,7 @@ export default {
         if (callback) {
           callback(true)
         }
-        this.onRefresh()
+        this.loadData()
       })
     },
     toCheckMode() {
@@ -854,6 +983,9 @@ export default {
       // 功能按钮
       functionButtons.forEach((rf, i) => {
         const btn = this.buildButton(rf, i)
+        if (btn.rights === 'none') {
+          return
+        }
         // 顶部按钮
         if (hasButton(rf.button_type, 'toolbar', rf.position)) {
           btn.position = 'toolbar'
@@ -924,7 +1056,8 @@ export default {
         rightIcon: rightIcon,
         menus: menus,
         disabled: disabled,
-        hidden: hidden
+        hidden: hidden,
+        rights: rf.rights ? rf.rights[0].type : 'all'
       }
     },
     converType(type) {
@@ -965,108 +1098,333 @@ export default {
       return btns.includes(key)
     },
     buildQuerycolumns(queryColumns) {
-      this.searchForms.forms = []
-      if (this.$utils.isEmpty(queryColumns)) {
-        return
-      }
-
-      // 目前基础数据类型为4种,后续开发再补充。
-      const dataType = ['varchar', 'date', 'clob', 'number']
-      const arr = [
-        'text',
-        'number',
-        'numberRange',
-        'hidden',
-        'select',
-        'dateRange',
-        'datePicker',
-        'autoNumber'
-      ]
-      const fieldTypeArr = [
-        'dateRange',
-        'select',
-        'dictionary',
-        'number',
-        'date',
-        'datePicker'
-      ]
-      const queryColumnsData = []
-      queryColumns.forEach(column => {
-        const field = this.templateFields[column.name]
-        let fieldType = column.field_type ? column.field_type : field.field_type
-        if (!fieldType) {
-          fieldType = field.type
-        }
-
-        let fieldOptions = {}
-        if (!column.field_options) {
-          fieldOptions = field.field_options
+        this.searchForms.forms = []
+        if (this.$utils.isEmpty(queryColumns)) {
+          return
         }
-        if (fieldType === 'date') {
+        // TODO:目前第一个字段查询字段只支持 文本,多行文本和自动编号、数字、日期范围
+        const firstFieldTypes = ['text', 'textarea', 'daterange', 'autonumber', 'number']
+        //
+        const arr = [
+          'text',
+          'number',
+          'numberRange',
+          'hidden',
+          'select',
+          'dateRange',
+          'datePicker',
+          'autoNumber'
+        ]
+  
+        const columns = []
+        const queryColumnsData = []
+        queryColumns.forEach(column => {
+          if (column.common === 'N') return
+          const field = this.convertField(column)
+          const fd = this.buildSearchForm(field, !!column.same)
+          columns.push(fd)
+          const fieldType = field.field_type || ''
+          if (firstFieldTypes.includes(fieldType.toLowerCase())) {
+            queryColumnsData.push(fd)
+          }
+          if (!arr.includes(fieldType)) {
+            this.slotForms.push(fd)
+          }
+          this.slotForms.forEach(v => {
+            this.paramsForm[v.prop] = ''
+          })
+        })
+        // console.log('columns--->', this.slotForms)
+        this.searchForms.forms = columns
+        // 顶部查询条件
+        this.queryColumns = queryColumnsData || []
+        const queryColumn = this.$utils.isNotEmpty(this.queryColumns) ? this.queryColumns[0] : {}
+        this.queryKey = queryColumn.prop || ''
+        this.queryName = queryColumn.label || ''
+        this.fieldType = queryColumn.fieldType || ''
+    },
+    /**
+     * 转换字段
+     */
+    convertField: function (column) {
+        
+        const field = this.fields[column.name.toLowerCase()] || null
+        const same = !(column['same'] && column['same'] === 'N')
+        let fieldType = same ? (field ? field['field_type'] || 'text' : 'text') : column['field_type'] || 'text'
+        const fieldOptions = same ? (field ? field['field_options'] || {} : {}) : column['field_options'] || {}
+        const dataType = field ? field['type'] || 'varchar' : 'varchar'
+        const dataTypeList = ['date', 'timestamp', 'datetime', 'currentTime', 'currentDate']
+        // console.log('datePicker===>',column.name, JSON.parse(JSON.stringify(column)))
+        // 字段是日期类型
+        if (dataTypeList.includes(dataType) && fieldType !== 'datePicker' && fieldType !== 'dateRange') {
           fieldType = 'datePicker'
         }
-
-        column.fieldType = fieldType
-        if (dataType.includes(field.type)) {
-          if (
-            field.type === 'varchar' ||
-            field.type === 'clob' ||
-            field.type === 'number' ||
-            field.type === 'date'
-          ) {
-            if (!fieldTypeArr.includes(column.field_type)) {
-              column.name = 'Q^' + column.name + '^SL'
-            }
-            if (
-              column.field_type === 'select' ||
-              column.field_type === 'dictionary'
-            ) {
-              column.name = 'Q^' + column.name + '^S'
-            }
-            if (column.field_type === 'datePicker') {
-              column.name = 'Q^' + column.name + '^D'
-            }
-            if (column.field_type === 'number') {
-              column.name = 'Q^' + column.name + '^DB'
-            }
+        if (fieldType === 'datePicker' || fieldType === 'dateRange') {
+          const datefmtType = fieldOptions['datefmt_type']
+          if (datefmtType !== 'custom') {
+            fieldOptions['datefmt'] = this.getDatefmt(fieldOptions)
           }
-          // TODO: 数据类型为日期类时改其余控件数据类型 PC端配置日期改其他类型控件无效果,日期类型绑定字段暂且为目前字段。
         }
 
-        const fielder = {
-          fieldType: fieldType,
-          slotName: !arr.includes(fieldType)
-            ? column.name + 'searchForm'
-            : null,
-          prop: column.name,
-          label: column.label,
-          fieldOptions: fieldOptions,
-          options: fieldOptions.options || []
+        // 处理当前用户,当前组织控件
+        if (fieldType === 'currentUser' || fieldType === 'currentOrg' || fieldType === 'currentPosition') {
+          fieldType = 'selector'
         }
-        // 目前查询字段只支持text
-        if (
-          fieldType === 'text' ||
-          fieldType === 'textarea' ||
-          fieldType === 'autoNumber'
-        ) {
-          queryColumnsData.push(fielder)
+        column['field_type'] = fieldType
+        column['field_options'] = fieldOptions
+        column['data_type'] = dataType
+        return column
+    },
+    buildSearchForm(field, same) {
+      // console.log(field)
+      let querySuffix
+      const datasetType = this.dataTemplate.datasetType
+      const dataTypes = ['date', 'varchar', 'number']
+      if (dataTypes.includes(field.dataType) &&
+        field.queryCondition && this.$utils.isNotEmpty(field.queryCondition)) {
+        const dataTypesSuffixs = datasetType === 'thirdparty' ? this.queryConditionOptions[field.fieldsTypes || 'varchar'] : this.queryConditionOptions[field.dataType]
+        const suffixData = dataTypesSuffixs.filter(d => d.value === field.queryCondition)
+        querySuffix = this.$utils.isNotEmpty(suffixData) ? suffixData[0].suffix : 'SL'
+      } else {
+        if (field.dataType === 'number') {
+          querySuffix = 'SIN'
         }
-        this.searchForms.forms.push(fielder)
-        if (!arr.includes(fieldType)) {
-          this.slotForms.push(fielder)
+      }
+      // 1、日期/数字 条件为范围时得特殊处理。
+      // 2、控件类型不一致时选的控件类型传递后缀是否以数据格式类型得对应条件后缀为准,还是单独保持原样。
+      // 3、直接添加查询字段时得默认拼接后缀,保留目前写死得后缀将其转化在内部作为直接添加而不进入查询字段时得默认条件后缀。
+
+      let searchColumn = {
+        label: field.label,
+        placeholder: field.placeholder
+      }
+      // 控件类型
+      const fieldType = field['field_type'] || 'text'
+
+      const fieldOptions = field['field_options']
+      // 组合字段
+      if (field.addType === 'combination') {
+        const queryFileds = this.buildJointFileds(field.combinationKeyField).filter(f => f !== '')
+
+        const combinationQueryFileds = []
+        const queryCondition = field.queryCondition || 'include'
+        queryFileds.forEach(name => {
+          const column = this.fields[name.toLowerCase()] || { }
+          const type = column.type || 'varchar'
+          const dataType = this.dataTypes[type] || {}
+          if (type === 'date') {
+            combinationQueryFileds.push({
+              queryfields: 'Q^' + name + dataType.start
+            }, {
+              queryfields: 'Q^' + name + dataType.end
+            })
+          } else {
+            const fieldSuffix = dataType[queryCondition] ? dataType[queryCondition] : 'SL'
+            combinationQueryFileds.push({ queryfields: 'Q^' + name + fieldSuffix })
+          }
+        })
+        const prop = field.combinationName
+        this.combinationQueryFileds[prop] = {
+          prop: prop,
+          conditionType: this.conditionTypeOptions[queryCondition].conditionType,
+          queryFileds: combinationQueryFileds
         }
-        this.slotForms.forEach(v => {
-          this.paramsForm[v.prop] = ''
+        // ---------------------------------------------------------
+        searchColumn = Object.assign(searchColumn, {
+          prop: prop,
+          modelValue: prop,
+          fieldType: fieldType,
+          fieldOptions: fieldOptions
         })
-      })
-
-      // 顶部查询条件
-      this.queryColumns = queryColumnsData || []
-      const queryColumn = this.$utils.isNotEmpty(this.queryColumns)
-        ? this.queryColumns[0]
-        : {}
-      this.queryKey = queryColumn.prop || ''
-      this.queryName = queryColumn.label || ''
+      } else {
+        if (fieldType === 'hidden') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'SL'
+          }
+          searchColumn = Object.assign(searchColumn, {
+            prop: `Q^${field.name}^${querySuffix}`,
+            modelValue: `Q^${field.name}^${querySuffix}`,
+            fieldType: fieldType,
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'numberRange') { // 数字范围
+          if (this.$utils.isEmpty(querySuffix)) {
+            if (field.dataType === 'number') {
+              querySuffix = ['DBL', 'DBG']
+            } else {
+              const dataTypesSuffixs = this.queryConditionOptions[field.dataType]
+              querySuffix = [dataTypesSuffixs[0]['suffix'], dataTypesSuffixs[0]['suffix']]
+            }
+          }
+          searchColumn = Object.assign(searchColumn, {
+            prop: [`Q^${field.name}^${querySuffix[0]}`, `Q^${field.name}^${querySuffix[1]}`],
+            modelValue: `Q^${field.name}^${querySuffix[0]}`,
+            fieldType: 'numberRange',
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'radio' || fieldType === 'checkbox' || fieldType === 'select') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = fieldType !== 'checkbox' && !fieldOptions.multiple ? 'S' : 'SL'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            modelValue: `Q^${field.name}^${querySuffix}`,
+            fieldType: fieldType,
+            fieldOptions: fieldOptions,
+            valueKey: 'value',
+            multiple: fieldOptions.multiple || fieldType === 'checkbox' || false,
+            options: this.buildOptions(fieldOptions && fieldOptions.options ? fieldOptions.options : [])
+          })
+          // this.setOptionsInField(searchColumn, fieldOptions)
+        } else if (fieldType === 'switch') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'S'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            fieldType: 'select',
+            fieldOptions: fieldOptions,
+            options: this.buildSwitchOptions(fieldOptions)
+          })
+        } else if (fieldType === 'date') { // 日期
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'D'
+          }
+          const datefmt = fieldOptions.datefmt || ''
+          const prop = `Q^${field.name}^${querySuffix}^${datefmt}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            fieldType: 'date',
+            fieldOptions: fieldOptions,
+            dateType: fieldOptions.datefmt_type ? fieldOptions.datefmt_type : 'date'
+          })
+        } else if (fieldType === 'datePicker' || fieldType.toLowerCase() === 'daterange') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'D'
+          }
+          const suffix = typeof querySuffix === 'object' && this.$utils.isNotEmpty(querySuffix) ? querySuffix : ['DL', 'DG']
+          // const options = this.filterPickerOptions(field)
+          // const pickerOptions = options.scopeData
+          // const value = options.operationScriptDate
+          const datefmt = fieldOptions.datefmt || ''
+          const dateDealFmt = DateFormatUtil.dealFmt(fieldOptions.datefmt)
+          // const props = [`Q^${field.name}^${suffix[0]}^${datefmt}`, `Q^${field.name}^${suffix[1]}^${datefmt}`]
+          const props = `Q^${field.name}^${suffix[0]}^${datefmt}`
+          searchColumn = Object.assign(searchColumn, {
+            hasSame: same || false,
+            datefmt: '^' + datefmt,
+            prop: props,
+            modelValue: `Q^${field.name}^${querySuffix}^${datefmt}`,
+            fieldType: fieldType === 'datePicker' ? dateDealFmt.dateType : dateDealFmt.dateType + 'range',
+            fieldOptions: fieldOptions
+            // pickerOptions: pickerOptions || {}
+          })
+        } else if (fieldType === 'dictionary') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = fieldOptions.multiple ? 'SL' : 'S'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            slotName: prop + 'searchForm',
+            fieldType: fieldType,
+            placeholder: fieldOptions.placeholder,
+            multiple: fieldOptions.multiple || false,
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'selector') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'SL'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            slotName: prop + 'searchForm',
+            fieldType: fieldType,
+            modelValue: prop,
+            multiple: fieldOptions.multiple || false,
+            selectorType: fieldOptions.selector_type || 'user',
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'customDialog') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'S'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            slotName: prop + 'searchForm',
+            fieldType: fieldType,
+            modelValue: prop,
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'linkdata') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'S'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            slotName: prop + 'searchForm',
+            fieldType: fieldType,
+            modelValue: prop,
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'address') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'SL'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            slotName: prop + 'searchForm',
+            modelValue: prop,
+            fieldType: fieldType,
+            fieldOptions: fieldOptions
+          })
+        } else if (fieldType === 'number') {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'SIN'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            modelValue: prop,
+            fieldType: fieldType,
+            field_options: fieldOptions,
+            dateType: field.dataType
+          })
+        } else {
+          if (this.$utils.isEmpty(querySuffix)) {
+            querySuffix = 'SL'
+          }
+          const prop = `Q^${field.name}^${querySuffix}`
+          searchColumn = Object.assign(searchColumn, {
+            prop: prop,
+            modelValue: prop,
+            slotName: prop + 'searchForm',
+            fieldOptions: fieldOptions
+          })
+        }
+      }
+      // console.log('searchColumn===>', searchColumn)
+      return searchColumn
+    },
+    buildOptions (options = []) {
+        const rtn = []
+        options.forEach((option) => {
+            rtn.push({
+                value: option.val,
+                label: option.label
+            })
+        })
+        return rtn
+    },
+    setOptionsInField () {},
+    buildSwitchOptions (fieldOptions) {
+        return FormUtils.getSwitchOptions(fieldOptions, 'value')
     },
     changeQuery(val, data) {
       this.queryName = data['label']
@@ -1080,15 +1438,13 @@ export default {
       if (el) {
         el.parentNode.removeChild(el)
       }
-
+      // 不兼容pc脚本无意义
       if (
         this.dataTemplate.attrs &&
-        (this.dataTemplate.attrs.mobile_script ||
-          this.dataTemplate.attrs.script)
+        (this.dataTemplate.attrs.mobile_script)
       ) {
         const code =
-          this.dataTemplate.attrs.mobile_script ||
-          this.dataTemplate.attrs.script
+          this.dataTemplate.attrs.mobile_script
         el = document.createElement('script')
         el.type = 'text/javascript'
         el.id = id
@@ -1106,6 +1462,10 @@ export default {
 </script>
 <style lang="scss">
 .data-template-list {
+.delayShow {
+  display: flex;
+  align-items: center;
+}
   .options-null {
     bottom: -9px !important;
   }
@@ -1120,10 +1480,10 @@ export default {
     font-size: 16px;
     display: block;
   }
-  .desc {
-    font-size: 14px;
-    line-height: 22px;
-  }
+  // .desc {
+  //   font-size: 12px;
+  //   line-height: 22px;
+  // }
   .active {
     color: #4688f9;
   }