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

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',
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 { dictDataApi } from '@/api/org'
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 }[]>([])

View File

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

View File

@ -182,7 +182,7 @@ import {
} from '@vicons/ionicons5'
import { useUserStore } from '@/stores/user'
import { dictDataApi } from '@/api/org'
import {
mytasks,
inspectio
@ -198,6 +198,9 @@ const userStore = useUserStore()
const hasPermission = (permission: string) => userStore.hasPermission(permission)
//
const qcAssingStatusOptions = ref<{ label: string; value: any }[]>([])
// ==================== ====================
const searchForm = reactive({
page: 1,
@ -224,6 +227,34 @@ const columns = [
// type: 'selection',
// 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',
title: '工序编号',
@ -242,20 +273,12 @@ const columns = [
key: 'assingStatus',
minWidth: 150,
render(row:any) {
let text = ''
if(row.assingStatus == 0){
text = '待执行'
}else if(row.assingStatus == 1){
text = '执行中'
}else if(row.assingStatus == 2){
text = '质检中'
}else if(row.assingStatus == 3){
text = '已汇报'
}else if(row.assingStatus == 4){
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
},
@ -277,7 +300,7 @@ const columns = [
key: 'rework',
minWidth: 100,
render(row:any) {
const quit = row.rework === 3
const quit = row.rework === 1
return h(NTag, {type: quit ? 'error' : 'success', size: 'small'}, {default: () => (quit ? '是' : '否')})
}
},
@ -418,7 +441,7 @@ function reset() {
//
function getlist() {
mytasks(searchForm).then((rps:any) => {
datalist.value = rps.list
datalist.value = rps.records
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) {
// dialog.warning({
// title: '',
@ -524,6 +555,7 @@ onMounted(() => {
getlist()
loadDictOptions()
})
</script>