olp-table 7.2.10 → 7.2.11
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/bundle-report.html +3 -3
- package/olp-table.common.js +1 -1
- package/olp-table.umd.js +1 -1
- package/olp-table.umd.min.js +1 -1
- 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 spli
|
|
|
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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && !this.state.saveUrl.concat(\"/online/crudAes/\")) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && this.state.saveUrl.indexOf(\"/online/crudAes/\") == -1) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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
|
|
package/olp-table.umd.js
CHANGED
|
@@ -531,7 +531,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var spli
|
|
|
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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && !this.state.saveUrl.concat(\"/online/crudAes/\")) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && this.state.saveUrl.indexOf(\"/online/crudAes/\") == -1) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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
|
|
package/olp-table.umd.min.js
CHANGED
|
@@ -531,7 +531,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var spli
|
|
|
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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && !this.state.saveUrl.concat(\"/online/crudAes/\")) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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 _utils_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _api_dist__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/api/dist */ \"./src/api/dist.js\");\n/* harmony import */ var _store_dict__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/dict */ \"./src/store/dict.js\");\n/* harmony import */ var _store_dictType__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/dictType */ \"./src/store/dictType.js\");\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\n\nconst dict = (0,_store_dict__WEBPACK_IMPORTED_MODULE_9__.storeDict)();\nconst dictType = (0,_store_dictType__WEBPACK_IMPORTED_MODULE_10__.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: \"olForm\",\n components: {\n OlTableSelect: _components_ol_table_select_vue__WEBPACK_IMPORTED_MODULE_11__[\"default\"]\n },\n inject: ['http'],\n props: {\n isDialog: {\n type: Boolean,\n default: true\n }\n },\n data() {\n return {\n formData: {},\n optionData: {},\n form: {},\n initOk: false,\n dynamicSlotsTable: [],\n dynamicSlotsField: {},\n dynamicSlotsOtherResult: {},\n show: true,\n state: {\n isDialog: true,\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 theme: 't1',\n tableConfigId: '',\n dbName: '',\n tableName: '',\n otherProp: {}\n }\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 getParams() {\n let params = {\n tableConfigId: this.state.tableConfigId,\n dbName: this.state.dbName,\n tableName: this.state.tableName,\n columnAndValueMap: {}\n };\n if (this.state.type != '0') {\n let formData = this.$refs.formRef.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.columnAndValueMap[prop] = value;\n }\n } else {\n params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);\n }\n if (this.state.saveUrl && this.state.saveUrl.indexOf(\"/online/crudAes/\") == -1) {\n return params.columnAndValueMap;\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.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]];\n delete params.columnAndValueMap[kvs[0]];\n } else {\n let val = params.columnAndValueMap[kvs];\n params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];\n delete params.columnAndValueMap[kvs];\n }\n }\n } else {\n // 编辑时默认更新条件为id\n params.whereMap['id'] = this.formData['id'];\n if (!params.whereMap['id']) {\n params.whereMap['id'] = this.formData['t1_id'];\n }\n delete params.columnAndValueMap['id'];\n }\n } else if (this.state.updateKey) {\n let split = this.state.updateKey.split(',');\n params['genIdMap'] = {};\n for (let kv of split) {\n let kvs = kv.split(\"=\");\n if (kvs.length == 2) {\n params['genIdMap'][kvs[0]] = kvs[1];\n } else {\n params['genIdMap'][kvs[0]] = 'uuid';\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 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 async save() {\n let params = this.getParams();\n if (this.state.otherProp && this.state.otherProp.beforeSave) {\n try {\n let next = eval(\"(params)=>{\" + this.state.otherProp.beforeSave + \"}\");\n if (next(params) === false) {\n return;\n }\n } catch (e) {\n console.log(e);\n return;\n }\n }\n this.state.loading = true;\n try {\n let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save';\n if (this.state.requestType.toLowerCase() == \"put\") {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.put)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else if (!this.state.saveUrl || this.state.saveUrl.indexOf(\"/online/crudAes/\") != -1) {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.postAes)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n } else {\n await (0,_utils_http_httpUtils__WEBPACK_IMPORTED_MODULE_5__.post)(this.http, url, params).then(status => {\n this.saveOk(status);\n });\n }\n } catch (e) {\n console.error(e);\n } finally {\n this.state.loading = false;\n }\n },\n initFormColumn(data) {\n for (let column of this.form.column) {\n if (data.disabled || column.disabled == 1) {\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 } else {\n this.initDict(column);\n }\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;\" + \"let {value} = params;\" + replaceDollarBraces(column[event]) + \"})\" + \"}\");\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n },\n doInit(data) {\n if (data.disabled) {\n this.show = false;\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.state.edit = data['code'] == 'edit' == true;\n this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';\n if (data.form.title) {\n this.state.title = data.form.title;\n }\n this.state.dialogVisible = true;\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 this.form = data.form;\n if (this.state.type == 0) {\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 this.initFormColumn(data);\n } else {\n let {\n width,\n height\n } = this.form.formConfig;\n //赋值弹窗宽度和高度\n this.state.width = width;\n this.state.maxHeight = height + 'px';\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 init(data) {\n try {\n this.beforeInit();\n this.doInit(data);\n setTimeout(() => {\n this.afterInit();\n }, 350);\n } catch (e) {\n console.error(e);\n }\n },\n /**\r\n * 初始化后回调\r\n */\n afterInit() {\n if (this.state.otherProp && this.state.otherProp.afterInit) {\n try {\n eval(this.state.otherProp.afterInit);\n } catch (e) {\n console.log(e);\n }\n }\n },\n /**\r\n * 初始化前回调\r\n */\n beforeInit() {\n if (this.state.otherProp && this.state.otherProp.beforeInit) {\n try {\n eval(this.state.otherProp.beforeInit);\n } catch (e) {\n console.log(e);\n }\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 //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”\n let dataType = typeof this.formData[column.prop];\n if ([\"number\", \"boolean\"].indexOf(dataType) != -1) {\n this.formData[column.prop] = String(this.formData[column.prop]);\n column.value = this.formData[column.prop];\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 column.value = this.formData[column.prop];\n } else if (column.value != undefined) {\n this.formData[column.prop] = String(column.value);\n } else {\n // 数据字典与值类型不一致\n 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_8__.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_9__.storeDict)().init(this.http);\n });\n },\n created() {}\n});\n\n//# sourceURL=webpack://olp-table/./src/components/table/ol-form/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
|
|