zhangxp
2023-06-01 d5fae6385b7f55cb84986b4b7fa341ad1cd9f75f
集成接口联调
已修改3个文件
已添加1个文件
396 ■■■■■ 文件已修改
Source/UBCS-WEB/src/api/integration/integration.js 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/router/axios.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/integration/integrationIndex.vue 333 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/vue.config.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/integration/integration.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
import request from '@/router/axios';
// ä¸»æ•°æ®åˆ†ç±»æ ‘
export const referCodeClassifyTree = (params) => {
    return request({
      url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/referCodeClassifyTree',
      method: 'get',
      params: params
    })
  }
  // ä¸»æ•°æ®åˆ†ç±»å±žæ€§ä¿¡æ¯
export const listCodeAttributeByClassId = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/listCodeAttributeByClassId',
    method: 'get',
    params: params
  })
}
// é›†å›¢åˆ†ç±»æ ‘
export const referTree = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/referTree',
    method: 'get',
    params: params
  })
}
// é›†å›¢åˆ†ç±»æ ‘(查询集团分类属性接口)
export const referTreeByClassId = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/listViewModelAttributeByClassId',
    method: 'get',
    params: params
  })
}
// å±žæ€§æ˜ å°„
export const gridAttrMapping = (params) => {
  return request({
    url: '/api//ubcs-applyjtcodeservice/DockingPreApplyCode/gridAttrMapping',
    method: 'get',
    params: params
  })
}
// å±žæ€§å–值范围映射
export const gridAttrRanges = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/gridAttrRanges',
    method: 'get',
    params: params
  })
}
// å±žæ€§æ˜ å°„保存方法
export const batchAddSave = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/DockingPreApplyCode/batchAddSave',
    method: 'get',
    params: params
  })
}
Source/UBCS-WEB/src/router/axios.js
@@ -17,7 +17,7 @@
import 'nprogress/nprogress.css';
//默认超时时间
axios.defaults.timeout = 10000;
axios.defaults.timeout = 20000;
//返回其他状态码
axios.defaults.validateStatus = function (status) {
  return status >= 200 && status <= 500;
Source/UBCS-WEB/src/views/integration/integrationIndex.vue
@@ -6,16 +6,29 @@
                    <el-input placeholder="输入关键字进行过滤" v-model="filterText">
                    </el-input>
                    <el-menu :default-openeds="['1', '3']">
                        <el-tree class="filter-tree" :data="treeData" :props="defaultProps" default-expand-all
                            :filter-node-method="filterNode" ref="tree">
                        <el-tree class="filter-tree" :data="treeData" accordion :props="defaultProps"
                            :filter-node-method="filterNode" empty-text="暂无数据" ref="tree" @node-click="handelTreeCell">
                        </el-tree>
                    </el-menu>
                </el-aside>
            </el-card>
            <el-main>
                <el-card>
                    <avue-crud :data="tableData" :option="option" ref="crud" @row-update="addUpdate" @row-save="rowSave"
                        @row-click="handleRowClick">
                    <el-form :model="form">
                        <el-form-item label="集团分类" label-width="70px" size="small">
                            <el-select clearable ref="selectTree" v-model="form.groupValue" placeholder="请选择"
                                popper-class="popperTreeSelect">
                                <el-option :value="groupVal" :label="groupVal">
                                    <el-tree ref="groupTree" :data="groupTreeData" empty-text="暂无数据" :props="defaultProps"
                                        @node-click="handleNodeClick">
                                    </el-tree>
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-form>
                    <avue-crud :table-loading="loading" :data="tableData" :option="option" ref="crud" @cell-class-name="handelCellRow"
                        @cell-click="handleCellClick">
                        <template slot="menuLeft">
                            <el-button icon="el-icon-plus" size="small" type="primary" @click="dialogPush = true">新 å¢ž
                            </el-button>
@@ -24,35 +37,40 @@
                            <el-button icon="el-icon-connection" size="small" type="primary" @click="handleSync">同步模型
                            </el-button>
                        </template>
                        <template slot="defaultValue" slot-scope="{scope}">
                            <!-- <el-input v-model="scope.row.defaultValue" v-if="scope.row.index === tableRowIndex && scope.column.index === tableColumnIndex" @blur="inputBlur"> </el-input> -->
                            <span>{{ scope }}</span>
                        </template>
                    </avue-crud>
                    <el-card :style="{ marginTop: '20px' }">
                        <avue-crud :data="tableData" :option="optinos" ref="crud" @row-update="addUpdate"
                            @row-save="rowSave" @row-click="handleRowClick">
                        <avue-crud :data="tablesData" :option="optinos" ref="crud"
                        @cell-click="handleCellClick">
                        </avue-crud>
                    </el-card>
                </el-card>
                <el-dialog title="编码属性" :visible.sync="dialogPush" destroy-on-close append-to-body="true" width="30%"
                    :before-close="handleClose">
                    <el-form :model="form">
                        <el-form-item label="查询条件" label-width="70px" size="small">
                            <el-input v-model="form.name" autocomplete="off" @change="handleQuery"></el-input>
                        </el-form-item>
                    </el-form>
                    <p class="text_tip">*选择分类进行属性过滤, æˆ–者输入属性的全拼或者简拼进行查询! å¦‚: å§“名 (可输入xm或xinming )</p>
                    <transfer v-model="transferValue" :data="transferData" :filter-method="filterMethod"
                        filter-placeholder="请输入属性拼音全拼或者拼音缩写" @left-check-change="handelLeftCheck"></transfer>
                    <span slot="footer" class="dialog-footer">
                        <el-button @click="dialogPush = false">取 æ¶ˆ</el-button>
                        <el-button type="primary" @click="dialogVisible = false">保 å­˜</el-button>
                    </span>
                </el-dialog>
            </el-main>
        </el-container>
        <el-dialog title="编码属性" :visible.sync="dialogPush" append-to-body="true" destroy-on-close width="30%"
            :before-close="handleClose">
            <el-form :model="form">
                <el-form-item label="查询条件" label-width="70px" size="small">
                    <el-input v-model="form.name" autocomplete="off" @change="handleQuery"></el-input>
                </el-form-item>
            </el-form>
            <p class="text_tip">*选择分类进行属性过滤, æˆ–者输入属性的全拼或者简拼进行查询! å¦‚: å§“名 (可输入xm或xinming )</p>
            <transfer v-model="transferValue" :data="transferData" :filter-method="filterMethod"
                filter-placeholder="请输入属性拼音全拼或者拼音缩写" @left-check-change="handelLeftCheck"></transfer>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogPush = false">取 æ¶ˆ</el-button>
                <el-button type="primary" @click="dialogPush = false">保 å­˜</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import transfer from '@/components/transfer/index'
import pinyin from 'js-pinyin'
import { referCodeClassifyTree, referTree, gridAttrMapping } from '@/api/integration/integration.js'
export default {
    components: {
        transfer
@@ -75,94 +93,27 @@
        return {
            form: {
                name: '',
                groupValue: ''
            },
            loading: false,
            ishowTree: false,
            search: '',
            transferData: generateData(),
            transferValue: [],
            dialogPush: false,
            tableData: [
            tableData: [],
            tablesData: [
                {
                    id: 1,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 2,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                },
                {
                    id: 3,
                    groupTypeName: '人员',
                    codeView: '编码视图',
                    sex: '性别',
                    typeName: '螺栓',
                    attributeName: '',
                    defaultValue: '',
                    id:'01',
                    groupTypeName:'李四',
                    codeView:'张三',
                    sex:'',
                    typeName:''
                }
            ],
            filterText: '',
            tableRowIndex:null,
            tableColumnIndex:null,
            optinos: {
                title: '集团属性',
                maxHeight: '300px',
@@ -182,8 +133,8 @@
                column: [
                    { label: '属性集团枚举值', prop: 'groupTypeName', minWidth: 80, },
                    { label: '集团属性枚举显示名称', prop: 'codeView', minWidth: 80 },
                    { label: 'MDM枚举值', prop: 'sex', minWidth: 80 },
                    { label: 'MDM枚举显示名称', prop: 'typeName', minWidth: 80, overHidden: true },
                    { label: 'MDM枚举值', prop: 'sex', minWidth: 80, cell: true },
                    { label: 'MDM枚举显示名称', prop: 'typeName', minWidth: 80, cell: true },
                ]
            },
            option: {
@@ -198,89 +149,91 @@
                emptyBtn: false,
                searchBtn: false,
                searchShowBtn: false,
                cellBtn: true,
                cellBtn: false,
                border: true,
                searchMenuSpan: 8,
                column: [
                    {
                        label: '集团分类',
                        prop: 'groupTypeName',
                        minWidth: 80,
                        type: "select",
                        dicUrl: "/api/ubcs-system/dict/dictionary?code=org_category",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        slot: true,
                        search: true,
                        rules: [{
                            message: "请输入集团分类名称"
                        }]
                    },
                    { label: '所属视图', prop: 'codeView', minWidth: 80 },
                    { label: '集团属性', prop: 'sex', minWidth: 80 },
                    { label: '分类名称', prop: 'typeName', minWidth: 80, overHidden: true },
                    { label: '属性名称', prop: 'attributeName', minWidth: 80, cell: true },
                    { label: '集团分类', prop: 'sourceClassifyName', minWidth: 80, },
                    { label: '所属视图', prop: 'viewName', minWidth: 80 },
                    { label: '集团属性', prop: 'sourceAttrName', minWidth: 80 },
                    { label: '分类名称', prop: 'targetClassifyName', minWidth: 80, overHidden: true },
                    { label: '属性名称', prop: 'targetAttrName', minWidth: 80},
                    { label: '默认值', prop: 'defaultValue', minWidth: 140, cell: true },
                ]
            },
            treeData: [{
                id: 1,
                label: '一级 1',
                children: [{
                    id: 4,
                    label: '二级 1-1',
                    children: [{
                        id: 9,
                        label: '三级 1-1-1'
                    }, {
                        id: 10,
                        label: '三级 1-1-2'
                    }]
                }]
            }, {
                id: 2,
                label: '一级 2',
                children: [{
                    id: 5,
                    label: '二级 2-1'
                }, {
                    id: 6,
                    label: '二级 2-2'
                }]
            }, {
                id: 3,
                label: '一级 3',
                children: [{
                    id: 7,
                    label: '二级 3-1'
                }, {
                    id: 8,
                    label: '二级 3-2'
                }]
            }],
            treeData: [],
            groupTreeData: [],
            defaultProps: {
                children: 'children',
                label: 'label'
            }
                label: 'name',
                id: 'oid',
                isLeaf: ''
            },
            groupVal: '',
            treeParam: {}
        }
    },
    watch: {
        filterText(val) {
            console.log(this.$refs.tree)
            this.$refs.tree.filter(val);
        }
    },
    created() {
        this.getReferCodeClassifyTree()
        pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
        console.log(pinyin.getFullChars('管理员'))
        console.log(pinyin.getCamelChars('管理员'))
    },
    methods: {
        async getReferCodeClassifyTree() {
            const param = {
                parentBtmName: "jclass",
                valueField: "oid",
                textField: "name",
                parentFieldName: "id"
            }
            const response = await referCodeClassifyTree(param)
            console.log(response)
            if (response.status === 200) {
                let data = response.data;
                this.treeData = data.map(item => item.children ? { ...item, ...{ isLeaf: false } } : { ...item, ...{ isLeaf: true } })
            }
        },
        async getlistCodeAttributeByClassId(oid) {
            this.loading = true
            console.log(this.treeParam)
            const response = await gridAttrMapping({ sourceClassifyId: oid, ...this.treeParam })
            console.log(response)
            if (response.status === 200) {
                this.loading = false
                this.tableData = response.data.data
            }
        },
        async referTree(oid, checked) {
            this.groupTreeData = []
            const response = await referTree({ 'conditionMap[codeclsfid]': oid, parentOid: null })
            console.log(response)
            if (response.status === 200) {
                if (checked) {
                    let items = response.data.map(item => {
                        let obj = {}
                        if (item.checked) obj = { ...item }
                        else obj = null
                        return obj
                    })
                    var r = items.filter(s => { return s && s.trim() });
                    this.groupTreeData = r
                } else {
                    this.groupTreeData = response.data
                }
            }
        },
        filterNode(value, data) {
            console.log(value)
            console.log(data)
            if (!value) return true;
            return data.label.indexOf(value) !== -1;
            return data.name.indexOf(value) !== -1;
        },
        handleSave() {
@@ -291,26 +244,46 @@
        handelLeftCheck(event) {
            console.log(event)
        },
        addUpdate(event, done) {
            console.log(event)
            done()
        },
        rowSave(event, done) {
            console.log(event)
            done()
        },
        handleRowClick(row, event, column) {
            console.log(row)
            console.log(event)
            console.log(column)
        handelCellRow( {row, column, rowIndex, columnIndex }) {
            row.index = rowIndex
            column.index = columnIndex
        },
        handleQuery(event) {
            console.log(event)
            this.form.name = event
        },
        filterMethod(query, item) {
        filterMethod(item) {
            return item.pinyins.indexOf(this.form.name) > -1;
        },
        handelTreeCell(event) {
            console.log(event)
            if (event.leaf) {
                this.treeParam.codeClassifyId = event.oid
                this.form.groupValue = ''
                this.groupVal = ''
                this.tableData = []
                this.referTree(event.oid, event.checked)
            }
        },
        handleNodeClick(data) {
            console.log(data)
            this.form.groupValue = data.name
            this.groupVal = data.name
            this.$refs.selectTree.blur()
            this.getlistCodeAttributeByClassId(data.oid)
        },
        handleCellClick(row, column,cell, event) {
            console.log(row)
            console.log(column)
            console.log(cell)
            console.log(event)
          this.tableRowIndex = row.index
          this.tableColumnIndex = column.index
        },
        inputBlur() {
            this.tableColumnIndex = ''
            this.tableRowIndex = null
        }
    }
}
</script>
@@ -320,6 +293,14 @@
    color: #F56C6C;
}
.setstyle {
    min-height: 200px;
    padding: 0 !important;
    margin: 0;
    overflow: auto;
    cursor: default !important;
}
/deep/ .el-transfer-panel__list {
    width: 100%;
}
Source/UBCS-WEB/vue.config.js
@@ -27,7 +27,8 @@
      '/api': {
        //本地服务接口地址
          target: 'http://localhost:37000',
        // target: 'http://192.168.3.7:37000',
        // target: 'http://192.168.1.63:37000',
        //target: 'http://192.168.3.7:37000',
        //target: 'http://dev.vci-tech.com:37000',
        //target: 'http://192.168.1.51:37000/',
        //远程演示服务地址,可用于直接启动项目