|
|
@@ -113,8 +113,36 @@
|
|
|
<u-input v-model="form.limitHours" type="number" placeholder="请输入要求时间(小时)" />
|
|
|
</u-form-item>
|
|
|
<u-form-item label="报修人" prop="actualUser" required :label-width="150">
|
|
|
- <u-input v-model="form.actualUser" :cursor-spacing="cursorSpacing" />
|
|
|
+ <!-- 报修人默认带出当前登录人,可搜索选择系统账号,避免同名报修人无法区分 -->
|
|
|
+ <u-input v-model="form.actualUser" disabled @click="openReporterPopup" type="select"
|
|
|
+ placeholder="请选择报修人" />
|
|
|
</u-form-item>
|
|
|
+ <u-popup v-model="reporterPopupShow" mode="bottom" border-radius="20">
|
|
|
+ <view class="bg-color-white">
|
|
|
+ <view class="d-flex j-between a-center p3">
|
|
|
+ <view class="text-color-6 f-size-28" @click="reporterPopupShow = false">取消</view>
|
|
|
+ <view class="main-color-text f-size-32 f-weight-6">选择报修人</view>
|
|
|
+ <view class="f-size-28" style="visibility: hidden">占位</view>
|
|
|
+ </view>
|
|
|
+ <view class="px3 pb2">
|
|
|
+ <u-search v-model="reporterKeyword" placeholder="搜索姓名或账号" :show-action="false"
|
|
|
+ :bg-color="'#f4f4f4'"></u-search>
|
|
|
+ </view>
|
|
|
+ <scroll-view scroll-y style="max-height: 500rpx" class="px3">
|
|
|
+ <view class="py2 border-bottom f-size-30" v-for="item in filteredReporterList" :key="item.userId"
|
|
|
+ @click="chooseReporter(item)">
|
|
|
+ {{ item.realName }}<text v-if="item.username" class="text-color-6">({{ item.username }})</text>
|
|
|
+ </view>
|
|
|
+ <view v-if="!filteredReporterList.length && !reporterKeyword" class="p3 text-color-6 f-size-28">
|
|
|
+ 暂无可选人员
|
|
|
+ </view>
|
|
|
+ <!-- 搜索无结果时允许直接按输入的姓名报修(非系统账号) -->
|
|
|
+ <view v-if="reporterKeyword" class="py2 f-size-30 main-color-text" @click="useReporterKeyword">
|
|
|
+ 直接使用姓名“{{ reporterKeyword }}”
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
<u-form-item label="故障描述" prop="content" required :label-width="150">
|
|
|
<u-input v-model="form.content" :cursor-spacing="cursorSpacing" />
|
|
|
</u-form-item>
|
|
|
@@ -152,6 +180,8 @@ export default {
|
|
|
level: '',
|
|
|
// 传入的
|
|
|
sbId: '',
|
|
|
+ // 报修人选中账号的 userId,提交时传后端避免同名歧义
|
|
|
+ userId: '',
|
|
|
needStop: null,
|
|
|
levelValue: '',
|
|
|
source: '',
|
|
|
@@ -172,6 +202,9 @@ export default {
|
|
|
errorTypeState: false, // 故障类型
|
|
|
errorTypeList: [],
|
|
|
limitDateShow: false, // 要求日期
|
|
|
+ reporterPopupShow: false, // 报修人搜索选择弹层
|
|
|
+ reporterKeyword: '', // 报修人搜索关键字
|
|
|
+ reporterList: [], // 报修人候选:全部启用账号
|
|
|
dateParams: {
|
|
|
year: true,
|
|
|
month: true,
|
|
|
@@ -248,6 +281,13 @@ export default {
|
|
|
message: '请选择故障类型',
|
|
|
trigger: ['blur', 'change']
|
|
|
}
|
|
|
+ ],
|
|
|
+ actualUser: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择报修人',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
// #ifdef MP-WEIXIN
|
|
|
@@ -297,7 +337,7 @@ export default {
|
|
|
onShow() {
|
|
|
this.userInfo = this.$BaseTool.UserUtil.getUserInfo()
|
|
|
if (this.userInfo) {
|
|
|
- this.form.actualUser = this.userInfo.realName
|
|
|
+ this.setDefaultReporter()
|
|
|
}
|
|
|
const pages = getCurrentPages()
|
|
|
const currPage = pages[pages.length - 1]
|
|
|
@@ -398,6 +438,7 @@ export default {
|
|
|
.getSbPositionTree().then(res => {
|
|
|
this.sbPositionData = res.data
|
|
|
})
|
|
|
+ this.getReporterList()
|
|
|
// const categoryMap = this.$DictCache.getLabelByValueMapByType(
|
|
|
// this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_CATEGORY
|
|
|
// )
|
|
|
@@ -426,7 +467,60 @@ export default {
|
|
|
onReady() {
|
|
|
this.$refs.uForm.setRules(this.rules)
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ // 报修人候选按姓名/账号本地过滤
|
|
|
+ filteredReporterList() {
|
|
|
+ const kw = (this.reporterKeyword || '').trim().toLowerCase()
|
|
|
+ if (!kw) {
|
|
|
+ return this.reporterList
|
|
|
+ }
|
|
|
+ return this.reporterList.filter(item => {
|
|
|
+ const name = (item.realName || '').toLowerCase()
|
|
|
+ const username = (item.username || '').toLowerCase()
|
|
|
+ return name.indexOf(kw) > -1 || username.indexOf(kw) > -1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 报修人候选列表:全部启用账号,默认带出当前登录人
|
|
|
+ getReporterList() {
|
|
|
+ this.$Http
|
|
|
+ .queryUser({ status: 1 })
|
|
|
+ .then(res => {
|
|
|
+ this.reporterList = res.data || []
|
|
|
+ this.setDefaultReporter()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 默认报修人=当前登录人(仅未选择时赋值)
|
|
|
+ setDefaultReporter() {
|
|
|
+ if (!this.userInfo) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.form.actualUser) {
|
|
|
+ this.form.actualUser = this.userInfo.realName
|
|
|
+ this.form.userId = this.userInfo.userId
|
|
|
+ }
|
|
|
+ },
|
|
|
+ openReporterPopup() {
|
|
|
+ if (!this.reporterList.length) {
|
|
|
+ uni.showToast({ icon: 'none', title: '暂无可选人员' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.reporterKeyword = ''
|
|
|
+ this.reporterPopupShow = true
|
|
|
+ },
|
|
|
+ // 选中系统账号:同时记录 userId,后端以账号为准不会认错人
|
|
|
+ chooseReporter(item) {
|
|
|
+ this.form.actualUser = item.realName
|
|
|
+ this.form.userId = item.userId
|
|
|
+ this.reporterPopupShow = false
|
|
|
+ },
|
|
|
+ // 按搜索框输入的姓名直接填报:不带 userId,后端降级按姓名匹配
|
|
|
+ useReporterKeyword() {
|
|
|
+ this.form.actualUser = this.reporterKeyword
|
|
|
+ this.form.userId = ''
|
|
|
+ this.reporterPopupShow = false
|
|
|
+ },
|
|
|
//
|
|
|
confirm(e) {
|
|
|
console.log(e)
|
|
|
@@ -494,6 +588,8 @@ export default {
|
|
|
sbName: this.form.sbName,
|
|
|
sbCph: this.form.sbCph,
|
|
|
actualUser: this.form.actualUser,
|
|
|
+ // 报修人选中账号,后端以 userId 为准避免同名歧义
|
|
|
+ userId: this.form.userId || null,
|
|
|
category: this.form.category ? Number(this.form.category) : null,
|
|
|
level: this.form.levelValue ? Number(this.form.levelValue) : null,
|
|
|
repairErrorTypeId: this.form.repairErrorTypeId || null,
|
|
|
@@ -563,6 +659,7 @@ export default {
|
|
|
repair: '',
|
|
|
remarks: '',
|
|
|
actualUser: this.userInfo ? this.userInfo.realName : '',
|
|
|
+ userId: this.userInfo ? this.userInfo.userId : '',
|
|
|
content: '',
|
|
|
repairErrorTypeId: '',
|
|
|
photo: '',
|