Browse Source

发布任务准备

master
maochaoying 2 years ago
parent
commit
e55255837e
  1. 7
      src/api/info.js
  2. 43
      src/components/Publish.vue
  3. 4
      src/pages/index.vue

7
src/api/info.js

@ -14,6 +14,13 @@ export const coreListApi = () => {
}) })
} }
export const coreListByStationIdApi = id => {
return request({
url: `/core/list/${id}`,
method: 'GET',
})
}
export const addStationApi = data => { export const addStationApi = data => {
return request({ return request({
url: '/station/add', url: '/station/add',

43
src/components/Publish.vue

@ -28,15 +28,16 @@
class="demo-select-base" class="demo-select-base"
clearable clearable
filterable filterable
@change="handleStationChange"
placeholder="请选择所在核电站" placeholder="请选择所在核电站"
> >
<t-option <t-option
v-for="(item, index) in stationList"
:value="item.value"
:label="item.label"
:key="index"
v-for="item in stationList"
:value="item.id"
:label="item.name"
:key="item.id"
> >
{{ item.label }}
{{ item.name }}
</t-option> </t-option>
</t-select> </t-select>
</t-form-item> </t-form-item>
@ -49,12 +50,12 @@
placeholder="请选择所在核芯堆" placeholder="请选择所在核芯堆"
> >
<t-option <t-option
v-for="(item, index) in coreList"
:value="item.value"
:label="item.label"
:key="index"
v-for="item in coreList"
:value="item.id"
:label="item.name"
:key="item.id"
> >
{{ item.label }}
{{ item.name }}
</t-option> </t-option>
</t-select> </t-select>
</t-form-item> </t-form-item>
@ -88,6 +89,7 @@
</template> </template>
<script> <script>
import { allOperatorApi } from '@/api/publish' import { allOperatorApi } from '@/api/publish'
import { stationListApi, coreListByStationIdApi } from '@/api/info'
const INITIAL_DATA = { const INITIAL_DATA = {
taskname: '', taskname: '',
order: '', order: '',
@ -99,11 +101,7 @@ export default {
data() { data() {
return { return {
formData: { ...INITIAL_DATA }, formData: { ...INITIAL_DATA },
stationList: [
{ label: '计算机学院', value: '1' },
{ label: '软件学院', value: '2' },
{ label: '物联网学院', value: '3' },
],
stationList: [],
userList: [], userList: [],
coreList: [], coreList: [],
rules: { rules: {
@ -132,6 +130,18 @@ export default {
}, },
methods: { methods: {
async handleStationChange(value, context) {
const res = await coreListByStationIdApi(value)
if (res?.code == 200) {
this.coreList = res?.data.list
}
},
async getStationList() {
const res = await stationListApi()
if (res?.code == 200) {
this.stationList = res?.data?.list
}
},
async getAllOperator() { async getAllOperator() {
const res = await allOperatorApi() const res = await allOperatorApi()
if (res?.code == 200) { if (res?.code == 200) {
@ -140,13 +150,11 @@ export default {
}, },
onReset() { onReset() {
this.$message.success('重置成功') this.$message.success('重置成功')
console.log('formData', this.formData)
}, },
onSubmit({ validateResult, firstError }) { onSubmit({ validateResult, firstError }) {
if (validateResult === true) { if (validateResult === true) {
this.$message.success('提交成功') this.$message.success('提交成功')
} else { } else {
console.log('Errors: ', validateResult)
this.$message.warning(firstError) this.$message.warning(firstError)
} }
}, },
@ -154,6 +162,7 @@ export default {
mounted() { mounted() {
this.getAllOperator() this.getAllOperator()
this.getStationList()
}, },
} }
</script> </script>

4
src/pages/index.vue

@ -106,7 +106,7 @@
</svg> </svg>
<p class="title">用户管理</p> <p class="title">用户管理</p>
</div> </div>
<div class="menu" @click="changePage(4)" v-if="role == 'ROLE_ADMIN'">
<!-- <div class="menu" @click="changePage(4)" v-if="role == 'ROLE_ADMIN'">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
@ -126,7 +126,7 @@
</g> </g>
</svg> </svg>
<p class="title">相机调试</p> <p class="title">相机调试</p>
</div>
</div> -->
<div class="menu" @click="changePage(5)" v-if="role == 'ROLE_ADMIN'"> <div class="menu" @click="changePage(5)" v-if="role == 'ROLE_ADMIN'">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"

Loading…
Cancel
Save