From 3eced4f79a9cf7b211e86b26b8c8ca20ae3f4576 Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期一, 29 一月 2024 09:44:59 +0800
Subject: [PATCH] 获取集团分类根节点前端传null传入后端直接改为空字符串bug修复
---
Source/UBCS-WEB/src/views/integration/integrationTransfer.vue | 257 +++++++++++++++++++++++++++------------------------
1 files changed, 135 insertions(+), 122 deletions(-)
diff --git a/Source/UBCS-WEB/src/views/integration/integrationTransfer.vue b/Source/UBCS-WEB/src/views/integration/integrationTransfer.vue
index e070be9..25df711 100644
--- a/Source/UBCS-WEB/src/views/integration/integrationTransfer.vue
+++ b/Source/UBCS-WEB/src/views/integration/integrationTransfer.vue
@@ -1,144 +1,157 @@
<template>
- <el-dialog :title="title" :visible.sync="dialogVisible" append-to-body="true" destroy-on-close width="35%"
- @close="handelClose">
- <el-form :model="form">
- <el-form-item label="鏌ヨ鏉′欢" label-width="70px" size="small">
- <el-input v-model="inputVal" autocomplete="off" @change="handleQuery"></el-input>
- </el-form-item>
- </el-form>
- <p class="text_tip">*閫夋嫨鍒嗙被杩涜灞炴�ц繃婊�, 鎴栬�呰緭鍏ュ睘鎬х殑鍏ㄦ嫾鎴栬�呯畝鎷艰繘琛屾煡璇�! 濡�: 濮撳悕 (鍙緭鍏m鎴杧inming )</p>
- <transfer v-model="transferValue" :data="newdata" :filter-method="filterMethod"
- :filter-placeholder="filterPlaceholder" :props="props"></transfer>
- <span slot="footer" class="dialog-footer">
+ <el-dialog :title="title" :visible.sync="dialogVisible" append-to-body="true" destroy-on-close width="50%"
+ @close="handelClose">
+ <el-form :model="form">
+ <el-form-item label="鏌ヨ鏉′欢" label-width="70px" size="small">
+ <el-input v-model="inputVal" autocomplete="off" @change="handleQuery"></el-input>
+ </el-form-item>
+ </el-form>
+ <p class="text_tip">*閫夋嫨鍒嗙被杩涜灞炴�ц繃婊�, 鎴栬�呰緭鍏ュ睘鎬х殑鍏ㄦ嫾鎴栬�呯畝鎷艰繘琛屾煡璇�! 濡�: 濮撳悕 (鍙緭鍏m鎴杧inming )</p>
+ <div style="width: 100%; display: flex; justify-content: space-around">
+ <transfer v-model="transferValue" :data="newdata" :filter-method="filterMethod"
+ :filter-placeholder="filterPlaceholder" :props="props"></transfer>
+ </div>
+ <span slot="footer" class="dialog-footer">
<el-button @click="visible = false">鍙� 娑�</el-button>
<el-button type="primary" @click="handelTransferSave">淇� 瀛�</el-button>
</span>
- </el-dialog>
+ </el-dialog>
</template>
<script>
import transfer from '@/components/transfer/index'
import pinyin from 'js-pinyin'
+
export default {
- components: {
- transfer
+ components: {
+ transfer
+ },
+ name: 'IntegrationTransfer',
+ props: {
+ // 鏄惁鎵撳紑
+ visible: {
+ typeof: Boolean,
+ default: false
},
- name: 'IntegrationTransfer',
+ // 寮圭獥鏍囬
+ title: {
+ typeof: String,
+ default: '缂栫爜灞炴��'
+ },
+ // 鏁版嵁婧�
+ data: {
+ typeof: Array,
+ default: () => []
+ },
+ // 鏁版嵁榛樿鍊煎緱props
props: {
- // 鏄惁鎵撳紑
- visible: {
- typeof: Boolean,
- default: false
- },
- // 寮圭獥鏍囬
- title: {
- typeof: String,
- default: '缂栫爜灞炴��'
- },
- // 鏁版嵁婧�
- data: {
- typeof: Array,
- default: () => []
- },
- // 鏁版嵁榛樿鍊煎緱props
- props: {
- typeof: Object,
- default: () => {
- return {
- label: 'label',
- key: 'key',
- disabled: 'disabled'
- };
- }
- },
- // 濡傛灉鏈夌壒娈婃搷浣滐紝涓�鏉℃暟鎹彧鑳界敤涓�娆$殑鎿嶄綔锛屽氨闇�瑕佹妸绂佺敤鐨勬暟鎹瓧娈电敤lebel瀵瑰簲鐨勫�间紶閫掕繃鏉�
- disabledData: {
- typeof: Array,
- default: () => []
- },
- // 鏌ヨ鏂囨湰妗嗙殑placeholder
- filterPlaceholder: {
- typeof: String,
- default: '璇疯緭鍏ユ嫾闊冲叏鎷兼垨鑰呮嫾闊崇缉鍐�'
- }
- },
- data() {
+ typeof: Object,
+ default: () => {
return {
- inputVal: '',
- transferValue: this.value,
- dialogVisible: this.visible,
- }
+ label: 'label',
+ key: 'key',
+ disabled: 'disabled'
+ };
+ }
},
- watch: {
- visible(n) {
- this.dialogVisible = n;
- },
- dialogVisible(n) {
- this.$emit('update:visible', n)
- },
+ // 濡傛灉鏈夌壒娈婃搷浣滐紝涓�鏉℃暟鎹彧鑳界敤涓�娆$殑鎿嶄綔锛屽氨闇�瑕佹妸绂佺敤鐨勬暟鎹瓧娈电敤lebel瀵瑰簲鐨勫�间紶閫掕繃鏉�
+ disabledData: {
+ typeof: Array,
+ default: () => []
},
- computed: {
- newdata() {
- pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
- let name = this.props.label
- let key = this.props.key
- if(this.data){
- let data = this.data.map(item => {
- let objitem = { disabled: false, ...item }
- if (this.disabledData.length !== 0) {
- this.disabledData.forEach(element => {
- if (objitem[name] === element) objitem.disabled = true
- });
- }
- return objitem
- })
- return
- }
- return data.map(item => {
- let pinYin = pinyin.getFullChars(item[this.props.label])
- let renPing = pinyin.getCamelChars(item[this.props.label])
- const obj = { pinyins: pinYin, renPing: renPing, [name]: item[this.props.label], [key]: item[this.props.key], disabled: item.disabled }
- return obj
- })
- }
- },
- methods: {
- // 鏂板寮圭獥鏌ヨ鎸夐挳
- handleQuery(event) {
- this.inputVal = event
- },
- // 绌挎妗嗘煡璇㈡暟鎹繃婊わ紙鍙屾潯浠讹級
- filterMethod(query, item) {
- return item.pinyins.indexOf(this.inputVal) > -1 || item.renPing.indexOf(this.inputVal) > -1
- },
- // 鍏抽棴娓呴櫎鎵�鏈夋暟鎹�
- handelClose() {
- this.transferValue = []
- this.inputVal = ''
- this.visible = false
- },
- // 纭畾鎸夐挳锛岃繑鍥炲綋鍓嶆暟鎹拰淇敼鍚庣殑鏁版嵁
- handelTransferSave() {
- let that = this
- let datas = that.newdata
- const findtra = datas.findIndex(item => item.oid === that.transferValue[0].oid)
- datas[findtra].disabled = true
- const obj = {
- // 褰撳墠閫夋嫨鐨勬暟鎹�
- value: this.transferValue,
- // 鎬绘暟鎹�
- data: datas
- }
- that.$emit('save', obj)
- that.transferValue = []
- that.inputVal = ''
- },
+ // 鏌ヨ鏂囨湰妗嗙殑placeholder
+ filterPlaceholder: {
+ typeof: String,
+ default: '璇疯緭鍏ユ嫾闊冲叏鎷兼垨鑰呮嫾闊崇缉鍐�'
}
+ },
+ data() {
+ return {
+ inputVal: '',
+ transferValue: this.value,
+ dialogVisible: this.visible,
+ }
+ },
+ watch: {
+ visible(n) {
+ this.dialogVisible = n;
+ },
+ dialogVisible(n) {
+ this.$emit('update:visible', n)
+ },
+ },
+ computed: {
+ newdata() {
+ pinyin.setOptions({checkPolyphone: false, charCase: 1});
+
+ let name = this.props.label;
+ let key = this.props.key;
+
+ if (Array.isArray(this.data)) {
+ let data = this.data.map(item => {
+ let objitem = {disabled: false, ...item};
+ if (this.disabledData.length !== 0) {
+ this.disabledData.forEach(element => {
+ if (objitem[name] === element) objitem.disabled = true;
+ });
+ }
+ return objitem;
+ });
+ return data.map(item => {
+ let pinYin = pinyin.getFullChars(item[this.props.label]);
+ let renPing = pinyin.getCamelChars(item[this.props.label]);
+ const obj = {
+ pinyins: pinYin,
+ renPing: renPing,
+ [name]: item[this.props.label],
+ [key]: item[this.props.key],
+ disabled: item.disabled,
+ id:item.id
+ };
+ return obj;
+ });
+ } else {
+ return []; // 鍦ㄦ病鏈夋暟鎹椂杩斿洖涓�涓┖鏁扮粍
+ }
+ }
+ },
+ methods: {
+ // 鏂板寮圭獥鏌ヨ鎸夐挳
+ handleQuery(event) {
+ this.inputVal = event
+ },
+ // 绌挎妗嗘煡璇㈡暟鎹繃婊わ紙鍙屾潯浠讹級
+ filterMethod(query, item) {
+ return item.pinyins.indexOf(this.inputVal) > -1 || item.renPing.indexOf(this.inputVal) > -1
+ },
+ // 鍏抽棴娓呴櫎鎵�鏈夋暟鎹�
+ handelClose() {
+ this.transferValue = []
+ this.inputVal = ''
+ this.visible = false
+ },
+ // 纭畾鎸夐挳锛岃繑鍥炲綋鍓嶆暟鎹拰淇敼鍚庣殑鏁版嵁
+ handelTransferSave() {
+ let that = this
+ let datas = that.newdata
+ const findtra = datas.findIndex(item => item.oid === that.transferValue[0].oid)
+ datas[findtra].disabled = true
+ const obj = {
+ // 褰撳墠閫夋嫨鐨勬暟鎹�
+ value: this.transferValue,
+ // 鎬绘暟鎹�
+ data: datas
+ }
+ that.$emit('save', obj)
+ that.transferValue = []
+ that.inputVal = ''
+ },
+ }
}
</script>
<style lang="scss" scoped>
.text_tip {
- padding: 10px 0;
- color: #F56C6C;
+ padding: 10px 0;
+ color: #F56C6C;
}
</style>
--
Gitblit v1.9.3