| New file | 
|  |  |  | 
|---|
|  |  |  | <script setup> | 
|---|
|  |  |  | import { getCurrentInstance, ref, watch, reactive } from 'vue'; | 
|---|
|  |  |  | import { useRouter } from "vue-router"; | 
|---|
|  |  |  | import { get, post, postForm } from '@/utils/request.js' | 
|---|
|  |  |  | import { message, Modal } from 'ant-design-vue'; | 
|---|
|  |  |  | import { logout } from '@/config.js'; | 
|---|
|  |  |  | import { formatMessage } from '@/utils/localeUtils.js'; | 
|---|
|  |  |  | import useTableSearch from '@/utils/tableUtils.jsx'; | 
|---|
|  |  |  | const context = getCurrentInstance()?.appContext.config.globalProperties; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const router = useRouter(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const TABLE_KEY = 'table-locDetl'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let tableData = ref([]); | 
|---|
|  |  |  | let open = ref(false); | 
|---|
|  |  |  | const locId = ref(null); | 
|---|
|  |  |  | const showWidth = ref("60%") | 
|---|
|  |  |  | getColumns(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | getColumnSearchProps, | 
|---|
|  |  |  | } = useTableSearch(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const state = reactive({ | 
|---|
|  |  |  | selectedRowKeys: [], | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | columns: [], | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | state.columns = [ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.loc_no', '库位号'), | 
|---|
|  |  |  | dataIndex: 'locNo', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('locNo'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.mat_id', '物料'), | 
|---|
|  |  |  | dataIndex: 'matId$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('matId$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.matnr', '物料号'), | 
|---|
|  |  |  | dataIndex: 'matnr', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('matnr'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.order_no', '订单号'), | 
|---|
|  |  |  | dataIndex: 'orderNo', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('orderNo'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.batch', '批号'), | 
|---|
|  |  |  | dataIndex: 'batch', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('batch'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.anfme', '数量'), | 
|---|
|  |  |  | dataIndex: 'anfme', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('anfme'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.status', '状态'), | 
|---|
|  |  |  | dataIndex: 'status$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('status$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   title: formatMessage('db.man_loc_detl.create_time', '添加时间'), | 
|---|
|  |  |  | //   dataIndex: 'createTime$', | 
|---|
|  |  |  | //   width: 140, | 
|---|
|  |  |  | //   ellipsis: true, | 
|---|
|  |  |  | //   ...getColumnSearchProps('createTime$'), | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   title: formatMessage('db.man_loc_detl.create_by', '添加人员'), | 
|---|
|  |  |  | //   dataIndex: 'createBy$', | 
|---|
|  |  |  | //   width: 140, | 
|---|
|  |  |  | //   ellipsis: true, | 
|---|
|  |  |  | //   ...getColumnSearchProps('createBy$'), | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.update_time', '修改时间'), | 
|---|
|  |  |  | dataIndex: 'updateTime$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('updateTime$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.update_by', '修改人员'), | 
|---|
|  |  |  | dataIndex: 'updateBy$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('updateBy$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc_detl.memo', '备注'), | 
|---|
|  |  |  | dataIndex: 'memo', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('memo'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const fieldList = []; | 
|---|
|  |  |  | //加载扩展字段 | 
|---|
|  |  |  | async function getColumns() { | 
|---|
|  |  |  | let fieldResp = await post('/api/matField/list', { | 
|---|
|  |  |  | fieldType: 1 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | let fieldResult = fieldResp.data; | 
|---|
|  |  |  | let tmp = state.columns; | 
|---|
|  |  |  | if (fieldResult.code == 200) { | 
|---|
|  |  |  | let data = fieldResult.data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.forEach((item) => { | 
|---|
|  |  |  | tmp.push({ | 
|---|
|  |  |  | title: formatMessage(item.language, item.describe), | 
|---|
|  |  |  | name: item.name, | 
|---|
|  |  |  | dataIndex: item.name, | 
|---|
|  |  |  | key: item.name, | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | editable: true, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | fieldList.push(item.name); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // tmp.push({ | 
|---|
|  |  |  | //     title: formatMessage('common.operation', '操作'), | 
|---|
|  |  |  | //     name: 'oper', | 
|---|
|  |  |  | //     dataIndex: 'oper', | 
|---|
|  |  |  | //     key: 'oper', | 
|---|
|  |  |  | //     width: 140, | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | state.columns = tmp; | 
|---|
|  |  |  | } else if (result.code === 401) { | 
|---|
|  |  |  | message.error(result.msg); | 
|---|
|  |  |  | logout() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | message.error(result.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleOk = () => { | 
|---|
|  |  |  | openDetl.value = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleCancel = () => { | 
|---|
|  |  |  | openDetl.value = false; | 
|---|
|  |  |  | orderId.value = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | watch(locId, (newVal, oldVal) => { | 
|---|
|  |  |  | if (newVal != null) { | 
|---|
|  |  |  | get("/api/locDetl/locId/" + newVal, {}).then((resp) => { | 
|---|
|  |  |  | let result = resp.data; | 
|---|
|  |  |  | tableData.value = result.data; | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineExpose({ | 
|---|
|  |  |  | tableData, | 
|---|
|  |  |  | locId, | 
|---|
|  |  |  | open, | 
|---|
|  |  |  | showWidth, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'showLocDetlComponent' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | <a-modal v-model:open="open" :width="showWidth" @ok="handleOk" @cancel="handleCancel"> | 
|---|
|  |  |  | <a-table :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" | 
|---|
|  |  |  | :scroll="{ y: 768 }" :columns="state.columns"> | 
|---|
|  |  |  | <template #bodyCell="{ column, text, record }"> | 
|---|
|  |  |  | <template v-if="column.dataIndex === 'workQty'"> | 
|---|
|  |  |  | <a-button type="link" @click="openWorkTask(record)">{{ text }}</a-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <template v-if="column.dataIndex === 'qty'"> | 
|---|
|  |  |  | <a-button type="link" @click="openCompleteQty(record)">{{ text }}</a-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <template v-if="column.dataIndex === 'waitQty'"> | 
|---|
|  |  |  | <a-button type="link" @click="openWaitQty(record)">{{ text }}</a-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </a-table> | 
|---|
|  |  |  | </a-modal> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style></style> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <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/loc/save' : '/api/loc/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 LocStsQueryList = ref(null); | 
|---|
|  |  |  | LocStsQuery(); | 
|---|
|  |  |  | function LocStsQuery() { | 
|---|
|  |  |  | postForm('/api/locSts/query', {}).then(resp => { | 
|---|
|  |  |  | let result = resp.data; | 
|---|
|  |  |  | LocStsQueryList.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_loc.loc_no', '库位号') " | 
|---|
|  |  |  | name="locNo" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | :rules="[{ required: true }]" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.locNo" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.loc_sts_id', '库位状态') " | 
|---|
|  |  |  | name="locStsId" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-select | 
|---|
|  |  |  | v-model:value="formData.locStsId" | 
|---|
|  |  |  | :placeholder="formatMessage('common.select', '请选择')" | 
|---|
|  |  |  | style="width: 100%" | 
|---|
|  |  |  | show-search | 
|---|
|  |  |  | :options="LocStsQueryList" | 
|---|
|  |  |  | optionFilterProp="label" | 
|---|
|  |  |  | optionLabelProp="label" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </a-select> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.row1', '排') " | 
|---|
|  |  |  | name="row1" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.row1" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.bay1', '列') " | 
|---|
|  |  |  | name="bay1" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.bay1" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.lev1', '层') " | 
|---|
|  |  |  | name="lev1" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.lev1" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.barcode', '条码') " | 
|---|
|  |  |  | name="barcode" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.barcode" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.uuid', '编号') " | 
|---|
|  |  |  | name="uuid" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.uuid" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.flag', '标识') " | 
|---|
|  |  |  | name="flag" | 
|---|
|  |  |  | style="width: 250px;" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <a-input | 
|---|
|  |  |  | v-model:value="formData.flag" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </a-form-item> | 
|---|
|  |  |  | <a-form-item | 
|---|
|  |  |  | :label="formatMessage('db.man_loc.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_loc.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_loc.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_loc.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_loc.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_loc.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> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <script setup> | 
|---|
|  |  |  | import { getCurrentInstance, ref, computed, reactive } from 'vue'; | 
|---|
|  |  |  | import { useRouter } from "vue-router"; | 
|---|
|  |  |  | import { get, post, postBlob } from '@/utils/request.js' | 
|---|
|  |  |  | import { message, Modal } from 'ant-design-vue'; | 
|---|
|  |  |  | import { logout } from '@/config.js'; | 
|---|
|  |  |  | import EditView from './edit.vue' | 
|---|
|  |  |  | import { formatMessage } from '@/utils/localeUtils.js'; | 
|---|
|  |  |  | import useTableSearch from '@/utils/tableUtils.jsx'; | 
|---|
|  |  |  | import LocDetlShowView from '@/components/locDetl/show.vue'; | 
|---|
|  |  |  | const context = getCurrentInstance()?.appContext.config.globalProperties; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const router = useRouter(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const TABLE_KEY = 'table-loc'; | 
|---|
|  |  |  | let currentPage = 1; | 
|---|
|  |  |  | let pageSize = 10; | 
|---|
|  |  |  | const searchInput = ref("") | 
|---|
|  |  |  | const editChild = ref(null) | 
|---|
|  |  |  | const locDetlShowChild = ref(null) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let tableData = ref([]); | 
|---|
|  |  |  | getPage(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | getColumnSearchProps, | 
|---|
|  |  |  | handleResizeColumn, | 
|---|
|  |  |  | } = useTableSearch(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const columns = [ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.loc_no', '库位号'), | 
|---|
|  |  |  | dataIndex: 'locNo', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('locNo'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.loc_sts_id', '库位状态'), | 
|---|
|  |  |  | dataIndex: 'locStsId$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('locStsId$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.row1', '排'), | 
|---|
|  |  |  | dataIndex: 'row1', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('row1'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.bay1', '列'), | 
|---|
|  |  |  | dataIndex: 'bay1', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('bay1'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.lev1', '层'), | 
|---|
|  |  |  | dataIndex: 'lev1', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('lev1'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.barcode', '条码'), | 
|---|
|  |  |  | dataIndex: 'barcode', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('barcode'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.uuid', '编号'), | 
|---|
|  |  |  | dataIndex: 'uuid', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('uuid'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.flag', '标识'), | 
|---|
|  |  |  | dataIndex: 'flag', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('flag'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.status', '状态'), | 
|---|
|  |  |  | dataIndex: 'status$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('status$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.create_time', '添加时间'), | 
|---|
|  |  |  | dataIndex: 'createTime$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('createTime$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.create_by', '添加人员'), | 
|---|
|  |  |  | dataIndex: 'createBy$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('createBy$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.update_time', '修改时间'), | 
|---|
|  |  |  | dataIndex: 'updateTime$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('updateTime$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.update_by', '修改人员'), | 
|---|
|  |  |  | dataIndex: 'updateBy$', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('updateBy$'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('db.man_loc.memo', '备注'), | 
|---|
|  |  |  | dataIndex: 'memo', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | ellipsis: true, | 
|---|
|  |  |  | ...getColumnSearchProps('memo'), | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | title: formatMessage('common.operation', '操作'), | 
|---|
|  |  |  | name: 'oper', | 
|---|
|  |  |  | dataIndex: 'oper', | 
|---|
|  |  |  | key: 'oper', | 
|---|
|  |  |  | width: 140, | 
|---|
|  |  |  | fixed: 'right', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const state = reactive({ | 
|---|
|  |  |  | selectedRowKeys: [], | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const hasSelected = computed(() => state.selectedRowKeys.length > 0); | 
|---|
|  |  |  | const start = () => { | 
|---|
|  |  |  | state.loading = true; | 
|---|
|  |  |  | // ajax request after empty completing | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | state.loading = false; | 
|---|
|  |  |  | state.selectedRowKeys = []; | 
|---|
|  |  |  | }, 1000); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | const onSelectChange = selectedRowKeys => { | 
|---|
|  |  |  | // console.log('selectedRowKeys changed: ', selectedRowKeys); | 
|---|
|  |  |  | state.selectedRowKeys = selectedRowKeys; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getPage() { | 
|---|
|  |  |  | post('/api/loc/page', { | 
|---|
|  |  |  | current: currentPage, | 
|---|
|  |  |  | pageSize: pageSize, | 
|---|
|  |  |  | condition: searchInput.value | 
|---|
|  |  |  | }).then((resp) => { | 
|---|
|  |  |  | let result = resp.data; | 
|---|
|  |  |  | if (result.code == 200) { | 
|---|
|  |  |  | let data = result.data; | 
|---|
|  |  |  | tableData.value = data; | 
|---|
|  |  |  | } else if (result.code === 401) { | 
|---|
|  |  |  | message.error(result.msg); | 
|---|
|  |  |  | logout() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | message.error(result.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleEdit = (item) => { | 
|---|
|  |  |  | editChild.value.open = true; | 
|---|
|  |  |  | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); | 
|---|
|  |  |  | editChild.value.isSave = item == null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleDel = (rows) => { | 
|---|
|  |  |  | Modal.confirm({ | 
|---|
|  |  |  | title: formatMessage('page.delete', '删除'), | 
|---|
|  |  |  | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), | 
|---|
|  |  |  | maskClosable: true, | 
|---|
|  |  |  | onOk: async () => { | 
|---|
|  |  |  | const hide = message.loading(formatMessage('common.loading', '请求中')); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | post('/api/loc/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { | 
|---|
|  |  |  | let result = resp.data; | 
|---|
|  |  |  | if (result.code === 200) { | 
|---|
|  |  |  | message.success(result.msg); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | message.error(result.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | getPage() | 
|---|
|  |  |  | hide() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | message.error(formatMessage('common.fail', '请求失败')); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleExport = async (intl) => { | 
|---|
|  |  |  | postBlob('/api/loc/export', {}).then(result => { | 
|---|
|  |  |  | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); | 
|---|
|  |  |  | window.location.href = window.URL.createObjectURL(blob); | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const onSearch = () => { | 
|---|
|  |  |  | // console.log('search'); | 
|---|
|  |  |  | getPage() | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const onPageChange = (page, size) => { | 
|---|
|  |  |  | currentPage = page; | 
|---|
|  |  |  | pageSize = size; | 
|---|
|  |  |  | getPage(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleTableReload(value) { | 
|---|
|  |  |  | getPage() | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const showDetl = (record) => { | 
|---|
|  |  |  | console.log(record); | 
|---|
|  |  |  | locDetlShowChild.value.open = true; | 
|---|
|  |  |  | locDetlShowChild.value.locId = record.id; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: '库位查询' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | <EditView ref="editChild" @tableReload="handleTableReload" /> | 
|---|
|  |  |  | <div class="table-header"> | 
|---|
|  |  |  | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" | 
|---|
|  |  |  | style="width: 200px;" @search="onSearch" /> | 
|---|
|  |  |  | <div class="table-header-right"> | 
|---|
|  |  |  | <!-- <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> --> | 
|---|
|  |  |  | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" | 
|---|
|  |  |  | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" | 
|---|
|  |  |  | :pagination="{ total: tableData.total, onChange: onPageChange }" | 
|---|
|  |  |  | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn"> | 
|---|
|  |  |  | <template #bodyCell="{ column, text, record }"> | 
|---|
|  |  |  | <template v-if="column.dataIndex === 'oper'"> | 
|---|
|  |  |  | <div style="display: flex;justify-content: space-evenly;"> | 
|---|
|  |  |  | <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.loc.locDetl', '库存明细') }}</a-button> | 
|---|
|  |  |  | <!-- <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> | 
|---|
|  |  |  | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') | 
|---|
|  |  |  | }}</a-button> --> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </a-table> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <LocDetlShowView ref="locDetlShowChild" /> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style></style> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
|---|
|  |  |  | @GetMapping("/locDetl/locId/{locId}") | 
|---|
|  |  |  | public R list(@PathVariable("locId") Long locId) { | 
|---|
|  |  |  | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId)); | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.parseLocDetl(list); | 
|---|
|  |  |  | return R.ok().add(locDetls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
|---|
|  |  |  | @GetMapping("/locDetl/{id}") | 
|---|
|  |  |  | public R get(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return R.ok().add(locDetlService.getById(id)); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> getLocDetlList(Map<String, Object> map); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> parseLocDetl(List<LocDetl> list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.mapper.LocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.LocDetlFieldService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.LocDetlService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ViewLocDetlMapper viewLocDetlMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlFieldService locDetlFieldService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageParam<ViewLocDetl, BaseParam> getPage(PageParam<ViewLocDetl, BaseParam> pageParam, QueryWrapper<ViewLocDetl> buildWrapper) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return locDetls; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocDetl> parseLocDetl(List<LocDetl> list) { | 
|---|
|  |  |  | for (LocDetl locDetl : list) { | 
|---|
|  |  |  | List<LocDetlField> locDetlFieldList = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId())); | 
|---|
|  |  |  | locDetl.syncField(locDetlFieldList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|