Commit 3aa86aa1 by qinjianhui

feat: 用户管理优化

parent b36fbba0
......@@ -60,3 +60,12 @@ export function getDetailsByIdApi(id: number) {
},
)
}
// 切换用户状态
export function changeUserStatusApi(status: number, id: number) {
return axios.get<never,BaseRespData<never>>('factory/factoryUser/enableDisable',{
params: {
status,
id
}
})
}
......@@ -35,10 +35,10 @@ export function confirmProductionOrder(ids: number[]) {
}
// 下载稿件
export function downloadOrder(ids: number[]) {
return axios.post<never, BaseRespData<never>>(
export function downloadOrder(id: number) {
return axios.get<never, BaseRespData<never>>(
'factory/customJomallOrder/downloadMaterial',
ids,
{ params: { id } },
)
}
......@@ -110,8 +110,8 @@ export function getOrderDetail(id: number) {
{
params: {
id,
}
}
},
},
)
}
......
......@@ -38,6 +38,7 @@ export interface OrderData {
finishTime?: string
paymentTime?: string
remark?: string
manuscriptUrl?: string
startStockingTime?: string
source?: string
substrateAreaCode?: string
......
......@@ -43,7 +43,7 @@
</el-form-item>
<el-form-item>
<el-button
v-loading="loading"
:loading="loading"
style="width: 100%"
size="large"
type="primary"
......
......@@ -98,6 +98,7 @@
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
@change="(e:number) => onChangeStatus(e, scope.row)"
></ElSwitch>
</el-tooltip>
</template>
......@@ -200,6 +201,7 @@ import {
updateUserApi,
deleteUserApi,
getDetailsByIdApi,
changeUserStatusApi,
} from '@/api/auth'
import Icon from '@/components/Icon.vue'
import { UserEditForm, userData, userSearchForm } from '@/types/api/user'
......@@ -331,6 +333,19 @@ const onOpenedUserForm = async () => {
const handleSelectionChange = (s: userData[]) => {
selection.value = s
}
const onChangeStatus = async (value: number, item: userData) => {
try {
const res = await changeUserStatusApi(value, item.id)
ElMessage({
message: res.message,
type: 'success',
offset: window.innerHeight / 2,
})
search()
} catch (e) {
showError(e)
}
}
</script>
<style lang="scss" scoped>
......
......@@ -86,11 +86,22 @@
(item.num || 0) - (item.shipmentNum || 0)
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<el-button
type="success"
size="small"
@click="downloadManuscriptBySubOrder(item)"
>下载稿件</el-button
>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { OrderData } from '@/types/api/order'
import { filePath } from '@/api/axios'
import { downloadOrder } from '@/api/order'
import { OrderData, ProductList } from '@/types/api/order'
import { showError } from '@/utils/ui'
import { PropType } from 'vue'
defineProps({
......@@ -101,8 +112,16 @@ defineProps({
isDetail: {
type: Boolean,
default: false,
}
},
})
const downloadManuscriptBySubOrder = async (item: ProductList) => {
try {
const res = await downloadOrder(item.id)
window.open(filePath + res.message)
} catch (e) {
showError(e)
}
}
</script>
<style lang="scss" scoped>
.order-list-expand_item {
......
......@@ -460,7 +460,6 @@ import {
getOrderList,
getOrderTabData,
confirmProductionOrder,
downloadOrder,
printOrder,
addInternalTagApi,
loadSendOutList,
......@@ -645,7 +644,7 @@ const downloadManuscript = async () => {
offset: window.innerHeight / 2,
})
}
const ids = selection.value.map((item) => item.id)
const manuscriptUrl = selection.value.map((item) => item.manuscriptUrl)
try {
await showConfirm('是否确认下载', {
confirmButtonText: '确认',
......@@ -655,12 +654,9 @@ const downloadManuscript = async () => {
} catch {
return
}
try {
const res = await downloadOrder(ids)
window.open(filePath + res.message)
} catch (e) {
showError(e)
}
manuscriptUrl.forEach((path) => {
window.open(filePath + path)
})
}
// 打印生产单
const printManuscript = async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment