Browse Source

优化代码 ts any 指定类型

feature/three
LiLongLong 3 months ago
parent
commit
ff43e68c5d
  1. 2
      src/apis/container.ts
  2. 2
      src/components/craft/AddCraftDialog.vue
  3. 13
      src/components/craft/CraftStatus.vue
  4. 2
      src/types/user.d.ts
  5. 2
      src/views/container/index.vue
  6. 4
      src/views/container/liquidItem.vue
  7. 10
      src/views/craft/index.vue
  8. 8
      src/views/ore/index.vue
  9. 8
      src/views/solution/index.vue
  10. 10
      src/views/user/index.vue

2
src/apis/container.ts

@ -1,5 +1,5 @@
import http from 'libs/http' import http from 'libs/http'
export const getContainerList = (): Promise<System.PageResponse<Container.ContainerItem>> => http.get(`/container/list`)
export const getContainerList = (): Promise<Container.ContainerItem[]> => http.get(`/container/list`)
export const updateContainer = (params: Container.ContainerItem): Promise<null> => http.put(`/container`, params) export const updateContainer = (params: Container.ContainerItem): Promise<null> => http.put(`/container`, params)

2
src/components/craft/AddCraftDialog.vue

@ -224,7 +224,7 @@ defineExpose({
<FtButton @click="closeDialog"> <FtButton @click="closeDialog">
取消 取消
</FtButton> </FtButton>
<FtButton ref="saveRef" :loading="loading" :click-handle="onConfirm">
<FtButton type="primary" ref="saveRef" :loading="loading" :click-handle="onConfirm">
确定 确定
</FtButton> </FtButton>
</div> </div>

13
src/components/craft/CraftStatus.vue

@ -158,7 +158,7 @@ defineExpose({
</div> </div>
<div class="item2"> <div class="item2">
<div>工艺执行状态</div> <div>工艺执行状态</div>
<div v-if="stateList.length" class="state-log">
<div v-if="stateList.length" class="state-log state-back">
<div v-for="item in stateList" :key="item.state"> <div v-for="item in stateList" :key="item.state">
<span class="state-span"><label class="state-log-label">矿石名称</label><span class="state-log-text">{{ item.oresName }}</span></span> <span class="state-span"><label class="state-log-label">矿石名称</label><span class="state-log-text">{{ item.oresName }}</span></span>
<span class="state-span"><label class="state-log-label">工艺名称</label><span class="state-log-text">{{ item.craftsName }}</span></span> <span class="state-span"><label class="state-log-label">工艺名称</label><span class="state-log-text">{{ item.craftsName }}</span></span>
@ -198,16 +198,21 @@ defineExpose({
height: 50vh; height: 50vh;
max-height: 50vh; max-height: 50vh;
overflow: auto; overflow: auto;
padding: 20px;
padding: 10px;
}
.state-back{
background: #0d0d0d;
color: #0f0;
border-radius: 10px;
} }
.state-span{ .state-span{
padding-left: 10px; padding-left: 10px;
} }
.state-log-label{ .state-log-label{
font-weight: 600; font-weight: 600;
font-size: .875rem;
font-size: 10px;
} }
.state-log-text{ .state-log-text{
font-size: .875rem;
font-size: 10px;
} }
</style> </style>

2
src/types/user.d.ts

@ -16,7 +16,7 @@ declare namespace User {
nickname: string | number nickname: string | number
password: string | number password: string | number
role: string | number role: string | number
fixedUser: string | number
fixedUser?: string | number
deleted: string | number deleted: string | number
} }

2
src/views/container/index.vue

@ -29,7 +29,7 @@ const querySolutionList = async () => {
const queryContainerList = () => { const queryContainerList = () => {
getContainerList().then((res) => { getContainerList().then((res) => {
if (res) { if (res) {
const list: Container.ContainerItem[] = res.list
const list: Container.ContainerItem[] = res
const solutionList: Container.ContainerItem[] = [] const solutionList: Container.ContainerItem[] = []
list.forEach((item, index) => { list.forEach((item, index) => {
// 8, // 8,

4
src/views/container/liquidItem.vue

@ -139,7 +139,7 @@ const onSubmitSolution = () => {
<FtButton @click="onClose"> <FtButton @click="onClose">
取消 取消
</FtButton> </FtButton>
<FtButton @click="onSubmitSolution">
<FtButton type="primary" @click="onSubmitSolution">
确认 确认
</FtButton> </FtButton>
</div> </div>
@ -197,7 +197,7 @@ const onSubmitSolution = () => {
width: 15vw; width: 15vw;
} }
.footer { .footer {
margin-top: 4rem;
margin-top: 3rem;
line-height: 20px; line-height: 20px;
} }
.footer-content{ .footer-content{

10
src/views/craft/index.vue

@ -145,10 +145,10 @@ const returnOre = () => {
<template> <template>
<div class="component-page"> <div class="component-page">
<section class="flex items-center h-20 gap-3 pl-3"> <section class="flex items-center h-20 gap-3 pl-3">
<FtButton @click="onAddCraft">
<FtButton type="primary" @click="onAddCraft">
添加工艺 添加工艺
</FtButton> </FtButton>
<FtButton @click="onEditCraft">
<FtButton type="primary" @click="onEditCraft">
编辑工艺 编辑工艺
</FtButton> </FtButton>
<FtButton @click="onDelCraft"> <FtButton @click="onDelCraft">
@ -185,14 +185,16 @@ const returnOre = () => {
</el-select> </el-select>
</div> </div>
<div style="display: flex; justify-content: center;align-items: center; height:100px"> <div style="display: flex; justify-content: center;align-items: center; height:100px">
<FtButton @click="onStart">
<FtButton type="primary" @click="onStart">
开始执行 开始执行
</FtButton> </FtButton>
</div> </div>
</el-dialog> </el-dialog>
<CraftStatus ref="craftStatusRef" /> <CraftStatus ref="craftStatusRef" />
<div class="return-ore"> <div class="return-ore">
<FtButton @click="returnOre">返回</FtButton>
<FtButton @click="returnOre">
返回
</FtButton>
</div> </div>
</div> </div>
</template> </template>

8
src/views/ore/index.vue

@ -133,10 +133,10 @@ const onShowCraft = () => {
</div> </div>
<div v-else> <div v-else>
<div> <div>
<FtButton @click="onAddOre">
<FtButton type="primary" @click="onAddOre">
添加矿石 添加矿石
</FtButton> </FtButton>
<FtButton @click="onEditOre">
<FtButton type="primary" @click="onEditOre">
编辑矿石 编辑矿石
</FtButton> </FtButton>
<FtButton @click="onDelOre"> <FtButton @click="onDelOre">
@ -165,7 +165,7 @@ const onShowCraft = () => {
</el-table> </el-table>
<!-- <FtTable :columns="columns" has-header :btn-list="btnList" :get-data-fn="queryOresList" /> --> <!-- <FtTable :columns="columns" has-header :btn-list="btnList" :get-data-fn="queryOresList" /> -->
</div> </div>
<FtDialog v-model="visible" title="添加矿石" style="width:35vw; height:30vh">
<FtDialog v-model="visible" title="添加矿石" style="width:25vw; height:25vh">
<div class="add-content"> <div class="add-content">
<label>矿石名称</label> <label>矿石名称</label>
<span><el-input v-model="name" style="width:200px" /></span> <span><el-input v-model="name" style="width:200px" /></span>
@ -175,7 +175,7 @@ const onShowCraft = () => {
<FtButton @click="closeDialog"> <FtButton @click="closeDialog">
取消 取消
</FtButton> </FtButton>
<FtButton :loading="loading" :click-handle="onConfirm">
<FtButton type="primary" :loading="loading" :click-handle="onConfirm">
确定 确定
</FtButton> </FtButton>
</div> </div>

8
src/views/solution/index.vue

@ -106,10 +106,10 @@ const closeDialog = () => {
<template> <template>
<div> <div>
<div> <div>
<FtButton @click="addSolution">
<FtButton type="primary" @click="addSolution">
添加溶液 添加溶液
</FtButton> </FtButton>
<FtButton @click="editSolution">
<FtButton type="primary" @click="editSolution">
编辑溶液 编辑溶液
</FtButton> </FtButton>
<FtButton @click="delSolution"> <FtButton @click="delSolution">
@ -125,7 +125,7 @@ const closeDialog = () => {
<el-table-column prop="updateTime" label="更新时间" /> <el-table-column prop="updateTime" label="更新时间" />
</el-table> </el-table>
</div> </div>
<FtDialog v-model="visible" title="添加溶液" style="width:35vw; height:30vh">
<FtDialog v-model="visible" title="添加溶液" style="width:25vw; height:25vh">
<div class="add-content"> <div class="add-content">
<label>溶液名称</label> <label>溶液名称</label>
<span><el-input v-model="name" style="width:200px" /></span> <span><el-input v-model="name" style="width:200px" /></span>
@ -135,7 +135,7 @@ const closeDialog = () => {
<FtButton @click="closeDialog"> <FtButton @click="closeDialog">
取消 取消
</FtButton> </FtButton>
<FtButton :click-handle="onConfirm">
<FtButton type="primary" :click-handle="onConfirm">
确定 确定
</FtButton> </FtButton>
</div> </div>

10
src/views/user/index.vue

@ -17,7 +17,6 @@ const queryUserList = () => {
pageNum: 1, pageNum: 1,
} }
userList(params).then((res) => { userList(params).then((res) => {
console.log('res===', res)
userDataList.value = res.list userDataList.value = res.list
}) })
} }
@ -52,7 +51,6 @@ const onConfirm = (formRef: FormInstance | undefined) => {
nickname, nickname,
password, password,
role: isAdmin ? 'ADMIN' : 'USER', role: isAdmin ? 'ADMIN' : 'USER',
fixedUser: 'ENABLE',
deleted: 'ENABLE', deleted: 'ENABLE',
} }
addUser(params).then(() => { addUser(params).then(() => {
@ -71,10 +69,10 @@ const onConfirm = (formRef: FormInstance | undefined) => {
<template> <template>
<div> <div>
<div> <div>
<FtButton @click="createUser">
<FtButton type="primary" @click="createUser">
添加用户 添加用户
</FtButton> </FtButton>
<FtButton @click="editUser">
<FtButton type="primary" @click="editUser">
编辑用户 编辑用户
</FtButton> </FtButton>
<FtButton @click="delUser"> <FtButton @click="delUser">
@ -89,7 +87,7 @@ const onConfirm = (formRef: FormInstance | undefined) => {
<el-table-column prop="nickname" label="用户名" /> <el-table-column prop="nickname" label="用户名" />
<el-table-column prop="fixedUser" label="状态"> <el-table-column prop="fixedUser" label="状态">
<template #default="scoped"> <template #default="scoped">
<span v-if="scoped.row.fixedUser === 'ENABLE'">正常</span>
<span v-if="scoped.row.deleted === 'ENABLE'">正常</span>
<span v-else>停用</span> <span v-else>停用</span>
</template> </template>
</el-table-column> </el-table-column>
@ -156,7 +154,7 @@ const onConfirm = (formRef: FormInstance | undefined) => {
<FtButton @click="closeDialog"> <FtButton @click="closeDialog">
取消 取消
</FtButton> </FtButton>
<FtButton :click-handle="() => { onConfirm(userFormRef) }">
<FtButton type="primary" :click-handle="() => { onConfirm(userFormRef) }">
确定 确定
</FtButton> </FtButton>
</div> </div>

Loading…
Cancel
Save