|
@@ -14,14 +14,64 @@
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
>
|
|
|
- <a-select v-decorator="['repairUserId', {rules: [{required: true, message: '维修人负责人不能为空'}]}]" placeholder="请选择">
|
|
|
|
|
- <a-select-option
|
|
|
|
|
- v-for="item in deptUserList"
|
|
|
|
|
- :key="item.userId"
|
|
|
|
|
- :label="item.realName"
|
|
|
|
|
- :value="item.userId">{{ item.realName }}
|
|
|
|
|
- </a-select-option>
|
|
|
|
|
- </a-select>
|
|
|
|
|
|
|
+ <div style="position: relative;">
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ v-model="searchKeyword"
|
|
|
|
|
+ placeholder="点击选择维修负责人"
|
|
|
|
|
+ readonly
|
|
|
|
|
+ @click="showDropdown = !showDropdown"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-icon
|
|
|
|
|
+ slot="suffix"
|
|
|
|
|
+ type="down"
|
|
|
|
|
+ @click="showDropdown = !showDropdown"
|
|
|
|
|
+ />
|
|
|
|
|
+ </a-input>
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="showDropdown"
|
|
|
|
|
+ style="
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 100%;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ border: 1px solid #d9d9d9;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
|
|
|
+ max-height: 300px;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ z-index: 1000;
|
|
|
|
|
+ margin-top: 4px;
|
|
|
|
|
+ "
|
|
|
|
|
+ @mouseleave="onDropdownMouseLeave"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div style="padding: 8px; border-bottom: 1px solid #f0f0f0; position: sticky; top: 0; background: #fff; z-index: 1;">
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ v-model="filterKeyword"
|
|
|
|
|
+ placeholder="搜索姓名"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @click.stop
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="item in filteredDeptUserList"
|
|
|
|
|
+ :key="item.userId"
|
|
|
|
|
+ @click="selectUser(item)"
|
|
|
|
|
+ :style="{
|
|
|
|
|
+ padding: '8px 12px',
|
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
|
+ background: selectedUserId === item.userId ? '#e6f7ff' : 'transparent'
|
|
|
|
|
+ }"
|
|
|
|
|
+ @mouseenter="($event.target.style.background = selectedUserId === item.userId ? '#e6f7ff' : '#f5f5f5')"
|
|
|
|
|
+ @mouseleave="($event.target.style.background = selectedUserId === item.userId ? '#e6f7ff' : 'transparent')"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ item.realName }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="filteredDeptUserList.length === 0" style="padding: 16px; text-align: center; color: #999;">
|
|
|
|
|
+ 无匹配结果
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
</row-item>
|
|
</row-item>
|
|
|
</row-list>
|
|
</row-list>
|
|
@@ -51,38 +101,76 @@ import { queryUserDept } from '@/api/upms/user-dept'
|
|
|
import { queryUser } from '@/api/upms/user'
|
|
import { queryUser } from '@/api/upms/user'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- name: 'DispatchBaseForm',
|
|
|
|
|
|
|
+ name: 'AssignForm',
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
confirmLoading: false,
|
|
confirmLoading: false,
|
|
|
modalTitle: null,
|
|
modalTitle: null,
|
|
|
form: this.$form.createForm(this),
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
visible: false,
|
|
|
- // 下拉框map
|
|
|
|
|
sourceMap: {},
|
|
sourceMap: {},
|
|
|
levelMap: {},
|
|
levelMap: {},
|
|
|
statusMap: {},
|
|
statusMap: {},
|
|
|
record: {},
|
|
record: {},
|
|
|
userList: [],
|
|
userList: [],
|
|
|
- deptUserList: []
|
|
|
|
|
|
|
+ deptUserList: [],
|
|
|
|
|
+ showDropdown: false,
|
|
|
|
|
+ searchKeyword: '',
|
|
|
|
|
+ filterKeyword: '',
|
|
|
|
|
+ selectedUserId: null,
|
|
|
|
|
+ selectedUserName: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- props: {
|
|
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ filteredDeptUserList () {
|
|
|
|
|
+ if (!this.filterKeyword) {
|
|
|
|
|
+ return this.deptUserList
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.deptUserList.filter(item =>
|
|
|
|
|
+ item.realName.toLowerCase().includes(this.filterKeyword.toLowerCase())
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
created () {
|
|
created () {
|
|
|
- // 下拉框map
|
|
|
|
|
this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
|
|
this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
|
|
|
this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
|
|
this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
|
|
|
this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
|
|
this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
|
|
|
this.getUsers()
|
|
this.getUsers()
|
|
|
this.getDeptUsers()
|
|
this.getDeptUsers()
|
|
|
},
|
|
},
|
|
|
|
|
+ mounted () {
|
|
|
|
|
+ document.addEventListener('click', this.handleDocumentClick)
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeDestroy () {
|
|
|
|
|
+ document.removeEventListener('click', this.handleDocumentClick)
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ handleDocumentClick (e) {
|
|
|
|
|
+ if (this.showDropdown && !e.target.closest('.ant-input-affix-wrapper')) {
|
|
|
|
|
+ this.showDropdown = false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onDropdownMouseLeave () {
|
|
|
|
|
+ },
|
|
|
|
|
+ selectUser (item) {
|
|
|
|
|
+ this.selectedUserId = item.userId
|
|
|
|
|
+ this.selectedUserName = item.realName
|
|
|
|
|
+ this.searchKeyword = item.realName
|
|
|
|
|
+ this.showDropdown = false
|
|
|
|
|
+ this.form.setFieldsValue({ repairUserId: item.userId })
|
|
|
|
|
+ },
|
|
|
base (record) {
|
|
base (record) {
|
|
|
this.visible = true
|
|
this.visible = true
|
|
|
- // 如果是空标识添加
|
|
|
|
|
this.modalTitle = '派工'
|
|
this.modalTitle = '派工'
|
|
|
this.record = record
|
|
this.record = record
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.form.resetFields()
|
|
|
|
|
+ this.selectedUserId = null
|
|
|
|
|
+ this.selectedUserName = ''
|
|
|
|
|
+ this.searchKeyword = ''
|
|
|
|
|
+ this.filterKeyword = ''
|
|
|
|
|
+ this.showDropdown = false
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
getDeptUsers () {
|
|
getDeptUsers () {
|
|
|
queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.XIAN_CHANG_WEI_XIU_ZU, userStatus: 1 }).then(res => {
|
|
queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.XIAN_CHANG_WEI_XIU_ZU, userStatus: 1 }).then(res => {
|
|
@@ -97,6 +185,10 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
save () {
|
|
save () {
|
|
|
|
|
+ if (!this.selectedUserId) {
|
|
|
|
|
+ this.$message.warning('请选择维修负责人')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
const { form: { validateFieldsAndScroll } } = this
|
|
const { form: { validateFieldsAndScroll } } = this
|
|
|
this.confirmLoading = true
|
|
this.confirmLoading = true
|
|
|
validateFieldsAndScroll((errors, values) => {
|
|
validateFieldsAndScroll((errors, values) => {
|
|
@@ -105,6 +197,7 @@ export default {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
values.id = this.record.id
|
|
values.id = this.record.id
|
|
|
|
|
+ values.repairUserId = this.selectedUserId
|
|
|
dispatchModelByDTO(values)
|
|
dispatchModelByDTO(values)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
this.handleCancel(values)
|
|
this.handleCancel(values)
|