| | |
| | | |
| | | export const getTree = (params,url) => { |
| | | return request({ |
| | | url: url || '/api/ubcs-code/codeClassify/treeCodeClassify', |
| | | url: url, |
| | | method: 'get', |
| | | params: { |
| | | ...params |
| | |
| | | |
| | | export const getLazyTree = (params,url) => { |
| | | return request({ |
| | | url: url||'/api/ubcs-system/dept/lazy-tree', |
| | | url: url, |
| | | method: 'get', |
| | | params: { |
| | | ...params |
| | |
| | | </span> |
| | | </template> |
| | | <template :slot="item.prop + ''" v-for="item in slotColumnList"> |
| | | <!-- <vciWebRefer |
| | | <vciWebRefer |
| | | v-if="item.type == 'refer'" |
| | | :value="item.value" |
| | | :options="item.referConfig || {}" |
| | | ></vciWebRefer> --> |
| | | :referConfig="item.referConfig || {}" |
| | | ></vciWebRefer> |
| | | </template> |
| | | </avue-form> |
| | | </div> |
| | |
| | | tooltips: "请输入数字", |
| | | type: "text", |
| | | unique: false, |
| | | verify: /^[0-9]+$/g, |
| | | verify: "/[0-9]/", |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | |
| | | }) |
| | | .then((res) => { |
| | | if (res.status === 200) { |
| | | this.$emit('getFormTemplateEnd', res.data) |
| | | this.templateRender(res.data.formDefineVO.items); |
| | | this.$emit("getFormTemplateEnd", res.data); |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | |
| | | format: formItem.dateFormate, |
| | | keyAttr: formItem.keyAttr, |
| | | value: formItem.defaultValue, |
| | | // tip: formItem.tooltips, |
| | | // tipPlacement: "right", |
| | | placeholder: formItem.inputTip, |
| | | comboxKey: formItem.comboxKey, |
| | | display: !formItem.hidden, |
| | | maxlength: formItem.maxlength, |
| | | filterable: true, |
| | | referConfig: formItem.referConfig, |
| | | referConfig:formItem.type=='refer'?{ |
| | | title:formItem.text, |
| | | showField:formItem.showField || formItem.field, |
| | | field: formItem.field, |
| | | placeholder: formItem.inputTip, |
| | | options:formItem.referConfig, |
| | | value:'', |
| | | text:'' |
| | | }:{}, |
| | | change: () => { |
| | | this.changeFun(formItem.displayExtension, formItem.prop); |
| | | }, |
| | | span: formItem.type === "textarea" ? 24 : this.trendsSpan, |
| | | rules: [ |
| | | { |
| | |
| | | this.formIndex++; |
| | | this.loading = false; |
| | | this.geDictData(dictKeys); |
| | | this.getFormDetail(); |
| | | this.getFormDetail() |
| | | }, |
| | | // 使用传入的表单数据配置 |
| | | resetFormConfig(formItem) { |
| | |
| | | return val; |
| | | } |
| | | }, |
| | | changeFun(displayExtension, prop) { |
| | | // executeCode({displayExtension, data: this.form}).then(res => { |
| | | // this.form[prop] = res.data.data |
| | | // }) |
| | | }, |
| | | // 获取swich和已拿到的下拉数据 |
| | | getDataList(type, dicData) { |
| | | if (type === "truefalse") { |
| | |
| | | }); |
| | | }, |
| | | // 表单校验 |
| | | validate() { |
| | | validate() { |
| | | return new Promise((resolve) => { |
| | | this.$refs.form.validate((valid, done, msg) => { |
| | | console.error(msg, valid); |
| | | if (valid) { |
| | | done(); |
| | | resolve(true); |
| | | } else { |
| | | resolve(false); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | // 获取表单详情数据 |
| | | getFormDetail() { |
| | | if (this.type === 'add') return |
| | | if (this.type === "add") return; |
| | | getFormDetail({ templateOid: this.templateOid, oid: this.rowOid }).then( |
| | | (res) => { |
| | | this.form = Object.assign(this.form, res.obj) |
| | | console.log(res, "res"); |
| | | console.error(msg, valid) |
| | | if (valid) { |
| | | resolve(true) |
| | | } else { |
| | | resolve(false); |
| | | } |
| | | ); |
| | | }); |
| | | }) |
| | | |
| | | }, |
| | | // 获取表单数据 |
| | | getFormDetail() { |
| | | if (this.type === 'add') return |
| | | getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then(res => { |
| | | console.log(res, 'res'); |
| | | }) |
| | | } |
| | | }, |
| | | watch: { |
| | | // 表单数据修改反馈到父组件 |
| | |
| | | <template> |
| | | <vciWebReferTree v-if="refertype=='tree'" :value="value" :options="options"></vciWebReferTree> |
| | | <vciWebReferTable v-else-if="refertype=='table'" :value="value" :options="options"></vciWebReferTable> |
| | | <vciWebReferDefalut v-else :value="value" :options="options"></vciWebReferDefalut> |
| | | <vciWebReferTree v-if="refertype=='tree'" :value="value" :referConfig="referConfig"></vciWebReferTree> |
| | | <vciWebReferTable v-else-if="refertype=='table'" :value="value" :referConfig="referConfig"></vciWebReferTable> |
| | | <vciWebReferDefalut v-else :value="value" :referConfig="referConfig"></vciWebReferDefalut> |
| | | </template> |
| | | |
| | | <script> |
| | | import vciWebReferTree from "./vciWebReferTree.vue"; |
| | | import vciWebReferTable from "./vciWebReferTable.vue"; |
| | | import vciWebReferDefalut from "./vciWebReferTable.vue"; |
| | | import {validatenull} from "@/util/validate"; |
| | | export default { |
| | | name: "vciWebRefer", |
| | | props:["options","value"], |
| | | props:["referConfig"], |
| | | components: { vciWebReferTree,vciWebReferTable,vciWebReferDefalut}, |
| | | data() { |
| | | return { |
| | | refertype:this.options.type |
| | | refertype: this.referConfig.options.type, |
| | | isMuti: ("true" == this.referConfig.options.isMuti || this.referConfig.options.isMuti == true || this.referConfig.options.muti == true) ? true : false, |
| | | value: this.referConfig.value |
| | | }; |
| | | }, |
| | | created() { |
| | | var title =this.referConfig.title || ''; |
| | | title = title.replace(":",""); |
| | | if(title){ |
| | | title = validatenull(this.referConfig.title)?('为【' + title + '】选取值'):this.referConfig.title; |
| | | }else{ |
| | | title = validatenull(this.referConfig.title)?('为【' + this.referConfig.showField + '】选取值'):this.referConfig.title; |
| | | } |
| | | this.referConfig.title= title; |
| | | this.referConfig.isMuti=this.isMuti |
| | | if(this.refertype=='tree'){ |
| | | console.log('referConfig:') |
| | | console.log(this.options) |
| | | console.log(this.referConfig) |
| | | } |
| | | |
| | | }, |
| | |
| | | <script> |
| | | export default { |
| | | name: "vciWebReferTable", |
| | | props:["options","value"], |
| | | props:["referConfig","value"], |
| | | data() { |
| | | return { |
| | | placeholder:'请选择数据', |
| | | placeholder:this.referConfig.placeholder || '请选择数据', |
| | | column:{ |
| | | children:{ |
| | | border: true, |
| | |
| | | }, |
| | | }, |
| | | props: { |
| | | label: 'name', |
| | | value: 'oid' |
| | | value: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', |
| | | label: this.referConfig.textField || this.referConfig.options.textField || "name" |
| | | } |
| | | }; |
| | | }, |
| | |
| | | <template> |
| | | <avue-input-tree :props="props" :lazy="lazy" :tree-load="treeLoad" :leaf-only="!options.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree> |
| | | <avue-input-tree :props="props" :lazy="lazy" :tree-load="treeLoad" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | |
| | | export default { |
| | | name: "vciWebReferTree", |
| | | props:["options","value"], |
| | | props:["referConfig","value"], |
| | | data() { |
| | | return { |
| | | lazy:this.options.loadType == 'node', |
| | | isMuti:this.options.muti, |
| | | placeholder:'请选择内容', |
| | | options: this.referConfig.options, |
| | | lazy: this.referConfig.options.loadType == 'node', |
| | | isMuti: this.referConfig.isMuti, |
| | | placeholder: this.referConfig.placeholder || '请选择内容', |
| | | props: { |
| | | value:this.options.valueField || 'oid', |
| | | label:this.options.textField || "name" |
| | | value: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', |
| | | label: this.referConfig.textField || this.referConfig.options.textField || "name" |
| | | //value:"value", |
| | | //label:"title" |
| | | }, |
| | | treeData:[], |
| | | params:{} |
| | | }; |
| | | treeUrl: this.referConfig.options.url || '',//'/api/ubcs-code/codeClassify/treeCodeClassify', |
| | | treeData: [], |
| | | params: {}, |
| | | loadType: {'all': 'all', 'node': 'node'}, |
| | | copyParam: ['btmType', 'lnType', 'toBtmType', 'textField', 'valueField', 'parentFieldName', 'parentValue', 'sort', 'order', 'isDirection', 'whereSql', 'isMuti', 'queryScheme', 'isQueryAllColumn', 'queryColumn', 'split', 'loadType', 'onlyLeaf', 'onlyLeafText', 'parentUsedField'] |
| | | } |
| | | }, |
| | | created() { |
| | | this.getParams(); |
| | | }, |
| | | mounted() { |
| | | if(!this.lazy){ |
| | | this.getTree() |
| | | if(this.options.data){//如果是固定数据的情况下 |
| | | this.treeData=this.options.data |
| | | }else{ |
| | | this.getTree() |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | getParams:function (){ |
| | | var queryParams = {}; |
| | | debugger; |
| | | if(this.options.extraParams){ |
| | | queryParams = this.options.extraParams; |
| | | } |
| | | for(var i= 0 ; i < this.copyParam.length ; i ++){ |
| | | if(this.copyParam[i] == "btmType") { |
| | | queryParams[this.copyParam[i]] = this.options['referBo'] || this.options['referType']; |
| | | }else if(this.copyParam[i] in this.options){ |
| | | queryParams[this.copyParam[i]] = this.options[this.copyParam[i]]; |
| | | } |
| | | } |
| | | queryParams['referBo'] = this.options['referBo'] || this.options['referType']; |
| | | queryParams['selectAllLevel'] = (this.options.loadType == this.loadType.all?true:false);//true时后台会报错 |
| | | if(queryParams.isMuti =="true"){ |
| | | queryParams.muti =true; |
| | | } |
| | | if(queryParams.isQueryAllColumn =="true"){ |
| | | queryParams.isQueryAllColumn = true; |
| | | } |
| | | if(this.options.useFormKey && this.options.formValues){ |
| | | //使用表单上的字段来过滤 |
| | | queryParams['conditionMap["' + (this.options.paramForFormKey?this.options.paramForFormKey:this.options.useFormKey) + '"]'] = this.options.formValues[this.options.useFormKey]; |
| | | } |
| | | if (!this.options.loadType) { |
| | | this.options.loadType = this.loadType.node; |
| | | } |
| | | queryParams['queryAllLevel'] = this.options.loadType == this.loadType.node? false : true;//默认逐级展开 |
| | | queryParams['loadType'] = this.options.loadType; |
| | | queryParams['multipleSelect'] = this.isMuti; |
| | | queryParams['isMuti'] = queryParams['multipleSelect']; |
| | | if (this.options.remoteSort && this.options.initSort) { |
| | | queryParams['order'] = this.options.initSort.type;//方法 |
| | | queryParams['sort'] = this.options.initSort.field;//字段 |
| | | } |
| | | if (this.options.rootParams) { |
| | | for (var key in this.options.rootParams) { |
| | | queryParams[key] = this.options.rootParams[key]; |
| | | } |
| | | } |
| | | if (this.options.conditionParams) { |
| | | //说明是扩展属性 |
| | | for (var key in this.options.conditionParams) { |
| | | queryParams['conditionMap["' + key + '"]'] = this.options.conditionParams[key];//新的方式 |
| | | } |
| | | } |
| | | if(this.options.where ) { |
| | | for (var key in this.options.where) { |
| | | queryParams['conditionMap["' + key + '"]'] = this.options.where[key];//新 |
| | | } |
| | | } |
| | | if (this.options.treeExtandParams) { |
| | | //说明是扩展属性 |
| | | for (var key in this.options.treeExtandParams) { |
| | | queryParams['extandParamsMap["' + key + '"]'] = this.options.treeExtandParams[key];//新的方式 |
| | | } |
| | | } |
| | | if (this.options.sourceDataParams) { |
| | | //说明是扩展属性 |
| | | for (var key in this.options.sourceDataParams) { |
| | | if (key && key.constructor === Object) return; |
| | | queryParams['sourceData["' + key + '"]'] = this.options.sourceDataParams[key];//新的方式 |
| | | } |
| | | } |
| | | if (this.options.replaceParams) { |
| | | //说明是扩展属性 |
| | | for (var key in this.options.replaceParams) { |
| | | if (key && key.constructor === Object) return; |
| | | queryParams['replaceMap["' + key + '"]'] = this.options.replaceParams[key];//新的方式 |
| | | } |
| | | } |
| | | this.params=queryParams; |
| | | |
| | | }, |
| | | getTree(){ |
| | | getTree(this.params,this.options.url).then(res => { |
| | | getTree(this.params,this.treeUrl).then(res => { |
| | | this.treeData=res.data |
| | | }) |
| | | }, |
| | | treeLoad: function (treeNode, resolve) { |
| | | const parentId = (treeNode.level === 0) ? 0 : treeNode.data.id; |
| | | getLazyTree({...this.params,parentId:parentId}).then(res => { |
| | | const parentOid = (treeNode.level === 0) ? 0 : treeNode.data.oid; |
| | | this.params.parentOid=parentOid.indexOf('@vcitreesep@') > -1 ? parentOid.split('@vcitreesep@')[1] : parentOid; |
| | | this.params.parentValue=this.params.parentOid; |
| | | this.params.parentBtmName=treeNode.data.attributes.btmName || treeNode.data.attributes.btmname; |
| | | this.params.parentBtmType=this.params.parentBtmName; |
| | | |
| | | if (this.options.rootParams && treeNode.level !== 0) { |
| | | for (var key in this.options.rootParams) { |
| | | delete this.params[key] |
| | | } |
| | | } |
| | | getLazyTree(this.params,this.treeUrl).then(res => { |
| | | resolve(res.data.data.map(item => { |
| | | return { |
| | | ...item, |