Merge remote-tracking branch 'origin/master'
| | |
| | | import {paramLow,callPreEvent, callPostEvent} from './BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | |
| | | import AddEditDialog from "@/components/actions/AddEditDialog" |
| | | |
| | | export const doAction = (options) => { |
| | | options.paramVOS = paramLow(options.paramVOS) |
| | |
| | | */ |
| | | export const doAdd = (options,callback)=> { |
| | | const paramVOS = options.paramVOS; |
| | | if (!paramVOS['form'] && !paramVOS['context']) { |
| | | if (!paramVOS['form'] && !paramVOS['context']&& !paramVOS['content']) { |
| | | Vue.prototype.$message.error("æé®é
ç½®ä¸æ£ç¡®"); |
| | | return false; |
| | | } |
| | | |
| | | Vue.prototype.$message.success('æ§è¡'+paramVOS.title); |
| | | if(callback){ |
| | | callback(options); |
| | | const dialogConstructor = Vue.extend(AddEditDialog); |
| | | let instance = new dialogConstructor(); |
| | | instance.props={ |
| | | sourceData:options.sourceData, |
| | | dataStore:options.dataStore, |
| | | paramVOS:paramVOS |
| | | } |
| | | const vm = instance.$mount(); |
| | | vm.visible=true; |
| | | vm.dialogClose=function (){ |
| | | document.body.removeChild(vm.$el); |
| | | instance.$destroy(); |
| | | instance = null; |
| | | }; |
| | | vm.prototype.saveCallback=function (){ |
| | | if (callback) { |
| | | callback(options); |
| | | } |
| | | } |
| | | document.body.appendChild(vm.$el); |
| | | |
| | | } |
| | | /** |
| | | * åç½®äºä»¶ |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | //è·å䏿 |
| | | export const getDicts = (id) => { |
| | | return request({ |
| | | url: '/api/uiDataController/getEnum', |
| | | method: 'get', |
| | | params: { |
| | | comboxKey:id, |
| | | id:id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/blade-system/dict/list', |
| | |
| | | import vciWebRefer from "@/components/refer/vciWebRefer.vue"; |
| | | import { formatMilliseconds } from "@/util/formatTime"; |
| | | import { validatenull } from "@/util/validate"; |
| | | import { getDicts } from "@/api/system/dict"; |
| | | |
| | | export default { |
| | | name: "basicForm", |
| | |
| | | datetime: "datetime", |
| | | date: "date", |
| | | refer: "refer", |
| | | multiFile:"upload" |
| | | } |
| | | }; |
| | | }, |
| | |
| | | this.option.group = group; |
| | | }, |
| | | initItem(item){ |
| | | const type=this.columnType[this.type] || this.type |
| | | const type=this.columnType[item.type] || item.type |
| | | const col= { |
| | | ...item, |
| | | label: item.text, |
| | | prop: item.field, |
| | | showProp:item.showField, |
| | | type: type, |
| | | labelWidth: this.labelWidth || (item.text.length >= 6 ? 115 : 90), |
| | | disabled: item.disabled || this.disabled, |
| | | disabled: item.readOnly || this.disabled, |
| | | span: item.span |
| | | ? item.span |
| | | : item.type === "textarea" |
| | |
| | | trigger: "blur" |
| | | }] |
| | | } |
| | | if (col.propType === "dict") { |
| | | if (col.type === "select") { |
| | | if(!validatenull(col.dictCode)) { |
| | | /*this.getDicts(col.dictCode).then((res) => { |
| | | if (res.success) { |
| | | const dic = res.obj.data; |
| | | /*getDicts(col.dictCode).then((res) => { |
| | | if (res.data.success){ |
| | | if(res.data.data && res.data.obj == null){ |
| | | res.data.obj = res.data.data |
| | | } |
| | | const dic = res.data.obj; |
| | | col.dicData = dic.map((d) => { |
| | | return { |
| | | label: d.name, |
| | | key: d.code, |
| | | value: d.code, |
| | | label: d.value, |
| | | key: d.key, |
| | | value: d.key, |
| | | attributes:d.attributes |
| | | }; |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog v-dialogDrag |
| | | :title="paramVOS.title" |
| | | :visible.sync="visible" |
| | | :width="width" |
| | | :style="'height:'+height || 'auto'" |
| | | :append-to-body="true" |
| | | class="avue-dialog avue-dialog--top" |
| | | @close="dialogClose"> |
| | | dialog |
| | | <basic-form ref="formRef" v-if="paramVOS.form"></basic-form> |
| | | <ui-view ref="uiViewRef" v-else-if="paramVOS.content || paramVOS.context"></ui-view> |
| | | <div v-if="paramVOS.form" class="avue-dialog__footer"> |
| | | <el-button type="primary" @click="saveHandler">ä¿ å</el-button> |
| | | <el-button @click="escHandler">å æ¶</el-button> |
| | | <el-button @click="resetValue">é ç½®</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import uiView from "@/views/base/UIContentViewerInDialog" |
| | | import {dataForm} from "@/api/base/ui"; |
| | | |
| | | export default { |
| | | name: "AddEditDialog", |
| | | components:{uiView}, |
| | | props: { |
| | | sourceData: { |
| | | //æå±åºåçä¸ä¸åºåé䏿°æ® |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | dataStore: { |
| | | //å¼¹çªæ¶æé®æå±åºåé䏿°æ® |
| | | type: Array, |
| | | default: [] |
| | | }, |
| | | paramVOS: { |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | width: { |
| | | type: String, |
| | | default:'70%' |
| | | }, |
| | | height: { |
| | | type: String, |
| | | default:'500px' |
| | | }, |
| | | }, |
| | | data(){ |
| | | return { |
| | | visible:false |
| | | } |
| | | }, |
| | | computed:{ |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | methods: { |
| | | dialogClose() { |
| | | this.visible = false; |
| | | }, |
| | | onLoad: function () { |
| | | if (Object.keys(this.sourceData).length > 0 && this.isShow) { |
| | | this.loading = true; |
| | | dataForm(this.params).then(res => { |
| | | this.form = res.data.obj; |
| | | this.loading = false; |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | }, |
| | | saveHandler() { |
| | | this.dialogClose(); |
| | | }, |
| | | escHandler() { |
| | | this.dialogClose(); |
| | | }, |
| | | resetValue() { |
| | | this.$refs.formRef.resetValue(); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {dataForm} from "@/api/base/ui"; |
| | | |
| | | export default { |
| | | name: "dynamic-form", |
| | |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | //ä¸ä¸åºåä¸å¡ç±»å |
| | | sourceBtmType:{ |
| | | type: String |
| | | }, |
| | | dataStore: { |
| | | //å¼¹çªæ¶æé®æå±åºåé䏿°æ® |
| | | type: Array, |
| | |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | params:{}, |
| | | sourceDataMapParams:{}, |
| | | currentDefineVO:this.componentVO.formDefineVO, |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | sourceData: { |
| | | handler(newval) { |
| | | //æºæ°æ®æååæ¶åæ´å½ååºåæ°æ® |
| | | console.log(this.areasName); |
| | | console.log(newval); |
| | | this.sourceDataMapParams=this.sourceDataMap(); |
| | | this.getParams(); |
| | | this.handleRefresh(); |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.getParams(); |
| | | }, |
| | | methods: { |
| | | sourceDataMap: function () { |
| | | const sourceDataMap = {}; |
| | | if (Object.keys(this.sourceData).length>0) { |
| | | if(this.sourceData.oid ) { |
| | | if (this.sourceData.oid.indexOf('@vcitreesep@') > -1) { |
| | | this.sourceData.oid = this.sourceData.oid.split('@vcitreesep@')[1]; |
| | | } |
| | | sourceDataMap.sourceBtmName = this.sourceBtmType;; |
| | | sourceDataMap.sourceOid = this.sourceData.oid; |
| | | } |
| | | for (let i in this.sourceData) { |
| | | let item = this.sourceData[i] |
| | | if (item && item.constructor === Object) return; |
| | | if (i == 'type' || i == 'context' || i == 'content') return; |
| | | sourceDataMap['sourceData["' + i + '"]'] = item |
| | | } |
| | | } |
| | | |
| | | if (Object.keys(this.paramVOS).length>0) { |
| | | for (let i in this.paramVOS) { |
| | | let item = this.paramVOS[i] |
| | | if (item && item.constructor === Object) return; |
| | | if (i == 'type' || i == 'context' || i == 'content') return; |
| | | sourceDataMap['sourceData["' + i + '"]'] = item |
| | | } |
| | | } |
| | | return sourceDataMap; |
| | | }, |
| | | getParams: function () { |
| | | const formParams = { |
| | | btmname: this.currentDefineVO.btmType, |
| | | btmType:this.currentDefineVO.btmType, |
| | | formDefineId: this.currentDefineVO.id, |
| | | oid:this.currentDefineVO.oid |
| | | }; |
| | | if(this.dataStore[0] && this.dataStore[0].oid) { |
| | | formParams.oid = this.dataStore[0].oid; |
| | | } |
| | | const sourceDataMapList = this.sourceDataMapParams; |
| | | |
| | | this.params = Object.assign({},formParams, sourceDataMapList); |
| | | console.log(this.params) |
| | | }, |
| | | onLoad:function () { |
| | | if (Object.keys(this.sourceData).length>0 && this.isShow) { |
| | | this.loading = true; |
| | | dataForm(this.params).then(res => { |
| | | this.form = res.data.obj; |
| | | this.loading = false; |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | }, |
| | | handleRefresh(){ |
| | | |
| | | } |