2023-4-17-设备

zhc4dev
YTD 2 years ago
parent 69ccdd769d
commit 16cd8ca4d7
  1. 2
      ant-design-vue-jeecg/src/components/jeecg/modal/JPopupOnlReport.vue
  2. 222
      ant-design-vue-jeecg/src/components/jeecgbiz/JSelectUserByDep.vue
  3. 2
      ant-design-vue-jeecg/src/components/jeecgbiz/modal/JSelectUserByDepModal.vue
  4. 2
      ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue

@ -119,7 +119,7 @@
total: 0 total: 0
} }
}, },
cgRpConfigId:"", cgRpConfigId:"1610839316058812417",
modalWidth:MODAL_WIDTH, modalWidth:MODAL_WIDTH,
tableScroll:{x:true}, tableScroll:{x:true},
dynamicParam:{}, dynamicParam:{},

@ -1,111 +1,145 @@
<template> <template>
<div> <div>
<a-input-search <!-- <a-input
v-model="userNames" v-model="userNames"
placeholder="请选择用户" placeholder="请点击选择用户"
readOnly readOnly
unselectable="on" unselectable="on"
@search="onSearchDepUser"> @search="onSearchDepUser"
:disabled="disabled"
@click="onSearchDepUser"
>
<a-icon slot="enterButton" type="cluster" title="部门选择控件" />
</a-input> -->
<a-input-search v-model="userNames" placeholder="请先选择用户" readOnly unselectable="on" @search="onSearchDepUser">
<a-button slot="enterButton" :disabled="disabled">选择用户</a-button> <a-button slot="enterButton" :disabled="disabled">选择用户</a-button>
</a-input-search> </a-input-search>
<j-select-user-by-dep-modal ref="selectModal" :modal-width="modalWidth" :multi="multi" @ok="selectOK" :user-ids="value" @initComp="initComp"/> <j-select-user-by-dep-modal
ref="selectModal"
:modal-width="modalWidth"
:multi="multi"
@ok="selectOK"
:user-ids="value"
@initComp="initComp"
/>
<!-- :user-ids="value" -->
</div> </div>
</template> </template>
<script> <script>
import JSelectUserByDepModal from './modal/JSelectUserByDepModal' import JSelectUserByDepModal from './modal/JSelectUserByDepModal'
export default { export default {
name: 'JSelectUserByDep', name: 'JSelectUserByDep',
components: {JSelectUserByDepModal}, components: { JSelectUserByDepModal },
props: { props: {
modalWidth: { modalWidth: {
type: Number, type: Number,
default: 1250, default: 1250,
required: false required: false,
}, },
value: { value: {
type: String, type: String,
required: false required: false,
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false,
}, },
multi: { multi: {
type: Boolean, type: Boolean,
default: true, default: false,
required: false required: false,
}, },
backUser: { backUser: {
type: Boolean, type: Boolean,
default: false, default: false,
required: false required: false,
} },
}, },
data() { data() {
return { return {
userIds: "", userIds: '',
userNames: "" userNames: '',
}
},
mounted() {
this.userIds = this.value
},
watch: {
value(val) {
this.userIds = val
}
},
model: {
prop: 'value',
event: 'change'
},
methods: {
initComp(userNames) {
this.userNames = userNames
},
//
backDeparInfo(){
if(this.backUser===true){
if(this.userIds && this.userIds.length>0){
let arr1 = this.userIds.split(',')
let arr2 = this.userNames.split(',')
let info = []
for(let i=0;i<arr1.length;i++){
info.push({
value: arr1[i],
text: arr2[i]
})
} }
this.$emit('back', info) },
} mounted() {
} this.userIds = this.value
}, },
onSearchDepUser() { watch: {
this.$refs.selectModal.showModal() value(val) {
}, this.userIds = val
selectOK(rows, idstr) { },
console.log("当前选中用户", rows) },
console.log("当前选中用户ID", idstr) // model: {
if (!rows) { // prop: 'value',
this.userNames = '' // event: 'change',
this.userIds = '' // },
} else { methods: {
let temp = '' initComp(userNames) {
for (let item of rows) { this.userNames = userNames
temp += ',' + item.realname },
} //
this.userNames = temp.substring(1) backDeparInfo() {
this.userIds = idstr if (this.backUser === true) {
} if (this.userIds && this.userIds.length > 0) {
this.$emit("change", this.userIds) let arr1 = this.userIds.split(',')
} let arr2 = this.userNames.split(',')
let info = []
for (let i = 0; i < arr1.length; i++) {
info.push({
value: arr1[i],
text: arr2[i],
})
}
this.$emit('back', info)
}
}
},
onSearchDepUser() {
this.$refs.selectModal.showModal()
},
selectOK(rows, idstr) {
//
let temp = ''
console.log('当前选中用户', rows)
console.log('当前选中用户ID', idstr)
//if(!rows)
if (!rows && rows.length <= 0) {
this.userNames = ''
this.userIds = ''
} else {
// let temp = ''
//
for (let item of rows) {
//
console.log(item)
// temp += item.realname
console.log(temp)
//
temp += ' ' + item.realname
}
// this.userNames = temp.substring(1)
this.userNames = temp
console.log(this.userNames)
this.userIds = idstr
console.log(rows)
}
this.$emit('change', this.userIds)
//
// this.$emit('change', this.userNames)
this.backDeparInfo()
},
},
model: {
prop: 'userNames',
event: 'change',
},
} }
}
</script> </script>
<style scoped> <style scoped></style>
</style>

@ -275,7 +275,7 @@
this.selectUserRows.push(row) this.selectUserRows.push(row)
} }
} }
this.selectUserIds = this.selectUserRows.map(row => row.username).join(',') this.selectUserIds = this.selectUserRows.map(row => row.id).join(',')
}, },
// , // ,
onDepSelect(selectedDepIds) { onDepSelect(selectedDepIds) {

@ -61,7 +61,7 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="管理人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="administrator"> <a-form-model-item label="管理人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="administrator">
<j-select-user-by-dep v-model="model.administrator" /> <j-select-user-by-dep v-model="model.administrator" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">

Loading…
Cancel
Save