#
Junjie
2024-07-12 504b712bc9dac49aad4276df285968a47fdd3962
zy-asrs-admin/src/views/loc/locDetl/index.vue
@@ -17,106 +17,13 @@
const editChild = ref(null)
let tableData = ref([]);
getColumns();
getPage();
const columns = [
        {
            title: formatMessage('db.man_loc_detl.loc_id', '库位'),
            dataIndex: 'locId$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.loc_no', '库位号'),
            dataIndex: 'locNo',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.mat_id', '物料'),
            dataIndex: 'matId$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.matnr', '物料号'),
            dataIndex: 'matnr',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.order_no', '订单号'),
            dataIndex: 'orderNo',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.batch', '批号'),
            dataIndex: 'batch',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.anfme', '数量'),
            dataIndex: 'anfme',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.extend', '扩展'),
            dataIndex: 'extend',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.status', '状态'),
            dataIndex: 'status$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.create_time', '添加时间'),
            dataIndex: 'createTime$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.create_by', '添加人员'),
            dataIndex: 'createBy$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.update_time', '修改时间'),
            dataIndex: 'updateTime$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.update_by', '修改人员'),
            dataIndex: 'updateBy$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.man_loc_detl.memo', '备注'),
            dataIndex: 'memo',
            width: 140,
            ellipsis: true,
        },
  {
    title: formatMessage('common.operation', '操作'),
    name: 'oper',
    dataIndex: 'oper',
    key: 'oper',
    width: 140,
  },
];
const state = reactive({
  selectedRowKeys: [],
  loading: false,
  columns: [],
});
const hasSelected = computed(() => state.selectedRowKeys.length > 0);
const start = () => {
@@ -131,6 +38,124 @@
  // console.log('selectedRowKeys changed: ', selectedRowKeys);
  state.selectedRowKeys = selectedRowKeys;
};
state.columns = [
  {
    title: formatMessage('db.man_loc_detl.loc_id', '库位'),
    dataIndex: 'locId$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.loc_no', '库位号'),
    dataIndex: 'locNo',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.mat_id', '物料'),
    dataIndex: 'matId$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.matnr', '物料号'),
    dataIndex: 'matnr',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.order_no', '订单号'),
    dataIndex: 'orderNo',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.batch', '批号'),
    dataIndex: 'batch',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.anfme', '数量'),
    dataIndex: 'anfme',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.status', '状态'),
    dataIndex: 'status$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.create_time', '添加时间'),
    dataIndex: 'createTime$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.create_by', '添加人员'),
    dataIndex: 'createBy$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.update_time', '修改时间'),
    dataIndex: 'updateTime$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.update_by', '修改人员'),
    dataIndex: 'updateBy$',
    width: 140,
    ellipsis: true,
  },
  {
    title: formatMessage('db.man_loc_detl.memo', '备注'),
    dataIndex: 'memo',
    width: 140,
    ellipsis: true,
  },
];
//加载扩展字段
async function getColumns() {
  let fieldResp = await post('/api/matField/list', {
    unique: 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,
      })
    })
    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);
  }
}
function getPage() {
  post('/api/locDetl/page', {
@@ -227,7 +252,7 @@
    <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">
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'oper'">
          <div style="display: flex;justify-content: space-evenly;">