olp-table 7.1.5 → 7.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/olp-table.common.js +4 -4
- package/olp-table.umd.js +4 -4
- package/olp-table.umd.min.js +4 -4
- package/package.json +1 -1
package/olp-table.common.js
CHANGED
|
@@ -531,7 +531,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
|
|
|
531
531
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
532
532
|
|
|
533
533
|
"use strict";
|
|
534
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
534
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"()=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next() === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
535
535
|
|
|
536
536
|
/***/ }),
|
|
537
537
|
|
|
@@ -1598,7 +1598,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1598
1598
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1599
1599
|
|
|
1600
1600
|
"use strict";
|
|
1601
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1601
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n class: \"table-right-operation-but\",\n link: \"\",\n status: obj['status'],\n type: obj['status'],\n loading: $setup.bindLoading(obj, $setup.props.row),\n disabled: obj['disabled'] || $setup.getCallBack('disabledCallBack', obj, $setup.props.row, false),\n onClick: $event => _ctx.$emit('handleOperationClick', {\n row: $setup.props.row,\n obj: obj,\n setLoading: $setup.setLoading\n })\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"loading\", \"disabled\", \"onClick\"])), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.getCallBack('showCallBack', obj, $setup.props.row, true)]]);\n }), 256 /* UNKEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)], 64 /* STABLE_FRAGMENT */);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-operate/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1602
1602
|
|
|
1603
1603
|
/***/ }),
|
|
1604
1604
|
|
|
@@ -1620,7 +1620,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1620
1620
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1621
1621
|
|
|
1622
1622
|
"use strict";
|
|
1623
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1623
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n const _directive_hasPermi = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)(\"hasPermi\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n key: obj.code,\n status: obj['status'],\n type: obj['status'],\n disabled: obj['disabled'],\n circle: obj.alignMode === 'right' && !obj['status'],\n loading: $data.loading[obj.code],\n onClick: $event => $options.handleToolbarBtnClick(obj.code)\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [obj.alignMode === 'right' && !obj['status'] ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", {\n key: 0,\n title: obj.name\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */)], 8 /* PROPS */, _hoisted_1)) : obj.code === 'sortable' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n style: {\n \"color\": \"#1677FF\"\n },\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj.values ? 'vxe-icon-checkbox-checked' : 'vxe-icon-checkbox-unchecked')\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]))]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"disabled\", \"circle\", \"loading\", \"onClick\"])), [[_directive_hasPermi, [$props.currentPermi + obj.code]], [vue__WEBPACK_IMPORTED_MODULE_0__.vShow, obj['show']]]);\n }), 128 /* KEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)]);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-tool-btn/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1624
1624
|
|
|
1625
1625
|
/***/ }),
|
|
1626
1626
|
|
|
@@ -10761,7 +10761,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
10761
10761
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10762
10762
|
|
|
10763
10763
|
"use strict";
|
|
10764
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = item.selectDom == 3 ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd';\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10764
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = vue__WEBPACK_IMPORTED_MODULE_4__.version.split('.')[0] == 2 ? 'yyyy-MM-dd' : 'YYYY-MM-DD';\n if (item.selectDom == 3) {\n item.domFormat = item.domFormat + ' HH:mm:ss';\n }\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10765
10765
|
|
|
10766
10766
|
/***/ }),
|
|
10767
10767
|
|
package/olp-table.umd.js
CHANGED
|
@@ -531,7 +531,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
|
|
|
531
531
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
532
532
|
|
|
533
533
|
"use strict";
|
|
534
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
534
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"()=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next() === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
535
535
|
|
|
536
536
|
/***/ }),
|
|
537
537
|
|
|
@@ -1598,7 +1598,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1598
1598
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1599
1599
|
|
|
1600
1600
|
"use strict";
|
|
1601
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1601
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n class: \"table-right-operation-but\",\n link: \"\",\n status: obj['status'],\n type: obj['status'],\n loading: $setup.bindLoading(obj, $setup.props.row),\n disabled: obj['disabled'] || $setup.getCallBack('disabledCallBack', obj, $setup.props.row, false),\n onClick: $event => _ctx.$emit('handleOperationClick', {\n row: $setup.props.row,\n obj: obj,\n setLoading: $setup.setLoading\n })\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"loading\", \"disabled\", \"onClick\"])), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.getCallBack('showCallBack', obj, $setup.props.row, true)]]);\n }), 256 /* UNKEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)], 64 /* STABLE_FRAGMENT */);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-operate/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1602
1602
|
|
|
1603
1603
|
/***/ }),
|
|
1604
1604
|
|
|
@@ -1620,7 +1620,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1620
1620
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1621
1621
|
|
|
1622
1622
|
"use strict";
|
|
1623
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1623
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n const _directive_hasPermi = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)(\"hasPermi\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n key: obj.code,\n status: obj['status'],\n type: obj['status'],\n disabled: obj['disabled'],\n circle: obj.alignMode === 'right' && !obj['status'],\n loading: $data.loading[obj.code],\n onClick: $event => $options.handleToolbarBtnClick(obj.code)\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [obj.alignMode === 'right' && !obj['status'] ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", {\n key: 0,\n title: obj.name\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */)], 8 /* PROPS */, _hoisted_1)) : obj.code === 'sortable' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n style: {\n \"color\": \"#1677FF\"\n },\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj.values ? 'vxe-icon-checkbox-checked' : 'vxe-icon-checkbox-unchecked')\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]))]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"disabled\", \"circle\", \"loading\", \"onClick\"])), [[_directive_hasPermi, [$props.currentPermi + obj.code]], [vue__WEBPACK_IMPORTED_MODULE_0__.vShow, obj['show']]]);\n }), 128 /* KEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)]);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-tool-btn/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1624
1624
|
|
|
1625
1625
|
/***/ }),
|
|
1626
1626
|
|
|
@@ -10761,7 +10761,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
10761
10761
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10762
10762
|
|
|
10763
10763
|
"use strict";
|
|
10764
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = item.selectDom == 3 ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd';\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10764
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = vue__WEBPACK_IMPORTED_MODULE_4__.version.split('.')[0] == 2 ? 'yyyy-MM-dd' : 'YYYY-MM-DD';\n if (item.selectDom == 3) {\n item.domFormat = item.domFormat + ' HH:mm:ss';\n }\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10765
10765
|
|
|
10766
10766
|
/***/ }),
|
|
10767
10767
|
|
package/olp-table.umd.min.js
CHANGED
|
@@ -531,7 +531,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
|
|
|
531
531
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
532
532
|
|
|
533
533
|
"use strict";
|
|
534
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
534
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.for-each.js */ \"./node_modules/core-js/modules/es.iterator.for-each.js\");\n/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/object */ \"./src/utils/object.js\");\n/* harmony import */ var _utils_message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/message */ \"./src/utils/message.js\");\n/* harmony import */ var _utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/http/httpUtils */ \"./src/utils/http/httpUtils.js\");\n/* harmony import */ var _utils_tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/tree */ \"./src/utils/tree.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\n/* harmony import */ var _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/components/table/model/model-index.vue */ \"./src/components/table/model/model-index.vue\");\n/* harmony import */ var _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/ol-table-select.vue */ \"./src/components/ol-table-select.vue\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_9__.storeDictType)();\nfunction replaceDollarBraces(str) {\n return str.toString().replace(/\\$\\{?([^{}]+)\\}?/g, function (match, innerContent) {\n return innerContent ? `'${innerContent}'` : match;\n });\n}\nfunction parseJson(column) {\n let attrs = column.attrs;\n if (attrs) {\n try {\n attrs = JSON.parse(attrs);\n for (let key of Object.keys(attrs)) {\n column[key] = attrs[key];\n }\n } catch (e) {\n console.error(\"解析attrs异常\", attrs);\n }\n }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: \"olMainFormSubTable\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"],\n ModelIndex: _components_table_model_model_index_vue__WEBPACK_IMPORTED_MODULE_10__[\"default\"]\n },\n inject: ['http'],\n data() {\n return {\n url: {\n saveUrl: \"/online/crudAes/saveMainAndSubs\"\n },\n uuid: undefined,\n subForeignKey: '',\n formData: {},\n optionData: {},\n form: {\n column: []\n },\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n exBtnDisabled: undefined,\n state: {\n loading: false,\n fullscreen: false,\n dialogVisible: false,\n title: \"\",\n width: '60%',\n comCommit: true,\n maxHeight: '400px',\n type: '0',\n edit: false,\n saveUrl: '',\n requestType: 'post',\n updateKey: '',\n deleteId: '',\n theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\n };\n },\n computed: {\n https() {\n return this.http;\n }\n },\n methods: {\n hideColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', false, prop);\n },\n showColumn(prop) {\n (0,_utils_object__WEBPACK_IMPORTED_MODULE_3__.setArrayObjectKeyValue)(this.form.column, 'display', true, prop);\n },\n getDeleteId(param) {\n for (let key of Object.keys(param)) {\n if (key != '$parentId') {\n return key;\n }\n }\n },\n getSubUpdateList(table) {\n let subColumnAndValueList = [];\n for (const row of table.data) {\n subColumnAndValueList.push(this.getSubUpdate(row, table.columns));\n }\n return subColumnAndValueList;\n },\n getSubUpdate(row, columns) {\n let subColumnAndValue = {};\n for (const column of columns) {\n if (!column.tableSaveToOtherProp || column.tableSaveToOtherProp != '1') {\n subColumnAndValue[column.tableField ? column.tableField : column.field] = row[column.field];\n }\n }\n return subColumnAndValue;\n },\n getParams() {\n // 子表信息\n let subTable = this.$refs.subTable.table.t1;\n let deleteId = this.getDeleteId(subTable.deleteParameter);\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n // 主表的唯一字段\n mainTableKey: [this.state.deleteId],\n //主表的唯一字段\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n mainGenIdMap: {\n [this.state.deleteId]: 'uuid'\n },\n mianColumnAndValueMap: {},\n // 子表名称\n subTableName: subTable.tableConfig.mainTable,\n // 子表要自动生成的唯一字段 如果没有 可以忽略\n subGenIdMap: {\n [deleteId]: 'uuid'\n },\n // 子表子主表的数据\n subColumnAndValueList: this.getSubUpdateList(subTable.table),\n // 子表的唯一字段\n subTableKey: [deleteId],\n // 表的关联key,这里框架自动复制 {主表字段,子表的字段}\n subForeignKey: {\n [this.state.deleteId]: this.subForeignKey\n }\n };\n if (this.state.type != '0') {\n let formData = this.$refs.value.getFormData(false);\n for (let prop of Object.keys(formData)) {\n let value = formData[prop];\n if (value instanceof String) {\n value = value.trim();\n }\n params.mianColumnAndValueMap[prop] = value;\n }\n } else {\n params.mianColumnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl) {\n return params.mianColumnAndValueMap;\n }\n if (this.state.edit) {\n params.whereMap = {};\n if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params.mianColumnAndValueMap[kvs[0]] = params.mianColumnAndValueMap[kvs[1]];\n } else {\n let val = params.mianColumnAndValueMap[kvs];\n params.mianColumnAndValueMap[kvs] = val != undefined ? val : this.formData[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.mianColumnAndValueMap['id'] = this.formData['id'];\n if (!params.mianColumnAndValueMap['id']) {\n params.mianColumnAndValueMap['id'] = this.formData['t1_id'];\n }\n }\n }\n return params;\n },\n /**\r\n * 根据列配置获取数据库表更新数据\r\n * @param column\r\n * @param formData\r\n * @returns {{}}\r\n */\n getTableUpdateValue(column, formData) {\n let columnAndValueMap = {};\n for (let {\n prop,\n tableField\n } of column) {\n if (tableField && tableField == '1') {\n continue;\n }\n let value = formData[prop];\n if (value != undefined) {\n if (value instanceof String) {\n value = value.trim();\n }\n columnAndValueMap[prop] = value;\n }\n }\n return columnAndValueMap;\n },\n async doValidate() {\n let dom = undefined;\n let keys = [];\n let status = true;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n status = false;\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n status = false;\n }\n done();\n });\n }\n if (dom) {\n // 定位代码\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n status = false;\n }\n return status;\n },\n async doSave() {\n let dom;\n let keys;\n if (this.state.type != '0') {\n await this.$refs.formRef.getNativeForm().validate((valid, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getWidgetRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n });\n } else {\n await this.$refs.formRef.validate((valid, done, msg) => {\n if (!valid) {\n keys = Object.keys(msg);\n dom = this.$refs.formRef.getPropRef(keys[0]);\n dom.$el.scrollIntoView({\n block: \"center\",\n behavior: \"smooth\"\n });\n (0,_utils_message__WEBPACK_IMPORTED_MODULE_4__.useMessage)().error(\"您还有\" + keys.length + \"项信息未填写,请填写后再操作!\");\n } else {\n this.save();\n }\n done();\n });\n }\n },\n saveOk(status) {\n this.state.loading = false;\n if (status) {\n this.state.dialogVisible = false;\n this.$emit('query');\n }\n if (this.state.otherProp && this.state.otherProp.afterSave) {\n try {\n eval(this.state.otherProp.afterSave);\n } catch (e) {\n console.log(e);\n }\n }\n },\n save() {\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"()=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next() === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let params = this.getParams();\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, this.url.saveUrl, params).then(status => {\n this.saveOk(status);\n });\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n setUUID(data) {\n this.uuid = data.uuid;\n this.subForeignKey = data.foreignKey;\n },\n init(data) {\n this.show = data.disabled == false;\n this.exBtnDisabled = data.exBtnDisabled;\n // 初始化动态插槽表格\n data.form.column.forEach(column => {\n if (data.disabled) {\n column.disabled = true;\n }\n if (column.selectDom === '22') {\n //表格选取\n let slotObj = {\n slotName: column.prop,\n config: JSON.parse(column.attrs).olTableSelect\n };\n this.dynamicSlotsField[column.prop] = column; //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据\n this.dynamicSlotsTable.push(slotObj); //收集需要的动态插槽字段信息\n const otherResult = slotObj.config.otherResult; //返回额外参数字段配置\n if (otherResult !== null && otherResult !== undefined && otherResult !== '') {\n let otherResultArray = [];\n otherResult.split(\",\").forEach(m => {\n let k = m.split(\":\");\n otherResultArray.push({\n targetField: k[[k.length - 1]],\n sourceField: k[0]\n });\n });\n this.dynamicSlotsOtherResult[column.prop] = otherResultArray;\n }\n }\n });\n if (data.saveUrl) {\n this.state.saveUrl = data.saveUrl.trim();\n if (data.requestType) {\n this.state.requestType = data.requestType;\n }\n }\n this.setUUID(data);\n this.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n //赋值弹窗宽度和高度\n if (data.form.diaLogWidth) {\n this.state.width = data.form.diaLogWidth;\n }\n if (data.form.diaLogHeight) {\n this.state.maxHeight = data.form.diaLogHeight + 'px';\n }\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\n this.form = data.form;\n this.formData = data.formData;\n for (let key of Object.keys(this.state)) {\n if (data[key]) {\n this.state[key] = data[key];\n }\n }\n if (this.state.otherProp) {\n try {\n this.state.otherProp = JSON.parse(this.state.otherProp);\n } catch (e) {\n console.log(e);\n }\n }\n },\n ok(e) {\n if (!this.show) {\n this.$refs.subTable.getTableRefs().setAllBtnDisabled(this.exBtnDisabled);\n }\n for (let column of this.form.column) {\n if (column.disabled == 1) {\n column.disabled = true;\n }\n this.initDict(column);\n parseJson(column);\n for (let event of ['change']) {\n if (column[event] && !(column[event] instanceof Function)) {\n try {\n column[event] = eval(\"(params)=>{this.$nextTick(()=>{\" + \"let formData = this.formData;console.log(formData);\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n this.setParameter(e);\n if (this.state.edit) {\n e.query();\n }\n },\n setParameter(e) {\n let param = {\n [this.subForeignKey]: this.formData[this.state.deleteId]\n };\n e.parameter = {\n ...e.parameter,\n ...param\n };\n },\n initDict(column) {\n if (column.dictCode) {\n column.dicData = dict.val(column.dictCode);\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n if (this.state.edit) {\n return;\n }\n if (this.formData[column.prop] != undefined) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n // 数据字典与值类型不一致\n if (this.formData[column.prop] != undefined && this.formData[column.prop] != '' && [\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\n } else if (this.formData[column.prop] == undefined) {\n setTimeout(() => {\n if (column.dicData) {\n for (let dicDatum of column.dicData) {\n if (dicDatum.isDefault == 1) {\n this.formData[column.prop] = dicDatum.value;\n column.value = this.formData[column.prop];\n }\n }\n }\n }, 100);\n }\n }\n } else if (column.dictTable || column.dictUrl) {\n if (column.selectDom == 1) {\n column.type = \"select\";\n }\n column.filterable = true;\n column.dicData = [];\n setTimeout(() => {\n this.setDictTable(column, undefined);\n }, 10);\n if (column.type == 'tree') {\n column.filterable = column.filterable == undefined ? true : column.clearable;\n column.clearable = column.clearable == undefined ? true : column.clearable;\n } else {\n column.filterMethod = e => {\n this.$nextTick(() => {\n this.setDictTable(column, e);\n });\n };\n }\n }\n },\n setDictUrl(column, like) {\n let dictUrl = column.dictUrl.split(\",\");\n let url;\n let label = 'label';\n let value = 'value';\n let parentId = 'parentId';\n // get,url,label,value,parent_id\n let doGet = true;\n if (dictUrl.length > 1) {\n if (dictUrl[0].toString().toLowerCase() == 'post') {\n doGet = false;\n }\n url = dictUrl[1];\n label = dictUrl[2];\n value = dictUrl[3];\n parentId = dictUrl[4];\n } else {\n url = dictUrl[0];\n }\n if (doGet) {\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.get)(this.http, url + \"?label=\" + like).then(data => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n } else {\n let params = {};\n if (like) {\n params['label'] = like;\n }\n (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, column.dictUrl, params, false).then(({\n data\n }) => {\n column.dicData.length = 0;\n if (column.type == 'tree') {\n for (let da of data) {\n da['label'] = da[label];\n da['value'] = da[value];\n }\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, value, parentId);\n } else {\n data.forEach(da => {\n da['label'] = da[label];\n da['value'] = da[value];\n column.dicData.push(da);\n });\n }\n });\n }\n },\n setDictTable(column, like) {\n if (column.dictTable && column.dictTable.toString().trim() != '') {\n this.doSetDictTable(column, like);\n } else if (column.dictUrl) {\n this.setDictUrl(column, like);\n }\n },\n doSetDictTable(column, like) {\n let value = this.formData[column.prop];\n /*String tableName;\r\n String dataBase;\r\n String label;\r\n String value;\r\n Map<String, Object> where;*/\n // olp-vue-pro,system_users,nickname,id,parentId\n let params = {};\n let dictTable = JSON.parse(JSON.stringify(column.dictTable));\n if (dictTable instanceof Object) {\n params = dictTable;\n } else {\n dictTable = column.dictTable.split(\",\");\n params[\"dbName\"] = dictTable[0];\n params[\"tableName\"] = dictTable[1];\n params[\"label\"] = dictTable[2];\n params[\"value\"] = dictTable[3];\n if (dictTable[4]) {\n params[\"parentValue\"] = dictTable[4];\n }\n }\n if (like || value) {\n if (!params.where) {\n params.where = {};\n }\n }\n if (!params[\"parentValue\"]) {\n if (like) {\n params.where['_like_' + params[\"label\"]] = like;\n }\n if (value) {\n params.defaultValue = value;\n }\n }\n (0,_api_dist__WEBPACK_IMPORTED_MODULE_7__.initDictTable)(this.http, params).then(data => {\n column.dicData.length = 0;\n if (params[\"parentValue\"]) {\n column.dicData = (0,_utils_tree__WEBPACK_IMPORTED_MODULE_6__.handleTree)(data, 'dictValue', 'parentValue');\n } else {\n data.forEach(d => {\n column.dicData.push(d);\n });\n }\n });\n },\n /**\r\n * 表格选择器回调函数\r\n * @param data\r\n */\n olTableSelectChange(slotName, data) {\n // console.info('插槽名称', slotName, '表格回传的数据', data)\n // console.info('表格', this.form.column)\n this.formData[slotName] = data.value; //修改表单数据,以便后续提交\n if (typeof this.dynamicSlotsField[slotName].change === 'function') {\n this.dynamicSlotsField[slotName].change(data.value); //字段数据更新回调\n }\n //给其他字段赋值\n this.dynamicSlotsOtherResult[slotName]?.forEach(item => {\n this.formData[item.targetField] = data.data[item.sourceField];\n });\n }\n },\n mounted() {\n this.$nextTick(() => {\n (0,_store_dict__WEBPACK_IMPORTED_MODULE_8__.storeDict)().init(this.http);\n });\n },\n created() {\n // console.info(\"我是主子表\")\n }\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-main-form-sub-table/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
535
535
|
|
|
536
536
|
/***/ }),
|
|
537
537
|
|
|
@@ -1598,7 +1598,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1598
1598
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1599
1599
|
|
|
1600
1600
|
"use strict";
|
|
1601
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1601
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n class: \"table-right-operation-but\",\n link: \"\",\n status: obj['status'],\n type: obj['status'],\n loading: $setup.bindLoading(obj, $setup.props.row),\n disabled: obj['disabled'] || $setup.getCallBack('disabledCallBack', obj, $setup.props.row, false),\n onClick: $event => _ctx.$emit('handleOperationClick', {\n row: $setup.props.row,\n obj: obj,\n setLoading: $setup.setLoading\n })\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"loading\", \"disabled\", \"onClick\"])), [[vue__WEBPACK_IMPORTED_MODULE_0__.vShow, $setup.getCallBack('showCallBack', obj, $setup.props.row, true)]]);\n }), 256 /* UNKEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)], 64 /* STABLE_FRAGMENT */);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-operate/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1602
1602
|
|
|
1603
1603
|
/***/ }),
|
|
1604
1604
|
|
|
@@ -1620,7 +1620,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
1620
1620
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1621
1621
|
|
|
1622
1622
|
"use strict";
|
|
1623
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const
|
|
1623
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; }\n/* harmony export */ });\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n\nconst _hoisted_1 = [\"title\"];\nconst _hoisted_2 = {\n key: 1\n};\nconst _hoisted_3 = {\n key: 2\n};\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)(\"el-button\");\n const _directive_hasPermi = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)(\"hasPermi\");\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"div\", null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"left\", {}, undefined, true), _ctx.$attrs.value !== undefined ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: 0\n }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)(_ctx.$attrs.value, obj => {\n return (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_el_button, {\n key: obj.code,\n status: obj['status'],\n type: obj['status'],\n disabled: obj['disabled'],\n circle: obj.alignMode === 'right' && !obj['status'],\n loading: $data.loading[obj.code],\n onClick: $event => $options.handleToolbarBtnClick(obj.code)\n }, {\n default: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(() => [obj.alignMode === 'right' && !obj['status'] ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", {\n key: 0,\n title: obj.name\n }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */)], 8 /* PROPS */, _hoisted_1)) : obj.code === 'sortable' ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n style: {\n \"color\": \"#1677FF\"\n },\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj.values ? 'vxe-icon-checkbox-checked' : 'vxe-icon-checkbox-unchecked')\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(\"span\", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)(\"i\", {\n class: (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(obj['icon'])\n }, null, 2 /* CLASS */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(obj['name']), 1 /* TEXT */)]))]),\n _: 2 /* DYNAMIC */\n }, 1032 /* PROPS, DYNAMIC_SLOTS */, [\"status\", \"type\", \"disabled\", \"circle\", \"loading\", \"onClick\"])), [[_directive_hasPermi, [$props.currentPermi + obj.code]], [vue__WEBPACK_IMPORTED_MODULE_0__.vShow, obj['show']]]);\n }), 128 /* KEYED_FRAGMENT */)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(\"v-if\", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderSlot)(_ctx.$slots, \"right\", {}, undefined, true)]);\n}\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-table-tool-btn/index.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/vue-loader/dist/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/vue-loader/dist/index.js??ruleSet%5B0%5D.use%5B0%5D");
|
|
1624
1624
|
|
|
1625
1625
|
/***/ }),
|
|
1626
1626
|
|
|
@@ -10761,7 +10761,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
10761
10761
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10762
10762
|
|
|
10763
10763
|
"use strict";
|
|
10764
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = item.selectDom == 3 ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd';\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10764
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OTMixinColumnMethod: function() { return /* binding */ OTMixinColumnMethod; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.iterator.constructor.js */ \"./node_modules/core-js/modules/es.iterator.constructor.js\");\n/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.iterator.some.js */ \"./node_modules/core-js/modules/es.iterator.some.js\");\n/* harmony import */ var core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_some_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_columnProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/columnProp */ \"./src/utils/columnProp.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue */ \"vue\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\nfunction setColumnParams(column, key, value) {\n if (value === undefined) {\n return;\n }\n if (!column['params']) {\n column['params'] = {};\n }\n column['params'][key] = value;\n}\nconst OTMixinColumnMethod = {\n methods: {\n setColumnCssClass(o) {\n if (o.dictCode) {\n let vals = this.dictVal(o.dictCode);\n let cssClass = {};\n if (vals) {\n let dictValueLabel = {};\n for (let obj of vals) {\n dictValueLabel[obj.dictValue] = obj.dictLabel;\n if (obj.cssClass) {\n let css = obj.cssClass.trim();\n try {\n css = css.replace(/([a-zA-Z_]\\w*):/g, '\"$1\":').replace(/'/g, '\"');\n css = JSON.parse(css);\n if (Array.isArray(css)) {\n let data = {};\n if (css[0]) {\n data['backgroundColor'] = css[0];\n }\n if (css[1]) {\n data['color'] = css[1];\n }\n cssClass[obj.dictValue] = data;\n } else {\n cssClass[obj.dictValue] = css;\n }\n } catch (e) {\n console.error(\"列名:\", o.title, \"数据字典:\", obj.dictLabel, \"样式异常:\", css);\n }\n }\n }\n setColumnParams(o, 'dictValueLabel', dictValueLabel);\n }\n if (Object.keys(cssClass).length != 0) {\n setColumnParams(o, 'cssClass', cssClass);\n }\n }\n },\n initColumn(columns, tableConfig) {\n this.table.mergeFields = [];\n let items = [];\n columns = columns.sort(({\n sort: a\n }, {\n sort: b\n }) => a - b);\n for (let column of columns) {\n this.toParseOtherProp(column);\n }\n this.table.columnSource = JSON.parse(JSON.stringify(columns));\n let {\n optionJson,\n seq\n } = tableConfig;\n if (optionJson) {\n optionJson = JSON.parse(optionJson);\n }\n for (let o of columns) {\n this.setColumnCssClass(o);\n this.initFormatter(o);\n this.initSlots(o);\n this.setTreeOpenColumn(o, tableConfig);\n this.setMergeField(o);\n this.setColumnShowOverFlow(o, optionJson);\n this.setProp(o);\n this.setColumnHide(o);\n this.setFixed(o);\n this.setShowFooter(o);\n this.getVNode(o, items);\n // 可编辑配置\n if (this.hasEditConfig()) {\n this.setEditConfig(o);\n }\n }\n items.sort(({\n searchSort: a\n }, {\n searchSort: b\n }) => a - b);\n this.setSearchArea(items);\n columns = this.initBodyLeftColumn(columns, seq);\n if (this.table['show-footer']) {\n if (!columns[0].width || columns[0].width < 55) {\n columns[0].width = 55;\n }\n }\n this.table.columns = columns;\n //暂时不合并,启用虚拟滚动\n this.initMergeCells();\n },\n hasEditConfig() {\n return this.table.editConfig && (this.table.editConfig.enabled === true || typeof this.table.editConfig.enabled === 'string' && this.table.editConfig.enabled.toLowerCase() === 'true');\n },\n setEditConfig(o) {\n if (o.tableSaveToOtherProp && o.tableSaveToOtherProp == '1') {\n return;\n }\n if (o.selectDom == '1') {\n o.editRender = {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 文本域\n if (o.selectDom == '10') {\n o.editRender = {\n name: 'textarea',\n props: {\n type: 'textarea',\n // 指定为多行文本框\n placeholder: '请输入' + o.title,\n rows: 3,\n // 默认显示行数\n autosize: {\n minRows: 2,\n maxRows: 6\n },\n // 自动调整高度\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 数字\n if (o.selectDom == '7') {\n o.editRender = {\n name: '$input',\n props: {\n type: this.getType(o.selectDom),\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n };\n }\n // 时间\n if (o.selectDom == '3' || o.selectDom == '6') {\n o.editRender = {\n name: 'VxeInput',\n props: {\n type: this.getType(o.selectDom),\n valueFormat: 'yyyy-MM-dd HH:mm:ss'\n }\n };\n }\n // 下拉框\n if (o.selectDom == '2' || o.selectDom == '8') {\n o.editRender = {\n name: 'VxeSelect',\n options: this.dictVal(o.dictCode),\n props: {\n placeholder: '请选择' + o.title\n }\n };\n }\n },\n getType(selectDom) {\n if (selectDom == '3') {\n return 'datetime';\n }\n if (selectDom == '6') {\n return 'date';\n }\n if (selectDom == '7') {\n return 'number';\n }\n },\n /**\r\n * 初始化列左边\r\n * @param columns\r\n * @param type\r\n * @returns {*}\r\n */\n initBodyLeftColumn(columns, type) {\n const hasSeqColumn = columns.some(col => ['seq', 'sequence', '序号'].includes(col.field || col.prop || col.type));\n if (type == 1 && !hasSeqColumn) {\n columns.unshift({\n type: 'seq',\n width: 55,\n title: '序号',\n fixed: 'left'\n });\n }\n const hasCheckboxColumn = columns.some(col => ['checkbox'].includes(col.type));\n const hasRadioColumn = columns.some(col => ['radio'].includes(col.type));\n if (this.selectBox == 2 && !hasCheckboxColumn) {\n columns.unshift({\n type: 'checkbox',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n } else if (this.selectBox == 1 && !hasRadioColumn) {\n columns.unshift({\n type: 'radio',\n width: 45,\n showOverflow: false,\n fixed: 'left'\n });\n }\n return columns;\n },\n setTreeOpenColumn(o, tableConfig) {\n if (tableConfig.tree == 1 && o.field == tableConfig.openColumn) {\n o.treeNode = true;\n if (!o.align) {\n o.align = 'left';\n }\n }\n },\n setMergeField(column) {\n if (column.mergeFlag == '1') {\n this.table.mergeFields.push(column.field);\n }\n },\n setColumnHide(o) {\n //隐藏\n if (o.visible == \"0\") {\n o.visible = false;\n }\n },\n initFormatter(o) {\n try {\n if (o.formatter) {\n o.formatter = eval(\"({cellValue, row, column})=>{\" + o.formatter + \"}\");\n } else if (o.dictCode) {\n o.formatter = eval(\"\" + \"({cellValue, row, column})=>{if(column.params && column.params.dictValueLabel){ let dictValueLabelElement = column.params.dictValueLabel[cellValue];if(dictValueLabelElement){return dictValueLabelElement;} }return cellValue}\");\n }\n } catch (e) {\n console.log(o.title, \"formatter异常:\", o.formatter);\n this.$message.error(o.title + \"formatter异常!\");\n }\n },\n initSlots(o) {\n if (o.selectDom == 20) {\n o.slotsName = 'img_default';\n o.slots = {\n default: 'img_default'\n };\n }\n if (o.selectDom == '21') {\n o.slotsName = 'icon_default';\n o.slots = {\n default: 'icon_default'\n };\n }\n },\n setFixed(item) {\n //修改固定字段的值\n if (item.fixed === '1') {\n item.fixed = 'left';\n } else if (item.fixed === '2') {\n item.fixed = 'right';\n }\n if (item.align === '1') {\n item.align = 'left';\n } else if (item.align === '2') {\n item.align = 'right';\n } else if (item.align === '0') {\n item.align = 'center';\n }\n },\n setProp(item) {\n item.resizable = undefined;\n if (item.sortable != undefined && item.sortable != \"\") {\n let order = item.field + (item.sortable == 0 ? \" ASC \" : \" DESC \");\n this.orderByColumns.push(order);\n }\n ////时间类型\n if (!item.width && (item.selectDom == 3 || item.selectDom == 6)) {\n item.minWidth = 150;\n } else if (!item.width && item.title) {\n item.minWidth = item.title.length * 30;\n }\n },\n setShowFooter(item) {\n if (item['totalToOtherProp']) {\n this.table['show-footer'] = true;\n }\n },\n toParseOtherProp(item) {\n //其他属性赋值\n try {\n let otherProp = JSON.parse(item.otherProp);\n item.otherProp = otherProp;\n for (let key of Object.keys(otherProp)) {\n item[key] = otherProp[key];\n }\n } catch (e) {\n if (item.otherProp) {\n console.error(item.field + \"其他属性无法解析:\" + item.otherProp);\n }\n item.otherProp = {};\n }\n if (item['totalToOtherProp'] === undefined) {\n item['totalToOtherProp'] = '';\n }\n },\n /**\r\n * 设置搜索\r\n * @param items\r\n */\n setSearchArea(items) {\n if (items.length != 0) {\n items.push({\n itemRender: {\n name: '$buttons',\n children: [{\n props: {\n type: 'submit',\n content: '查询',\n status: 'primary'\n },\n events: {\n click: this.query\n }\n }, {\n props: {\n type: 'button',\n content: '重置'\n },\n events: {\n click: this.resetQuery\n }\n }]\n }\n });\n this.table.formConfig.size = this.table.size;\n }\n this.table.formConfig.items = items;\n },\n getVNode(o, items) {\n if (o.selectType == undefined) {\n return;\n }\n //99是范围查询\n if (o.selectType == 99) {\n let itemStart = this.initFormConfig(o, 5);\n let itemEnd = this.initFormConfig(o, 6);\n //时间范围查询\n if (o.selectDom == 3 || o.selectDom == 6) {\n let placeholder = o.selectDom == 3 ? '时间' : '';\n itemStart.placeholder = '请选择开始日期' + placeholder;\n delete itemStart.itemRender;\n itemEnd.placeholder = '请选择结束日期' + placeholder;\n }\n items.push(itemStart);\n items.push(itemEnd);\n } else {\n items.push(this.initFormConfig(o));\n }\n },\n initFormConfig(o, type) {\n let key = o.tableField;\n if (o.tableNameSEARCHToOtherProp != undefined && o.tableNameSEARCHToOtherProp != '') {\n key = o.tableNameSEARCHToOtherProp + '.' + key;\n }\n let item = {\n align: 'left',\n field: key,\n span: 6,\n searchSort: o.searchSort,\n title: o.titleSEARCHToOtherProp != undefined ? o.titleSEARCHToOtherProp : o.title,\n key: key,\n type: o.selectType,\n selectDom: o.selectDom,\n tableName: o.tableNameSEARCHToOtherProp,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true,\n toDate: o.toDateSEARCHToOtherProp,\n itemRender: {\n name: '$input',\n props: {\n placeholder: '请输入' + o.title,\n clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n }\n }\n };\n // if(this.table.editConfig && (\n // this.table.editConfig.enabled === true ||\n // (typeof this.table.editConfig.enabled === 'string' &&\n // this.table.editConfig.enabled.toLowerCase() === 'true')\n // )){\n // o.editRender = {\n // name:'$input',\n // props: {\n // placeholder: '请输入' + o.title,\n // clearable: o.clearableSEARCHToOtherProp == '1' ? false : true\n // }\n // }\n // }\n try {\n this.table.formConfig.data[item.key] = eval(o.valueSEARCHToOtherProp);\n } catch (e) {}\n if (type == 5) {\n item.title = o.title + \"开始\";\n item.type = 5;\n item.field = \"$\" + o.tableField;\n item.key = \"$\" + o.tableField;\n } else if (type == 6) {\n item.field = o.tableField + \"$\";\n item.type = 6;\n item.key = o.tableField + \"$\";\n item.title = o.title + \"结束\";\n }\n if ((item.type == 6 || item.type == 5) && o.selectDom == undefined) {\n o.selectDom = 7;\n }\n this.getItemRender(o, item, type);\n if (item.title && item.title.length > 6) {\n item.titleWidth = 20 * (item.title.length - 2);\n } else if (item.title.toString().trim().length == 0) {\n item.titleWidth = 0;\n }\n if (o.spanSEARCHToOtherProp != undefined) {\n item.span = 6;\n }\n return item;\n },\n getItemRender(o, item, type) {\n if (o.dictCode) {\n delete item.itemRender;\n item.slots = {\n default: o.selectDom + item.field\n };\n item.slotsName = o.selectDom + item.field;\n item.options = this.dictVal(o.dictCode);\n item.placeholder = '请选择' + o.title;\n item.clearable = o.clearableSEARCHToOtherProp == '1';\n item.multiple = o.selectDom == '8';\n } else if (o.selectDom == 7) {\n item.itemRender.props.type = 'integer';\n } else if (o.selectDom == 10) {\n item.itemRender.name = 'textarea';\n } else if (o.selectDom == 3 || o.selectDom == 6) {\n delete item.itemRender;\n item.domDate = true;\n if (o.selectType == 98 && item.selectDom == 6) {\n item.span = 7;\n item.domType = 'daterange';\n } else {\n item.domType = item.selectDom == 3 ? 'datetime' : 'date';\n }\n //这里跟element plus不一样\n item.domFormat = vue__WEBPACK_IMPORTED_MODULE_4__.version.split('.')[0] == 2 ? 'yyyy-MM-dd' : 'YYYY-MM-DD';\n if (item.selectDom == 3) {\n item.domFormat = item.domFormat + ' HH:mm:ss';\n }\n item.slots = {\n default: o.selectDom + item.field + \"_time\"\n };\n item.slotsName = o.selectDom + item.field + \"_time\";\n item.placeholder = '请选择';\n if (type == 5) {\n item.placeholder += \"开始\";\n } else if (type == 6) {\n item.placeholder += \"结束\";\n }\n if (o.selectDom == 3) {\n item.placeholder += \"时间\";\n }\n }\n },\n setColumnShowOverFlow(column, optionObj) {\n if (optionObj) {\n if (optionObj.table && optionObj.table.columnConfig && optionObj.table.columnConfig.showOverflow) {\n if (column.type != 'seq' || column.type != 'checkbox') {\n column.showOverflow = optionObj.table.columnConfig.showOverflow;\n }\n }\n }\n },\n initMergeCells() {\n if (this.table.mergeCells) {\n this.table.mergeCells = JSON.parse(this.table.mergeCells);\n return;\n }\n if (this.table.mergeFields && this.table.mergeFields.length != 0) {\n this.table.spanMethod = this.mergeRowMethod;\n }\n },\n // 通用行合并函数(将相同多列数据合并为一行)\n mergeRowMethod({\n row,\n _rowIndex,\n column,\n visibleData\n }) {\n const cellValue = row[column.field];\n if (cellValue && this.table.mergeFields.includes(column.field)) {\n const prevRow = visibleData[_rowIndex - 1];\n let nextRow = visibleData[_rowIndex + 1];\n if (prevRow && prevRow[column.field] === cellValue) {\n return {\n rowspan: 0,\n colspan: 0\n };\n } else {\n let countRowspan = 1;\n while (nextRow && nextRow[column.field] === cellValue) {\n nextRow = visibleData[++countRowspan + _rowIndex];\n }\n if (countRowspan > 1) {\n return {\n rowspan: countRowspan,\n colspan: 1\n };\n }\n }\n }\n },\n setDictCellStyle({\n row,\n rowIndex,\n $rowIndex,\n column,\n columnIndex,\n $columnIndex\n }) {\n if (column.params && column.params.cssClass) {\n return column.params.cssClass[row[column[(0,_utils_columnProp__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(column)]]];\n }\n },\n setTableStyle(option) {\n if (option['cell-style'] === undefined) {\n option['cell-style'] = {\n flag: \"flag##function#\",\n isFunction: true\n };\n }\n option['cell-style']['code'] = \"let OTMixinColumnMethod_setDictCellStyle = this.setDictCellStyle(params); if(OTMixinColumnMethod_setDictCellStyle){ return OTMixinColumnMethod_setDictCellStyle;}\\n\" + option['cell-style']['code'];\n }\n }\n};\n\n//# sourceURL=webpack://olp-table/./src/mixins/VTMixin/OTMixinColumnMethod.js?");
|
|
10765
10765
|
|
|
10766
10766
|
/***/ }),
|
|
10767
10767
|
|