Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Starter Web Vue
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
product
kim3-web-vue
Starter Web Vue
Commits
5fb3dcba
Commit
5fb3dcba
authored
Jul 08, 2021
by
水落(YangLei)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码优化
parent
799f3e81
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
59 deletions
+53
-59
src/components/MySelect/RequestSelect.vue
src/components/MySelect/RequestSelect.vue
+5
-0
src/components/MySelect/search_select.vue
src/components/MySelect/search_select.vue
+7
-5
src/pages/xunjian/task_managment/center/common/index.js
src/pages/xunjian/task_managment/center/common/index.js
+0
-17
src/pages/xunjian/task_managment/center/form.vue
src/pages/xunjian/task_managment/center/form.vue
+6
-11
src/pages/xunjian/task_managment/center/index.vue
src/pages/xunjian/task_managment/center/index.vue
+35
-26
No files found.
src/components/MySelect/RequestSelect.vue
View file @
5fb3dcba
...
...
@@ -24,6 +24,8 @@ export default {
request
:
Function
,
formatData
:
{
type
:
Object
,
default
:
undefined
},
getName
:
Function
,
labelFiled
:
String
,
// 和 formatData 一样 传一种就行了
valueFiled
:
String
,
},
data
()
{
return
{
...
...
@@ -34,6 +36,9 @@ export default {
if
(
this
.
request
)
{
const
newArr
=
await
this
.
request
();
this
.
data
=
this
.
formatData
?
await
formatObj
(
newArr
,
this
.
formatData
)
:
newArr
;
this
.
data
=
this
.
labelFiled
?
formatObj
(
newArr
,
{
label
:
this
.
labelFiled
,
value
:
this
.
valueFiled
,
key
:
this
.
valueFiled
})
:
this
.
data
;
}
},
methods
:
{
...
...
src/components/MySelect/search_select.vue
View file @
5fb3dcba
...
...
@@ -21,8 +21,9 @@ export default {
props
:
{
url
:
String
,
searchField
:
String
,
formatData
:
Object
,
mode
:
String
,
labelFiled
:
String
,
valueFiled
:
String
,
},
model
:
{
prop
:
'
value
'
,
...
...
@@ -38,10 +39,11 @@ export default {
},
methods
:
{
async
getData
(
searchString
)
{
this
.
options
=
formatObj
(
await
getReq
(
this
.
url
,
{
[
this
.
searchField
]:
searchString
}),
this
.
formatData
,
);
this
.
options
=
formatObj
(
await
getReq
(
this
.
url
,
{
[
this
.
searchField
]:
searchString
}),
{
label
:
this
.
labelFiled
,
value
:
this
.
valueFiled
,
key
:
this
.
valueFiled
,
});
},
handleSearch
(
value
)
{
if
(
this
.
timeOut
)
clearTimeout
(
this
.
timeOut
);
...
...
src/pages/xunjian/task_managment/center/common/index.js
deleted
100644 → 0
View file @
799f3e81
export
const
areaFormatData
=
{
label
:
'
regionName
'
,
value
:
'
regionId
'
,
key
:
'
regionId
'
,
};
export
const
statusFormtData
=
{
label
:
'
paramName
'
,
value
:
'
paramValue
'
,
key
:
'
paramValue
'
,
};
export
const
banZuFormatData
=
{
label
:
'
paramName
'
,
value
:
'
paramValue
'
,
key
:
'
paramValue
'
,
};
src/pages/xunjian/task_managment/center/form.vue
View file @
5fb3dcba
...
...
@@ -4,8 +4,9 @@
<a-form-model-item
label=
"地区"
prop=
"regionId"
>
<RequestSelect
:request=
"getAreaListDataApi"
:formatData=
"areaFormatData"
v-model=
"form.regionId"
labelFiled=
"regionName"
valueFiled=
"regionId"
/>
</a-form-model-item>
...
...
@@ -21,8 +22,9 @@
<a-form-model-item
label=
"班组"
prop=
"shiftType"
>
<RequestSelect
:request=
"getBanZuListApi"
:formatData=
"banZuFormatData"
v-model=
"form.shiftType"
labelFiled=
"paramName"
valueFiled=
"paramValue"
/>
</a-form-model-item>
...
...
@@ -39,7 +41,8 @@
<SearchSelect
url=
"/api/v1/users/searching"
searchField=
"userName"
:formatData=
"formatXunJianRenData"
labelFiled=
"userName"
valueFiled=
"userId"
v-model=
"form.inspectionIdList"
mode=
"multiple"
/>
...
...
@@ -54,7 +57,6 @@ import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import
SearchSelect
from
'
@/components/MySelect/search_select.vue
'
;
import
UrlSelect
from
'
@/components/MySelect/url_select.vue
'
;
import
{
getAreaListDataApi
,
getBanZuListApi
,
addXunJianTaskApi
}
from
'
@/api
'
;
import
{
areaFormatData
,
banZuFormatData
}
from
'
./common
'
;
export
default
{
props
:
{
...
...
@@ -65,7 +67,6 @@ export default {
data
()
{
return
{
getAreaListDataApi
,
banZuFormatData
,
getBanZuListApi
,
form
:
{},
rules
:
{
...
...
@@ -75,12 +76,6 @@ export default {
routeId
:
[{
required
:
true
}],
regionId
:
[{
required
:
true
}],
},
areaFormatData
,
formatXunJianRenData
:
{
value
:
'
userId
'
,
label
:
'
userName
'
,
key
:
'
userId
'
,
},
};
},
computed
:
{
...
...
src/pages/xunjian/task_managment/center/index.vue
View file @
5fb3dcba
...
...
@@ -19,57 +19,73 @@
<a-date-picker
class=
"tw-w-full"
show-time
v-model=
"query.
start
Time"
v-model=
"query.
end
Time"
valueFormat=
"YYYY-MM-DD HH:mm:ss"
/>
</my-form-item>
<my-form-item
label=
"地区"
>
<RequestSelect
:request=
"getAreaListDataApi"
:formatData=
"areaFormatData"
v-model=
"query.regionId"
labelFiled=
"regionName"
valueFiled=
"regionId"
/>
</my-form-item>
<my-form-item
label=
"专业"
>
<RequestSelect
:request=
"getAreaListDataApi"
:formatData=
"areaFormatData"
v-model=
"query.regionId"
<UrlSelect
:url=
"
query.regionId
? `/ranger/inspection/api/v1/specialities/valid/regions/$
{query.regionId}/list`
: ''
"
v-model="query.specialityId"
labelFiled="specialityName"
valueFiled="specialityId"
/>
</my-form-item>
<my-form-item
label=
"线路"
>
<RequestSelect
:request=
"getAreaListDataApi"
:formatData=
"areaFormatData"
v-model=
"query.regionId"
<UrlSelect
:url=
"
query.regionId
? `/ranger/inspection/api/v1/routes/regions/$
{query.regionId}/list`
: ''
"
labelFiled="routeName"
valueFiled="routeId"
v-model="query.routeId"
/>
</my-form-item>
<my-form-item
label=
"班组"
>
<RequestSelect
:request=
"getBanZuListApi"
:formatData=
"banZuFormatData"
v-model=
"query.shiftType"
labelFiled=
"paramName"
valueFiled=
"paramValue"
/>
</my-form-item>
<my-form-item
label=
"巡检状态"
>
<RequestSelect
:request=
"getBusinessListApi"
:formatData=
"statusFormtData"
v-model=
"query.inspectionState"
labelFiled=
"paramName"
valueFiled=
"paramValue"
/>
</my-form-item>
<my-form-item
label=
"任务类型"
>
<RequestSelect
:request=
"getTaskTypeApi"
:formatData=
"taskTypeFormatData"
v-model=
"query.jobType"
labelFiled=
"paramName"
valueFiled=
"paramValue"
/>
</my-form-item>
<my-form-item
label=
"巡检人"
>
<
Request
Select
:request=
"getBusinessListApi
"
:formatData=
"statusFormtData
"
<
Search
Select
url=
"/api/v1/users/searching
"
searchField=
"userName
"
v-model=
"query.lastInspectionStaffId"
labelFiled=
"userName"
valueFiled=
"userId"
/>
</my-form-item>
</
template
>
...
...
@@ -98,20 +114,20 @@
<
script
>
import
Table
from
'
@/components/table/table.vue
'
;
import
Form
from
'
./form.vue
'
;
import
UrlSelect
from
'
@/components/MySelect/url_select.vue
'
;
import
{
getXunJianDownloadUrlApi
}
from
'
@/api
'
;
import
{
downloadFileByUrl
}
from
'
@/utils
'
;
import
RequestSelect
from
'
@/components/MySelect/RequestSelect.vue
'
;
import
SearchSelect
from
'
@/components/MySelect/search_select.vue
'
;
import
{
getAreaListDataApi
,
getBusinessListApi
,
getBanZuListApi
,
getTaskTypeApi
}
from
'
@/api
'
;
import
{
areaFormatData
,
statusFormtData
,
banZuFormatData
}
from
'
./common
'
;
export
default
{
components
:
{
Table
,
Form
,
RequestSelect
},
components
:
{
Table
,
Form
,
RequestSelect
,
UrlSelect
,
SearchSelect
},
data
()
{
return
{
getAreaListDataApi
,
getBusinessListApi
,
getBanZuListApi
,
banZuFormatData
,
getTaskTypeApi
,
addBtn
:
{
title
:
'
新建临时任务
'
,
...
...
@@ -124,13 +140,6 @@ export default {
{
type
:
'
confirm
'
},
],
selected
:
[],
areaFormatData
,
statusFormtData
,
taskTypeFormatData
:
{
label
:
'
paramName
'
,
value
:
'
paramValue
'
,
key
:
'
paramValue
'
,
},
};
},
methods
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment