|
@@ -1,15 +1,20 @@
|
|
|
<template>
|
|
|
- <div class="pageIndexClass">
|
|
|
+ <div class="user">
|
|
|
+ <div class="tree">
|
|
|
+ <TreeList title="分类" submitType="2" :hiddenBtn="true" :data="treeListData" v-model="sourceList.pagination.productClassifyId"
|
|
|
+ @change="treeChange">
|
|
|
+ </TreeList>
|
|
|
+ </div>
|
|
|
<div class="content">
|
|
|
<byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
|
|
|
highlight-current-row :action-list="[
|
|
|
- selectStatus
|
|
|
+ ]" @get-list="getList">
|
|
|
+ <!-- selectStatus
|
|
|
? {}
|
|
|
: {
|
|
|
text: '导出Excel',
|
|
|
action: () => deriveExcel(),
|
|
|
- },
|
|
|
- ]" @get-list="getList">
|
|
|
+ }, -->
|
|
|
<template #btn="{ item }">
|
|
|
<div style="width: 100%; text-align: center">
|
|
|
<el-button type="primary" @click="checkTheFlow(item)" v-if="!selectStatus" text>查看流水</el-button>
|
|
@@ -20,7 +25,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</byTable>
|
|
|
- <div v-if="goodList && goodList.length > 0">
|
|
|
+ <!-- <div v-if="goodList && goodList.length > 0">
|
|
|
<div>已选择货品</div>
|
|
|
<div style="margin: 10px 0px">
|
|
|
<el-tag style="margin-right: 10px" type="info" closable v-for="(good, index) in goodList" :key="good.id"
|
|
@@ -32,7 +37,7 @@
|
|
|
确 定
|
|
|
</el-button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -41,12 +46,17 @@
|
|
|
import { computed, ref } from "vue";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
+import TreeList from "./treeList.vue";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const props = defineProps({
|
|
|
selectStatus: Boolean,
|
|
|
warehouseId: String,
|
|
|
+ rowId: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
});
|
|
|
const warehouseList = ref([]);
|
|
|
const sourceList = ref({
|
|
@@ -56,7 +66,9 @@ const sourceList = ref({
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
keyword: "",
|
|
|
- id: "",
|
|
|
+ companyId: "",
|
|
|
+ definition: "",
|
|
|
+ productClassifyId: "",
|
|
|
},
|
|
|
});
|
|
|
const productUnit = ref([]);
|
|
@@ -71,15 +83,19 @@ const definition = ref([
|
|
|
},
|
|
|
]);
|
|
|
const loading = ref(false);
|
|
|
+const companyData = ref([]);
|
|
|
const selectConfig = computed(() => {
|
|
|
- if (props.warehouseId) {
|
|
|
- return [];
|
|
|
- }
|
|
|
return [
|
|
|
{
|
|
|
- label: "仓库名称",
|
|
|
- prop: "id",
|
|
|
- data: warehouseList.value,
|
|
|
+ label: "归属公司",
|
|
|
+ prop: "companyId",
|
|
|
+ data: companyData.value,
|
|
|
+ isShowAll: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "物品类型",
|
|
|
+ prop: "definition",
|
|
|
+ data: definition.value,
|
|
|
},
|
|
|
];
|
|
|
});
|
|
@@ -88,18 +104,15 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "仓库名称",
|
|
|
- prop: "warehouseId",
|
|
|
- width: 220,
|
|
|
- },
|
|
|
- render(type) {
|
|
|
- return proxy.dictValueLabel(type, warehouseList.value);
|
|
|
+ prop: "warehouseName",
|
|
|
+ width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "物品类型",
|
|
|
prop: "productDefinition",
|
|
|
- width: 140,
|
|
|
+ width: 80,
|
|
|
},
|
|
|
render(type) {
|
|
|
return proxy.dictValueLabel(type, definition.value);
|
|
@@ -109,14 +122,14 @@ const config = computed(() => {
|
|
|
attrs: {
|
|
|
label: "所属分类",
|
|
|
prop: "productClassifyName",
|
|
|
- width: 140,
|
|
|
+ width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "物品编码",
|
|
|
- prop: "productCode",
|
|
|
- width: 160,
|
|
|
+ prop: "productCustomCode",
|
|
|
+ width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -133,16 +146,16 @@ const config = computed(() => {
|
|
|
width: 160,
|
|
|
},
|
|
|
},
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "单位",
|
|
|
- prop: "productUnit",
|
|
|
- width: 120,
|
|
|
- },
|
|
|
- render(unit) {
|
|
|
- return proxy.dictKeyValue(unit, productUnit.value);
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "单位",
|
|
|
+ // prop: "productUnit",
|
|
|
+ // width: 120,
|
|
|
+ // },
|
|
|
+ // render(unit) {
|
|
|
+ // return proxy.dictKeyValue(unit, productUnit.value);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "库存数量",
|
|
@@ -158,56 +171,104 @@ const config = computed(() => {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "操作",
|
|
|
- slot: "btn",
|
|
|
- width: 120,
|
|
|
- fixed: "right",
|
|
|
- align: "center",
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "操作",
|
|
|
+ // slot: "btn",
|
|
|
+ // width: 120,
|
|
|
+ // fixed: "right",
|
|
|
+ // align: "center",
|
|
|
+ // },
|
|
|
+ // },
|
|
|
];
|
|
|
});
|
|
|
+
|
|
|
+const treeListData = ref([]);
|
|
|
+
|
|
|
+const arrayRecursion = (arr, definition) => {
|
|
|
+ arr.forEach((item) => {
|
|
|
+ item.definition = definition;
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ arrayRecursion(item.children, definition);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return arr;
|
|
|
+};
|
|
|
const getDict = () => {
|
|
|
- proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
- if (res.rows && res.rows.length > 0) {
|
|
|
- warehouseList.value = res.rows.map((item) => {
|
|
|
- return {
|
|
|
- label: item.name,
|
|
|
- value: item.id,
|
|
|
- };
|
|
|
+ proxy
|
|
|
+ .get("/tenantDept/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ keyword: "",
|
|
|
+ tenantId: proxy.useUserStore().user.tenantId,
|
|
|
+ type: 0,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ companyData.value = res.data.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.deptName,
|
|
|
+ value: x.deptId,
|
|
|
+ }));
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ sourceList.value.pagination.companyId = companyData.value[0].value;
|
|
|
+ }
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+
|
|
|
+ Promise.all([
|
|
|
+ proxy.post("/productClassify/tree", {
|
|
|
+ parentId: "",
|
|
|
+ name: "",
|
|
|
+ definition: "1",
|
|
|
+ }),
|
|
|
+ proxy.post("/productClassify/tree", {
|
|
|
+ parentId: "",
|
|
|
+ name: "",
|
|
|
+ definition: "2",
|
|
|
+ }),
|
|
|
+ ]).then((res) => {
|
|
|
+ if (res && res.length > 1) {
|
|
|
+ res[1].forEach((x) => {
|
|
|
+ x.id = x.id + "";
|
|
|
});
|
|
|
+ treeListData.value = [
|
|
|
+ {
|
|
|
+ id: "-1",
|
|
|
+ label: "全部",
|
|
|
+ parentId: "",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: "1",
|
|
|
+ definition: "1",
|
|
|
+ label: "产品",
|
|
|
+ parentId: "-1",
|
|
|
+ children: arrayRecursion(res[0], "1"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "2",
|
|
|
+ definition: "2",
|
|
|
+ label: "物料",
|
|
|
+ parentId: "-1",
|
|
|
+ children: arrayRecursion(res[1], "2"),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
}
|
|
|
});
|
|
|
- proxy.getDict(["unit"]).then((res) => {
|
|
|
- productUnit.value = res["unit"];
|
|
|
- });
|
|
|
- // proxy
|
|
|
- // .post("/dictTenantData/page", {
|
|
|
- // pageNum: 1,
|
|
|
- // pageSize: 999,
|
|
|
- // dictCode: "product_type",
|
|
|
- // tenantId: useUserStore().user.tenantId,
|
|
|
- // })
|
|
|
- // .then((res) => {
|
|
|
- // if (res.rows && res.rows.length > 0) {
|
|
|
- // productType.value = res.rows.map((item) => {
|
|
|
- // return {
|
|
|
- // label: item.dictValue,
|
|
|
- // value: item.dictKey,
|
|
|
- // };
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
};
|
|
|
-const getList = async (req) => {
|
|
|
+
|
|
|
+const getList = (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
- if (props.warehouseId) {
|
|
|
- sourceList.value.pagination.id = props.warehouseId;
|
|
|
+ let url = "";
|
|
|
+ if (props.rowId) {
|
|
|
+ sourceList.value.pagination.snapshotId = props.rowId;
|
|
|
+ url = "/stockSnapshotDetails/page";
|
|
|
+ } else {
|
|
|
+ url = "/stock/page";
|
|
|
}
|
|
|
- proxy.post("/stock/page", sourceList.value.pagination).then((res) => {
|
|
|
+ proxy.post(url, sourceList.value.pagination).then((res) => {
|
|
|
sourceList.value.data = res.rows;
|
|
|
sourceList.value.pagination.total = res.total;
|
|
|
setTimeout(() => {
|
|
@@ -215,8 +276,29 @@ const getList = async (req) => {
|
|
|
}, 200);
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const treeChange = (e) => {
|
|
|
+ if (e.id != undefined && e.id != "-1") {
|
|
|
+ let productClassifyId = "";
|
|
|
+ if (["1", "2"].includes(e.id)) {
|
|
|
+ sourceList.value.pagination.productClassifyId = "";
|
|
|
+ sourceList.value.pagination.definition = e.id;
|
|
|
+ } else {
|
|
|
+ if (e.id != e.definition) {
|
|
|
+ productClassifyId = e.id;
|
|
|
+ }
|
|
|
+ sourceList.value.pagination.productClassifyId = productClassifyId;
|
|
|
+ sourceList.value.pagination.definition = e.definition;
|
|
|
+ }
|
|
|
+ getList();
|
|
|
+ } else {
|
|
|
+ sourceList.value.pagination.productClassifyId = "";
|
|
|
+ sourceList.value.pagination.definition = "";
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+};
|
|
|
getDict();
|
|
|
-getList();
|
|
|
+
|
|
|
const checkTheFlow = (item) => {
|
|
|
proxy.$router.replace({
|
|
|
path: "/purchaseSales/stockManage/record",
|
|
@@ -278,7 +360,15 @@ const handleSubmit = () => {
|
|
|
.tenant {
|
|
|
padding: 20px;
|
|
|
}
|
|
|
-::v-deep(.el-input-number .el-input__inner) {
|
|
|
- text-align: left;
|
|
|
+.user {
|
|
|
+ padding: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .tree {
|
|
|
+ width: 300px;
|
|
|
+ }
|
|
|
+ .content {
|
|
|
+ width: calc(100% - 310px);
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|