系统管理模块台站部分 新增和编辑弹窗增加CATEGORY字段
增加/sys/dict/getltems接口及联调 保存和修改接口增加请求字段
This commit is contained in:
parent
ada699cc13
commit
1c1e5d2f26
|
@ -85,6 +85,18 @@
|
|||
@change="handleStatus"
|
||||
></j-dict-select-tag>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="Category" prop="category">
|
||||
<a-select
|
||||
v-model="model.category"
|
||||
:options="categoryOptions"
|
||||
show-arrow
|
||||
allowClear
|
||||
placeholder="select..."
|
||||
@change="onCategoryChange"
|
||||
>
|
||||
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</custom-modal>
|
||||
<!-- 新增/编辑 结束 -->
|
||||
|
@ -201,12 +213,14 @@ export default {
|
|||
}
|
||||
}
|
||||
return {
|
||||
categoryOptions: [],
|
||||
queryParam: {},
|
||||
rules: {
|
||||
stationId: [{ required: true, message: 'Please Enter Station Id' }],
|
||||
stationCode: [{ required: true, validator: validateStationCode }],
|
||||
countryCode: [{ required: true, validator: validateCountryCode }],
|
||||
status: [{ required: true, message: 'Please Select Status', trigger: 'change' }],
|
||||
category: [{ required: true, message: 'Please Select Category', trigger: 'change' }],
|
||||
},
|
||||
url: {
|
||||
list: '/gardsStations/findPage',
|
||||
|
@ -226,6 +240,23 @@ export default {
|
|||
this.$set(this.model, 'status', 'Operating')
|
||||
},
|
||||
methods: {
|
||||
async getCategoryItem() {
|
||||
try {
|
||||
const res = await getAction('/sys/dict/getItems', { dictCode: 'Station Category' })
|
||||
console.log(res)
|
||||
this.categoryOptions = res.map((item) => {
|
||||
return {
|
||||
label: item.text,
|
||||
value: item.value,
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
onCategoryChange(val) {
|
||||
console.log(val)
|
||||
},
|
||||
handleStatus(val) {
|
||||
this.model.status = val
|
||||
},
|
||||
|
@ -252,15 +283,20 @@ export default {
|
|||
},
|
||||
|
||||
onAdd() {
|
||||
this.getCategoryItem()
|
||||
this.isAdd = true
|
||||
// this.model = {}
|
||||
this.visible = true
|
||||
},
|
||||
onEdit() {
|
||||
this.getCategoryItem()
|
||||
if (this.selectedRowKeys && this.selectedRowKeys.length) {
|
||||
this.isAdd = false
|
||||
this.visible = true
|
||||
const find = this.dataSource.find((item) => item.stationId === this.selectedRowKeys[0])
|
||||
if (find) {
|
||||
find.category = find.category.toString()
|
||||
}
|
||||
this.model = cloneDeep(find)
|
||||
} else {
|
||||
this.$message.warn('Please Select An Item To Edit')
|
||||
|
|
Loading…
Reference in New Issue
Block a user