Commit 3aa86aa1 by qinjianhui

feat: 用户管理优化

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