|
|
@ -16,7 +16,34 @@ |
|
|
|
:onClose="stationClose" |
|
|
|
> |
|
|
|
<template v-slot:body> |
|
|
|
<div>这是使用插槽定义的对话框内容</div> |
|
|
|
<t-form |
|
|
|
:data="stationForm" |
|
|
|
:rules="stationRules" |
|
|
|
ref="form" |
|
|
|
@reset="onStationReset" |
|
|
|
@submit="onStationSubmit" |
|
|
|
> |
|
|
|
<t-form-item label="核电站名称" name="name"> |
|
|
|
<t-input |
|
|
|
v-model="stationForm.name" |
|
|
|
placeholder="请输入核电站名称" |
|
|
|
></t-input> |
|
|
|
</t-form-item> |
|
|
|
<t-form-item label="核电站地址" name="address"> |
|
|
|
<t-input |
|
|
|
v-model="stationForm.address" |
|
|
|
placeholder="请输入核电站地址" |
|
|
|
></t-input> |
|
|
|
</t-form-item> |
|
|
|
<t-form-item> |
|
|
|
<t-space size="10px"> |
|
|
|
<t-button theme="primary" type="submit">提交</t-button> |
|
|
|
<t-button theme="default" variant="base" type="reset" |
|
|
|
>重置</t-button |
|
|
|
> |
|
|
|
</t-space> |
|
|
|
</t-form-item> |
|
|
|
</t-form> |
|
|
|
</template> |
|
|
|
</t-dialog> |
|
|
|
|
|
|
@ -47,7 +74,52 @@ |
|
|
|
:onClose="coreClose" |
|
|
|
> |
|
|
|
<template v-slot:body> |
|
|
|
<div>这是使用插槽定义的对话框内容</div> |
|
|
|
<t-form |
|
|
|
:data="coreForm" |
|
|
|
:rules="coreRules" |
|
|
|
ref="form" |
|
|
|
@reset="onCoreReset" |
|
|
|
@submit="onCoreSubmit" |
|
|
|
> |
|
|
|
<t-form-item label="名称" name="name"> |
|
|
|
<t-input |
|
|
|
v-model="coreForm.name" |
|
|
|
placeholder="请输入名称" |
|
|
|
></t-input> |
|
|
|
</t-form-item> |
|
|
|
<t-form-item label="序列号" name="serialNumber"> |
|
|
|
<t-input |
|
|
|
v-model="coreForm.serialNumber" |
|
|
|
placeholder="请输入序列号" |
|
|
|
></t-input> |
|
|
|
</t-form-item> |
|
|
|
<t-form-item label="所属核电站" name="stationId"> |
|
|
|
<t-select |
|
|
|
v-model="coreForm.stationId" |
|
|
|
class="demo-select-base" |
|
|
|
clearable |
|
|
|
filterable |
|
|
|
placeholder="请选择所属核电站" |
|
|
|
> |
|
|
|
<t-option |
|
|
|
v-for="item in stationList" |
|
|
|
:value="item.id" |
|
|
|
:label="item.name" |
|
|
|
:key="item.id" |
|
|
|
> |
|
|
|
{{ item.name }} |
|
|
|
</t-option> |
|
|
|
</t-select> |
|
|
|
</t-form-item> |
|
|
|
<t-form-item> |
|
|
|
<t-space size="10px"> |
|
|
|
<t-button theme="primary" type="submit">提交</t-button> |
|
|
|
<t-button theme="default" variant="base" type="reset" |
|
|
|
>重置</t-button |
|
|
|
> |
|
|
|
</t-space> |
|
|
|
</t-form-item> |
|
|
|
</t-form> |
|
|
|
</template> |
|
|
|
</t-dialog> |
|
|
|
<t-table |
|
|
@ -67,10 +139,54 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="jsx"> |
|
|
|
import { stationListApi, coreListApi } from '@/api/info' |
|
|
|
import { |
|
|
|
stationListApi, |
|
|
|
coreListApi, |
|
|
|
addStationApi, |
|
|
|
addCoreApi, |
|
|
|
delStationApi, |
|
|
|
delCoreApi, |
|
|
|
} from '@/api/info' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
coreForm: { |
|
|
|
name: '', |
|
|
|
stationId: '', |
|
|
|
serialNumber: '', |
|
|
|
}, |
|
|
|
stationForm: { |
|
|
|
name: '', |
|
|
|
address: '', |
|
|
|
}, |
|
|
|
stationRules: { |
|
|
|
name: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '核电站名称必填', |
|
|
|
type: 'error', |
|
|
|
trigger: 'blur', |
|
|
|
}, |
|
|
|
], |
|
|
|
}, |
|
|
|
coreRules: { |
|
|
|
name: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '名称必填', |
|
|
|
type: 'error', |
|
|
|
trigger: 'blur', |
|
|
|
}, |
|
|
|
], |
|
|
|
serialNumber: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '序列号必填', |
|
|
|
type: 'error', |
|
|
|
trigger: 'blur', |
|
|
|
}, |
|
|
|
], |
|
|
|
}, |
|
|
|
tabValue: 'first', |
|
|
|
stationVisible: false, |
|
|
|
coreVisible: false, |
|
|
@ -106,6 +222,10 @@ export default { |
|
|
|
title: '序列号', |
|
|
|
}, |
|
|
|
{ |
|
|
|
colKey: 'stationId', |
|
|
|
title: '所属核电站', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
cell: (h, { row }) => ( |
|
|
|
<div> |
|
|
@ -119,8 +239,62 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
delStation(id) {}, |
|
|
|
delCore(id) {}, |
|
|
|
onCoreReset() { |
|
|
|
this.$message.success('重置成功') |
|
|
|
}, |
|
|
|
async onCoreSubmit({ validateResult, firstError }) { |
|
|
|
if (validateResult === true) { |
|
|
|
const res = await addCoreApi(this.coreForm) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.result) { |
|
|
|
this.$message.success('提交成功') |
|
|
|
this.coreVisible = false |
|
|
|
this.getCoreList() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.warning(firstError) |
|
|
|
} |
|
|
|
}, |
|
|
|
onStationReset() { |
|
|
|
this.$message.success('重置成功') |
|
|
|
}, |
|
|
|
async onStationSubmit({ validateResult, firstError }) { |
|
|
|
if (validateResult === true) { |
|
|
|
const res = await addStationApi(this.stationForm) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.result) { |
|
|
|
this.$message.success('提交成功') |
|
|
|
this.stationVisible = false |
|
|
|
this.getStationList() |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.error(res?.msg) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.warning(firstError) |
|
|
|
} |
|
|
|
}, |
|
|
|
async delStation(id) { |
|
|
|
const res = await delStationApi(id) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.result) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.getStationList() |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message.error(res?.msg) |
|
|
|
} |
|
|
|
}, |
|
|
|
async delCore(id) { |
|
|
|
const res = await delCoreApi(id) |
|
|
|
if (res?.code == 200) { |
|
|
|
if (res?.data?.result) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.getCoreList() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
stationClose() { |
|
|
|
this.stationVisible = false |
|
|
|
}, |
|
|
|