修改派工管理暂停/启用代码

This commit is contained in:
shaoleiliu-netizen123 2026-06-03 17:31:09 +08:00
parent 8f2faf04b0
commit 729c76e5ef
4 changed files with 175 additions and 62 deletions

View File

@ -126,6 +126,14 @@ export const userApi = {
method: 'get', method: 'get',
responseType: 'blob' responseType: 'blob'
}) })
},
//查询全部用户
getPathList() {
return request({
url:"sys/user/list",
method:'get'
})
} }
} }

View File

@ -73,7 +73,8 @@
import { ref, reactive, h, onMounted } from 'vue' import { ref, reactive, h, onMounted } from 'vue'
import { dictDataApi } from '@/api/org' import { dictDataApi } from '@/api/org'
import { submitLogApi } from '@/api/submitLog' import { submitLogApi } from '@/api/submitLog'
import { NButton, NSpace, NIcon,NTag, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline, Options } from '@vicons/ionicons5'
// //
const statisticTypeOptions = ref<{ label: string; value: any }[]>([]) const statisticTypeOptions = ref<{ label: string; value: any }[]>([])

View File

@ -16,7 +16,7 @@
<n-input v-model:value="searchForm.processName" placeholder="请输入工序名称" clearable /> <n-input v-model:value="searchForm.processName" placeholder="请输入工序名称" clearable />
</n-form-item-gi> </n-form-item-gi>
<n-form-item-gi :span="6" label="工人名称"> <n-form-item-gi :span="6" label="工人名称">
<n-input v-model:value="searchForm.stringUserName" placeholder="请输入工人名称" clearable /> <n-input v-model:value="searchForm.userName" placeholder="请输入工人名称" clearable />
</n-form-item-gi> </n-form-item-gi>
<!-- <n-form-item-gi :span="6" label="数里"> <!-- <n-form-item-gi :span="6" label="数里">
<n-input v-model:value="searchForm.processId" placeholder="请输入数里" clearable /> <n-input v-model:value="searchForm.processId" placeholder="请输入数里" clearable />
@ -99,7 +99,7 @@
v-model:page="pagination.page" v-model:page="pagination.page"
v-model:page-size="pagination.pageSize" v-model:page-size="pagination.pageSize"
:item-count="pagination.itemCount" :item-count="pagination.itemCount"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[2,10, 20, 50, 100]"
show-size-picker show-size-picker
show-quick-jumper show-quick-jumper
@update:page="handlePageChange" @update:page="handlePageChange"
@ -140,9 +140,15 @@
</n-form-item> </n-form-item>
</n-gi> </n-gi>
<n-gi> <n-gi>
<n-form-item label="工人名称" path="stringUserName"> <n-form-item label="改派工人" path="">
<n-input v-model:value="formData.stringUserName" placeholder="请选择工人" /> <n-select
</n-form-item> v-model:value="reassform.userId"
placeholder="请指定改派的员工"
clearable
style="width: 200px"
:options="reassignEmployees"
/>
</n-form-item>
</n-gi> </n-gi>
<n-gi> <n-gi>
<n-form-item label="数量" path="quantity"> <n-form-item label="数量" path="quantity">
@ -202,8 +208,15 @@
<n-input v-model:value="gxobg.name" disabled /> <n-input v-model:value="gxobg.name" disabled />
</n-form-item> </n-form-item>
<n-form-item label="工人名称" path=""> <n-form-item label="改派工人" path="">
<n-input v-model:value="reassform.userid" placeholder="请选择员工" /> <n-select
v-model:value="reassform.userId"
placeholder="请指定改派的员工"
clearable
style="width: 200px"
:options="reassignEmployees"
/>
</n-form-item> </n-form-item>
<n-form-item label="改派原因" path="reason"> <n-form-item label="改派原因" path="reason">
<n-input type="textarea" v-model:value="reassform.reason" placeholder="请输入改派原因" /> <n-input type="textarea" v-model:value="reassform.reason" placeholder="请输入改派原因" />
@ -337,7 +350,8 @@ import {
ref, ref,
reactive, reactive,
h, h,
onMounted, onMounted,
render,
} from 'vue' } from 'vue'
@ -369,7 +383,8 @@ import {
} from '@/api/production' } from '@/api/production'
import { submitLogApi } from '@/api/submitLog' import { submitLogApi } from '@/api/submitLog'
import { an } from 'vue-router/dist/router-CWoNjPRp.mjs'
import { SysUser, userApi } from '@/api/system'
//const dialog = useDialog() //const dialog = useDialog()
@ -390,7 +405,6 @@ const qcStatusOptions = ref<{ label: string; value: any }[]>([])
const qcAssingStatusOptions = ref<{ label: string; value: any }[]>([]) const qcAssingStatusOptions = ref<{ label: string; value: any }[]>([])
// //
const infoIsCollapse = ref(false) const infoIsCollapse = ref(false)
const reportDetailVisible = ref(false) const reportDetailVisible = ref(false)
@ -414,14 +428,18 @@ const submitColumns = ref([
} }
]) ])
//
const reassignEmployees = ref<Array<{value: number, username: string}>>([])
// ==================== ==================== // ==================== ====================
const searchForm = reactive({ const searchForm = reactive({
page: 1, page: 1,
pageSize: 20, pageSize: 20,
processId:'', processId:null ,
processName:'', processName:null,
stringUserName:'' userName:null
}) })
@ -437,11 +455,41 @@ const pagination = reactive({
itemCount: 0 itemCount: 0
}) })
const columns = [ const columns = [
// { // {
// type: 'selection', // type: 'selection',
// minWidth:60 // minWidth:60
// }, // },
{
align:"center",
title:"物料名称",
key:"materialName",
minWidth:150,
render(row:any) {
var opt = row.materialName
if(opt) return opt
return '-'
}
},
{
align:"center",
title:"物料编码",
key:"materialCode",
minWidth:150,
render(row:any) {
var opt = row.materialCode
if(opt) return opt
return '-'
}
},
{
align:"center",
title:"派工编号",
key:"assingCode",
minWidth:150
},
{ {
align:'center', align:'center',
title: '工序编号', title: '工序编号',
@ -460,22 +508,28 @@ const columns = [
key: 'assingStatus', key: 'assingStatus',
minWidth: 150, minWidth: 150,
render(row:any) { render(row:any) {
let text = '' // let text = ''
if(row.assingStatus == 1){ // if(row.assingStatus == 1){
text = '待执行' // text = ''
}else if(row.assingStatus == 2){ // }else if(row.assingStatus == 2){
text = '执行中' // text = ''
}else if(row.assingStatus == 3){ // }else if(row.assingStatus == 3){
text = '质检中' // text = ''
}else if(row.assingStatus == 4){ // }else if(row.assingStatus == 4){
text = '已汇报' // text = ''
}else if(row.assingStatus == 5){ // }else if(row.assingStatus == 5){
text = '已关闭' // text = ''
} // }
// return text
const val = row.assingStatus
const opt = qcAssingStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
return text
} }
//0 1 2+34
}, },
{ {
align:'center', align:'center',
@ -495,7 +549,7 @@ const columns = [
key: 'rework', key: 'rework',
minWidth: 100, minWidth: 100,
render(row:any) { render(row:any) {
const quit = row.rework === 3 const quit = row.rework === 1
return h(NTag, {type: quit ? 'error' : 'success', size: 'small'}, {default: () => (quit ? '是' : '否')}) return h(NTag, {type: quit ? 'error' : 'success', size: 'small'}, {default: () => (quit ? '是' : '否')})
} }
}, },
@ -535,9 +589,14 @@ const columns = [
}, },
{ {
align:'center', align:'center',
title: '质检打回数', title: '质检打回数',
key: 'qualityReturnNum', key: 'qualityReturnNum',
minWidth: 150 minWidth: 150,
render(row:any) {
var count = row.qualityReturnNum
if(count>0) return count
return 0
}
}, },
{ {
align:'center', align:'center',
@ -606,7 +665,7 @@ const columns = [
options:[ options:[
{label:"改派",key:'transfer'}, {label:"改派",key:'transfer'},
{type: 'divider' }, // 线 {type: 'divider' }, // 线
{label:'暂停',key:'pauseResume'}, {label: '启用/暂停',key:'pauseResume'},
{type: 'divider' }, // 线 {type: 'divider' }, // 线
{label:'查看汇报',key:'view'}, {label:'查看汇报',key:'view'},
], ],
@ -705,9 +764,11 @@ function search() {
// //
function reset() { function reset() {
searchForm.processId ='' searchForm.processId =null
searchForm.processName = '' searchForm.processName = null
searchForm.stringUserName = '' searchForm.userName = null
} }
// //
@ -784,9 +845,9 @@ let reassform = reactive<any>({
// userId:'', //id // userId:'', //id
// stringUserName:'', // // stringUserName:'', //
id:'', //id id:null, //id
reason:'', // reason:null, //
userid:456 //Id userId:null //Id
}) })
const reassrules = { const reassrules = {
userid: [{ required: true, message: '请选择员工', trigger: 'blur' }] userid: [{ required: true, message: '请选择员工', trigger: 'blur' }]
@ -855,8 +916,7 @@ function handlpause(n:any) {
pauseformRef.value?.restoreValidation() pauseformRef.value?.restoreValidation()
pauseform.id = n.id pauseform.id = n.id
pauseform.reason = '' pauseform.reason = ''
pauseform.status = n.staus pauseform.status = n.status === '0'?'1':'0'
} }
function pauseSubmit() { function pauseSubmit() {
@ -866,12 +926,10 @@ function pauseSubmit() {
pauseisedbtn.value = true pauseisedbtn.value = true
pauseresume(pauseform).then(() => { pauseresume(pauseform).then(() => {
message.success('操作成功!') message.success('操作成功!')
setTimeout(()=> { pausemodal.value = false
pausemodal.value = false pauseLoading.value = false
pauseLoading.value = false pauseisedbtn.value = false
pauseisedbtn.value = false getlist()
getlist()
},1000)
}).catch(() => { }).catch(() => {
pauseLoading.value = false pauseLoading.value = false
pauseisedbtn.value = false pauseisedbtn.value = false
@ -950,9 +1008,23 @@ async function loadDictOptions() {
}catch {} }catch {}
} }
//
async function getUserList() {
const res = await userApi.getPathList();
reassignEmployees.value = res.map((user:SysUser)=>(
{
label: user.username,
value: user.id
}
))
}
onMounted(() => { onMounted(() => {
getlist() getlist()
getUserList()
loadDictOptions() loadDictOptions()
//workload() //workload()

View File

@ -182,7 +182,7 @@ import {
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { dictDataApi } from '@/api/org'
import { import {
mytasks, mytasks,
inspectio inspectio
@ -198,6 +198,9 @@ const userStore = useUserStore()
const hasPermission = (permission: string) => userStore.hasPermission(permission) const hasPermission = (permission: string) => userStore.hasPermission(permission)
//
const qcAssingStatusOptions = ref<{ label: string; value: any }[]>([])
// ==================== ==================== // ==================== ====================
const searchForm = reactive({ const searchForm = reactive({
page: 1, page: 1,
@ -224,6 +227,34 @@ const columns = [
// type: 'selection', // type: 'selection',
// minWidth:60 // minWidth:60
// }, // },
{
align:"center",
title:"物料名称",
key:"materialName",
minWidth:150,
render(row:any) {
var opt = row.materialName
if(opt) return opt
return '-'
}
},
{
align:"center",
title:"物料编码",
key:"materialCode",
minWidth:150,
render(row:any) {
var opt = row.materialCode
if(opt) return opt
return '-'
}
},
{
align:"center",
title:"派工编号",
key:"assingCode",
minWidth:150
},
{ {
align:'center', align:'center',
title: '工序编号', title: '工序编号',
@ -242,20 +273,12 @@ const columns = [
key: 'assingStatus', key: 'assingStatus',
minWidth: 150, minWidth: 150,
render(row:any) { render(row:any) {
let text = '' const val = row.assingStatus
if(row.assingStatus == 0){ const opt = qcAssingStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
text = '待执行' if (!opt) return val ?? '-'
}else if(row.assingStatus == 1){
text = '执行中' return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}else if(row.assingStatus == 2){
text = '质检中'
}else if(row.assingStatus == 3){
text = '已汇报'
}else if(row.assingStatus == 4){
text = '已关闭'
}
return text
} }
//0 1 2+34 //0 1 2+34
}, },
@ -277,7 +300,7 @@ const columns = [
key: 'rework', key: 'rework',
minWidth: 100, minWidth: 100,
render(row:any) { render(row:any) {
const quit = row.rework === 3 const quit = row.rework === 1
return h(NTag, {type: quit ? 'error' : 'success', size: 'small'}, {default: () => (quit ? '是' : '否')}) return h(NTag, {type: quit ? 'error' : 'success', size: 'small'}, {default: () => (quit ? '是' : '否')})
} }
}, },
@ -418,7 +441,7 @@ function reset() {
// //
function getlist() { function getlist() {
mytasks(searchForm).then((rps:any) => { mytasks(searchForm).then((rps:any) => {
datalist.value = rps.list datalist.value = rps.records
pagination.itemCount = rps.total pagination.itemCount = rps.total
}) })
} }
@ -506,6 +529,14 @@ function pauseSubmit() {
}) })
} }
//
async function loadDictOptions() {
try {
const data = await dictDataApi.listByType('assing_status')
qcAssingStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
}
// function zantqy(row:any) { // function zantqy(row:any) {
// dialog.warning({ // dialog.warning({
// title: '', // title: '',
@ -524,6 +555,7 @@ onMounted(() => {
getlist() getlist()
loadDictOptions()
}) })
</script> </script>