| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/task/save' : '/api/task/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const taskStsQueryList = ref(null); |
| | | taskStsQuery(); |
| | | function taskStsQuery() { |
| | | postForm('/api/taskSts/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | taskStsQueryList.value = result.data; |
| | | }) |
| | | } |
| | | const taskTypeQueryList = ref(null); |
| | | taskTypeQuery(); |
| | | function taskTypeQuery() { |
| | | postForm('/api/taskType/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | taskTypeQueryList.value = result.data; |
| | | }) |
| | | } |
| | | const userQueryList = ref(null); |
| | | userQuery(); |
| | | function userQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | userQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '任务管理-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" |
| | | :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;" |
| | | autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item :label="formatMessage('db.man_task.task_no', '任务编号')" name="taskNo" style="width: 250px;"> |
| | | <a-input v-model:value="formData.taskNo" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.task_sts', '任务状态')" name="taskSts" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.taskSts" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="taskStsQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.task_type', '任务类型')" name="taskType" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.taskType" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="taskTypeQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.io_pri', '优先级')" name="ioPri" style="width: 250px;"> |
| | | <a-input v-model:value="formData.ioPri" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.origin_loc', '源库位')" name="originLoc" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.originLoc" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.target_loc', '目标库位')" name="targetLoc" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.targetLoc" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.origin_site', '源站点')" name="originSite" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.originSite" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.target_site', '目标站点')" name="targetSite" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.targetSite" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.barcode', '托盘码')" name="barcode" style="width: 250px;"> |
| | | <a-input v-model:value="formData.barcode" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.status', '状态')" name="status" style="width: 250px;"> |
| | | <a-select v-model:value="formData.status" :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.create_time', '添加时间')" name="createTime" |
| | | style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.create_by', '添加人员')" name="createBy" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.update_time', '修改时间')" name="updateTime" |
| | | style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.update_by', '修改人员')" name="updateBy" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_task.memo', '备注')" name="memo" style="width: 250px;"> |
| | | <a-input v-model:value="formData.memo" /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | | <script setup>
|
| | | import { ref, nextTick } from 'vue';
|
| | | import { get, post, postBlob, postForm } from '@/utils/request.js'
|
| | | import { formatMessage } from '@/utils/localeUtils.js';
|
| | | import { message } from 'ant-design-vue';
|
| | |
|
| | | const formTable = ref(null);
|
| | | const submitButton = ref(null);
|
| | | const isSave = ref(true);
|
| | | const open = ref(false);
|
| | | const initFormData = {}
|
| | | let formData = ref(initFormData);
|
| | |
|
| | | const emit = defineEmits(['tableReload'])
|
| | |
|
| | | const handleOk = (e) => {
|
| | | nextTick(() => {
|
| | | setTimeout(() => {
|
| | | submitButton.value.$el.click();
|
| | | }, 100);
|
| | | });
|
| | | };
|
| | |
|
| | | const onFinish = values => {
|
| | | // console.log('Success:', values);
|
| | | open.value = false;
|
| | | post(isSave.value ? '/api/task/save' : '/api/task/update', formData.value).then((resp) => {
|
| | | let result = resp.data;
|
| | | if (result.code === 200) {
|
| | | message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功'));
|
| | | } else {
|
| | | message.error(result.msg);
|
| | | }
|
| | | emit('tableReload', 'reload')
|
| | | nextTick(() => {
|
| | | formTable.value.resetFields()
|
| | | })
|
| | | })
|
| | | };
|
| | | const onFinishFailed = errorInfo => {
|
| | | console.log('Failed:', errorInfo);
|
| | | };
|
| | |
|
| | | const taskStsQueryList = ref(null);
|
| | | taskStsQuery();
|
| | | function taskStsQuery() {
|
| | | postForm('/api/taskSts/query', {}).then(resp => {
|
| | | let result = resp.data;
|
| | | taskStsQueryList.value = result.data;
|
| | | })
|
| | | }
|
| | | const taskTypeQueryList = ref(null);
|
| | | taskTypeQuery();
|
| | | function taskTypeQuery() {
|
| | | postForm('/api/taskType/query', {}).then(resp => {
|
| | | let result = resp.data;
|
| | | taskTypeQueryList.value = result.data;
|
| | | })
|
| | | }
|
| | | const userQueryList = ref(null);
|
| | | userQuery();
|
| | | function userQuery() {
|
| | | postForm('/api/user/query', {}).then(resp => {
|
| | | let result = resp.data;
|
| | | userQueryList.value = result.data;
|
| | | })
|
| | | }
|
| | |
|
| | |
|
| | | defineExpose({
|
| | | open,
|
| | | formData,
|
| | | initFormData,
|
| | | isSave,
|
| | | })
|
| | |
|
| | | </script>
|
| | |
|
| | | <script>
|
| | | export default {
|
| | | name: '任务管理-edit'
|
| | | }
|
| | | </script>
|
| | |
|
| | | <template>
|
| | | <div>
|
| | | <a-modal v-model:open="open"
|
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk"
|
| | | style="width: 600px;">
|
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }"
|
| | | :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;"
|
| | | autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed">
|
| | | <a-form-item :label="formatMessage('db.man_task.task_no', '任务编号')" name="taskNo" style="width: 250px;">
|
| | | <a-input v-model:value="formData.taskNo" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.task_sts', '任务状态')" name="taskSts"
|
| | | style="width: 250px;">
|
| | | <a-select v-model:value="formData.taskSts" :placeholder="formatMessage('common.select', '请选择')"
|
| | | style="width: 100%" show-search :options="taskStsQueryList" optionFilterProp="label"
|
| | | optionLabelProp="label">
|
| | | </a-select>
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.task_type', '任务类型')" name="taskType"
|
| | | style="width: 250px;">
|
| | | <a-select v-model:value="formData.taskType" :placeholder="formatMessage('common.select', '请选择')"
|
| | | style="width: 100%" show-search :options="taskTypeQueryList" optionFilterProp="label"
|
| | | optionLabelProp="label">
|
| | | </a-select>
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.io_pri', '优先级')" name="ioPri" style="width: 250px;">
|
| | | <a-input v-model:value="formData.ioPri" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.origin_loc', '源库位')" name="originLoc"
|
| | | style="width: 250px;">
|
| | | <a-input v-model:value="formData.originLoc" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.target_loc', '目标库位')" name="targetLoc"
|
| | | style="width: 250px;">
|
| | | <a-input v-model:value="formData.targetLoc" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.origin_site', '源站点')" name="originSite"
|
| | | style="width: 250px;">
|
| | | <a-input v-model:value="formData.originSite" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.target_site', '目标站点')" name="targetSite"
|
| | | style="width: 250px;">
|
| | | <a-input v-model:value="formData.targetSite" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.barcode', '托盘码')" name="barcode" style="width: 250px;">
|
| | | <a-input v-model:value="formData.barcode" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.status', '状态')" name="status" style="width: 250px;">
|
| | | <a-select v-model:value="formData.status" :options="[
|
| | | { label: '正常', value: 1 },
|
| | | { label: '禁用', value: 0 },
|
| | | ]">
|
| | | </a-select>
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.create_time', '添加时间')" name="createTime"
|
| | | style="width: 250px;">
|
| | | <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss"
|
| | | value-format="YYYY-MM-DD HH:mm:ss" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.create_by', '添加人员')" name="createBy"
|
| | | style="width: 250px;">
|
| | | <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '请选择')"
|
| | | style="width: 100%" show-search :options="userQueryList" optionFilterProp="label"
|
| | | optionLabelProp="label">
|
| | | </a-select>
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.update_time', '修改时间')" name="updateTime"
|
| | | style="width: 250px;">
|
| | | <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss"
|
| | | value-format="YYYY-MM-DD HH:mm:ss" />
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.update_by', '修改人员')" name="updateBy"
|
| | | style="width: 250px;">
|
| | | <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '请选择')"
|
| | | style="width: 100%" show-search :options="userQueryList" optionFilterProp="label"
|
| | | optionLabelProp="label">
|
| | | </a-select>
|
| | | </a-form-item>
|
| | | <a-form-item :label="formatMessage('db.man_task.memo', '备注')" name="memo" style="width: 250px;">
|
| | | <a-input v-model:value="formData.memo" />
|
| | | </a-form-item>
|
| | |
|
| | | <a-form-item>
|
| | | <a-button type="primary" html-type="submit" ref="submitButton"
|
| | | style="visibility: hidden;">Submit</a-button>
|
| | | </a-form-item>
|
| | | </a-form>
|
| | | </a-modal>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <style></style>
|