| | |
| | | </el-button> |
| | | <span v-if="tableHeadFindData.length > 0 "> |
| | | <el-select slot="prepend" v-model="keyWordFind" placeholder="请选择" size="small" @change="searchChange"> |
| | | <el-option v-for="item in tableHeadFindData" :key="item.id" :label="item.label" :value="item.prop" ></el-option> |
| | | <el-option v-for="item in tableHeadFindData" :key="item.id" :label="item.label" |
| | | :value="item.prop"></el-option> |
| | | </el-select> |
| | | <el-input v-model="WupinFindValue" placeholder="请输入关键字按回车查询" |
| | | size="small" style="width: 180px; margin-left: 5px; margin-top: 10px" v-if="!isTimeStatus" |
| | | <el-input v-if="!isTimeStatus" v-model="WupinFindValue" |
| | | placeholder="请输入关键字按回车查询" size="small" style="width: 180px; margin-left: 5px; margin-top: 10px" |
| | | @keyup.enter.native="tableFindInp"></el-input> |
| | | </span> |
| | | <span class="block" v-if="tableHeadFindData.length > 0 && isTimeStatus"> |
| | | <span v-if="tableHeadFindData.length > 0 && isTimeStatus" class="block"> |
| | | <el-date-picker |
| | | v-model="dateValue" |
| | | placeholder="选择日期" |
| | | size="small" |
| | | type="date" |
| | | style="margin-left: 5px" |
| | | @change="dateChange" |
| | | placeholder="选择日期"> |
| | | type="date" |
| | | @change="dateChange"> |
| | | </el-date-picker> |
| | | </span> |
| | | <span v-if="tableHeadFindData.length > 0" style="margin-left: 10px"> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | isTimeStatus:false, |
| | | isTimeName:'', |
| | | dateValue:"", |
| | | isTimeStatus: false, |
| | | isTimeName: '', |
| | | dateValue: "", |
| | | //批量编辑对话框 |
| | | bulkeditvisible: false, |
| | | LinkVisible: false, |
| | |
| | | |
| | | if (_index == 0) { |
| | | this.keyWordFind = record.queryField; |
| | | }; |
| | | } |
| | | ; |
| | | // if(record.fieldType === "datetime"){ |
| | | // this.isTimeStatus = true; |
| | | // console.log(this.isTimeStatus) |
| | |
| | | templateOid: this.templateOid, |
| | | codeClassifyOid: this.codeClassifyOid, |
| | | ...val, |
| | | page: this.page.currentPage = 1,/** 每次点击高级查询都应该从第一页开始*/ |
| | | page: this.page.currentPage = 1, /** 每次点击高级查询都应该从第一页开始*/ |
| | | limit: this.page.pageSize |
| | | }); |
| | | this.tableData = res.data.data; |
| | |
| | | }); |
| | | // console.log(this.isTimeStatus) |
| | | }, |
| | | dateChange(val){ |
| | | if(val){ |
| | | dateChange(val) { |
| | | if (val) { |
| | | const momentDate = moment(this.dateValue); |
| | | const dateString = momentDate.format("yyyy-MM-DD"); |
| | | this.isLoading = true; |
| | |
| | | codeClassifyOid: this.codeClassifyOid, |
| | | page: this.page.currentPage, |
| | | limit: this.page.pageSize, |
| | | ['conditionMap[' + this.keyWordFind + ']']: dateString |
| | | ['conditionMap[' + this.keyWordFind + ']']: dateString |
| | | }).then(res => { |
| | | this.tableData = res.data.data; |
| | | this.page.total = res.data.total; |
| | |
| | | <template> |
| | | <div v-if="display"> |
| | | <vciWebReferTree :key="key" :data-key="key" ref="vciWebReferTree" v-if="refertype=='tree'" @setValue="setValue" :value="value" :text="text" :title="title" :disabled="disabled" :referConfig="referConfig"></vciWebReferTree> |
| | | <vciWebReferTable :key="key" :data-key="key" v-else-if="refertype=='table'" @setValue="setValue" :value="value" :text="text" :title="title" :disabled="disabled" :referConfig="referConfig" :referType="referType"></vciWebReferTable> |
| | | <vciWebReferDefalut :key="key" :data-key="key" v-else @setValue="setValue" :value="value" :text="text" :title="title" :disabled="disabled" :referConfig="referConfig" :referType="referType"></vciWebReferDefalut> |
| | | <vciWebReferTree |
| | | v-if="refertype=='tree'" |
| | | :key="key" ref="vciWebReferTree" |
| | | :data-key="key" |
| | | :disabled="disabled" |
| | | :referConfig="referConfig" |
| | | :text="text" |
| | | :title="title" |
| | | :value="value" |
| | | @setValue="setValue"> |
| | | </vciWebReferTree> |
| | | |
| | | <vciWebReferTable |
| | | v-else-if="refertype=='table'" |
| | | :key="key" :data-key="key" |
| | | :disabled="disabled" |
| | | :referConfig="referConfig" |
| | | :referType="referType" |
| | | :text="text" |
| | | :title="title" |
| | | :value="value" |
| | | @setValue="setValue"> |
| | | </vciWebReferTable> |
| | | |
| | | <vciWebReferDefalut |
| | | v-else |
| | | :key="key" |
| | | :data-key="key" |
| | | :disabled="disabled" |
| | | :referConfig="referConfig" |
| | | :referType="referType" |
| | | :text="text" :title="title" |
| | | :value="value" |
| | | @setValue="setValue"> |
| | | </vciWebReferDefalut> |
| | | |
| | | </div> |
| | | </template> |
| | |
| | | import vciWebReferTree from "./vciWebReferTree.vue"; |
| | | import vciWebReferTable from "./vciWebReferTable.vue"; |
| | | import vciWebReferDefalut from "./vciWebReferDefalut.vue"; |
| | | |
| | | export default { |
| | | name: "vciWebRefer", |
| | | props: ["referConfig","value","text","disabled","display",'key','referType'], |
| | | props: ["referConfig", "value", "text", "disabled", "display", 'key', 'referType'], |
| | | components: {vciWebReferTree, vciWebReferTable, vciWebReferDefalut}, |
| | | data() { |
| | | return { |
| | | reterTypeLeavl:'213', |
| | | reterTypeLeavl: '213', |
| | | refertype: this.referConfig.options.type, |
| | | emitData:{}, |
| | | title:'', |
| | | display:this.display || true, |
| | | disabled:this.disabled || false |
| | | emitData: {}, |
| | | title: '', |
| | | display: this.display || true, |
| | | disabled: this.disabled || false |
| | | }; |
| | | }, |
| | | created() { |
| | | if (!this.referConfig.options && this.referConfig.options.isMuti==undefined) { |
| | | if (!this.referConfig.options && this.referConfig.options.isMuti == undefined) { |
| | | this.referConfig.options = { |
| | | isMuti: this.referConfig.options.muti || false |
| | | } |
| | |
| | | var title = this.referConfig.title || ''; |
| | | title = title.replace(":", ""); |
| | | title = title ? ('为【' + title + '】选取值') : ('为【' + this.referConfig.showField + '】选取值'); |
| | | this.title=title; |
| | | this.title = title; |
| | | }, |
| | | methods: { |
| | | setValue(value) { |
| | | this.emitData = value; |
| | | } |
| | | }, |
| | | watch:{ |
| | | watch: { |
| | | // 修改反馈到父组件 |
| | | emitData: { |
| | | deep: true, |
| | | immediate: true, |
| | | handler(newV) { |
| | | this.text=newV.text; |
| | | this.value=newV.value; |
| | | this.text = newV.text; |
| | | this.value = newV.value; |
| | | this.$emit("setReferValue", newV); |
| | | } |
| | | }, |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="title" |
| | | v-dialogDrag append-to-body="true" |
| | | <el-dialog v-dialogDrag |
| | | :height="options.height|| 'auto'" :title="title" |
| | | :visible.sync="visible" |
| | | top="0" |
| | | class="avue-dialog avue-dialog--top" |
| | | :width="options.width|| '80%'" |
| | | :height="options.height|| 'auto'" |
| | | @close="dialogClose" > |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | append-to-body="true" |
| | | class="avue-dialog avue-dialog--top" |
| | | top="0" |
| | | @close="dialogClose"> |
| | | <avue-crud ref="referDefalutCrud" |
| | | v-model="value" |
| | | ref="referDefalutCrud" |
| | | :data="data" |
| | | :option="option" |
| | | :page.sync="page" |
| | | :table-loading="loading" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | |
| | | <div class="avue-dialog__footer"> |
| | | <div class="avue-dialog__footer--left valueInfo">{{ valueInfo }}</div> |
| | | <el-button @click="escHandler">取 消</el-button> |
| | | <el-button @click="setValue" type="primary">确 定</el-button> |
| | | <el-button type="primary" @click="setValue">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <avue-input v-model="text" :disabled="disabled" :readonly="true" :placeholder="title" @click="!disabled && (visible=true)" ></avue-input> |
| | | <avue-input v-model="text" :disabled="disabled" :placeholder="title" :readonly="true" |
| | | @click="!disabled && (visible=true)"></avue-input> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { validatenull } from "@/util/validate"; |
| | | import {getList,getLazyList,getTableDefinedUrl} from "@/api/refer/table"; |
| | | import {validatenull} from "@/util/validate"; |
| | | import {getList, getLazyList, getTableDefinedUrl} from "@/api/refer/table"; |
| | | |
| | | export default { |
| | | name: "vciWebReferDefalut", |
| | | props:["referConfig","value","text","title","disabled","referType"], |
| | | props: ["referConfig", "value", "text", "title", "disabled", "referType"], |
| | | data() { |
| | | return { |
| | | visible: false, |
| | | options: this.referConfig.options||{}, |
| | | options: this.referConfig.options || {}, |
| | | isMuti: ("true" == this.referConfig.options.isMuti || this.referConfig.options.isMuti == true || this.referConfig.options.muti == true) ? true : false, |
| | | props: { |
| | | value: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', |
| | |
| | | }, |
| | | url: this.referConfig.options.url || '/api/ubcs-code/mdmEngineController/defaultReferDataGrid', |
| | | method: this.referConfig.options.method || 'GET', |
| | | tableDefinedUrl:'',//平台表格地址 |
| | | copyParam: ['referBo', 'textField', 'valueField', 'displayTable', 'whereSql', 'queryScheme'], |
| | | tableDefinedUrl: '',//平台表格地址 |
| | | copyParam: ['referBo', 'textField', 'valueField', 'displayTable', 'whereSql', 'queryScheme'], |
| | | query: {}, |
| | | loading: false, |
| | | page: { |
| | | layout: this.referType === "master" ? "total,pager,prev, next,jumper" : "total,pager,prev, next,jumper,sizes", |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: this.referConfig.options.data?this.referConfig.options.data.length :0 |
| | | total: this.referConfig.options.data ? this.referConfig.options.data.length : 0 |
| | | }, |
| | | data:this.referConfig.options.data || [], |
| | | data: this.referConfig.options.data || [], |
| | | selectionList: [], |
| | | option: { |
| | | addBtn: false, |
| | | columnBtn:false, |
| | | columnBtn: false, |
| | | //height: this.referConfig.options.height ? this.referConfig.options.height : 475, |
| | | calcHeight: 30, |
| | | tip: false, |
| | | menu:false, |
| | | menu: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | searchLabelWidth: 90, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | reserveSelection:true, |
| | | reserveSelection: true, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, |
| | | column: [] |
| | |
| | | this.page.pageSize = this.referConfig.options.tableConfig.limit; |
| | | } |
| | | }, |
| | | computed:{ |
| | | valueInfo:function (){ |
| | | return this.text ? ("已设置的值为[" + this.text + "]"): '未设置值' |
| | | computed: { |
| | | valueInfo: function () { |
| | | return this.text ? ("已设置的值为[" + this.text + "]") : '未设置值' |
| | | } |
| | | }, |
| | | methods: { |
| | | escHandler(){ |
| | | escHandler() { |
| | | this.visible = false; |
| | | this.$refs.referDefalutCrud.refreshTable() |
| | | }, |
| | | dialogClose(){ |
| | | dialogClose() { |
| | | this.visible = false; |
| | | this.$refs.referDefalutCrud.refreshTable() |
| | | }, |
| | | getParams:function () { |
| | | getParams: function () { |
| | | var queryParams = {}; |
| | | if (this.options.extraParams) { |
| | | queryParams = this.options.extraParams; |
| | |
| | | queryParams['order'] = this.options.initSort.type;//方法 |
| | | queryParams['sort'] = this.options.initSort.field;//字段 |
| | | } |
| | | if(this.options.sortField){ |
| | | if (this.options.sortField) { |
| | | queryParams['sort'] = this.options.sortField;//字段 |
| | | } |
| | | if(this.options.sortType){ |
| | | if (this.options.sortType) { |
| | | queryParams['order'] = this.options.sortType;//方法 |
| | | } |
| | | if (this.options.conditionParams) { |
| | |
| | | sortable: true, |
| | | width: 150, |
| | | search: true, |
| | | formatter:function (d){ |
| | | formatter: function (d) { |
| | | return d.id || d.data.id |
| | | } |
| | | }, { |
| | |
| | | sortable: true, |
| | | width: 150, |
| | | search: true, |
| | | formatter:function (d){ |
| | | formatter: function (d) { |
| | | return d.name || d.data.name |
| | | } |
| | | }, { |
| | | prop: 'description', |
| | | label: '描述', |
| | | width: 250, |
| | | formatter:function (d){ |
| | | formatter: function (d) { |
| | | return d.description || d.data.description |
| | | } |
| | | }, { |
| | |
| | | width: 60, |
| | | hidden: (!this.controllerSecret), |
| | | hide: (!this.controllerSecret), |
| | | formatter:function (d){ |
| | | formatter: function (d) { |
| | | return d.secretGradeText || d.data.secretGradeText |
| | | } |
| | | }]; |
| | | } else { |
| | | this.option.column = this.options.tableConfig.cols.map(item => { |
| | | if (item.field != 'LAY_TABLE_INDEX' && item.field != 'LAY_CHECKED') { |
| | | let formatter=item.template || item.templet; |
| | | if(typeof formatter == "string" && formatter !=''){ |
| | | formatter=eval("(" + formatter + ")") |
| | | }else{ |
| | | formatter=function (d){ |
| | | if(d[item.field]!=undefined){ |
| | | let formatter = item.template || item.templet; |
| | | if (typeof formatter == "string" && formatter != '') { |
| | | formatter = eval("(" + formatter + ")") |
| | | } else { |
| | | formatter = function (d) { |
| | | if (d[item.field] != undefined) { |
| | | return d[item.field] |
| | | }else if(d.data[item.field] !=undefined){ |
| | | } else if (d.data[item.field] != undefined) { |
| | | return d.data[item.field] |
| | | }else { |
| | | } else { |
| | | return '' |
| | | } |
| | | } |
| | |
| | | ...item, |
| | | label: item.title, |
| | | prop: item.field, |
| | | formatter:formatter, |
| | | sortable:item.sort, |
| | | hide:item.hidden, |
| | | search:this.options.tableConfig.queryColumns.some(qItem=>{ |
| | | return qItem.field==item.field |
| | | formatter: formatter, |
| | | sortable: item.sort, |
| | | hide: item.hidden, |
| | | search: this.options.tableConfig.queryColumns.some(qItem => { |
| | | return qItem.field == item.field |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | this.params = paramsData; |
| | | }, |
| | | setValue(){ |
| | | if(this.selectionList.length==0){ |
| | | this.$message.warning( '没有选择数据'); |
| | | setValue() { |
| | | if (this.selectionList.length == 0) { |
| | | this.$message.warning('没有选择数据'); |
| | | return false; |
| | | }else if(this.selectionList.length>1 && !this.isMuti){ |
| | | this.$message.warning( '每次只能选择一条数据'); |
| | | } else if (this.selectionList.length > 1 && !this.isMuti) { |
| | | this.$message.warning('每次只能选择一条数据'); |
| | | return false; |
| | | } |
| | | |
| | | var value = []; |
| | | var text = []; |
| | | var isMutiValue = (this.props.value.indexOf(",")>-1); |
| | | var isMutiRaw = (this.props.label.indexOf(",")>-1); |
| | | var _that=this |
| | | this.selectionList.forEach((item,_index) =>{ |
| | | if(isMutiValue){ |
| | | var isMutiValue = (this.props.value.indexOf(",") > -1); |
| | | var isMutiRaw = (this.props.label.indexOf(",") > -1); |
| | | var _that = this |
| | | this.selectionList.forEach((item, _index) => { |
| | | if (isMutiValue) { |
| | | var valueFieldArray = _that.props.value.split(","); |
| | | valueFieldArray.forEach((_itemField,_indexField)=>{ |
| | | let itemValue=item[_itemField]; |
| | | if(itemValue==undefined || itemValue == null){ |
| | | itemValue=item['data'][_itemField] |
| | | valueFieldArray.forEach((_itemField, _indexField) => { |
| | | let itemValue = item[_itemField]; |
| | | if (itemValue == undefined || itemValue == null) { |
| | | itemValue = item['data'][_itemField] |
| | | } |
| | | value.push( itemValue + (_that.referConfig.valueSep?_that.referConfig.valueSep:' ')); |
| | | value.push(itemValue + (_that.referConfig.valueSep ? _that.referConfig.valueSep : ' ')); |
| | | }) |
| | | }else { |
| | | let itemValue=item[_that.props.value]; |
| | | if(itemValue==undefined || itemValue == null){ |
| | | itemValue=item['data'][_that.props.value] |
| | | } else { |
| | | let itemValue = item[_that.props.value]; |
| | | if (itemValue == undefined || itemValue == null) { |
| | | itemValue = item['data'][_that.props.value] |
| | | } |
| | | value.push(itemValue); |
| | | } |
| | | if(isMutiRaw) { |
| | | if (isMutiRaw) { |
| | | var rawFieldArray = _that.props.label.split(","); |
| | | rawFieldArray.forEach((_itemField,_indexField)=>{ |
| | | let itemText=item[_itemField]; |
| | | if(itemText==undefined || itemText == null){ |
| | | itemText=item['data'][_itemField] |
| | | rawFieldArray.forEach((_itemField, _indexField) => { |
| | | let itemText = item[_itemField]; |
| | | if (itemText == undefined || itemText == null) { |
| | | itemText = item['data'][_itemField] |
| | | } |
| | | text.push(itemText + (_that.referConfig.textSep?_that.referConfig.textSep:' ')) ; |
| | | text.push(itemText + (_that.referConfig.textSep ? _that.referConfig.textSep : ' ')); |
| | | }) |
| | | }else{ |
| | | let itemText=item[_that.props.label]; |
| | | if(itemText==undefined || itemText == null){ |
| | | itemText=item['data'][_that.props.label] |
| | | } else { |
| | | let itemText = item[_that.props.label]; |
| | | if (itemText == undefined || itemText == null) { |
| | | itemText = item['data'][_that.props.label] |
| | | } |
| | | text.push(itemText); |
| | | } |
| | | }) |
| | | |
| | | let mapFields =this.referConfig.fieldMap || {}; |
| | | let mapFields = this.referConfig.fieldMap || {}; |
| | | try { |
| | | if(!validatenull(this.options.mapFields)){ |
| | | mapFields =Object.assign(this.referConfig.fieldMap,JSON.parse(this.options.mapFields)) ; |
| | | if (!validatenull(this.options.mapFields)) { |
| | | mapFields = Object.assign(this.referConfig.fieldMap, JSON.parse(this.options.mapFields)); |
| | | } |
| | | }catch (e) { |
| | | } catch (e) { |
| | | |
| | | } |
| | | this.value=value.join(','); |
| | | this.text=text.join(',') |
| | | this.$emit("setValue", {field:this.referConfig.field,showField:this.referConfig.showField,value:this.value,text:this.text,rawData:this.selectionList,fieldMap:mapFields}); |
| | | this.visible=false; |
| | | this.value = value.join(','); |
| | | this.text = text.join(',') |
| | | this.$emit("setValue", { |
| | | field: this.referConfig.field, |
| | | showField: this.referConfig.showField, |
| | | value: this.value, |
| | | text: this.text, |
| | | rawData: this.selectionList, |
| | | fieldMap: mapFields |
| | | }); |
| | | this.visible = false; |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | |
| | | this.onLoad(this.page); |
| | | done(); |
| | | }, |
| | | currentChange(currentPage){ |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize){ |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | rowClick (row) { |
| | | rowClick(row) { |
| | | this.$refs.referDefalutCrud.toggleSelection(); |
| | | this.$refs.referDefalutCrud.toggleRowSelection(row); //选中当前行 |
| | | this.selectionList=[row] |
| | | this.selectionList = [row] |
| | | }, |
| | | selectionChange(list) { |
| | | if (!this.isMuti && list.length > 1) { |
| | |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params={}) { |
| | | if(this.url){ |
| | | onLoad(page, params = {}) { |
| | | if (this.url) { |
| | | this.loading = true; |
| | | var query={} |
| | | var query = {} |
| | | if (this.query) { |
| | | for (var key in this.query) { |
| | | query['conditionMap["' + key + '"]'] = this.query[key]; |
| | | } |
| | | } |
| | | getList(Object.assign(params,this.params,this.query, query),page.currentPage, page.pageSize, this.url, this.method).then(res => { |
| | | let data=[] |
| | | if(res.data.records){ |
| | | getList(Object.assign(params, this.params, this.query, query), page.currentPage, page.pageSize, this.url, this.method).then(res => { |
| | | let data = [] |
| | | if (res.data.records) { |
| | | data = res.data.records |
| | | this.page.total=res.data.total ; |
| | | }else{ |
| | | this.page.total = res.data.total; |
| | | } else { |
| | | data = res.data.data.records; |
| | | this.page.total=res.data.data.total; |
| | | this.page.total = res.data.data.total; |
| | | } |
| | | this.data=data.map(item => { |
| | | item.data=item.data || {} |
| | | this.data = data.map(item => { |
| | | item.data = item.data || {} |
| | | return { |
| | | ...item |
| | | } |
| | | }) |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }).catch(error=>{ |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | this.loading = false; |
| | | }); |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .valueInfo{ |
| | | .valueInfo { |
| | | float: left; |
| | | border: 1px solid #E9E7E7; |
| | | display: inline-block; |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="title" |
| | | v-dialogDrag append-to-body="true" |
| | | <el-dialog v-dialogDrag |
| | | :height="options.height|| 'auto'" :title="title" |
| | | :visible.sync="visible" |
| | | top="0" |
| | | class="avue-dialog avue-dialog--top" |
| | | :width="options.width|| '80%'" |
| | | :height="options.height|| 'auto'" |
| | | @close="dialogClose" > |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | append-to-body="true" |
| | | class="avue-dialog avue-dialog--top" |
| | | top="0" |
| | | @close="dialogClose"> |
| | | <avue-crud ref="referCrud" |
| | | v-model="value" |
| | | ref="referCrud" |
| | | :data="data" |
| | | :option="option" |
| | | :page.sync="page" |
| | | :table-loading="loading" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | |
| | | </template> |
| | | </avue-crud> |
| | | <div class="avue-dialog__footer"> |
| | | <div class="avue-dialog__footer--left valueInfo">{{ valueInfo }} </div> |
| | | <div class="avue-dialog__footer--left valueInfo">{{ valueInfo }}</div> |
| | | <el-button @click="escHandler">取 消</el-button> |
| | | <el-button @click="setValue" type="primary">确 定</el-button> |
| | | <el-button type="primary" @click="setValue">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <avue-input v-model="text" :disabled="disabled" :readonly="true" :placeholder="title" @click="!disabled && (visible=true)"></avue-input> |
| | | <avue-input v-model="text" :disabled="disabled" :placeholder="title" :readonly="true" |
| | | @click="!disabled && (visible=true)"></avue-input> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { validatenull } from "@/util/validate"; |
| | | import {getList,getLazyList,getTableDefinedUrl} from "@/api/refer/table"; |
| | | import {validatenull} from "@/util/validate"; |
| | | import {getList, getLazyList, getTableDefinedUrl} from "@/api/refer/table"; |
| | | |
| | | export default { |
| | | name: "vciWebReferTable", |
| | | props:["referConfig","value","text","title","disabled","referType"], |
| | | props: ["referConfig", "value", "text", "title", "disabled", "referType"], |
| | | data() { |
| | | return { |
| | | visible: false, |
| | |
| | | label: this.referConfig.textField || this.referConfig.options.textField || "name" |
| | | }, |
| | | url: this.referConfig.options.url || '/api/ubcs-code/mdmEngineController/defaultReferDataGrid', |
| | | tableDefinedUrl:'',//平台表格地址 |
| | | copyParam: ['referBo', 'textField', 'valueField', 'displayTable', 'whereSql', 'queryScheme'], |
| | | tableDefinedUrl: '',//平台表格地址 |
| | | copyParam: ['referBo', 'textField', 'valueField', 'displayTable', 'whereSql', 'queryScheme'], |
| | | query: {}, |
| | | loading: false, |
| | | page: { |
| | | layout: this.referType === "master" ? "total,pager,prev, next,jumper" : "total,pager,prev, next,jumper,sizes", |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: this.referConfig.options.data?this.referConfig.options.data.length :0 |
| | | total: this.referConfig.options.data ? this.referConfig.options.data.length : 0 |
| | | }, |
| | | data:this.referConfig.options.data || [], |
| | | data: this.referConfig.options.data || [], |
| | | selectionList: [], |
| | | option: { |
| | | addBtn: false, |
| | | columnBtn:false, |
| | | columnBtn: false, |
| | | height: this.referConfig.options.height ? this.referConfig.options.height : 475, |
| | | calcHeight: 30, |
| | | tip: false, |
| | | menu:false, |
| | | menu: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | searchLabelWidth: 90, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | reserveSelection:true, |
| | | reserveSelection: true, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, |
| | | rowKey:'oid', |
| | | rowParentKey:'parentSaleProduct', |
| | | rowKey: 'oid', |
| | | rowParentKey: 'parentSaleProduct', |
| | | column: [] |
| | | } |
| | | }; |
| | |
| | | }) |
| | | }, |
| | | |
| | | computed:{ |
| | | valueInfo:function (){ |
| | | return this.text ? ("已设置的值为[" + this.text + "]"): '未设置值' |
| | | computed: { |
| | | valueInfo: function () { |
| | | return this.text ? ("已设置的值为[" + this.text + "]") : '未设置值' |
| | | } |
| | | }, |
| | | methods: { |
| | | escHandler(){ |
| | | escHandler() { |
| | | this.visible = false; |
| | | this.$refs.referDefalutCrud.refreshTable() |
| | | }, |
| | | dialogClose(){ |
| | | dialogClose() { |
| | | this.visible = false; |
| | | this.$refs.referDefalutCrud.refreshTable() |
| | | }, |
| | | getParams:function (){ |
| | | getParams: function () { |
| | | var queryParams = {}; |
| | | if(this.options.extraParams){ |
| | | if (this.options.extraParams) { |
| | | queryParams = this.options.extraParams; |
| | | } |
| | | if(this.options.useFormKey && this.options.formValues){ |
| | | if (this.options.useFormKey && this.options.formValues) { |
| | | //使用表单上的字段来过滤 |
| | | queryParams['conditionMap["' + (this.options.paramForFormKey?this.options.paramForFormKey:this.options.useFormKey) + '"]'] = this.options.formValues[this.options.useFormKey]; |
| | | queryParams['conditionMap["' + (this.options.paramForFormKey ? this.options.paramForFormKey : this.options.useFormKey) + '"]'] = this.options.formValues[this.options.useFormKey]; |
| | | } |
| | | if(this.options.where ) { |
| | | if (this.options.where) { |
| | | for (var key in this.options.where) { |
| | | queryParams['conditionMap["' + key + '"]'] = this.options.where[key];//新 |
| | | } |
| | | } |
| | | for(var i= 0 ; i < this.copyParam.length ; i ++){ |
| | | for (var i = 0; i < this.copyParam.length; i++) { |
| | | queryParams[this.copyParam[i]] = this.options[this.copyParam[i]]; |
| | | } |
| | | queryParams["isMuti"]=this.isMuti; |
| | | queryParams.muti =this.isMuti; |
| | | if(!queryParams['referBo']){ |
| | | queryParams["isMuti"] = this.isMuti; |
| | | queryParams.muti = this.isMuti; |
| | | if (!queryParams['referBo']) { |
| | | queryParams['referBo'] = this.options['referBo'] || this.options['referType']; |
| | | } |
| | | queryParams['referType']= queryParams['referBo'] |
| | | queryParams['referType'] = queryParams['referBo'] |
| | | if (this.options.initSort) { |
| | | queryParams['order'] = this.options.initSort.type;//方法 |
| | | queryParams['sort'] = this.options.initSort.field;//字段 |
| | | } |
| | | if(this.options.sortField){ |
| | | if (this.options.sortField) { |
| | | queryParams['sort'] = this.options.sortField;//字段 |
| | | } |
| | | if(this.options.sortType){ |
| | | if (this.options.sortType) { |
| | | queryParams['order'] = this.options.sortType;//方法 |
| | | } |
| | | if (this.options.conditionParams) { |
| | |
| | | } |
| | | var paramsData = {}; |
| | | //为了处理单引号和双引号的 |
| | | if(queryParams){ |
| | | for (var key in queryParams){ |
| | | if (queryParams) { |
| | | for (var key in queryParams) { |
| | | paramsData[key.replace(/"/g, "'")] = queryParams[key]; |
| | | } |
| | | } |
| | | |
| | | if(this.options.displayTable){ |
| | | if (this.options.displayTable) { |
| | | //说明是使用平台的表格 |
| | | getTableDefinedUrl({btmType:(this.options.referBo||this.options.referType),code:this.options.displayTable,isMuti:this.isMuti},this.tableDefinedUrl).then(result => { |
| | | console.log('result',result) |
| | | if(result.success){ |
| | | getTableDefinedUrl({ |
| | | btmType: (this.options.referBo || this.options.referType), |
| | | code: this.options.displayTable, |
| | | isMuti: this.isMuti |
| | | }, this.tableDefinedUrl).then(result => { |
| | | console.log('result', result) |
| | | if (result.success) { |
| | | var queryScheme = result.querySchema; |
| | | if(!validatenull(queryScheme) && validatenull(this.options.queryScheme)){ |
| | | if (!validatenull(queryScheme) && validatenull(this.options.queryScheme)) { |
| | | this.options.queryScheme = queryScheme; |
| | | } |
| | | paramsData['queryScheme'] = this.options.queryScheme; |
| | | if(result.showIndex){ |
| | | if (result.showIndex) { |
| | | this.option.index = true; |
| | | } |
| | | if(result.showCheckbox){ |
| | | if (result.showCheckbox) { |
| | | this.option.selection = true |
| | | } |
| | | var referColumn = ""; |
| | | if(result.columns){ |
| | | this.option.column= result.columns.map(item => { |
| | | if(item.field.indexOf(".")>-1){ |
| | | if (result.columns) { |
| | | this.option.column = result.columns.map(item => { |
| | | if (item.field.indexOf(".") > -1) { |
| | | referColumn += item.field + ","; |
| | | item.field = item.field.replace(".","_"); |
| | | item.field = item.field.replace(".", "_"); |
| | | } |
| | | if(!validatenull(item.enumCode)) { |
| | | if (!validatenull(item.enumCode)) { |
| | | //是枚举的内容 |
| | | item.type = 'select'; |
| | | item.dicUrl = "/api/ubcs-omd/enum/dictionary?code=" + item.enumCode; |
| | |
| | | trigger: "blur" |
| | | }]; |
| | | } |
| | | item.formatter=function(d){ |
| | | if(d[item.field]!=undefined){ |
| | | item.formatter = function (d) { |
| | | if (d[item.field] != undefined) { |
| | | return d[item.field] |
| | | }else if(d.data[item.field] !=undefined){ |
| | | } else if (d.data[item.field] != undefined) { |
| | | return d.data[item.field] |
| | | }else { |
| | | } else { |
| | | return '' |
| | | } |
| | | }; |
| | |
| | | }) |
| | | } |
| | | paramsData['referColumn'] = referColumn; |
| | | if(result.limit>0){ |
| | | if (result.limit > 0) { |
| | | this.page.pageSize = result.limit; |
| | | this.page.currentPage=1 |
| | | this.page.currentPage = 1 |
| | | } |
| | | if(this.options.isTreeGrid){ |
| | | if (this.options.isTreeGrid) { |
| | | //表格树加上配置 |
| | | } |
| | | this.params=paramsData; |
| | | }else{ |
| | | this.params = paramsData; |
| | | } else { |
| | | this.$message.error(result.msg); |
| | | } |
| | | |
| | | }); |
| | | }else{ |
| | | } else { |
| | | //说明是自定义的表格 |
| | | var tableConfig = this.options.tableConfig; |
| | | if(!tableConfig){ |
| | | this.$message.error( '没有定义参照的表格配置'); |
| | | if (!tableConfig) { |
| | | this.$message.error('没有定义参照的表格配置'); |
| | | } |
| | | if(!paramsData){ |
| | | if (!paramsData) { |
| | | paramsData = { |
| | | currentUserReferModelKey:this.options.currentUserReferModelKey, |
| | | currentUserReferMethodKey:this.options.currentUserReferMethodKey |
| | | currentUserReferModelKey: this.options.currentUserReferModelKey, |
| | | currentUserReferMethodKey: this.options.currentUserReferMethodKey |
| | | }; |
| | | }else{ |
| | | } else { |
| | | paramsData['currentUserReferModelKey'] = this.options.currentUserReferModelKey; |
| | | paramsData['currentUserReferMethodKey'] = this.options.currentUserReferMethodKey; |
| | | } |
| | | if(this.options.tableConfig && this.options.tableConfig.cols && this.options.tableConfig.cols.length>0) { |
| | | if (this.options.tableConfig && this.options.tableConfig.cols && this.options.tableConfig.cols.length > 0) { |
| | | //说明传递了的 |
| | | this.option.column= this.options.tableConfig.cols.map(item => { |
| | | this.option.column = this.options.tableConfig.cols.map(item => { |
| | | if (item.field != 'LAY_TABLE_INDEX' && item.field != 'LAY_CHECKED') { |
| | | let formatter=item.template || item.templet; |
| | | if(typeof formatter == "string" && formatter !=''){ |
| | | formatter=eval("(" + formatter + ")") |
| | | }else{ |
| | | formatter=function (d){ |
| | | if(d[item.field]!=undefined){ |
| | | let formatter = item.template || item.templet; |
| | | if (typeof formatter == "string" && formatter != '') { |
| | | formatter = eval("(" + formatter + ")") |
| | | } else { |
| | | formatter = function (d) { |
| | | if (d[item.field] != undefined) { |
| | | return d[item.field] |
| | | }else if(d.data[item.field] !=undefined){ |
| | | } else if (d.data[item.field] != undefined) { |
| | | return d.data[item.field] |
| | | }else { |
| | | } else { |
| | | return '' |
| | | } |
| | | } |
| | |
| | | ...item, |
| | | label: item.title, |
| | | prop: item.field, |
| | | formatter:formatter, |
| | | sortable:item.sort, |
| | | hide:item.hidden, |
| | | search: this.options.tableConfig.queryColumns.some(qItem=>{ |
| | | return qItem.field==item.field |
| | | formatter: formatter, |
| | | sortable: item.sort, |
| | | hide: item.hidden, |
| | | search: this.options.tableConfig.queryColumns.some(qItem => { |
| | | return qItem.field == item.field |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if(this.options.isTreeGrid){ |
| | | if (this.options.isTreeGrid) { |
| | | //表格树加上配置 |
| | | } |
| | | } |
| | | this.params=paramsData; |
| | | this.params = paramsData; |
| | | }, |
| | | setValue(){ |
| | | if(this.selectionList.length==0){ |
| | | this.$message.warning( '没有选择数据'); |
| | | setValue() { |
| | | if (this.selectionList.length == 0) { |
| | | this.$message.warning('没有选择数据'); |
| | | return false; |
| | | }else if(this.selectionList.length>1 && !this.isMuti){ |
| | | this.$message.warning( '每次只能选择一条数据'); |
| | | } else if (this.selectionList.length > 1 && !this.isMuti) { |
| | | this.$message.warning('每次只能选择一条数据'); |
| | | return false; |
| | | } |
| | | |
| | | var value = []; |
| | | var text = []; |
| | | var isMutiValue = (this.props.value.indexOf(",")>-1); |
| | | var isMutiRaw = (this.props.label.indexOf(",")>-1); |
| | | var _that=this |
| | | this.selectionList.forEach((item,_index) =>{ |
| | | if(isMutiValue){ |
| | | var isMutiValue = (this.props.value.indexOf(",") > -1); |
| | | var isMutiRaw = (this.props.label.indexOf(",") > -1); |
| | | var _that = this |
| | | this.selectionList.forEach((item, _index) => { |
| | | if (isMutiValue) { |
| | | var valueFieldArray = _that.props.value.split(","); |
| | | valueFieldArray.forEach((_itemField,_indexField)=>{ |
| | | let itemValue=item[_itemField]; |
| | | if(itemValue==undefined || itemValue == null){ |
| | | itemValue=item['data'][_itemField] |
| | | valueFieldArray.forEach((_itemField, _indexField) => { |
| | | let itemValue = item[_itemField]; |
| | | if (itemValue == undefined || itemValue == null) { |
| | | itemValue = item['data'][_itemField] |
| | | } |
| | | value.push( itemValue + (_that.referConfig.valueSep?_that.referConfig.valueSep:' ')); |
| | | value.push(itemValue + (_that.referConfig.valueSep ? _that.referConfig.valueSep : ' ')); |
| | | }) |
| | | }else { |
| | | let itemValue=item[_that.props.value]; |
| | | if(itemValue==undefined || itemValue == null){ |
| | | itemValue=item['data'][_that.props.value] |
| | | } else { |
| | | let itemValue = item[_that.props.value]; |
| | | if (itemValue == undefined || itemValue == null) { |
| | | itemValue = item['data'][_that.props.value] |
| | | } |
| | | value.push(itemValue); |
| | | } |
| | | if(isMutiRaw) { |
| | | if (isMutiRaw) { |
| | | var rawFieldArray = _that.props.label.split(","); |
| | | rawFieldArray.forEach((_itemField,_indexField)=>{ |
| | | let itemText=item[_itemField]; |
| | | if(itemText==undefined || itemText == null){ |
| | | itemText=item['data'][_itemField] |
| | | rawFieldArray.forEach((_itemField, _indexField) => { |
| | | let itemText = item[_itemField]; |
| | | if (itemText == undefined || itemText == null) { |
| | | itemText = item['data'][_itemField] |
| | | } |
| | | text.push(itemText + (_that.referConfig.textSep?_that.referConfig.textSep:' ')) ; |
| | | text.push(itemText + (_that.referConfig.textSep ? _that.referConfig.textSep : ' ')); |
| | | }) |
| | | }else{ |
| | | let itemText=item[_that.props.label]; |
| | | if(itemText==undefined || itemText == null){ |
| | | itemText=item['data'][_that.props.label] |
| | | } else { |
| | | let itemText = item[_that.props.label]; |
| | | if (itemText == undefined || itemText == null) { |
| | | itemText = item['data'][_that.props.label] |
| | | } |
| | | text.push(itemText); |
| | | } |
| | | }) |
| | | let mapFields =this.referConfig.fieldMap || {}; |
| | | let mapFields = this.referConfig.fieldMap || {}; |
| | | try { |
| | | if(!validatenull(this.options.mapFields)){ |
| | | mapFields =Object.assign(this.referConfig.fieldMap,JSON.parse(this.options.mapFields)) ; |
| | | if (!validatenull(this.options.mapFields)) { |
| | | mapFields = Object.assign(this.referConfig.fieldMap, JSON.parse(this.options.mapFields)); |
| | | } |
| | | }catch (e) { |
| | | } catch (e) { |
| | | |
| | | } |
| | | this.value=value.join(','); |
| | | this.text=text.join(',') |
| | | this.$emit("setValue", {field:this.referConfig.field,showField:this.referConfig.showField,value:this.value,text:this.text,rawData:this.selectionList,fieldMap:mapFields}); |
| | | this.visible=false; |
| | | this.value = value.join(','); |
| | | this.text = text.join(',') |
| | | this.$emit("setValue", { |
| | | field: this.referConfig.field, |
| | | showField: this.referConfig.showField, |
| | | value: this.value, |
| | | text: this.text, |
| | | rawData: this.selectionList, |
| | | fieldMap: mapFields |
| | | }); |
| | | this.visible = false; |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | |
| | | this.onLoad(this.page); |
| | | done(); |
| | | }, |
| | | currentChange(currentPage){ |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize){ |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | rowClick (row) { |
| | | rowClick(row) { |
| | | this.$refs.referCrud.toggleSelection(); |
| | | this.$refs.referCrud.toggleRowSelection(row); //选中当前行 |
| | | this.selectionList=[row] |
| | | this.selectionList = [row] |
| | | }, |
| | | selectionChange(list) { |
| | | if (!this.isMuti && list.length > 1) { |
| | |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params={}) { |
| | | if(this.url){ |
| | | onLoad(page, params = {}) { |
| | | if (this.url) { |
| | | this.loading = true; |
| | | var query={} |
| | | var query = {} |
| | | if (this.query) { |
| | | for (var key in this.query) { |
| | | query['conditionMap["' + key + '"]'] = this.query[key]; |
| | | } |
| | | } |
| | | getList(Object.assign(params,this.params,this.query, query),page.currentPage, page.pageSize, this.url).then(res => { |
| | | let data=[] |
| | | if(res.data.records){ |
| | | getList(Object.assign(params, this.params, this.query, query), page.currentPage, page.pageSize, this.url).then(res => { |
| | | let data = [] |
| | | if (res.data.records) { |
| | | data = res.data.records |
| | | this.page.total=res.data.total ; |
| | | }else{ |
| | | this.page.total = res.data.total; |
| | | } else { |
| | | data = res.data.data.records; |
| | | this.page.total=res.data.data.total; |
| | | this.page.total = res.data.data.total; |
| | | } |
| | | this.data=data.map(item => { |
| | | item.data=item.data || {} |
| | | this.data = data.map(item => { |
| | | item.data = item.data || {} |
| | | return { |
| | | ...item |
| | | } |
| | | }) |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }).catch(error=>{ |
| | | }).catch(error => { |
| | | this.$message.error(error); |
| | | this.loading = false; |
| | | }); |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .valueInfo{ |
| | | .valueInfo { |
| | | float: left; |
| | | border: 1px solid #E9E7E7; |
| | | display: inline-block; |
| | |
| | | <template> |
| | | <avue-input-tree ref="referTree" :props="props" :disabled="disabled" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :checked="checked" |
| | | :leaf-only="referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="title" :dic="treeData"></avue-input-tree> |
| | | <avue-input-tree ref="referTree" |
| | | v-model="value" |
| | | :checked="checked" |
| | | :dic="treeData" |
| | | :disabled="disabled" |
| | | :lazy="lazy" |
| | | :leaf-only="referConfig.onlyLeaf" |
| | | :multiple="isMuti" |
| | | :node-click="nodeClick" |
| | | :placeholder="title" |
| | | :props="props" |
| | | :tree-load="treeLoad"></avue-input-tree> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getTree,getLazyTree} from "@/api/refer/tree"; |
| | | import {getTree, getLazyTree} from "@/api/refer/tree"; |
| | | import {validatenull} from "@/util/validate"; |
| | | |
| | | export default { |
| | | name: "vciWebReferTree", |
| | | props:["referConfig","value","text","title","disabled"], |
| | | props: ["referConfig", "value", "text", "title", "disabled"], |
| | | data() { |
| | | return { |
| | | visible: false, |
| | | options: this.referConfig.options, |
| | | lazy: this.referConfig.options.loadType == 'node', |
| | | isMuti:("true" == this.referConfig.options.isMuti || this.referConfig.options.isMuti == true || this.referConfig.options.muti == true) ? true : false, |
| | | isMuti: ("true" == this.referConfig.options.isMuti || this.referConfig.options.isMuti == true || this.referConfig.options.muti == true) ? true : false, |
| | | props: { |
| | | value: 'oid', |
| | | label: "name" |
| | | }, |
| | | config:{ |
| | | config: { |
| | | valueField: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', |
| | | textField:this.referConfig.textField || this.referConfig.options.textField || "name", |
| | | textSep:this.referConfig.textSep || ' ' |
| | | textField: this.referConfig.textField || this.referConfig.options.textField || "name", |
| | | textSep: this.referConfig.textSep || ' ' |
| | | }, |
| | | treeUrl: this.referConfig.options.url || '/api/ubcs-code/mdmEngineController/defaultReferTree', |
| | | treeData: [], |
| | | checkedData:[], |
| | | currentNode:{}, |
| | | checkedData: [], |
| | | currentNode: {}, |
| | | 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'] |
| | |
| | | this.getParams(); |
| | | }, |
| | | mounted() { |
| | | if(!this.lazy){ |
| | | if(this.options.data){//如果是固定数据的情况下 |
| | | this.treeData=this.options.data |
| | | }else{ |
| | | if (!this.lazy) { |
| | | if (this.options.data) {//如果是固定数据的情况下 |
| | | this.treeData = this.options.data |
| | | } else { |
| | | this.getTree() |
| | | } |
| | | } |
| | | }, |
| | | computed:{}, |
| | | computed: {}, |
| | | methods: { |
| | | getParams:function (){ |
| | | getParams: function () { |
| | | var queryParams = {}; |
| | | if(this.options.extraParams){ |
| | | if (this.options.extraParams) { |
| | | queryParams = this.options.extraParams; |
| | | } |
| | | for(var i= 0 ; i < this.copyParam.length ; i ++){ |
| | | if(this.copyParam[i] == "btmType") { |
| | | 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){ |
| | | } 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['referType']= queryParams['referBo'] |
| | | queryParams['selectAllLevel'] = (this.options.loadType == this.loadType.all?true:false);//true时后台会报错 |
| | | queryParams['referType'] = queryParams['referBo'] |
| | | queryParams['selectAllLevel'] = (this.options.loadType == this.loadType.all ? true : false);//true时后台会报错 |
| | | |
| | | queryParams.muti =this.isMuti; |
| | | if(queryParams.isQueryAllColumn =="true"){ |
| | | queryParams.muti = this.isMuti; |
| | | if (queryParams.isQueryAllColumn == "true") { |
| | | queryParams.isQueryAllColumn = true; |
| | | } |
| | | if(this.options.useFormKey && this.options.formValues){ |
| | | if (this.options.useFormKey && this.options.formValues) { |
| | | //使用表单上的字段来过滤 |
| | | queryParams['conditionMap["' + (this.options.paramForFormKey?this.options.paramForFormKey:this.options.useFormKey) + '"]'] = this.options.formValues[this.options.useFormKey]; |
| | | 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['queryAllLevel'] = this.options.loadType == this.loadType.node ? false : true;//默认逐级展开 |
| | | queryParams['loadType'] = this.options.loadType; |
| | | queryParams['multipleSelect'] = this.isMuti; |
| | | queryParams['isMuti'] = queryParams['multipleSelect']; |
| | |
| | | queryParams['order'] = this.options.initSort.type;//方法 |
| | | queryParams['sort'] = this.options.initSort.field;//字段 |
| | | } |
| | | if(this.options.sortField){ |
| | | if (this.options.sortField) { |
| | | queryParams['sort'] = this.options.sortField;//字段 |
| | | } |
| | | if(this.options.sortType){ |
| | | if (this.options.sortType) { |
| | | queryParams['order'] = this.options.sortType;//方法 |
| | | } |
| | | if (this.options.rootParams) { |
| | |
| | | queryParams['conditionMap["' + key + '"]'] = this.options.conditionParams[key];//新的方式 |
| | | } |
| | | } |
| | | if(this.options.where ) { |
| | | if (this.options.where) { |
| | | for (var key in this.options.where) { |
| | | queryParams['conditionMap["' + key + '"]'] = this.options.where[key];//新 |
| | | } |
| | |
| | | queryParams['replaceMap["' + key + '"]'] = this.options.replaceParams[key];//新的方式 |
| | | } |
| | | } |
| | | this.params=queryParams; |
| | | this.params = queryParams; |
| | | |
| | | }, |
| | | getTree() { |
| | |
| | | treeLoad: function (treeNode, resolve) { |
| | | //逐级加载 |
| | | 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; |
| | | 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 => { |
| | | getLazyTree(this.params, this.treeUrl).then(res => { |
| | | resolve(res.data.data.map(item => { |
| | | if(!item.attributes){ |
| | | item.attributes={ |
| | | data:{} |
| | | if (!item.attributes) { |
| | | item.attributes = { |
| | | data: {} |
| | | } |
| | | }else{ |
| | | item.attributes.data=item.attributes.data || {} |
| | | } else { |
| | | item.attributes.data = item.attributes.data || {} |
| | | } |
| | | return { |
| | | ...item, |
| | |
| | | })) |
| | | }); |
| | | }, |
| | | nodeClick(data, node, nodeComp){ |
| | | if(!this.isMuti) { |
| | | this.setValue({checkedNodes:[data]}) |
| | | nodeClick(data, node, nodeComp) { |
| | | if (!this.isMuti) { |
| | | this.setValue({checkedNodes: [data]}) |
| | | } |
| | | }, |
| | | checked(checkedNode, checkedData) { |
| | | this.setValue(checkedData) |
| | | }, |
| | | setValue:function (checkedData){ |
| | | this.checkedData=checkedData |
| | | setValue: function (checkedData) { |
| | | this.checkedData = checkedData |
| | | var value = []; |
| | | var text = []; |
| | | const textSep =this.config.textSep; |
| | | for(var j =0;j<checkedData.checkedNodes.length;j++){ |
| | | const item=checkedData.checkedNodes[j]; |
| | | var v=this.config.valueField.indexOf("attribute.")>=0?(item.attributes[this.config.valueField.replace("attribute.","")] || item.attributes.data[this.config.valueField.replace("attribute.","")]):(item.attributes[this.config.valueField] || item[this.config.valueField] || item.attributes.data[this.config.valueField]) |
| | | const textSep = this.config.textSep; |
| | | for (var j = 0; j < checkedData.checkedNodes.length; j++) { |
| | | const item = checkedData.checkedNodes[j]; |
| | | var v = this.config.valueField.indexOf("attribute.") >= 0 ? (item.attributes[this.config.valueField.replace("attribute.", "")] || item.attributes.data[this.config.valueField.replace("attribute.", "")]) : (item.attributes[this.config.valueField] || item[this.config.valueField] || item.attributes.data[this.config.valueField]) |
| | | value.push(v); |
| | | var tempRaw = []; |
| | | var textFieldArray = this.config.textField.split(","); |
| | | for (var i = 0; i < textFieldArray.length; i++) {//显示的字段可能有多个 |
| | | if (!validatenull(textFieldArray[i])) { |
| | | var t=textFieldArray[i].indexOf("attribute.")>=0?(item.attributes[textFieldArray[i].replace("attribute.","")] ||item.attributes.data[textFieldArray[i].replace("attribute.","")]):(item.attributes[textFieldArray[i]] || item[textFieldArray[i]] || item.attributes.data[textFieldArray[i]]) |
| | | var t = textFieldArray[i].indexOf("attribute.") >= 0 ? (item.attributes[textFieldArray[i].replace("attribute.", "")] || item.attributes.data[textFieldArray[i].replace("attribute.", "")]) : (item.attributes[textFieldArray[i]] || item[textFieldArray[i]] || item.attributes.data[textFieldArray[i]]) |
| | | tempRaw.push(t); |
| | | } |
| | | } |
| | | text.push(tempRaw.join(textSep)); |
| | | } |
| | | let mapFields =this.referConfig.fieldMap || {}; |
| | | let mapFields = this.referConfig.fieldMap || {}; |
| | | try { |
| | | if(!validatenull(this.options.mapFields)){ |
| | | mapFields =Object.assign(this.referConfig.fieldMap,JSON.parse(this.options.mapFields)) ; |
| | | if (!validatenull(this.options.mapFields)) { |
| | | mapFields = Object.assign(this.referConfig.fieldMap, JSON.parse(this.options.mapFields)); |
| | | } |
| | | }catch (e) { |
| | | } catch (e) { |
| | | |
| | | } |
| | | this.value = value.join(','); |
| | |
| | | showField: this.referConfig.showField, |
| | | value: this.value, |
| | | text: this.text || '', |
| | | isTreeMuti:this.isMuti, |
| | | isTreeMuti: this.isMuti, |
| | | rawData: checkedData.checkedNodes, |
| | | fieldMap:mapFields |
| | | fieldMap: mapFields |
| | | }); |
| | | } |
| | | } |