| | |
| | | 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 currentPage = 1;
|
| | | let pageSize = 10;
|
| | | let allQty = 0;
|
| | | const searchInput = ref("")
|
| | | const orderBy = ref({});
|
| | | const searchParam = ref({
|
| | | locNo: null,
|
| | | matnr: null,
|
| | | orderNo: null,
|
| | | batch: null,
|
| | | tagId: null,
|
| | | orderType: null,
|
| | | })
|
| | | const editChild = ref(null)
|
| | |
|
| | | const state = reactive({
|
| | | selectedRowKeys: [],
|
| | | loading: false,
|
| | |
| | | let tableData = ref([]);
|
| | | getColumns();
|
| | | getPage();
|
| | |
|
| | | getTotalQty();
|
| | | const {
|
| | | getColumnSearchProps,
|
| | | handleResizeColumn,
|
| | |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys);
|
| | | state.selectedRowKeys = selectedRowKeys;
|
| | | };
|
| | |
|
| | |
|
| | | const handleTableChange = (pagination, filters, sorter) => {
|
| | | if (sorter != null) {
|
| | | if (sorter?.order == "ascend") {
|
| | | orderBy.__v_raw = { order: "asc", field: "createTime" }
|
| | | } else if (sorter?.order == "descend") {
|
| | | orderBy.__v_raw = { order: "desc", field: "createTime" }
|
| | | }
|
| | | }
|
| | |
|
| | | getPage()
|
| | | }
|
| | |
|
| | | state.columns = [
|
| | | // {
|
| | |
| | | dataIndex: 'dewell$',
|
| | | width: 140,
|
| | | ellipsis: true,
|
| | | sorter: true,
|
| | | ...getColumnSearchProps('dewell$'),
|
| | | },
|
| | | {
|
| | |
| | | ellipsis: true,
|
| | | ...getColumnSearchProps('anfme'),
|
| | | },
|
| | | // {
|
| | | // title: formatMessage('db.man_loc_detl.freeze', '是否冻结'),
|
| | | // dataIndex: 'freeze$',
|
| | | // width: 140,
|
| | | // ellipsis: true,
|
| | | // ...getColumnSearchProps('freeze$'),
|
| | | // },
|
| | | {
|
| | | title: formatMessage('db.man_loc_detl.freeze', '是否冻结'),
|
| | | dataIndex: 'freeze$',
|
| | | width: 140,
|
| | | ellipsis: true,
|
| | | ...getColumnSearchProps('freeze$'),
|
| | | },
|
| | | {
|
| | | title: formatMessage('db.man_loc_detl.status', '状态'),
|
| | | dataIndex: 'status$',
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | function getTotalQty() {
|
| | | state.loading = true;
|
| | | post('/api/locDetl/all/Qty').then((resp) => {
|
| | | let result = resp.data;
|
| | | if (result.code == 200) {
|
| | | let {data} = result;
|
| | | console.log("------------=======>");
|
| | | allQty = data?.allQty;
|
| | | state.loading = false;
|
| | | } else if (result.code === 401) {
|
| | | message.error(result.msg);
|
| | | logout()
|
| | | } else {
|
| | | message.error(result.msg);
|
| | | }
|
| | | })
|
| | | }
|
| | |
|
| | |
|
| | | function getPage() {
|
| | | state.loading = true;
|
| | | post('/api/locDetl/page', {
|
| | | orderBy: orderBy.__v_raw,
|
| | | current: currentPage,
|
| | | pageSize: pageSize,
|
| | | condition: searchInput.value,
|
| | |
| | | if (result.code == 200) {
|
| | | let data = result.data;
|
| | | tableData.value = data;
|
| | |
|
| | | state.loading = false;
|
| | | } else if (result.code === 401) {
|
| | | message.error(result.msg);
|
| | |
| | | post('/api/out/locs/stock', params).then(resp => {
|
| | | let result = resp.data;
|
| | | if (result.code === 200) {
|
| | | console.log(result);
|
| | | message.success(result.msg);
|
| | | } else {
|
| | | message.error(result.msg);
|
| | |
| | | };
|
| | |
|
| | | const onSearch = () => {
|
| | | // console.log('search');
|
| | | currentPage = 1;
|
| | | getPage()
|
| | | }
|
| | |
|
| | |
| | | getPage()
|
| | | }
|
| | |
|
| | | const total = computed(() => tableData.value?.records?.reduce((sum, item) => sum + item.anfme, 0))
|
| | |
|
| | | </script>
|
| | |
|
| | | <script>
|
| | | export default {
|
| | | name: '库存明细'
|
| | | name: '库存明细',
|
| | | }
|
| | |
|
| | | </script>
|
| | |
|
| | | <template>
|
| | |
| | | style="width: 140px;margin-right: 10px;" />
|
| | | <a-input v-model:value="searchParam.batch" :placeholder="formatMessage('page.locDetl.batch.input', '请输入批号')"
|
| | | style="width: 140px;margin-right: 10px;" />
|
| | | <a-select v-model:value="searchParam.orderType"
|
| | | :placeholder="formatMessage('page.locDetl.orderNo.input', '仓库类型')" :options="[
|
| | | { label: '全部', value: null }, { label: '立库', value: 1 }, { label: '平库', value: 2 }]"
|
| | | style="width: 140px;margin-right: 10px;">
|
| | | </a-select>
|
| | | <a-select v-model:value="searchParam.tagId" :placeholder="formatMessage('page.locDetl.orderNo.input', '请选择品类')"
|
| | | :options="[
|
| | | { label: '默认分类', value: 10 }, { label: '机油', value: 11 }, { label: '变速箱油', value: 17 }, { label: '火花塞', value: 18 },
|
| | |
| | | </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 }"
|
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" @change="handleTableChange"
|
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" @resizeColumn="handleResizeColumn"
|
| | | :loading="state.loading">
|
| | | <template #bodyCell="{ column, text, record }">
|
| | |
| | | </div>
|
| | | </template>
|
| | | </template>
|
| | | <template #footer>
|
| | | <div style="display: 'flex';">
|
| | | <span>总库存:{{ allQty }} </span>
|
| | | <span>, 当前页总量:{{ total }}</span>
|
| | | </div>
|
| | | </template>
|
| | | </a-table>
|
| | | </div>
|
| | | </template>
|