| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- <template>
- <div>
- <!-- 数据表格 -->
- <item-search @search="reload" ref="refSeavch" @handledime="handledime">
- </item-search>
- <ele-pro-table
- ref="table"
- :initLoad="false"
- :columns="columns"
- :datasource="datasource"
- height="calc(100vh - 355px)"
- full-height="calc(100vh - 116px)"
- tool-class="ele-toolbar-form"
- cache-key="systemOrgUserTable"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar> </template>
- <!-- 批次号 -->
- <template v-slot:batchNo="{ row }">
- <el-popover placement="right-start" width="800" trigger="hover">
- <el-table :data="row.outInBatchDetailsVOList">
- <el-table-column
- width="150"
- property="bizNo"
- label="入库单号"
- ></el-table-column>
- <el-table-column
- width="100"
- property="bizType"
- label="入库场景"
- ></el-table-column>
- <el-table-column
- width="120"
- property="count"
- label="入库数量"
- ></el-table-column>
- <el-table-column
- width="80"
- property="measuringUnit"
- label="计量单位"
- ></el-table-column>
- <el-table-column
- width="100"
- property="packageCount"
- label="包装数量"
- ></el-table-column>
- <el-table-column
- width="80"
- property="packingUnit"
- label="包装单位"
- ></el-table-column>
- <el-table-column
- width="330"
- property="position"
- label="库位"
- ></el-table-column>
- <el-table-column
- width="160"
- property="createTime"
- label="入库时间"
- ></el-table-column>
- </el-table>
- <span slot="reference"> {{ row.batchNo }}</span>
- </el-popover>
- </template>
- <!-- 库存保质期 -->
- <template v-slot:expirationDate="{ row }">
- <span v-if="row.expirationDate">
- {{ row.expirationDate ? row.expirationDate : '-' }}
- {{
- row.expirationDateUnit == 'year'
- ? '年'
- : row.expirationDateUnit == 'month'
- ? '月'
- : '日'
- }}
- </span>
- </template>
- <!-- 质检状态 -->
- <template v-slot:qualityStatus="{ row }">
- <span v-if="row.qualityStatus == 1 || row.qualityStatus == 0"
- >已检</span
- >
- <span v-else-if="row.qualityStatus == 0">未检</span>
- <span v-else>-</span>
- </template>
- <!-- 质检结果 -->
- <template v-slot:qualityResult="{ row }">
- <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
- >合格</span
- >
- <span v-else-if="row.qualityResult == 1">不合格</span>
- <span v-else-if="row.qualityResult == 3">让步接收</span>
- <span v-else>-</span>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="details(row)"
- >
- 详情
- </el-link>
- </template>
- </ele-pro-table>
- </div>
- </template>
- <script>
- import ItemSearch from './item-search.vue';
- // import {
- // getUserPage,
- // removePersonnel,
- // unbindLoginName
- // } from '@/api/system/organization';
- import {
- pageeLedgerMain,
- removeItem,
- getWarehouseList
- } from '@/api/classifyManage/itemInformation';
- import ouint from '@/api/warehouseManagement/outin';
- import { getBatchDetails } from '@/api/classifyManage/index';
- export default {
- components: { ItemSearch },
- props: {
- // 机构id
- organizationId: [Number, String],
- // 全部机构
- organizationList: Array,
- current: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- searchForm: {
- dimension: 1
- },
- isShow: false,
- isPack: false,
- isMeta: false,
- selectedDime: 1
- };
- },
- computed: {
- // 表格列配置
- columns() {
- let obj = [
- {
- columnKey: 'index',
- type: 'index',
- width: 50,
- align: 'center',
- label: '序号',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '编码',
- showOverflowTooltip: true
- },
- {
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNum',
- label: '牌号',
- showOverflowTooltip: true
- },
- {
- prop: 'modelType',
- label: '型号',
- showOverflowTooltip: true
- },
- {
- prop: 'packingCountBase',
- label: '包装库存数量',
- sortable: 'custom',
- showOverflowTooltip: true,
- width: 130,
- align: 'center'
- },
- {
- prop: 'minUnit',
- label: '包装单位',
- showOverflowTooltip: true
- },
- {
- prop: 'availableCountBase',
- label: '计量库存数量',
- sortable: 'custom',
- showOverflowTooltip: true,
- width: 130,
- align: 'center'
- },
- {
- prop: 'measuringUnit',
- label: '计量单位',
- align: 'center'
- },
- {
- prop: 'expirationDate',
- slot: 'expirationDate',
- label: '库存保质期',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'expirationTime',
- label: '周期倒计时',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'qualityResult',
- slot: 'qualityResult',
- label: '质检结果',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'qualityStatus',
- slot: 'qualityStatus',
- label: '质检状态',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'paths',
- width: 230,
- label: '仓库',
- showOverflowTooltip: true
- },
- // {
- // prop: '',
- // label: '安全库存',
- // showOverflowTooltip: true
- // },
- // {
- // prop: '',
- // label: '质保期',
- // showOverflowTooltip: true
- // },
- {
- columnKey: 'action',
- label: '操作',
- width: 100,
- align: 'left',
- resizable: false,
- slot: 'action'
- }
- ];
- if (this.isShow) {
- obj.splice(1, 0, {
- slot: 'batchNo',
- prop: 'batchNo',
- label: '批次号',
- showOverflowTooltip: true
- });
- let index = obj.findIndex((item) => item.label == '仓库');
- if (index !== -1) {
- obj.splice(index, 1);
- }
- }
- if (this.isPack) {
- obj.splice(1, 0, {
- slot: 'batchNum',
- prop: 'batchNum',
- label: '批次号',
- showOverflowTooltip: true
- });
- // 寻找现有的 'code' 对象的索引
- let codeIndex = obj.findIndex((item) => item.prop === 'code');
- if (codeIndex !== -1) {
- // 删除现有的 'code' 对象
- obj.splice(codeIndex, 1, {
- prop: 'packagingCode',
- label: '包装编码',
- showOverflowTooltip: true
- });
- }
- }
- if (this.isMeta) {
- obj.splice(1, 0, {
- slot: 'batchNum',
- prop: 'batchNum',
- label: '批次号',
- showOverflowTooltip: true
- });
- obj.splice(10, 0, {
- prop: 'weight',
- label: '重量',
- showOverflowTooltip: true
- });
- obj.splice(11, 0, {
- prop: 'weightUnit',
- label: '重量单位',
- showOverflowTooltip: true
- });
- obj.splice(6, 0, {
- prop: 'meterielCode',
- label: '物料代号',
- showOverflowTooltip: true
- });
- obj.splice(7, 0, {
- prop: 'engrave',
- label: '刻码',
- showOverflowTooltip: true
- });
- // 寻找现有的 'code' 对象的索引
- let codeIndex = obj.findIndex((item) => item.prop === 'code');
- if (codeIndex !== -1) {
- // 删除现有的 'code' 对象
- obj.splice(codeIndex, 1, {
- prop: 'materialCode',
- label: '物料编码',
- showOverflowTooltip: true
- });
- }
- }
- return obj;
- }
- },
- methods: {
- handledime(val) {
- this.$set(this, 'isShow', val == 2);
- this.$set(this, 'isPack', val == 3);
- this.$set(this, 'isMeta', val == 4);
- // this.reload({
- // ...this.$refs.refSeavch.params,
- // dimension: this.$refs.refSeavch.dimension
- // });
- // if (val == 2) {
- // // this.handleBatchDimension(val);
- // this.reload();
- // } else if (val == 3) {
- // this.handleInventoryDimension(val);
- // }else{}
- this.reload();
- this.selectedDime = val;
- },
- //批次维度
- async handleBatchDimension(event) {
- // const treeId = this.$parent.$parent.$parent.current.id;
- // const params = {
- // page: 1,
- // size: 10,
- // categoryLevelId: treeId
- // };
- // const res = await getBatchDetails(params);
- // console.log(res);
- // 待完善
- },
- //库存维度
- async handleInventoryDimension(val) {
- // const treeId = this.$parent.$parent.$parent.current.id;
- // const rep = await ouint.getInventoryDetails({
- // pageNum: 1,
- // size: 10,
- // categoryLevelId: treeId
- // });
- // console.log(rep);
- //待完善
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- const dimension = this.$refs.refSeavch.dimension;
- const treeId = this.$parent.$parent.$parent.current.id;
- if (this.selectedDime == 1) {
- const data = ouint.getRealTimeInventory({
- ...where,
- ...order,
- pageNum: page,
- size: limit,
- dimension: dimension
- });
- const result = data.then((res) => {
- let item = res.list.map((item) => {
- return {
- ...item,
- paths: item.pathName.split(',')[0],
- qualityResult:
- typeof item.qualityResult != 'number'
- ? 3
- : item.qualityResult,
- qualityStatus:
- typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
- };
- });
- return { ...res, list: item };
- });
- return result;
- } else if (this.selectedDime == 2) {
- const params = {
- categoryLevelId: treeId,
- ...where,
- ...order,
- dimension: dimension
- };
- const data = getBatchDetails({
- ...params,
- pageNum: page,
- size: limit
- });
- const result = data.then((res) => {
- let item = res.list.map((item) => {
- return {
- ...item,
- minUnit: item.packingUnit,
- qualityResult:
- typeof item.qualityResult != 'number'
- ? 3
- : item.qualityResult,
- qualityStatus:
- typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
- };
- });
- return { ...res, list: item };
- });
- return result;
- } else if (this.selectedDime == 4) {
- const params = {
- categoryLevelId: treeId,
- ...where,
- ...order,
- dimension: dimension
- };
- const data = ouint.getMaterielDetails({
- ...params,
- pageNum: page,
- size: limit
- });
- const result = data.then((res) => {
- const data = res.list.map((item) => {
- return {
- ...item,
- minUnit: item.packingUnit,
- paths: item.pathName,
- availableCountBase: 1,
- packingCountBase: 1,
- materialCode: item.code,
- batchNum: item.batchNo,
- qualityResult:
- typeof item.qualityResult != 'number'
- ? 3
- : item.qualityResult,
- qualityStatus:
- typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
- };
- });
- console.log(data);
- return { ...res, list: data };
- });
- console.log(result);
- return result;
- } else {
- const params = {
- categoryLevelId: treeId,
- ...where,
- ...order,
- dimension: dimension
- };
- const data = ouint.getInventoryDetails({
- ...params,
- pageNum: page,
- size: limit
- });
- const result = data.then((res) => {
- const data = res.list.map((item) => {
- return {
- ...item,
- minUnit: item.packingUnit,
- paths: item.pathName.split(',')[0],
- // availableCountBase: 1,
- packingCountBase: 1,
- packagingCode: item.code,
- qualityResult:
- typeof item.qualityResult != 'number'
- ? 3
- : item.qualityResult,
- qualityStatus:
- typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
- };
- });
- return { ...res, list: data };
- });
- return result;
- }
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- this.$refs.table.reload({
- pageNum: 1,
- where: {
- ...where,
- categoryLevelId: this.current?.data?.id || this.current?.id
- }
- });
- });
- },
- details(row) {
- const key = Date.now();
- this.$store.commit('stockManagement/CLEAR_BASEINFO');
- this.$store.commit('stockManagement/CHANGE_BASEINFO', {
- key,
- value: row
- });
- const url =
- this.$refs.refSeavch.dimension == 1
- ? '/warehouseManagement/stockLedger/allBatchDetails'
- : '/warehouseManagement/stockLedger/batchDetails';
- this.$router.push({
- path: url,
- query: {
- key,
- dimension: this.$refs.refSeavch.dimension,
- id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
- assetId: row.assetId,
- batchNo: row.batchNo
- }
- });
- }
- },
- watch: {
- // 监听机构id变化
- current: {
- handler() {
- this.reload();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|