|
|
@@ -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;
|
|
|
}
|