工单派发
This commit is contained in:
@@ -137,6 +137,10 @@ const WorkOrderPage = () => {
|
||||
const [completeModalVisible, setCompleteModalVisible] = useState(false);
|
||||
const [completeForm] = Form.useForm();
|
||||
const messageApi = utils.message;
|
||||
// 派单弹窗
|
||||
const [dispatchUserModalVisible, setDispatchUserModalVisible] = useState(false);
|
||||
const [dispatchForm] = Form.useForm();
|
||||
|
||||
|
||||
// 排班更多弹窗
|
||||
const [scheduleModalVisible, setScheduleModalVisible] = useState(false);
|
||||
@@ -215,6 +219,36 @@ const WorkOrderPage = () => {
|
||||
});
|
||||
};
|
||||
|
||||
// 打开【派单弹窗】
|
||||
const openDispatchUserModal = () => {
|
||||
dispatchForm.setFieldsValue({
|
||||
id: currentDetail?.id,
|
||||
});
|
||||
setDispatchUserModalVisible(true);
|
||||
};
|
||||
|
||||
// 提交派单
|
||||
const submitDispatchWorkOrder = async (values) => {
|
||||
try {
|
||||
const params = {
|
||||
orderId: values.id,
|
||||
assigneeId: values.assignUserId, // 选中人员ID
|
||||
};
|
||||
const res = await dispatchWorkOrder(params);
|
||||
if (res.code === 200) {
|
||||
messageApi.success('工单派单成功');
|
||||
setDispatchUserModalVisible(false);
|
||||
dispatchForm.resetFields();
|
||||
} else {
|
||||
messageApi.error(res.msg || '派单失败');
|
||||
}
|
||||
} catch (err) {
|
||||
messageApi.error('派单请求异常');
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取工单配色(优先级)
|
||||
@@ -1419,8 +1453,7 @@ const WorkOrderPage = () => {
|
||||
<Button
|
||||
type="primary"
|
||||
block
|
||||
onClick={openExecuteModal}
|
||||
style={{ borderRadius: 8, height: 36, fontWeight: 600 }}
|
||||
onClick={openDispatchUserModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}
|
||||
icon={<PlayCircleFilled />}
|
||||
>
|
||||
派单
|
||||
@@ -1582,6 +1615,57 @@ const WorkOrderPage = () => {
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
{/* 派单弹窗:选择人员 */}
|
||||
<Modal
|
||||
title="工单派单"
|
||||
open={dispatchUserModalVisible}
|
||||
onCancel={() => setDispatchUserModalVisible(false)}
|
||||
footer={null}
|
||||
width={520}
|
||||
>
|
||||
<Form form={dispatchForm} layout="vertical" onFinish={submitDispatchWorkOrder}>
|
||||
<FormItem name="id" label="工单ID" hidden>
|
||||
<Input />
|
||||
</FormItem>
|
||||
<FormItem label="待派单工单">
|
||||
<div style={{
|
||||
padding: 8,
|
||||
background: '#f8fafc',
|
||||
borderRadius: 6,
|
||||
maxHeight: 150,
|
||||
overflow: 'auto'
|
||||
}}>
|
||||
|
||||
<div>• {currentDetail?.orderTitle} ({currentDetail?.orderNo})</div>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
name="assignUserId"
|
||||
label="选择接收人员"
|
||||
rules={[{ required: true, message: '请选择派单人员' }]}
|
||||
>
|
||||
<Select
|
||||
placeholder="请选择人员"
|
||||
showSearch
|
||||
style={{ width: '100%' }}
|
||||
optionFilterProp="label"
|
||||
filterOption={(input, option) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
options={userList.map(u => ({
|
||||
value: u.userId,
|
||||
label: u.userName || u.nickName || '未知人员'
|
||||
}))}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setDispatchUserModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认派单</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
|
||||
{/* 执行工单弹窗 */}
|
||||
<Modal title="执行工单" open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
|
||||
<Form form={form} layout="vertical" onFinish={submitExecute}>
|
||||
|
||||
Reference in New Issue
Block a user