|
@@ -26,27 +26,29 @@
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.productType')"
|
|
|
align="center"
|
|
|
- prop="productType"
|
|
|
+ prop="type"
|
|
|
+ :formatter="(row) => dictDataEcho(row.type, productTypeList)"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.productCode')"
|
|
|
align="center"
|
|
|
- prop="productCode"
|
|
|
+ prop="code"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.productName')"
|
|
|
align="center"
|
|
|
- prop="productName"
|
|
|
+ prop="name"
|
|
|
+ :formatter="showIsCombination"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.productUnit')"
|
|
|
align="center"
|
|
|
- prop="productUnit"
|
|
|
+ prop="unit"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.deptId')"
|
|
|
align="center"
|
|
|
- prop="deptId"
|
|
|
+ prop="deptName"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
:label="$t('product_material.product.lifeCycle')"
|
|
@@ -91,6 +93,14 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="req.pageNum"
|
|
|
+ :limit.sync="req.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
<el-dialog
|
|
|
:title="
|
|
|
titleText === 'add'
|
|
@@ -126,15 +136,12 @@
|
|
|
<el-radio-button label="">
|
|
|
{{ $t("product_material.product.all") }}
|
|
|
</el-radio-button>
|
|
|
- <el-radio-button label="1">
|
|
|
- {{
|
|
|
- $t("product_material.product.finishedProduct")
|
|
|
- }}</el-radio-button
|
|
|
+ <el-radio-button
|
|
|
+ v-for="item in productTypeList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.dictKey"
|
|
|
>
|
|
|
- <el-radio-button label="2">
|
|
|
- {{
|
|
|
- $t("product_material.product.partiallyPreparedProducts")
|
|
|
- }}</el-radio-button
|
|
|
+ {{ item.dictValue }}</el-radio-button
|
|
|
>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
@@ -175,21 +182,24 @@
|
|
|
>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="$t('product_material.product.deptId')">
|
|
|
- <el-select
|
|
|
- v-model="req.deptId"
|
|
|
- :placeholder="$t('pleaseSelect')"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :label="$t('product_material.product.deptId')"
|
|
|
>
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
+ <avue-input-tree
|
|
|
+ v-model="req.deptId"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择"
|
|
|
+ type="tree"
|
|
|
+ size="small"
|
|
|
+ :dic="deptList"
|
|
|
+ :props="defaultProps"
|
|
|
+ :node-click="popoverDeptHide"
|
|
|
+ ></avue-input-tree>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-form-item
|
|
|
:label="$t('product_material.product.jdPurchasePrice')"
|
|
|
>
|
|
@@ -323,6 +333,8 @@ import test from "@/components/form-test/index.vue";
|
|
|
|
|
|
import * as API from "@/api/product-material/product/index.js";
|
|
|
|
|
|
+import { getDeptData } from "@/api/system/common.js";
|
|
|
+
|
|
|
export default {
|
|
|
name: "product",
|
|
|
components: {
|
|
@@ -334,6 +346,11 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ deptList: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: "children",
|
|
|
+ label: "deptName",
|
|
|
+ },
|
|
|
req: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
@@ -350,8 +367,8 @@ export default {
|
|
|
jdPurchasePriceMin: "",
|
|
|
jdPurchasePriceMax: "",
|
|
|
combination: "",
|
|
|
- beginTime: "",
|
|
|
- endTime: "",
|
|
|
+ null: "",
|
|
|
+ null: "",
|
|
|
warehouseId: "",
|
|
|
},
|
|
|
tableList: [],
|
|
@@ -363,17 +380,18 @@ export default {
|
|
|
prop: "type",
|
|
|
data: [],
|
|
|
},
|
|
|
- {
|
|
|
- label: this.$t("product_material.product.deptId"),
|
|
|
- prop: "deptId",
|
|
|
- data: [],
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // label: this.$t("product_material.product.deptId"),
|
|
|
+ // prop: "deptId",
|
|
|
+ // data: [],
|
|
|
+ // },
|
|
|
{
|
|
|
label: this.$t("product_material.product.lifeCycle"),
|
|
|
prop: "lifeCycle",
|
|
|
data: [],
|
|
|
},
|
|
|
],
|
|
|
+
|
|
|
open: false,
|
|
|
form: {
|
|
|
classifyId: "",
|
|
@@ -386,8 +404,8 @@ export default {
|
|
|
purchasePrice: "",
|
|
|
sellingPrice: "",
|
|
|
jdPurchasePrice: "",
|
|
|
- newProductsDay: "",
|
|
|
- growUpDay: "",
|
|
|
+ newProductsDay: "60",
|
|
|
+ growUpDay: "120",
|
|
|
newProductsExpectedSales: "",
|
|
|
growUpExpectedSales: "",
|
|
|
matureExpectedSales: "",
|
|
@@ -399,22 +417,37 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- API.productTree({
|
|
|
- type: "1",
|
|
|
- name: "",
|
|
|
- }).then(
|
|
|
+ getDeptData({}).then(
|
|
|
(res) => {
|
|
|
- this.dialogForm.classifyId.data = res.data.data;
|
|
|
- this.loading = false;
|
|
|
+ this.deptList = res.data.data;
|
|
|
},
|
|
|
(err) => {
|
|
|
- console.log("productTree: " + err);
|
|
|
- this.loading = false;
|
|
|
+ console.log("getDeptData:" + err);
|
|
|
}
|
|
|
);
|
|
|
+ const businessDictData = JSON.parse(
|
|
|
+ window.localStorage.getItem("businessDict")
|
|
|
+ );
|
|
|
+ console.log(businessDictData, "业务字典");
|
|
|
+ const list = businessDictData.find(
|
|
|
+ (item) => item.code === "productType"
|
|
|
+ ).children;
|
|
|
+ this.selectConfig[0].data = list.map((item) => ({
|
|
|
+ label: item.dictValue,
|
|
|
+ value: item.dictKey,
|
|
|
+ }));
|
|
|
+ this.productTypeList = list;
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ popoverDeptHide(data) {
|
|
|
+ console.log(data);
|
|
|
+ // 部门数据处理
|
|
|
+ this.req.deptId = data.id;
|
|
|
+
|
|
|
+ console.log(this.req, "qqq");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
handleDateChange() {
|
|
|
this.req.beginTime = this.timeArr[0];
|
|
|
this.req.endTime = this.timeArr[1];
|
|
@@ -436,11 +469,12 @@ export default {
|
|
|
jdPurchasePriceMin: "",
|
|
|
jdPurchasePriceMax: "",
|
|
|
combination: "",
|
|
|
- beginTime: "",
|
|
|
- endTime: "",
|
|
|
+ beginTime: null,
|
|
|
+ endTime: null,
|
|
|
warehouseId: "",
|
|
|
};
|
|
|
this.timeArr = [];
|
|
|
+ this.getList();
|
|
|
},
|
|
|
handleQuery() {
|
|
|
console.log(this.req, "sss");
|
|
@@ -450,7 +484,9 @@ export default {
|
|
|
this.loading = true;
|
|
|
API.productList(this.req).then(
|
|
|
(res) => {
|
|
|
- this.tableList = res.data.data;
|
|
|
+ console.log(res, "ss");
|
|
|
+ this.tableList = res.data.data.records;
|
|
|
+ this.total = res.data.data.total;
|
|
|
this.loading = false;
|
|
|
},
|
|
|
(err) => {
|
|
@@ -458,14 +494,14 @@ export default {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
);
|
|
|
- API.productCount(this.req).then(
|
|
|
- (res) => {
|
|
|
- this.total = res.data.data.count;
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log("productCount: " + err);
|
|
|
- }
|
|
|
- );
|
|
|
+ // API.productCount(this.req).then(
|
|
|
+ // (res) => {
|
|
|
+ // this.total = res.data.data.count;
|
|
|
+ // },
|
|
|
+ // (err) => {
|
|
|
+ // console.log("productCount: " + err);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
},
|
|
|
|
|
|
handleCancel() {
|
|
@@ -480,8 +516,8 @@ export default {
|
|
|
purchasePrice: "",
|
|
|
sellingPrice: "",
|
|
|
jdPurchasePrice: "",
|
|
|
- newProductsDay: "",
|
|
|
- growUpDay: "",
|
|
|
+ newProductsDay: "60",
|
|
|
+ growUpDay: "120",
|
|
|
newProductsExpectedSales: "",
|
|
|
growUpExpectedSales: "",
|
|
|
matureExpectedSales: "",
|
|
@@ -492,12 +528,43 @@ export default {
|
|
|
},
|
|
|
productAdd() {
|
|
|
this.titleText = "add";
|
|
|
+ this.form = {
|
|
|
+ classifyId: "",
|
|
|
+ deptId: "",
|
|
|
+ type: "",
|
|
|
+ code: "",
|
|
|
+ name: "",
|
|
|
+ unit: "",
|
|
|
+ combination: "",
|
|
|
+ purchasePrice: "",
|
|
|
+ sellingPrice: "",
|
|
|
+ jdPurchasePrice: "",
|
|
|
+ newProductsDay: "60",
|
|
|
+ growUpDay: "120",
|
|
|
+ newProductsExpectedSales: "",
|
|
|
+ growUpExpectedSales: "",
|
|
|
+ matureExpectedSales: "",
|
|
|
+ clearancePeriod: "",
|
|
|
+ productCombinationList: [],
|
|
|
+ };
|
|
|
this.open = true;
|
|
|
},
|
|
|
handleEdit(row) {
|
|
|
this.titleText = "edit";
|
|
|
- this.dialogParams = row;
|
|
|
this.open = true;
|
|
|
+ if (row.combination === 1) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addProduct.loading = true;
|
|
|
+ API.getCombination({ id: row.id }).then((res) => {
|
|
|
+ this.form = row;
|
|
|
+ this.form.combination = this.form.combination + "";
|
|
|
+ this.form.productCombinationList = [...res.data.data.records];
|
|
|
+ this.$refs.addProduct.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form = row;
|
|
|
+ }
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
this.$confirm(this.$t("askDeleteData"), {
|
|
@@ -506,7 +573,7 @@ export default {
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
|
- API.productDel({ id: row.id, type: "1" }).then(() => {
|
|
|
+ API.productDel({ id: row.id }).then(() => {
|
|
|
this.msgSuccess(this.$t("deleteSuccess"));
|
|
|
this.getList();
|
|
|
});
|
|
@@ -521,7 +588,7 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
handleSubmit() {
|
|
|
- if (this.form.id) {
|
|
|
+ if (!this.form.id) {
|
|
|
API.productAdd(this.form).then(
|
|
|
() => {
|
|
|
this.msgSuccess(this.$t("addSuccess"));
|
|
@@ -549,6 +616,24 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
+ showType(row) {
|
|
|
+ const current = this.productTypeList.find(
|
|
|
+ (item) => item.dictKey == row.type
|
|
|
+ );
|
|
|
+ if (current) {
|
|
|
+ return current.dictValue;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showIsCombination(row) {
|
|
|
+ if (row.combination === 1) {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ {row.name} (<span style="color:#0084FF">组合</span>)
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return row.name;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|