Browse Source

值班管理搜索

master
laishajiang 2 years ago
parent
commit
ce6ace5c0f
  1. 7
      src/api/perms/admin.ts
  2. 80
      src/views/duty/edit.vue

7
src/api/perms/admin.ts

@ -50,6 +50,13 @@ export function listByEmpNo(query) {
return request.get({ url: '/system/admin/listByEmpNo', query}) return request.get({ url: '/system/admin/listByEmpNo', query})
} }
export function listByCurrentDeptAndDeptPid(query) {
return request.get({ url: '/system/admin/listByCurrentDeptAndDeptPid', query})
}
export function listByCurrentEmpNo(query) {
return request.get({ url: '/system/admin/listByCurrentEmpNo', query})
}
// 重置密码 // 重置密码
export function resetPassword(params: any) { export function resetPassword(params: any) {

80
src/views/duty/edit.vue

@ -67,11 +67,28 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="警号" prop="empNo"> <el-form-item label="警号" prop="empNo">
<el-input v-model="formData.empNo" disabled="disabled" placeholder="请输入" /> <!-- <el-input v-model="formData.empNo" placeholder="请输入" /> -->
<el-select
v-model="formData.empNo"
filterable
class="flex-1"
clearable
remote
placeholder="请搜索警号"
:remote-method="searchEmpNolist"
@change="handleEmpNoSelectChange"
>
<el-option
v-for="(item, index) in optionsData.empNolist"
:key="index"
:label="item.empNo"
:value="item.empNo"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="formData.mobile" placeholder="请输入" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="手机号" prop="mobile">-->
<!-- <el-input v-model="formData.mobile" placeholder="请输入" />-->
<!-- </el-form-item>-->
<el-form-item label="值班日期" prop="reportDate"> <el-form-item label="值班日期" prop="reportDate">
<el-date-picker v-model="formData.reportDate" type="daterange" range-separator="" start-placeholder="开始日期" <el-date-picker v-model="formData.reportDate" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="YYYY-MM-DD"></el-date-picker> end-placeholder="结束日期" value-format="YYYY-MM-DD"></el-date-picker>
@ -95,7 +112,7 @@ import { useDictOptions } from '@/hooks/useDictOptions'
import { roleAll } from '@/api/perms/role' import { roleAll } from '@/api/perms/role'
import { postAll } from '@/api/org/post' import { postAll } from '@/api/org/post'
import { deptLists } from '@/api/org/department' import { deptLists } from '@/api/org/department'
import { listByCurrentDept ,listByEmpNo } from '@/api/perms/admin' import { listByCurrentDeptAndDeptPid ,listByEmpNo ,listByCurrentEmpNo} from '@/api/perms/admin'
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { loginCaptcha } from '@/api/user' import { loginCaptcha } from '@/api/user'
import { isFunction } from 'lodash' import { isFunction } from 'lodash'
@ -128,7 +145,8 @@ const formData = reactive({
const { optionsData } = useDictOptions<{ const { optionsData } = useDictOptions<{
deptTypes: any[], deptTypes: any[],
policeList: any[], policeList: any[],
dept: any[] dept: any[],
empNolist:any[]
}>({ }>({
dept: { dept: {
api: deptLists api: deptLists
@ -233,9 +251,10 @@ const searchPoliceUser = (query: string) => {
setTimeout(() => { setTimeout(() => {
console.log(query) console.log(query)
const params= { const params= {
name: query name: query,
departId:formData.departId
} }
const policeList = listByCurrentDept(params).then((res: any) => { const policeList = listByCurrentDeptAndDeptPid(params).then((res: any) => {
optionsData.policeList=res; optionsData.policeList=res;
return Promise.resolve(res) return Promise.resolve(res)
}) })
@ -251,6 +270,51 @@ const searchPoliceUser = (query: string) => {
} }
const searchEmpNolist = (query: string) => {
if (query) {
setTimeout(() => {
console.log(query)
const params= {
departId:formData.departId,
EmpNo:query
}
const empNoList = listByCurrentEmpNo(params).then((res: any) => {
optionsData.empNolist=res;
return Promise.resolve(res)
})
.catch((err: any) => {
return Promise.reject(err)
})
}, 200)
} else {
optionsData.empNolist = []
}
}
const handleEmpNoSelectChange = (newValue) => {
formData.empNo=newValue
console.log("newValue"+newValue)
const params= {
EmpNo: newValue
}
listByEmpNo(params).then((res: any) => {
formData.policeName=res.name
return Promise.resolve(res)
})
.catch((err: any) => {
return Promise.reject(err)
})
console.log('选中的值:', newValue);
};
const handleSelectChange = (newValue) => { const handleSelectChange = (newValue) => {
formData.empNo=newValue formData.empNo=newValue
console.log("newValue"+newValue) console.log("newValue"+newValue)

Loading…
Cancel
Save