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
4721fe3b
Commit
4721fe3b
authored
Jul 13, 2021
by
陈浩玮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/chw' into 'master'
项目配置 See merge request product/kim3-web-vue/starter-web-vue!47
parents
2d384b6b
c58037a4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
395 additions
and
1 deletion
+395
-1
src/api/ranger.js
src/api/ranger.js
+12
-0
src/components/table/table.vue
src/components/table/table.vue
+2
-0
src/pages/ranger/basic/item/add_edit.vue
src/pages/ranger/basic/item/add_edit.vue
+261
-0
src/pages/ranger/basic/item/index.vue
src/pages/ranger/basic/item/index.vue
+113
-0
src/pages/ranger/basic/place/add_edit.vue
src/pages/ranger/basic/place/add_edit.vue
+1
-1
src/router/config.js
src/router/config.js
+6
-0
No files found.
src/api/ranger.js
View file @
4721fe3b
...
@@ -48,6 +48,18 @@ export function getUnitInfoApi(id) {
...
@@ -48,6 +48,18 @@ export function getUnitInfoApi(id) {
return
getReq
(
`/ranger/inspection/api/v1/units/
${
id
}
`
);
return
getReq
(
`/ranger/inspection/api/v1/units/
${
id
}
`
);
}
}
<<<<<<<
src
/
api
/
ranger
.
js
export
function
getItemsInfoApi
(
id
)
{
return
getReq
(
`/ranger/inspection/api/v1/items/
${
id
}
`
);
}
export
function
addItemsApi
(
data
)
{
return
postReq
(
'
/ranger/inspection/api/v1/items
'
,
data
);
}
export
function
editItemsApi
(
data
)
{
return
putReq
(
'
/ranger/inspection/api/v1/items
'
,
data
);
}
export
function
addExemptionApi
(
data
)
{
export
function
addExemptionApi
(
data
)
{
return
postReq
(
'
/ranger/inspection/api/v1/exemptions
'
,
data
);
return
postReq
(
'
/ranger/inspection/api/v1/exemptions
'
,
data
);
}
}
...
...
src/components/table/table.vue
View file @
4721fe3b
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
:title=
"newButtons.title"
:title=
"newButtons.title"
v-if=
"this.newButtons"
v-if=
"this.newButtons"
v-bind=
"this.newButtons.options"
v-bind=
"this.newButtons.options"
fixed=
"right"
width=
"180"
>
>
<
template
#default=
"row"
>
<
template
#default=
"row"
>
<my-ac-btn
:row=
"row"
:buttons=
"newButtons.data"
/>
<my-ac-btn
:row=
"row"
:buttons=
"newButtons.data"
/>
...
...
src/pages/ranger/basic/item/add_edit.vue
0 → 100644
View file @
4721fe3b
<
template
>
<Wraper
:hidden=
"hidden"
:onOk=
"submit"
:refresh=
"refresh"
:noFooter=
"isView"
>
<a-form-model
layout=
"vertical"
:model=
"form"
:rules=
"rules"
ref=
"form"
>
<a-form-model-item
label=
"项目名称"
prop=
"placeName"
>
<a-input
v-model=
"form.placeName"
:disabled=
"isView"
/>
</a-form-model-item>
<a-form-model-item
label=
"所属地区"
prop=
"regionId"
>
<UrlSelect
v-model=
"form.regionId"
url=
"/ranger/inspection/api/v1/region/list"
labelFiled=
"regionName"
valueFiled=
"regionId"
:disabled=
"isView"
/>
</a-form-model-item>
<a-form-model-item
label=
"所属地点"
prop=
"placeId"
>
<UrlSelect
v-model=
"form.placeId"
:url=
"
form.regionId ? `/ranger/inspection/api/v1/place/regions/$
{form.regionId}/list` : ''
"
labelFiled="placeName"
valueFiled="placeId"
:disabled="isView"
/>
</a-form-model-item>
<a-form-model-item
label=
"所属单元"
prop=
"unitId"
>
<UrlSelect
v-model=
"form.unitId"
:url=
"form.placeId ? `/ranger/inspection/api/v1/units/places/$
{form.placeId}/list` : ''"
labelFiled="unitName"
valueFiled="unitId"
:disabled="isView"
/>
</a-form-model-item>
<a-form-model-item
label=
"数据类型"
prop=
"dataType"
>
<a-select
v-model=
"form.dataType"
:disabled=
"isView"
>
<a-select-option
key=
"TEXT"
value=
"TEXT"
>
文本类型
</a-select-option>
<a-select-option
key=
"OPTION"
value=
"OPTION"
>
选项类型
</a-select-option>
<a-select-option
key=
"NUMERIC"
value=
"NUMERIC"
>
数值类型
</a-select-option>
</a-select>
</a-form-model-item>
<div
v-if=
"form.dataType === 'TEXT'"
>
<a-form-model-item
label=
"默认值"
prop=
"defaultText"
>
<a-textarea
placeholder=
"Basic usage"
:rows=
"4"
v-model=
"form.defaultText"
:disabled=
"isView"
/>
</a-form-model-item>
</div>
<div
v-if=
"form.dataType === 'OPTION'"
>
<a-form-model-item
label=
"选项类型"
prop=
"optionType"
>
<a-select
v-model=
"form.optionType"
:disabled=
"isView"
>
<a-select-option
key=
"TEXT"
value=
"TEXT"
>
开/关
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item
label=
"正常值"
prop=
"normalValue"
>
<a-select
v-model=
"form.normalValue"
:disabled=
"isView"
>
<a-select-option
key=
"1"
value=
"1"
>
开
</a-select-option>
<a-select-option
key=
"0"
value=
"0"
>
关
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item
label=
"异常值"
prop=
"abnormalValue"
>
<a-select
v-model=
"form.abnormalValue"
:disabled=
"isView"
>
<a-select-option
key=
"1"
value=
"1"
>
开
</a-select-option>
<a-select-option
key=
"0"
value=
"0"
>
关
</a-select-option>
</a-select>
</a-form-model-item>
</div>
<div
v-if=
"form.dataType === 'NUMERIC'"
>
<a-form-model-item
label=
"默认值"
prop=
"defaultValue"
>
<a-input
v-model=
"form.defaultValue"
placeholder=
"请输入"
/>
</a-form-model-item>
<a-form-model-item
label=
"上限值"
prop=
"upperLimitValue"
>
<a-input
v-model=
"form.upperLimitValue"
placeholder=
"请输入"
/>
</a-form-model-item>
<a-form-model-item
label=
"下限值"
prop=
"lowerLimitValue"
>
<a-input
v-model=
"form.lowerLimitValue"
placeholder=
"请输入"
/>
</a-form-model-item>
</div>
<a-form-model-item
label=
"备注"
prop=
"remark"
>
<a-textarea
placeholder=
"Basic usage"
:rows=
"4"
v-model=
"form.remark"
:disabled=
"isView"
/>
</a-form-model-item>
</a-form-model>
</Wraper>
</
template
>
<
script
>
import
Wraper
from
'
@/components/table/wraper.vue
'
;
import
UrlSelect
from
'
@/components/MySelect/url_select.vue
'
;
import
{
addItemsApi
,
editItemsApi
,
getItemsInfoApi
}
from
'
@/api
'
;
export
default
{
components
:
{
Wraper
,
UrlSelect
},
props
:
{
hidden
:
Function
,
row
:
Object
,
type
:
String
,
refresh
:
Function
},
data
()
{
let
normalValueValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
if
(
this
.
form
.
abnormalValue
)
{
if
(
value
===
this
.
form
.
abnormalValue
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
callback
();
}
}
else
{
callback
();
}
}
};
let
abnormalValueValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
if
(
this
.
form
.
abnormalValue
)
{
if
(
value
===
this
.
form
.
abnormalValue
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
callback
();
}
}
else
{
callback
();
}
}
};
let
defaultValueValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
if
(
this
.
form
.
upperLimitValue
&&
this
.
form
.
lowerLimitValue
)
{
if
(
this
.
form
.
upperLimitValue
>
value
&&
value
>
this
.
form
.
lowerLimitValue
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误
'
));
}
}
else
if
(
this
.
form
.
upperLimitValue
)
{
if
(
this
.
form
.
upperLimitValue
>
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误1
'
));
}
}
else
if
(
this
.
form
.
lowerLimitValue
)
{
if
(
this
.
form
.
lowerLimitValue
<
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误2
'
));
}
}
else
{
callback
();
}
}
};
let
upperLimitValueValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
if
(
this
.
form
.
defaultValue
&&
this
.
form
.
lowerLimitValue
)
{
if
(
this
.
form
.
defaultValue
<
value
&&
value
>
this
.
form
.
lowerLimitValue
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误
'
));
}
}
else
if
(
this
.
form
.
defaultValue
)
{
if
(
this
.
form
.
defaultValue
<
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误1
'
));
}
}
else
if
(
this
.
form
.
lowerLimitValue
)
{
if
(
this
.
form
.
lowerLimitValue
<
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误2
'
));
}
}
else
{
callback
();
}
}
};
let
lowerLimitValueValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
Please input the password
'
));
}
else
{
if
(
this
.
form
.
defaultValue
&&
this
.
form
.
upperLimitValue
)
{
if
(
this
.
form
.
defaultValue
>
value
&&
value
<
this
.
form
.
upperLimitValue
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误
'
));
}
}
else
if
(
this
.
form
.
defaultValue
)
{
if
(
this
.
form
.
defaultValue
>
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误1
'
));
}
}
else
if
(
this
.
form
.
upperLimitValue
)
{
if
(
this
.
form
.
upperLimitValue
>
value
)
{
callback
();
}
else
{
callback
(
new
Error
(
'
数值错误2
'
));
}
}
else
{
callback
();
}
}
};
return
{
form
:
{},
rules
:
{
placeName
:
[{
required
:
true
}],
placeId
:
[{
required
:
true
}],
regionId
:
[{
required
:
true
}],
unitId
:
[{
required
:
true
}],
dataType
:
[{
required
:
true
}],
defaultText
:
[{
required
:
true
}],
optionType
:
[{
required
:
true
}],
normalValue
:
[
{
required
:
true
},
{
validator
:
normalValueValidator
,
},
],
abnormalValue
:
[{
required
:
true
},
{
validator
:
abnormalValueValidator
}],
defaultValue
:
[{
required
:
true
},
{
validator
:
defaultValueValidator
}],
upperLimitValue
:
[{
required
:
true
},
{
validator
:
upperLimitValueValidator
}],
lowerLimitValue
:
[{
required
:
true
},
{
validator
:
lowerLimitValueValidator
}],
},
};
},
computed
:
{
isView
()
{
return
this
.
type
===
'
view
'
;
},
isEdit
()
{
return
this
.
type
===
'
edit
'
;
},
isAdd
()
{
return
this
.
type
===
null
;
},
},
async
mounted
()
{
if
(
!
this
.
isAdd
)
{
this
.
form
=
await
getItemsInfoApi
(
this
.
row
.
itemId
);
}
},
methods
:
{
async
submit
()
{
await
this
.
$refs
.
form
.
validate
();
if
(
this
.
isAdd
)
return
addItemsApi
(
this
.
form
);
if
(
this
.
isEdit
)
return
editItemsApi
(
this
.
form
);
},
},
};
</
script
>
src/pages/ranger/basic/item/index.vue
0 → 100644
View file @
4721fe3b
<
template
>
<Table
url=
"/ranger/inspection/api/v1/items"
rowKey=
"itemId"
addBtn
:buttons=
"buttons"
ref=
"table"
:scroll=
"
{ x: true }"
>
<template
#search
="
{ query }">
<MoreItem
label=
"地区"
>
<UrlSelect
url=
"/ranger/inspection/api/v1/region/list"
v-model=
"query.regionId"
labelFiled=
"regionName"
valueFiled=
"regionId"
/>
</MoreItem>
<MoreItem
label=
"地点"
>
<UrlSelect
v-model=
"query.placeId"
:url=
"
query.regionId ? `/ranger/inspection/api/v1/place/regions/$
{query.regionId}/list` : ''
"
labelFiled="placeName"
valueFiled="placeId"
/>
</MoreItem>
<MoreItem
label=
"单元"
>
<UrlSelect
v-model=
"query.unitId"
:url=
"query.placeId ? `/ranger/inspection/api/v1/units/places/$
{query.placeId}/list` : ''"
labelFiled="unitName"
valueFiled="unitId"
/>
</MoreItem>
<MoreItem
label=
"项目名称"
>
<a-input
v-model=
"query.inputValue"
placeholder=
"请输入项目名称"
/>
</MoreItem>
</
template
>
<!-- <template #operation>
<a-button @click="download">导出</a-button>
</template> -->
<
template
#drawer=
"drawer"
>
<AddAndEdit
v-bind=
"drawer"
/>
</
template
>
<a-table-column
title=
"项目名称"
data-index=
"itemName"
/>
<a-table-column
title=
"所属单元"
data-index=
"unitName"
/>
<a-table-column
title=
"数据类型"
>
<
template
#default=
"row"
>
<span>
{{
dataType
[
row
.
dataType
]
}}
</span>
</
template
>
</a-table-column>
<a-table-column
title=
"项目描述"
>
<
template
#default=
"row"
>
<span
v-if=
"row.dataType === 'TEXT'"
>
{{
row
.
defaultText
}}
</span>
<span
v-if=
"row.dataType === 'OPTION'"
>
{{
`正常值:${row.normalValue
}
异常值:${row.abnormalValue
}
`
}}
<
/spa
n
>
<
span
v
-
if
=
"
row.dataType === 'NUMERIC'
"
>
{{
`默认值:${row.defaultValue
}
上限值:${row.upperLimitValue
}
下限值:${row.lowerLimitValue
}
`
}}
<
/spa
n
>
<
/template
>
<
/a-table-column
>
<
a
-
table
-
column
title
=
"
修改人
"
data
-
index
=
"
editorName
"
/>
<
a
-
table
-
column
title
=
"
修改时间
"
data
-
index
=
"
editTime
"
/>
<
/Table
>
<
/template
>
<
script
>
import
Table
from
'
@/components/table/table.vue
'
;
import
UrlSelect
from
'
@/components/MySelect/url_select.vue
'
;
import
MoreItem
from
'
@/components/table/more_item.vue
'
;
import
AddAndEdit
from
'
./add_edit.vue
'
;
export
default
{
components
:
{
Table
,
UrlSelect
,
MoreItem
,
AddAndEdit
}
,
data
()
{
return
{
buttons
:
[
{
label
:
'
编辑
'
,
click
:
this
.
edit
}
,
{
label
:
'
详情
'
,
click
:
this
.
view
}
,
{
type
:
'
confirm
'
,
url
:
(
row
)
=>
`/ranger/inspection/api/v1/items/${row.itemId
}
`
,
after
:
this
.
refresh
,
}
,
],
dataType
:
{
TEXT
:
'
文本类型
'
,
OPTION
:
'
选项类型
'
,
NUMERIC
:
'
数值类型
'
,
}
,
}
;
}
,
methods
:
{
refresh
()
{
this
.
$refs
.
table
.
getData
();
}
,
edit
(
row
)
{
this
.
$refs
.
table
.
show
({
row
,
title
:
'
编辑
'
,
type
:
'
edit
'
}
);
}
,
view
(
row
)
{
this
.
$refs
.
table
.
show
({
row
,
title
:
'
查看
'
,
type
:
'
view
'
}
);
}
,
}
,
}
;
<
/script
>
src/pages/ranger/basic/place/add_edit.vue
View file @
4721fe3b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<a-input
v-model=
"form.placeName"
:disabled=
"isView"
/>
<a-input
v-model=
"form.placeName"
:disabled=
"isView"
/>
</a-form-model-item>
</a-form-model-item>
<a-form-model-item
label=
"所属
组织
"
prop=
"regionId"
>
<a-form-model-item
label=
"所属
地区
"
prop=
"regionId"
>
<UrlSelect
<UrlSelect
v-model=
"form.regionId"
v-model=
"form.regionId"
url=
"/ranger/inspection/api/v1/region/list"
url=
"/ranger/inspection/api/v1/region/list"
...
...
src/router/config.js
View file @
4721fe3b
...
@@ -81,9 +81,15 @@ const hasAuthorityRoutes = [
...
@@ -81,9 +81,15 @@ const hasAuthorityRoutes = [
component
:
()
=>
import
(
'
@/pages/ranger/basic/unit
'
),
component
:
()
=>
import
(
'
@/pages/ranger/basic/unit
'
),
},
},
{
{
path
:
'
item
'
,
name
:
'
项目配置
'
,
component
:
()
=>
import
(
'
@/pages/ranger/basic/item
'
),
},{
path
:
'
exemption
'
,
path
:
'
exemption
'
,
name
:
'
免检配置
'
,
name
:
'
免检配置
'
,
component
:
()
=>
import
(
'
@/pages/ranger/basic/exemption
'
),
component
:
()
=>
import
(
'
@/pages/ranger/basic/exemption
'
),
},
},
],
],
},
},
...
...
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