Browse Source

维多利亚基础维护

cz 2 năm trước cách đây
mục cha
commit
63f11d45af
31 tập tin đã thay đổi với 1934 bổ sung456 xóa
  1. 14 3
      src/App.vue
  2. 48 0
      src/api/product-material/customer/index.js
  3. 16 7
      src/api/product-material/material/index.js
  4. 13 0
      src/api/product-material/product/index.js
  5. 46 0
      src/api/product-material/spu/index.js
  6. 55 0
      src/api/product-material/supply/index.js
  7. 38 0
      src/api/product-material/supply/priceMaintenance.js
  8. 54 0
      src/api/product-material/warehouse/index.js
  9. 20 0
      src/api/system/common.js
  10. 10 0
      src/api/system/dict.js
  11. 1 1
      src/components/query/index.vue
  12. 114 0
      src/components/select-product/index.vue
  13. 18 1
      src/lang/zh.js
  14. 7 2
      src/main.js
  15. 14 1
      src/router/page/index.js
  16. 20 7
      src/util/util.js
  17. 308 0
      src/views/product-material/customer/addCustomer.vue
  18. 295 0
      src/views/product-material/customer/index.vue
  19. 64 29
      src/views/product-material/material/addMaterial.vue
  20. 84 24
      src/views/product-material/material/index.vue
  21. 10 7
      src/views/product-material/material/tree.vue
  22. 112 31
      src/views/product-material/product/addProduct.vue
  23. 145 60
      src/views/product-material/product/index.vue
  24. 9 7
      src/views/product-material/product/tree.vue
  25. 26 2
      src/views/product-material/spu/addSpu.vue
  26. 71 27
      src/views/product-material/supply/addSupply.vue
  27. 70 22
      src/views/product-material/supply/addSupplyPrice.vue
  28. 92 35
      src/views/product-material/supply/index.vue
  29. 95 149
      src/views/product-material/supply/priceMaintenance.vue
  30. 18 14
      src/views/product-material/warehouse/addWarehouse.vue
  31. 47 27
      src/views/product-material/warehouse/index.vue

+ 14 - 3
src/App.vue

@@ -5,6 +5,8 @@
 </template>
 
 <script>
+import { getBusinessDict } from "@/api/system/dict.js";
+
 export default {
   name: "app",
   data() {
@@ -12,10 +14,18 @@ export default {
   },
   watch: {},
   created() {
-
+    getBusinessDict({ current: 1, size: 999 }).then(
+      (res) => {
+        const list = res.data.data;
+        window.localStorage.setItem("businessDict", JSON.stringify(list));
+      },
+      (err) => {
+        console.log("getBusinessDict:" + err);
+      }
+    );
   },
   methods: {},
-  computed: {}
+  computed: {},
 };
 </script>
 <style lang="scss">
@@ -24,7 +34,8 @@ export default {
   height: 100%;
   overflow: hidden;
 }
-html,body{
+html,
+body {
   width: 100%;
   height: 100%;
 }

+ 48 - 0
src/api/product-material/customer/index.js

@@ -0,0 +1,48 @@
+import request from '@/router/axios'
+
+// customer列表 
+export function customerList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+// 添加customer 
+export function customerAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/add',
+    method: 'post',
+    data: data,
+  })
+}
+// customer详情 
+export function customerDetails(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/details',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑customer 
+export function customerEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除customer 
+export function customerDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/customerInfo/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 16 - 7
src/api/product-material/material/index.js

@@ -1,6 +1,6 @@
 import request from '@/router/axios'
 
-// 产品树形
+// 物料树形
 export function materialTree(data = {}) {
   return request({
     url: '/api/victoriatourist/classify/tree',
@@ -34,16 +34,16 @@ export function materialClassifyDel(data = {}) {
 }
 
 
-// 产品列表 
+// 物料列表 
 export function materialList(data = {}) {
   return request({
-    url: '/api/victoriatourist/material/list',
+    url: '/api/victoriatourist/material/page',
     method: 'post',
     data: data,
   })
 }
 
-// 产品条数 
+// 物料条数 
 export function materialCount(data = {}) {
   return request({
     url: '/api/victoriatourist/material/page',
@@ -52,8 +52,17 @@ export function materialCount(data = {}) {
   })
 }
 
+// 物料详情
+export function materialDetails(data = {}) {
+  return request({
+    url: '/api/victoriatourist/material/details',
+    method: 'post',
+    data: data,
+  })
+}
+
 
-// 添加产品 
+// 添加物料 
 export function materialAdd(data = {}) {
   return request({
     url: '/api/victoriatourist/material/add',
@@ -62,7 +71,7 @@ export function materialAdd(data = {}) {
   })
 }
 
-// 编辑产品 
+// 编辑物料 
 export function materialEdit(data = {}) {
   return request({
     url: '/api/victoriatourist/material/edit',
@@ -71,7 +80,7 @@ export function materialEdit(data = {}) {
   })
 }
 
-// 删除产品 
+// 删除物料 
 export function materialDel(data = {}) {
   return request({
     url: '/api/victoriatourist/material/delete',

+ 13 - 0
src/api/product-material/product/index.js

@@ -1,5 +1,8 @@
 import request from '@/router/axios'
 
+
+
+
 // 产品树形
 export function productTree(data = {}) {
   return request({
@@ -52,6 +55,16 @@ export function productCount(data = {}) {
   })
 }
 
+// 组合详情 
+export function getCombination(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productInfo/getCombinationPage',
+    method: 'post',
+    data: data,
+  })
+}
+
+
 
 // 添加产品 
 export function productAdd(data = {}) {

+ 46 - 0
src/api/product-material/spu/index.js

@@ -0,0 +1,46 @@
+import request from '@/router/axios'
+
+
+
+
+// spu列表 
+export function spuList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productSpu/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+
+
+
+// 添加spu 
+export function spuAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productSpu/add',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑spu 
+export function spuEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productSpu/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除spu 
+export function spuDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productSpu/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 55 - 0
src/api/product-material/supply/index.js

@@ -0,0 +1,55 @@
+import request from '@/router/axios'
+
+// supply列表 
+export function supplyList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+// supply下拉框
+export function supplySelect(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/list',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 添加supply 
+export function supplyAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/add',
+    method: 'post',
+    data: data,
+  })
+}
+// supply详情 
+export function supplyDetails(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/details',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑supply 
+export function supplyEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除supply 
+export function supplyDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplier/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 38 - 0
src/api/product-material/supply/priceMaintenance.js

@@ -0,0 +1,38 @@
+import request from '@/router/axios'
+
+// supplyPrice列表 
+export function supplyPriceList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplierPrice/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 添加supplyPrice 
+export function supplyPriceAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplierPrice/add',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑supplyPrice 
+export function supplyPriceEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplierPrice/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除supplyPrice 
+export function supplyPriceDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/supplierPrice/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 54 - 0
src/api/product-material/warehouse/index.js

@@ -0,0 +1,54 @@
+import request from '@/router/axios'
+
+
+
+
+// warehouse列表 
+export function warehouseList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/page',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+
+
+
+
+// 添加warehouse 
+export function warehouseAdd(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/add',
+    method: 'post',
+    data: data,
+  })
+}
+// warehouse详情 
+export function warehouseDetails(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/details',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 编辑warehouse 
+export function warehouseEdit(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 删除warehouse 
+export function warehouseDel(data = {}) {
+  return request({
+    url: '/api/victoriatourist/warehouse/delete',
+    method: 'post',
+    data: data,
+  })
+}
+

+ 20 - 0
src/api/system/common.js

@@ -0,0 +1,20 @@
+import request from '@/router/axios';
+
+export function getDeptData(data) {
+  return request({
+    url: '/api/victoriatourist/common/dept/tree',
+    method: 'post',
+    data: data
+  })
+}
+
+export function getRegionData(data) {
+  return request({
+    url: '/api/blade-ex/region/list',
+    method: 'post',
+    data: data
+  })
+}
+
+
+

+ 10 - 0
src/api/system/dict.js

@@ -1,5 +1,15 @@
 import request from '@/router/axios';
 
+export const getBusinessDict = (params) => {
+  return request({
+    url: '/api/blade-system/dict-biz/treeByTenantId',
+    method: 'get',
+    params: {
+      ...params,
+    }
+  })
+}
+
 export const getList = (current, size, params) => {
   return request({
     url: '/api/blade-system/dict/list',

+ 1 - 1
src/components/query/index.vue

@@ -72,7 +72,7 @@ export default {
     },
     handleClick(item, li) {
       item.label = li.label;
-      this.req[item.prop] = item.value;
+      this.req[item.prop] = li.value;
       this.$emit("handleQuery");
     },
     handleInter() {

+ 114 - 0
src/components/select-product/index.vue

@@ -0,0 +1,114 @@
+<template>
+  <div v-loading="loading">
+    <el-table :data="tableList">
+      <el-table-column
+        :label="$t('product_material.product.productType')"
+        align="center"
+        prop="type"
+        :formatter="(row) => dictDataEcho(row.type, productTypeList)"
+      />
+      <el-table-column
+        :label="$t('product_material.product.productCode')"
+        align="center"
+        prop="code"
+      />
+      <el-table-column
+        :label="$t('product_material.product.productName')"
+        align="center"
+        prop="name"
+      />
+      <el-table-column
+        :label="$t('product_material.product.productUnit')"
+        align="center"
+        prop="unit"
+      />
+      <el-table-column
+        :label="$t('product_material.product.deptId')"
+        align="center"
+        prop="deptName"
+      />
+      <el-table-column
+        :label="$t('product_material.product.lifeCycle')"
+        align="center"
+        prop="lifeCycle"
+      />
+      <el-table-column
+        :label="$t('product_material.product.cycleSales')"
+        align="center"
+        prop="cycleSales"
+        width="120"
+      />
+      <el-table-column
+        :label="$t('product_material.product.jdPurchasePrice')"
+        align="center"
+        prop="jdPurchasePrice"
+      />
+      <el-table-column
+        :label="$t('product_material.product.sellingPrice')"
+        align="center"
+        prop="sellingPrice"
+      />
+      <el-table-column
+        :label="$t('product_material.product.purchasePrice')"
+        align="center"
+        prop="purchasePrice"
+      />
+
+      <el-table-column :label="$t('operation')" align="center" width="80">
+        <template slot-scope="scope">
+          <el-button type="text" @click="handleSelect(scope.row)"
+            >{{ $t("select") }}
+          </el-button>
+          <!-- <el-button type="text" @click="handleDelete(scope.row)"
+            >{{ $t("delete") }}
+          </el-button> -->
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { productList } from "@/api/product-material/product/index.js";
+
+export default {
+  data() {
+    return {
+      loading: false,
+      tableList: [],
+      productTypeList: [],
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.productTypeList = businessDictData.find(
+      (item) => item.code === "productType"
+    ).children;
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.loading = true;
+      productList({ pageNum: 1, pageSize: 999 }).then(
+        (res) => {
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("productList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleSelect(row) {
+      this.$emit("select", row);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 18 - 1
src/lang/zh.js

@@ -28,6 +28,7 @@ export default {
   seniorQuery: "高级检索",
   reset: "重置",
   select: "选择",
+  productSelect: "产品选择",
   wel: {
     info: '早安,Smallwei,Avuex一款超乎你想象的框架!',
     dept: '我是avue团队下的一个部门-哈皮部门-哈皮职位',
@@ -346,18 +347,34 @@ export default {
       priceMaintenance: {
         supplyPriceAdd: "添加供应商价格",
         supplyPriceEdit: "编辑供应商价格",
-
         back: "返回",
         goodCode: '物品编码',
         goodName: '物品名称',
         goodType: '物品类型',
         price: '单价',
+        supplierIdRules: "请选择供应商",
         supplyPrice: "供应单价",
+        priceRules: "请输入单价",
       },
 
 
 
     },
+    customer: {
+      customerAdd: '添加客户',
+      customerEdit: "编辑客户",
+      customerCode: "客户编码",
+      customerName: "客户名称",
+      country: "国家",
+      province: "省/洲",
+      whereCity: "所在城市",
+      city: '城市',
+      contactInfo: "联系信息",
+      contacts: '联系人',
+      contactNumber: '联系电话',
+      enclosure: '附件',
+      address: "详细地址",
+    }
   },
   equipment: {
     deviceInterface: '设备界面',

+ 7 - 2
src/main.js

@@ -23,6 +23,10 @@ import Example from './components/example'
 import Pagination from './components/Pagination'
 import directive from './util/directives'
 
+import { dictDataEcho } from './util/util' //字典数据回显
+
+
+
 //cdn迁移进src目录
 import './assets/cdn/element-ui/2.15.1/theme-chalk/index.css'
 import './assets/cdn/animate/3.5.2/animate.css'
@@ -97,6 +101,7 @@ Vue.prototype.msgInfo = function (msg) {
   this.$message.info(msg)
 }
 
+Vue.prototype.dictDataEcho = dictDataEcho
 // 加载相关url地址
 Object.keys(urls).forEach((key) => {
   Vue.prototype[key] = urls[key]
@@ -118,13 +123,13 @@ function render({ props = {} } = {}) {
     router,
     store,
     i18n,
-    data() {},
+    data() { },
     render: (h) => h(App),
   }).$mount(container ? container.querySelector('#fjhxCloudVue') : '#fjhxCloudVue')
   console.log(instance)
 }
 // 独立运行时
-;(function () {
+; (function () {
   console.log(window.__POWERED_BY_QIANKUN__)
   if (window.__POWERED_BY_QIANKUN__) {
     __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__

+ 14 - 1
src/router/page/index.js

@@ -227,6 +227,7 @@ export default [
       },
     ],
   },
+
   {
     path: '/product-material/supply',
     component: Layout,
@@ -240,7 +241,19 @@ export default [
       },
     ],
   },
-
+  {
+    path: '/product-material/customer',
+    component: Layout,
+    redirect: '/product-material/customer/index',
+    children: [
+      {
+        path: 'index',
+        name: '客户维护',
+        component: () => import(/* webpackChunkName: "page" */ '@/views/product-material/customer/index'),
+        props: true,
+      },
+    ],
+  },
   {
     path: '/equipment',
     component: Layout,

+ 20 - 7
src/util/util.js

@@ -283,13 +283,13 @@ export const openWindow = (url, title, w, h) => {
     url,
     title,
     'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' +
-      w +
-      ', height=' +
-      h +
-      ', top=' +
-      top +
-      ', left=' +
-      left,
+    w +
+    ', height=' +
+    h +
+    ', top=' +
+    top +
+    ', left=' +
+    left,
   )
 
   // Puts focus on the newWindow
@@ -383,3 +383,16 @@ export function GenNonDuplicateID(data) {
   }
   return num
 }
+
+//根据value值回显字典label值
+export function dictDataEcho(value, arr) {
+  if (value && arr) {
+    value = value + ''
+    const current = arr.find(x => x.dictKey === value)
+    if (current != undefined && current.dictValue) {
+      return current.dictValue
+    }
+    return ''
+  }
+  return ''
+}

+ 308 - 0
src/views/product-material/customer/addCustomer.vue

@@ -0,0 +1,308 @@
+<template>
+  <div v-loading="loading">
+    <div class="form-box">
+      <el-form
+        label-position="top"
+        :model="form"
+        ref="form"
+        :rules="formRules"
+        label-width="100px"
+      >
+        <el-row>
+          <el-col :span="8">
+            <el-form-item
+              :label="$t('product_material.customer.customerCode')"
+              prop="code"
+            >
+              <el-input
+                v-model="form.code"
+                :placeholder="$t('pleaseInput')"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="1"></el-col>
+          <el-col :span="15">
+            <el-form-item label=".">
+              <span>不输入则自动生成,自动编码规则示例:C00001</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-form-item
+          :label="$t('product_material.customer.customerName')"
+          prop="name"
+        >
+          <el-input
+            v-model="form.name"
+            :placeholder="$t('pleaseInput')"
+          ></el-input>
+        </el-form-item>
+
+        <el-form-item :label="$t('product_material.customer.address')" required>
+          <el-row :gutter="10">
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="countryId">
+                <el-select
+                  v-model="form.countryId"
+                  :placeholder="$t('product_material.customer.country')"
+                  style="width: 100%"
+                  @change="countryChange"
+                >
+                  <el-option
+                    v-for="item in countryData"
+                    :key="item.id"
+                    :label="item.chineseName"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="provinceId">
+                <el-select
+                  v-model="form.provinceId"
+                  :placeholder="$t('product_material.customer.province')"
+                  style="width: 100%"
+                  @change="provinceChange"
+                  :disabled="!provinceData.length > 0"
+                >
+                  <el-option
+                    v-for="item in provinceData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="cityId">
+                <el-select
+                  v-model="form.cityId"
+                  :placeholder="$t('product_material.customer.city')"
+                  style="width: 100%"
+                  :disabled="!provinceData.length > 0 && !cityData.length > 0"
+                >
+                  <el-option
+                    v-for="item in cityData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form-item>
+
+        <el-form-item label="" prop="detailedAddress">
+          <el-input
+            v-model="form.detailedAddress"
+            :placeholder="$t('pleaseInput')"
+            type="textarea"
+            rows="4"
+          ></el-input>
+        </el-form-item>
+
+        <el-form-item
+          :label="$t('product_material.customer.contactInfo')"
+          required
+        >
+          <el-row :gutter="10">
+            <el-col :span="8">
+              <el-form-item label-width="0" prop="contacts">
+                <el-input
+                  v-model="form.contacts"
+                  :placeholder="$t('pleaseInput')"
+                >
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label-width="0" prop="phone">
+                <el-input v-model="form.phone" :placeholder="$t('pleaseInput')">
+                  <template>
+                    <div slot="prepend">+ 86</div>
+                  </template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form-item>
+
+        <el-form-item :label="$t('product_material.customer.enclosure')">
+          <el-upload
+            class="upload-demo"
+            action="/api/service-file/uploadFile"
+            :headers="uploadHeader"
+            :on-preview="handlePreview"
+            :on-remove="handleRemove"
+            :on-success="handleSuccess"
+            multiple
+            :file-list="fileList"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item>
+
+        <el-form-item label="备注" prop="remark">
+          <el-input
+            v-model="form.remark"
+            :placeholder="$t('pleaseInput')"
+            type="textarea"
+            rows="4"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div style="text-align: center; margin-top: 15px">
+      <el-button size="small" @click="handleCancel"
+        >{{ $t("cancel") }}
+      </el-button>
+      <el-button type="primary" size="small" @click="handleSubmit">
+        {{ $t("submit") }}</el-button
+      >
+    </div>
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/util/auth";
+import { getRegionData } from "@/api/system/common.js";
+
+export default {
+  name: "addCustomer",
+  components: {},
+  props: {
+    form: {
+      type: Object,
+      default: () => {},
+    },
+  },
+  data() {
+    return {
+      uploadHeader: {
+        Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
+        "Blade-Auth": "bearer " + getToken(),
+      },
+      countryData: [],
+      provinceData: [],
+      cityData: [],
+      loading: false,
+      formRules: {
+        countryId: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseSelect") +
+              this.$t("product_material.customer.country"),
+            trigger: "change",
+          },
+        ],
+        provinceId: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseSelect") +
+              this.$t("product_material.customer.province"),
+            trigger: "change",
+          },
+        ],
+        cityId: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseSelect") +
+              this.$t("product_material.customer.city"),
+            trigger: "change",
+          },
+        ],
+        type: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseSelect") +
+              this.$t("product_material.customer.customerType"),
+            trigger: "change",
+          },
+        ],
+        name: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseInput") +
+              this.$t("product_material.customer.customerName"),
+            trigger: "blur",
+          },
+        ],
+        contacts: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseInput") +
+              this.$t("product_material.customer.contacts"),
+            trigger: "blur",
+          },
+        ],
+        phone: [
+          {
+            required: true,
+            message:
+              this.$t("pleaseInput") +
+              this.$t("product_material.customer.contactNumber"),
+            trigger: "blur",
+          },
+        ],
+      },
+      fileList: [],
+    };
+  },
+  created() {
+    getRegionData({ parentId: "", type: "1" }).then((res) => {
+      this.countryData = res.data.data;
+    });
+  },
+  methods: {
+    handleSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.loading = true;
+          this.$emit("submit");
+        }
+      });
+    },
+    handleCancel() {
+      this.$emit("cancel");
+    },
+    countryChange(val) {
+      getRegionData({ parentId: val, type: "2" }).then((res) => {
+        this.provinceData = res.data.data;
+      });
+    },
+    provinceChange(val) {
+      getRegionData({ parentId: val, type: "3" }).then((res) => {
+        this.cityData = res.data.data;
+      });
+    },
+    handleSuccess(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handleRemove(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handlePreview() {},
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.form-box {
+  height: calc(100vh - 280px);
+  overflow: auto;
+  box-sizing: border-box;
+  padding: 10px;
+}
+</style>

+ 295 - 0
src/views/product-material/customer/index.vue

@@ -0,0 +1,295 @@
+
+
+<script>
+import test from "@/components/form-test/index.vue";
+import query from "@/components/query/index.vue";
+
+import byTable from "@/components/by-table/index.js";
+import addCustomer from "./addCustomer.vue";
+
+import * as API from "@/api/product-material/customer/index.js";
+
+export default {
+  components: {
+    test,
+    byTable,
+    query,
+    addCustomer,
+  },
+  data() {
+    return {
+      btnForm: {
+        otherButton: {
+          list: [
+            {
+              name: this.$t("product_material.customer.customerAdd"),
+              methodsText: "add",
+              type: "primary",
+              add: () => {
+                this.handleAdd();
+              },
+            },
+            {
+              name: this.$t("excelImport"),
+              methodsText: "excelImport",
+              type: "defualt",
+              excelImport: () => {
+                this.excelImport();
+              },
+            },
+          ],
+        },
+      },
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        keyword: "",
+        name: "",
+        code: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+      },
+      selectConfig: [],
+      tableList: [],
+      loading: false,
+      titleText: "",
+      open: false,
+      form: {
+        id: "",
+        code: "",
+        name: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+        detailedAddress: "",
+        contacts: "",
+        phone: "",
+        phonePrefixType: "",
+        remark: "",
+        fileInfoList: [],
+      },
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.loading = true;
+      API.customerList(this.queryParams).then(
+        (res) => {
+          console.log(res, "qq");
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
+          this.loading = false;
+        },
+        (err) => {
+          console.log("customerList: " + err);
+          this.loading = false;
+        }
+      );
+    },
+    handleQuery() {
+      this.getList();
+    },
+    handleAdd() {
+      this.form = {
+        id: "",
+        code: "",
+        name: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+        detailedAddress: "",
+        contacts: "",
+        phone: "",
+        phonePrefixType: "",
+        remark: "",
+        fileInfoList: [],
+      };
+      this.titleText = "add";
+      this.open = true;
+    },
+    handleCancel() {
+      this.form = {
+        id: "",
+        code: "",
+        name: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+        detailedAddress: "",
+        contacts: "",
+        phone: "",
+        phonePrefixType: "",
+        remark: "",
+        fileInfoList: [],
+      };
+      this.open = false;
+    },
+    handleEdit(row) {
+      this.titleText = "edit";
+      this.form = row;
+      this.open = true;
+      if (this.form.fileInfoList === "") {
+        this.form.fileInfoList = [];
+      }
+      this.$nextTick(() => {
+        this.$refs.addCustomer.loading = true;
+        this.$refs.addCustomer.countryChange(this.form.countryId);
+        this.$refs.addCustomer.provinceChange(this.form.provinceId);
+        this.$refs.addCustomer.loading = false;
+      });
+    },
+    handleSubmit() {
+      if (!this.form.id) {
+        API.customerAdd(this.form).then(
+          () => {
+            this.msgSuccess(this.$t("addSuccess"));
+            this.$refs.addCustomer.loading = false;
+            this.open = false;
+            this.getList();
+          },
+          (err) => {
+            console.log("customerAdd: " + err);
+            this.$refs.addCustomer.loading = false;
+          }
+        );
+      } else {
+        API.customerEdit(this.form).then(
+          () => {
+            this.msgSuccess(this.$t("editSuccess"));
+            this.open = false;
+            this.$refs.addCustomer.loading = false;
+            this.getList();
+          },
+          (err) => {
+            console.log("customerEdit: " + err);
+            this.$refs.addCustomer.loading = false;
+          }
+        );
+      }
+    },
+
+    handleDelete(row) {
+      this.$confirm(this.$t("askDeleteData"), {
+        confirmButtonText: this.$t("submitText"),
+        cancelButtonText: this.$t("cancelText"),
+        type: "warning",
+      }).then(() => {
+        API.customerDel({ id: row.id }).then(() => {
+          this.msgSuccess(this.$t("deleteSuccess"));
+          this.getList();
+        });
+      });
+    },
+    showAddress(row) {
+      return (
+        <div>
+          {row.countryName} , {row.provinceName} , {row.cityName}
+        </div>
+      );
+    },
+  },
+};
+</script>
+
+
+<template>
+  <div class="box-card">
+    <el-card class="header">
+      <test :form-config="btnForm"></test>
+    </el-card>
+    <el-card class="body-main">
+        <query
+        :selectConfig="selectConfig"
+        :req="queryParams"
+        :isShowMore="true"
+        @handleQuery="handleQuery"
+        @handleMore="
+          () => {
+            queryDialog = true;
+          }
+        "
+      ></query>
+      <el-table :data="tableList" v-loading="loading">
+      
+        <el-table-column
+          :label="$t('product_material.customer.customerCode')"
+          align="center"
+          prop="code"
+        />
+        <el-table-column
+          :label="$t('product_material.customer.customerName')"
+          align="center"
+          prop="name"
+        />
+        <el-table-column
+          :label="$t('product_material.customer.whereCity')"
+          align="center"
+          :formatter="showAddress"
+        />
+        <el-table-column
+          :label="$t('product_material.customer.contacts')"
+          align="center"
+          prop="contacts"
+        />
+        <el-table-column
+          :label="$t('product_material.customer.contactNumber')"
+          align="center"
+          prop="phone"
+        />
+
+        <el-table-column :label="$t('operation')" align="center" width="120">
+          <template slot-scope="scope">
+            <el-button type="text" @click="handleEdit(scope.row)"
+              >{{ $t("edit") }}
+            </el-button>
+            <el-button type="text" @click="handleDelete(scope.row)"
+              >{{ $t("delete") }}
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      </by-table>
+    </el-card>
+
+    <el-dialog
+      :title="
+        titleText === 'add'
+          ? $t('product_material.customer.customerAdd')
+          : $t('product_material.customer.customerEdit')
+      "
+      :visible.sync="open"
+      v-if="open"
+      width="50%"
+      top="60px"
+    >
+      <add-customer
+        :form="form"
+        @submit="handleSubmit"
+        @cancel="handleCancel"
+        ref="addMaterial"
+      ></add-customer>
+    </el-dialog>
+  </div>
+</template>
+
+
+<style lang="scss" scoped>
+.box-card {
+  height: calc(100vh - 110px);
+  overflow-y: auto;
+  display: flex;
+  flex-direction: column;
+  .header {
+    // height: 100px;
+    margin-bottom: 10px;
+    box-sizing: border-box;
+  }
+  .body-main {
+    flex: 1;
+  }
+}
+</style>

+ 64 - 29
src/views/product-material/material/addMaterial.vue

@@ -13,8 +13,10 @@
           prop="classifyId"
         >
           <el-cascader
+            :options="selectList"
             v-model="form.classifyId"
             :emitPath="false"
+            :props="{ label: 'name', value: 'id' }"
             style="width: 100%"
             size="small"
           ></el-cascader>
@@ -31,10 +33,10 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in materialTypeList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
                 >
                 </el-option>
               </el-select>
@@ -80,10 +82,10 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in materialUnitList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
                 >
                 </el-option>
               </el-select>
@@ -96,19 +98,15 @@
               :label="$t('product_material.material.deptId')"
               prop="deptId"
             >
-              <el-select
+              <el-cascader
+                :options="deptList"
                 v-model="form.deptId"
-                :placeholder="$t('pleaseSelect')"
+                :emitPath="false"
+                :props="{ label: 'deptName', value: 'id' }"
                 style="width: 100%"
-              >
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
-                </el-option>
-              </el-select>
+                size="small"
+                :show-all-levels="false"
+              ></el-cascader>
             </el-form-item>
           </el-col>
         </el-row>
@@ -134,6 +132,8 @@
 </template>
 
 <script>
+import * as API from "@/api/product-material/material/index.js";
+
 export default {
   name: "addMaterial",
 
@@ -142,19 +142,36 @@ export default {
       type: Object,
       default: () => {},
     },
+    selectList: {
+      type: Array,
+      default: () => [],
+    },
+    materialTypeList: {
+      type: Array,
+      default: () => [],
+    },
+    materialUnitList: {
+      type: Array,
+      default: () => [],
+    },
+    deptList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
+      // selectList: [],
       loading: false,
-      form: {
-        classifyId: "",
-        type: "",
-        code: "",
-        name: "",
-        unit: "",
-        introduce: "",
-        deptId: "",
-      },
+      // form: {
+      //   classifyId: "",
+      //   type: "",
+      //   code: "",
+      //   name: "",
+      //   unit: "",
+      //   introduce: "",
+      //   deptId: "",
+      // },
 
       formRules: {
         classifyId: [
@@ -195,11 +212,29 @@ export default {
       },
     };
   },
+  created() {
+    // API.materialTree({
+    //   type: "2",
+    //   name: "",
+    // }).then(
+    //   (res) => {
+    //     this.selectList = res.data.data;
+    //     this.loading = false;
+    //   },
+    //   (err) => {
+    //     console.log("materialTree: " + err);
+    //     this.loading = false;
+    //   }
+    // );
+  },
   methods: {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
           this.loading = true;
+          this.form.classifyId =
+            this.form.classifyId[this.form.classifyId.length - 1];
+          this.form.deptId = this.form.deptId[this.form.deptId.length - 1];
           this.$emit("submit");
         }
       });
@@ -216,6 +251,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 84 - 24
src/views/product-material/material/index.vue

@@ -26,20 +26,23 @@
             <el-table-column
               :label="$t('product_material.material.materialType')"
               align="center"
+              prop="type"
+              :formatter="(row) => dictDataEcho(row.type, materialTypeList)"
             />
             <el-table-column
               :label="$t('product_material.material.materialCode')"
               align="center"
+              prop="code"
             />
             <el-table-column
               :label="$t('product_material.material.materialName')"
               align="center"
-              prop="materialName"
+              prop="name"
             />
             <el-table-column
               :label="$t('product_material.material.materialUnit')"
               align="center"
-              prop="materialUnit"
+              prop="unit"
             />
             <el-table-column
               :label="$t('product_material.material.deptId')"
@@ -49,7 +52,7 @@
             <el-table-column
               :label="$t('product_material.material.description')"
               align="center"
-              prop="description"
+              prop="introduce"
             />
 
             <el-table-column
@@ -67,6 +70,13 @@
               </template>
             </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'
@@ -80,6 +90,10 @@
           >
             <add-material
               :form="form"
+              :selectList="selectList"
+              :materialTypeList="materialTypeList"
+              :materialUnitList="materialUnitList"
+              :deptList="deptList"
               @submit="handleSubmit"
               @cancel="handleCancel"
               ref="addMaterial"
@@ -183,6 +197,7 @@ import query from "@/components/query/index.vue";
 import addMaterial from "./addMaterial.vue";
 
 import * as API from "@/api/product-material/material/index.js";
+import { getDeptData } from "@/api/system/common.js";
 
 export default {
   name: "material",
@@ -195,11 +210,19 @@ export default {
   },
   data() {
     return {
+      deptList: [],
+      selectList: [],
+      materialTypeList: [],
+      materialUnitList: [],
       req: {
         pageNum: 1,
         pageSize: 10,
         keyword: "",
         classifyId: "",
+        type: "",
+        code: "",
+        name: "",
+        deptId: "",
       },
       tableList: [],
       total: 0,
@@ -208,13 +231,7 @@ export default {
         {
           label: this.$t("product_material.material.materialType"),
           prop: "type",
-          data: [
-            { label: "原料", value: 1 },
-            { label: "辅料", value: 2 },
-            { label: "配件", value: 3 },
-            { label: "包材", value: 4 },
-            { label: "其他", value: 5 },
-          ],
+          data: [],
         },
       ],
       open: false,
@@ -233,12 +250,33 @@ export default {
     };
   },
   created() {
+    getDeptData({}).then(
+      (res) => {
+        this.deptList = res.data.data;
+      },
+      (err) => {
+        console.log("getDeptData:" + err);
+      }
+    );
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.materialTypeList = businessDictData.find(
+      (item) => item.code === "materialType"
+    ).children;
+    this.selectConfig[0].data = this.materialTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+    this.materialUnitList = businessDictData.find(
+      (item) => item.code === "materialUnit"
+    ).children;
     API.materialTree({
       type: "2",
       name: "",
     }).then(
       (res) => {
-        this.dialogForm.classifyId.data = res.data.data;
+        this.selectList = res.data.data;
         this.loading = false;
       },
       (err) => {
@@ -266,7 +304,8 @@ export default {
       this.loading = true;
       API.materialList(this.req).then(
         (res) => {
-          this.tableList = res.data.data;
+          this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
           this.loading = false;
         },
         (err) => {
@@ -274,23 +313,44 @@ export default {
           this.loading = false;
         }
       );
-      API.materialCount(this.req).then(
-        (res) => {
-          this.total = res.data.data.count;
-        },
-        (err) => {
-          console.log("materialCount: " + err);
-        }
-      );
+      // API.materialCount(this.req).then(
+      //   (res) => {
+      //     this.total = res.data.data.count;
+      //   },
+      //   (err) => {
+      //     console.log("materialCount: " + err);
+      //   }
+      // );
     },
     materialAdd() {
       this.titleText = "add";
+      this.form = {
+        classifyId: "",
+        type: "",
+        code: "",
+        name: "",
+        unit: "",
+        introduce: "",
+        deptId: "",
+      };
       this.open = true;
     },
     handleEdit(row) {
       this.titleText = "edit";
-      this.dialogParams = row;
       this.open = true;
+      this.$nextTick(() => {
+        this.$refs.addMaterial.loading = true;
+        API.materialDetails({ id: row.id }).then(
+          (res) => {
+            this.form = res.data.data;
+            this.form.type = this.form.type + "";
+            this.$refs.addMaterial.loading = false;
+          },
+          (err) => {
+            console.log(err);
+          }
+        );
+      });
     },
     handleDelete(row) {
       this.$confirm(this.$t("askDeleteData"), {
@@ -326,17 +386,17 @@ export default {
       this.open = false;
     },
     handleSubmit() {
-      if (this.form.id) {
+      if (!this.form.id) {
         API.materialAdd(this.form).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addProduct.loading = false;
+            this.$refs.addMaterial.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
             console.log("materialAdd: " + err);
-            this.$refs.addProduct.loading = false;
+            this.$refs.addMaterial.loading = false;
           }
         );
       } else {

+ 10 - 7
src/views/product-material/material/tree.vue

@@ -8,7 +8,7 @@
       <el-input :placeholder="$t('search')" v-model="filterText" size="small">
       </el-input>
       <div style="width: 100px; margin-left: 10px">
-        <el-button size="mini"> 新增</el-button>
+        <el-button size="mini" @click="add"> 新增</el-button>
       </div>
     </el-row>
     <el-tree
@@ -26,16 +26,16 @@
       >
         <span>{{ node.label }}</span>
         <span v-show="data.id === currentNode.id">
-          <i class="el-icon-edit" @click="() => edit(node, data)"></i>
+          <i class="el-icon-edit" @click.stop="() => edit(node, data)"></i>
           <i
             class="el-icon-circle-plus-outline"
             style="margin-left: 10px"
-            @click="() => add(data)"
+            @click.stop="() => add(data)"
           ></i>
           <i
             class="el-icon-delete"
             style="margin-left: 10px"
-            @click="() => del(data)"
+            @click.stop="() => del(data)"
           ></i>
         </span>
       </span>
@@ -78,6 +78,8 @@ export default {
         type: null,
         parentId: null,
         name: null,
+        parentIdSet: null,
+        id: null,
       },
       currentNode: {},
       treeForm: {
@@ -120,7 +122,7 @@ export default {
       treeModal: false,
       defaultProps: {
         children: "children",
-        label: "label",
+        label: "name",
       },
     };
   },
@@ -138,7 +140,7 @@ export default {
     },
     filterNode(value, data) {
       if (!value) return true;
-      return data.label.indexOf(value) !== -1;
+      return data.name.indexOf(value) !== -1;
     },
     resetForm(formName) {},
     treehandleSubmit() {
@@ -193,6 +195,7 @@ export default {
     },
     add(row) {
       this.treeParams = {
+        parentIdSet: "",
         type: "2",
         parentId: "",
         name: "",
@@ -205,7 +208,7 @@ export default {
       this.treeParams = {
         type: "2",
         parentId: node.parent.data.id,
-        name: row.label,
+        name: row.name,
         id: row.id,
       };
       this.treeModal = true;

+ 112 - 31
src/views/product-material/product/addProduct.vue

@@ -13,8 +13,10 @@
           prop="classifyId"
         >
           <el-cascader
+            :options="selectList"
             v-model="form.classifyId"
             :emitPath="false"
+            :props="{ label: 'name', value: 'id' }"
             style="width: 100%"
             size="small"
           ></el-cascader>
@@ -25,13 +27,12 @@
         >
           <el-radio-group v-model="form.type">
             <el-radio-button
-              :label="$t('product_material.product.finishedProduct')"
-              name="1"
-            ></el-radio-button>
-            <el-radio-button
-              :label="$t('product_material.product.partiallyPreparedProducts')"
+              v-for="item in productTypeList"
+              :key="item.id"
+              :label="item.dictKey"
+            >
+              {{ item.dictValue }}</el-radio-button
             >
-            </el-radio-button>
           </el-radio-group>
         </el-form-item>
         <el-row :gutter="10">
@@ -73,10 +74,10 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in productUnitList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
                 >
                 </el-option>
               </el-select>
@@ -128,8 +129,9 @@
             >
               <el-date-picker
                 v-model="form.clearancePeriod"
-                type="date"
+                type="datetime"
                 placeholder="选择日期"
+                value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
             </el-form-item>
@@ -140,34 +142,34 @@
           prop="combination"
         >
           <el-radio-group v-model="form.combination">
-            <el-radio-button
-              :label="$t('product_material.product.yes')"
-              name="1"
-            ></el-radio-button>
-            <el-radio-button
-              :label="$t('product_material.product.no')"
-              name="0"
-            ></el-radio-button>
+            <el-radio-button label="1">
+              {{ $t("product_material.product.yes") }}</el-radio-button
+            >
+            <el-radio-button label="0">
+              {{ $t("product_material.product.no") }}</el-radio-button
+            >
           </el-radio-group>
         </el-form-item>
-        <div style="margin-bottom: 20px">
+        <div style="margin-bottom: 20px" v-if="form.combination === '1'">
           <labelTitle
             :content="$t('product_material.product.combinationDetails')"
           ></labelTitle>
         </div>
-        <el-form-item label-width="0px">
-          <el-button> {{ $t("select") }}</el-button>
+        <el-form-item label-width="0px" v-if="form.combination === '1'">
+          <el-button @click="selectDialog = true">
+            {{ $t("select") }}</el-button
+          >
         </el-form-item>
-        <el-form-item>
+        <el-form-item v-if="form.combination === '1'">
           <el-table :data="form.productCombinationList">
             <el-table-column
               :label="$t('product_material.product.productCode')"
-              prop="productCode"
+              prop="code"
             >
             </el-table-column>
             <el-table-column
               :label="$t('product_material.product.productName')"
-              prop="productName"
+              prop="name"
             >
             </el-table-column>
             <el-table-column
@@ -176,7 +178,9 @@
               align="center"
             >
               <template slot-scope="scope">
-                <el-button type="text">{{ $t("delete") }}</el-button>
+                <el-button type="text" @click="deleteRow(scope.$index)">{{
+                  $t("delete")
+                }}</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -186,12 +190,21 @@
             :content="$t('product_material.product.lifeCycleRules')"
           ></labelTitle>
         </div>
-        <el-row>
+        <el-row :gutter="10">
           <el-form-item
             :label="$t('product_material.product.newProductsExpectedSales')"
             prop="newProductsExpectedSales"
           >
-            <el-col :span="3"> 0 ~ 60 : </el-col>
+            <el-col :span="2" style="text-align: center">
+              0 &nbsp;&nbsp;~
+            </el-col>
+            <el-col :span="3">
+              <el-input
+                v-model="form.newProductsDay"
+                :placeholder="$t('pleaseInput')"
+              ></el-input>
+            </el-col>
+            <el-col :span="1" style="text-align: center"> : </el-col>
             <el-col :span="6">
               <el-input
                 v-model="form.newProductsExpectedSales"
@@ -200,12 +213,21 @@
             </el-col>
           </el-form-item>
         </el-row>
-        <el-row>
+        <el-row :gutter="10">
           <el-form-item
             :label="$t('product_material.product.growUpExpectedSales')"
             prop="growUpExpectedSales"
           >
-            <el-col :span="3"> 0 ~ 120 : </el-col>
+            <el-col :span="2" style="text-align: center">
+              61 &nbsp;&nbsp;~
+            </el-col>
+            <el-col :span="3">
+              <el-input
+                v-model="form.growUpDay"
+                :placeholder="$t('pleaseInput')"
+              ></el-input>
+            </el-col>
+            <el-col :span="1" style="text-align: center"> : </el-col>
             <el-col :span="6">
               <el-input
                 v-model="form.growUpExpectedSales"
@@ -238,15 +260,29 @@
         {{ $t("submit") }}</el-button
       >
     </div>
+
+    <el-dialog
+      :title="$t('productSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
+import selectProduct from "@/components/select-product/index.vue";
+
+import * as API from "@/api/product-material/product/index.js";
 export default {
   name: "addProduct",
   components: {
     labelTitle,
+    selectProduct,
   },
   props: {
     form: {
@@ -257,6 +293,9 @@ export default {
   data() {
     return {
       loading: false,
+      selectList: [],
+      productTypeList: [],
+      productUnitList: [],
       form: {
         classifyId: "",
         deptId: "",
@@ -321,13 +360,42 @@ export default {
           },
         ],
       },
+      selectDialog: false,
     };
   },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.productTypeList = businessDictData.find(
+      (item) => item.code === "productType"
+    ).children;
+    this.productUnitList = businessDictData.find(
+      (item) => item.code === "productUnit"
+    ).children;
+
+    this.loading = true;
+    API.productTree({
+      type: "1",
+      name: "",
+    }).then(
+      (res) => {
+        this.selectList = res.data.data;
+        this.loading = false;
+      },
+      (err) => {
+        console.log("productTree: " + err);
+        this.loading = false;
+      }
+    );
+  },
   methods: {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
           this.loading = true;
+          this.form.classifyId =
+            this.form.classifyId[this.form.classifyId.length - 1];
           this.$emit("submit");
         }
       });
@@ -335,6 +403,19 @@ export default {
     handleCancel() {
       this.$emit("cancel");
     },
+    handleSelect(row) {
+      this.form.productCombinationList.push({
+        linkProductId: row.id,
+        linkQuantity: "",
+        code: row.code,
+        name: row.name,
+      });
+      this.msgSuccess(this.$t("addSuccess"));
+    },
+    deleteRow(index) {
+      this.form.productCombinationList.splice(index, 1);
+      this.msgSuccess(this.$t("deleteSuccess"));
+    },
   },
 };
 </script>
@@ -344,6 +425,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 145 - 60
src/views/product-material/product/index.vue

@@ -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>

+ 9 - 7
src/views/product-material/product/tree.vue

@@ -8,7 +8,7 @@
       <el-input :placeholder="$t('search')" v-model="filterText" size="small">
       </el-input>
       <div style="width: 100px; margin-left: 10px">
-        <el-button size="mini"> 添加</el-button>
+        <el-button size="mini" @click="add"> 添加</el-button>
       </div>
     </el-row>
     <el-tree
@@ -26,16 +26,16 @@
       >
         <span>{{ node.label }}</span>
         <span v-show="data.id === currentNode.id">
-          <i class="el-icon-edit" @click="() => edit(node, data)"></i>
+          <i class="el-icon-edit" @click.stop="() => edit(node, data)"></i>
           <i
             class="el-icon-circle-plus-outline"
             style="margin-left: 10px"
-            @click="() => add(data)"
+            @click.stop="() => add(data)"
           ></i>
           <i
             class="el-icon-delete"
             style="margin-left: 10px"
-            @click="() => del(data)"
+            @click.stop="() => del(data)"
           ></i>
         </span>
       </span>
@@ -78,6 +78,7 @@ export default {
         id: null,
         type: null,
         parentId: null,
+        parentIdSet: null,
         name: null,
       },
       currentNode: {},
@@ -121,7 +122,7 @@ export default {
       treeModal: false,
       defaultProps: {
         children: "children",
-        label: "label",
+        label: "name",
       },
     };
   },
@@ -139,7 +140,7 @@ export default {
     },
     filterNode(value, data) {
       if (!value) return true;
-      return data.label.indexOf(value) !== -1;
+      return data.name.indexOf(value) !== -1;
     },
     resetForm(formName) {},
     treehandleSubmit() {
@@ -194,6 +195,7 @@ export default {
     },
     add(row) {
       this.treeParams = {
+        parentIdSet: "",
         type: "1",
         parentId: "",
         name: "",
@@ -206,7 +208,7 @@ export default {
       this.treeParams = {
         type: "1",
         parentId: node.parent.data.id,
-        name: row.label,
+        name: row.name,
         id: row.id,
       };
       this.treeModal = true;

+ 26 - 2
src/views/product-material/spu/addSpu.vue

@@ -46,7 +46,9 @@
           ></labelTitle>
         </div>
         <el-form-item label-width="0px">
-          <el-button> {{ $t("select") }}</el-button>
+          <el-button @click="selectDialog = true">
+            {{ $t("select") }}</el-button
+          >
         </el-form-item>
         <el-form-item>
           <el-table :data="form.productCombinationList">
@@ -81,15 +83,27 @@
         {{ $t("submit") }}</el-button
       >
     </div>
+    <el-dialog
+      :title="$t('productSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
+import selectProduct from "@/components/select-product/index.vue";
+
 export default {
   name: "addSpu",
   components: {
     labelTitle,
+    selectProduct,
   },
   props: {
     form: {
@@ -114,6 +128,7 @@ export default {
           },
         ],
       },
+      selectDialog: false,
     };
   },
   methods: {
@@ -128,6 +143,15 @@ export default {
     handleCancel() {
       this.$emit("cancel");
     },
+    handleSelect(row) {
+      this.form.productCombinationList.push({
+        linkProductId: row.id,
+        linkQuantity: "",
+        code: row.code,
+        name: row.name,
+      });
+      this.msgSuccess(this.$t("addSuccess"));
+    },
   },
 };
 </script>
@@ -137,6 +161,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 71 - 27
src/views/product-material/supply/addSupply.vue

@@ -14,13 +14,12 @@
         >
           <el-radio-group v-model="form.type">
             <el-radio-button
-              :label="$t('product_material.supply.finishedProduct')"
-              name="1"
-            ></el-radio-button>
-            <el-radio-button
-              :label="$t('product_material.supply.partiallyPreparedProducts')"
-              name="2"
-            ></el-radio-button>
+              v-for="item in supplyTypeList"
+              :key="item.id"
+              :label="item.dictKey"
+            >
+              {{ item.dictValue }}</el-radio-button
+            >
           </el-radio-group>
         </el-form-item>
 
@@ -56,12 +55,13 @@
                   v-model="form.countryId"
                   :placeholder="$t('product_material.supply.country')"
                   style="width: 100%"
+                  @change="countryChange"
                 >
                   <el-option
-                    v-for="item in options"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="item in countryData"
+                    :key="item.id"
+                    :label="item.chineseName"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -73,12 +73,14 @@
                   v-model="form.provinceId"
                   :placeholder="$t('product_material.supply.province')"
                   style="width: 100%"
+                  @change="provinceChange"
+                  :disabled="!provinceData.length > 0"
                 >
                   <el-option
-                    v-for="item in options"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="item in provinceData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -90,12 +92,13 @@
                   v-model="form.cityId"
                   :placeholder="$t('product_material.supply.city')"
                   style="width: 100%"
+                  :disabled="!provinceData.length > 0 && !cityData.length > 0"
                 >
                   <el-option
-                    v-for="item in options"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="item in cityData"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -138,7 +141,7 @@
 
         <el-form-item
           :label="$t('product_material.supply.contactInfo')"
-          prop="contacts"
+          required
         >
           <el-row :gutter="10">
             <el-col :span="8">
@@ -146,15 +149,17 @@
                 <el-input
                   v-model="form.contacts"
                   :placeholder="$t('pleaseInput')"
-                ></el-input>
+                >
+                </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="16">
               <el-form-item label-width="0" prop="phone">
-                <el-input
-                  v-model="form.phone"
-                  :placeholder="$t('pleaseInput')"
-                ></el-input>
+                <el-input v-model="form.phone" :placeholder="$t('pleaseInput')">
+                  <template>
+                    <div slot="prepend">+ 86</div>
+                  </template>
+                </el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -187,7 +192,8 @@
         <el-form-item :label="$t('product_material.supply.enclosure')">
           <el-upload
             class="upload-demo"
-            action="https://jsonplaceholder.typicode.com/posts/"
+            action="/api/service-file/uploadFile"
+            :headers="uploadHeader"
             :on-preview="handlePreview"
             :on-remove="handleRemove"
             :on-success="handleSuccess"
@@ -254,6 +260,10 @@
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
+
+import { getToken } from "@/util/auth";
+import { getRegionData } from "@/api/system/common.js";
+
 export default {
   name: "addSpu",
   components: {
@@ -264,9 +274,20 @@ export default {
       type: Object,
       default: () => {},
     },
+    supplyTypeList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
+      uploadHeader: {
+        Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
+        "Blade-Auth": "bearer " + getToken(),
+      },
+      countryData: [],
+      provinceData: [],
+      cityData: [],
       loading: false,
       formRules: {
         countryId: [
@@ -351,8 +372,14 @@ export default {
           },
         ],
       },
+      fileList: [],
     };
   },
+  created() {
+    getRegionData({ parentId: "", type: "1" }).then((res) => {
+      this.countryData = res.data.data;
+    });
+  },
   methods: {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
@@ -365,6 +392,23 @@ export default {
     handleCancel() {
       this.$emit("cancel");
     },
+    countryChange(val) {
+      getRegionData({ parentId: val, type: "2" }).then((res) => {
+        this.provinceData = res.data.data;
+      });
+    },
+    provinceChange(val) {
+      getRegionData({ parentId: val, type: "3" }).then((res) => {
+        this.cityData = res.data.data;
+      });
+    },
+    handleSuccess(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handleRemove(response, file, fileList) {
+      this.form.fileInfoList = fileList;
+    },
+    handlePreview() {},
   },
 };
 </script>
@@ -374,6 +418,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 70 - 22
src/views/product-material/supply/addSupplyPrice.vue

@@ -10,47 +10,53 @@
       >
         <el-form-item
           :label="$t('product_material.supply.supplyName')"
-          prop="name"
+          prop="supplierId"
         >
           <el-select
-            v-model="form.name"
+            v-model="form.supplierId"
             :placeholder="$t('pleaseSelect')"
             style="width: 100%"
           >
             <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
+              v-for="item in supplySelectList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
             >
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item :label="$t('product_material.product.product')">
+        <el-form-item :label="$t('product_material.product.product')" required>
           <el-row :gutter="10">
             <el-col :span="9">
-              <el-input
-                v-model="form.code"
-                :placeholder="$t('product_material.product.productCode')"
-              ></el-input>
+              <el-form-item label-width="0px" prop="code">
+                <el-input
+                  v-model="form.code"
+                  disabled
+                  :placeholder="$t('product_material.product.productCode')"
+                ></el-input>
+              </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-input
                 v-model="form.name"
+                disabled
                 :placeholder="$t('product_material.product.productName')"
               ></el-input>
             </el-col>
             <el-col :span="3">
-              <el-button size="small">{{ $t("select") }} </el-button>
+              <el-button size="small" @click="selectDialog = true"
+                >{{ $t("select") }}
+              </el-button>
             </el-col>
           </el-row>
         </el-form-item>
         <el-form-item
           :label="$t('product_material.supply.priceMaintenance.price')"
-          prop="name"
+          prop="price"
         >
           <el-input
-            v-model="form.name"
+            v-model="form.price"
             :placeholder="$t('pleaseInput')"
           ></el-input>
         </el-form-item>
@@ -64,45 +70,78 @@
         {{ $t("submit") }}</el-button
       >
     </div>
+
+    <el-dialog
+      :title="$t('productSelect')"
+      v-if="selectDialog"
+      :visible.sync="selectDialog"
+      width="80%"
+      top="60px"
+    >
+      <selectProduct @select="handleSelect"></selectProduct>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
+import selectProduct from "@/components/select-product/index.vue";
+
 export default {
   name: "addSpu",
   components: {
     labelTitle,
+    selectProduct,
   },
   props: {
     form: {
       type: Object,
       default: () => {},
     },
+
+    supplySelectList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
       loading: false,
-      // form: {
-      //   code: "",
-      //   name: "",
-      //   productCombinationList: [],
-      // },
       formRules: {
-        name: [
+        supplierId: [
           {
             required: true,
-            message: this.$t("product_material.spu.spuNameRules"),
+            message: this.$t(
+              "product_material.supply.priceMaintenance.supplierIdRules"
+            ),
+            trigger: "change",
+          },
+        ],
+        // code: [
+        //   {
+        //     required: true,
+        //     message: this.$t("product_material.supply.priceMaintenance.code"),
+        //     trigger: "blur",
+        //   },
+        // ],
+        price: [
+          {
+            required: true,
+            message: this.$t(
+              "product_material.supply.priceMaintenance.priceRules"
+            ),
             trigger: "blur",
           },
         ],
       },
+      selectDialog: false,
     };
   },
   methods: {
     handleSubmit() {
       this.$refs.form.validate((valid) => {
         if (valid) {
+          if (!this.form.materialId) return this.msgInfo("请选择产品");
           this.loading = true;
           this.$emit("submit");
         }
@@ -111,6 +150,15 @@ export default {
     handleCancel() {
       this.$emit("cancel");
     },
+    handleSupplyChange(val) {
+      this.form.materialId = val;
+    },
+    handleSelect(row) {
+      this.form.code = row.code;
+      this.form.name = row.name;
+      this.form.materialId = row.id;
+      this.msgSuccess(this.$t("addSuccess"));
+    },
   },
 };
 </script>
@@ -120,6 +168,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 92 - 35
src/views/product-material/supply/index.vue

@@ -18,48 +18,50 @@
         <el-table-column
           :label="$t('product_material.supply.supplyType')"
           align="center"
-          prop="productName"
+          prop="type"
+          :formatter="(row) => dictDataEcho(row.type, supplyTypeList)"
         />
         <el-table-column
           :label="$t('product_material.supply.supplyCode')"
           align="center"
-          prop="applicationName"
+          prop="code"
         />
         <el-table-column
           :label="$t('product_material.supply.supplyName')"
           align="center"
-          prop="applicationName"
+          prop="name"
         />
         <el-table-column
           :label="$t('product_material.supply.city')"
           align="center"
-          prop="applicationName"
+          :formatter="showAddress"
         />
         <el-table-column
-          :label="$t('product_material.supply.accountingPeriod')"
+          :label="$t('product_material.supply.contacts')"
           align="center"
-          prop="applicationName"
+          prop="contacts"
         />
         <el-table-column
-          :label="$t('product_material.supply.contacts')"
+          :label="$t('product_material.supply.accountingPeriod')"
           align="center"
-          prop="applicationName"
+          prop="accountPeriod"
         />
-        <el-table-column
+
+        <!-- <el-table-column
           :label="$t('product_material.supply.contactNumber')"
           align="center"
           prop="applicationName"
-        />
+        /> -->
         <el-table-column
           :label="$t('product_material.supply.returnAndReplacementPeriod')"
           align="center"
-          prop="applicationName"
+          prop="returnPeriod"
         />
-        <el-table-column
+        <!-- <el-table-column
           :label="$t('product_material.supply.enclosure')"
           align="center"
           prop="applicationName"
-        />
+        /> -->
 
         <el-table-column :label="$t('operation')" align="center" width="120">
           <template slot-scope="scope">
@@ -94,6 +96,7 @@
       >
         <add-supply
           :form="form"
+          :supplyTypeList="supplyTypeList"
           @submit="handleSubmit"
           @cancel="handleCancel"
           ref="addSupply"
@@ -275,7 +278,7 @@
 import test from "@/components/form-test/index.vue";
 import query from "@/components/query/index.vue";
 import addSupply from "./addSupply.vue";
-import * as API from "@/api/product-material/product/index.js";
+import * as API from "@/api/product-material/supply/index.js";
 
 import labelTitle from "@/components/label-title/index.vue";
 export default {
@@ -287,6 +290,7 @@ export default {
   },
   data() {
     return {
+      supplyTypeList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -373,38 +377,70 @@ export default {
       fileList: [],
     };
   },
-  created() {},
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.supplyTypeList = businessDictData.find(
+      (item) => item.code === "supplyType"
+    ).children;
+    this.selectConfig[0].data = this.supplyTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+    this.getList();
+  },
   methods: {
-    handleQuery() {
-      this.getList();
-    },
     go() {
       this.$router.push({
         path: "/product-material/supply/priceMaintenance",
       });
     },
-    handleEdit(row) {
-      this.titleText = "edit";
-      this.open = true;
-    },
+
     getList() {
       this.loading = true;
-      API.tdaDevicePage(this.queryParams).then(
+      API.supplyList(this.queryParams).then(
         (res) => {
-          this.total = res.data.data.total;
+          console.log(res, "qq");
           this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
           this.loading = false;
         },
         (err) => {
-          console.log("tdaDevicePage: " + err);
+          console.log("supplyList: " + err);
           this.loading = false;
         }
       );
     },
+    handleQuery() {
+      this.getList();
+    },
+
     spuAdd() {
+      this.form = {
+        type: "",
+        name: "",
+        code: "",
+        contacts: "",
+        phone: "",
+        phonePrefixType: "",
+        countryId: "",
+        provinceId: "",
+        cityId: "",
+        detailedAddress: "",
+        accountPeriod: "",
+        returnPeriod: "",
+        accountName: "",
+        bankAccount: "",
+        bankOfDeposit: "",
+        interBankNo: "",
+        fileInfoList: [],
+      };
+      this.fileList = [];
       this.titleText = "add";
       this.open = true;
     },
+
     handleCancel() {
       this.form = {
         type: "",
@@ -428,31 +464,45 @@ export default {
       this.fileList = [];
       this.open = false;
     },
+    handleEdit(row) {
+      this.titleText = "edit";
+      this.form = row;
+      this.open = true;
+      if (this.form.fileInfoList === "") {
+        this.form.fileInfoList = [];
+      }
+      this.$nextTick(() => {
+        this.$refs.addSupply.loading = true;
+        this.$refs.addSupply.countryChange(this.form.countryId);
+        this.$refs.addSupply.provinceChange(this.form.provinceId);
+        this.$refs.addSupply.loading = false;
+      });
+    },
     handleSubmit() {
-      if (this.form.id) {
-        API.productAdd(this.form).then(
+      if (!this.form.id) {
+        API.supplyAdd(this.form).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addProduct.loading = false;
+            this.$refs.addSupply.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
-            console.log("productAdd: " + err);
-            this.$refs.addProduct.loading = false;
+            console.log("supplyAdd: " + err);
+            this.$refs.addSupply.loading = false;
           }
         );
       } else {
-        API.productEdit(this.form).then(
+        API.supplyEdit(this.form).then(
           () => {
             this.msgSuccess(this.$t("editSuccess"));
             this.open = false;
-            this.$refs.addProduct.loading = false;
+            this.$refs.addSupply.loading = false;
             this.getList();
           },
           (err) => {
-            console.log("productEdit: " + err);
-            this.$refs.addProduct.loading = false;
+            console.log("supplyEdit: " + err);
+            this.$refs.addSupply.loading = false;
           }
         );
       }
@@ -464,12 +514,19 @@ export default {
         cancelButtonText: this.$t("cancelText"),
         type: "warning",
       }).then(() => {
-        API.tdaDeviceDelete({ id: row.id }).then(() => {
+        API.supplyDel({ id: row.id }).then(() => {
           this.msgSuccess(this.$t("deleteSuccess"));
           this.getList();
         });
       });
     },
+    showAddress(row) {
+      return (
+        <div>
+          {row.countryName} , {row.provinceName} , {row.cityName}
+        </div>
+      );
+    },
     handlePreview() {},
     handleRemove() {},
     handleSuccess() {},

+ 95 - 149
src/views/product-material/supply/priceMaintenance.vue

@@ -75,9 +75,11 @@
         :visible.sync="open"
         v-if="open"
         width="50%"
+        top="60px"
       >
         <add-supply-price
           :form="form"
+          :supplySelectList="supplySelectList"
           @submit="handleSubmit"
           @cancel="handleCancel"
           ref="addSupplyPrice"
@@ -192,7 +194,9 @@
 import test from "@/components/form-test/index.vue";
 import query from "@/components/query/index.vue";
 
-import * as API from "@/api/product-material/product/index.js";
+import { supplySelect } from "@/api/product-material/supply/index.js";
+import * as API from "@/api/product-material/supply/priceMaintenance.js";
+
 import addSupplyPrice from "./addSupplyPrice.vue";
 
 export default {
@@ -203,12 +207,18 @@ export default {
   },
   data() {
     return {
+      supplySelectList: [],
+      productTypeList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
         keyword: "",
-        tdaApplicationId: "",
-        tdaProductId: "",
+        supplierId: "",
+        materialId: "",
+        supplierName: "",
+        materialName: "",
+        materialCode: "",
+        materialType: "",
       },
       btnForm: {
         otherButton: {
@@ -248,135 +258,46 @@ export default {
         },
       ],
       queryDialog: false,
-      tableList: [{}],
+      tableList: [],
       loading: false,
-      total: 3,
+      total: null,
       open: false,
       titleText: "add",
       form: {
-        classifyId: "",
-        type: "",
-        code: "",
-        name: "",
-        unit: "",
-        introduce: "",
+        supplierId: "",
+        materialId: "",
+        price: "",
+        id: "",
       },
-      dialogForm: {
-        loadingStatus: false,
+    };
+  },
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.productTypeList = businessDictData.find(
+      (item) => item.code === "productType"
+    ).children;
+    this.selectConfig[0].data = this.productTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
 
-        name: {
-          label: this.$t("product_material.supply.supplyName"),
-          type: "input",
-        },
-        goodCode: {
-          span: 2,
-          label: this.$t("product_material.supply.priceMaintenance.goodCode"),
-          type: "input",
-        },
-        goodName: {
-          label: this.$t("product_material.supply.priceMaintenance.goodName"),
-          type: "input",
-        },
-        type: {
-          label: this.$t("product_material.supply.priceMaintenance.goodType"),
-          type: "select",
-          span: 2,
-          labelName: "labelName",
-          keyName: "keyName",
-          data: [],
-        },
-        supplyPrice: {
-          label: this.$t(
-            "product_material.supply.priceMaintenance.supplyPrice"
-          ),
-          type: "input",
-        },
+    this.supplyTypeList = businessDictData.find(
+      (item) => item.code === "supplyType"
+    ).children;
 
-        otherButton: {
-          align: "center",
-          list: [
-            {
-              name: this.$t("cancelText"),
-              methodsText: "cancel",
-              cancel: () => {
-                this.$refs.form.reset();
-                this.open = false;
-              },
-            },
-            {
-              name: this.$t("submitText"),
-              methodsText: "submit",
-              type: "primary",
-              submit: () => {
-                this.handleSubmit();
-              },
-            },
-          ],
-        },
-      },
-      dialogRules: {
-        name: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "blur",
-          },
-        ],
-        goodName: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "blur",
-          },
-        ],
-        supplyPrice: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "blur",
-          },
-        ],
-        goodCode: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "blur",
-          },
-        ],
-        type: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "change",
-          },
-        ],
-        goodType: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.supply.priceMaintenance.supplyPrice"
-            ),
-            trigger: "change",
-          },
-        ],
-      },
-    };
+    this.selectConfig[1].data = this.supplyTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+
+    supplySelect({ name: "", type: "", code: "" }).then((res) => {
+      this.supplySelectList = res.data.data;
+    });
+    this.getList();
   },
-  created() {},
   methods: {
-    handleQuery() {
-      this.getList();
-    },
     back() {
       this.$router.push({
         path: "/product-material/supply/index",
@@ -384,49 +305,74 @@ export default {
     },
     getList() {
       this.loading = true;
-      API.tdaDevicePage(this.queryParams).then(
+      API.supplyPriceList(this.queryParams).then(
         (res) => {
-          this.total = res.data.data.total;
           this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
           this.loading = false;
         },
         (err) => {
-          console.log("tdaDevicePage: " + err);
+          console.log("supplyPriceList: " + err);
           this.loading = false;
         }
       );
     },
+    handleQuery() {
+      this.getList();
+    },
     supplyPriceAdd() {
+      this.form = {
+        supplierId: "",
+        materialId: "",
+        price: "",
+        id: "",
+      };
       this.titleText = "add";
       this.open = true;
     },
+
+    handleCancel() {
+      this.form = {
+        supplierId: "",
+        materialId: "",
+        price: "",
+        id: "",
+      };
+      this.open = false;
+    },
     handleEdit(row) {
       this.titleText = "edit";
+      this.form = row;
       this.open = true;
     },
     handleSubmit() {
-      this.$refs.form.$refs["form"].validate((valid) => {
-        if (valid) {
-          this.dialogForm.loadingStatus = true;
-          API.tdaDeviceAdd(this.dialogParams).then(
-            () => {
-              this.msgSuccess(this.$t("addSuccess"));
-              this.open = false;
-              this.dialogForm.loadingStatus = false;
-              this.getList();
-            },
-            (err) => {
-              console.log("tdaDeviceAdd: " + err);
-              this.dialogForm.loadingStatus = false;
-            }
-          );
-          // } else {
-          //   setTimeout(() => {
-          //     const errorDiv = document.getElementsByClassName('is-error')
-          //     errorDiv[0].scrollIntoView()
-          //   }, 0)
-        }
-      });
+      if (!this.form.id) {
+        API.supplyPriceAdd(this.form).then(
+          () => {
+            this.msgSuccess(this.$t("addSuccess"));
+            this.$refs.addSupplyPrice.loading = false;
+            this.open = false;
+            this.getList();
+          },
+          (err) => {
+            console.log("supplyPriceAdd: " + err);
+            this.$refs.addSupplyPrice.loading = false;
+          }
+        );
+      } else {
+        API.supplyPriceEdit(this.form).then(
+          () => {
+            this.msgSuccess(this.$t("editSuccess"));
+            this.open = false;
+            this.$refs.addSupplyPrice.loading = false;
+            this.getList();
+          },
+          (err) => {
+            console.log("supplyPriceEdit: " + err);
+            this.$refs.addSupplyPrice.loading = false;
+          }
+        );
+      }
     },
     handleDelete(row) {
       this.$confirm(this.$t("askDeleteData"), {
@@ -434,7 +380,7 @@ export default {
         cancelButtonText: this.$t("cancelText"),
         type: "warning",
       }).then(() => {
-        API.tdaDeviceDelete({ id: row.id }).then(() => {
+        API.supplyPriceDel({ id: row.id }).then(() => {
           this.msgSuccess(this.$t("deleteSuccess"));
           this.getList();
         });

+ 18 - 14
src/views/product-material/warehouse/addWarehouse.vue

@@ -20,10 +20,10 @@
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in warehouseTypeList"
+                  :key="item.id"
+                  :label="item.dictValue"
+                  :value="item.dictKey"
                 >
                 </el-option>
               </el-select>
@@ -94,6 +94,10 @@ export default {
       type: Object,
       default: () => {},
     },
+    warehouseTypeList: {
+      type: Array,
+      default: () => [],
+    },
   },
   data() {
     return {
@@ -113,15 +117,15 @@ export default {
             trigger: "change",
           },
         ],
-        warehouseKeeperId: [
-          {
-            required: true,
-            message: this.$t(
-              "product_material.warehouse.warehouseKeeperIdRules"
-            ),
-            trigger: "change",
-          },
-        ],
+        // warehouseKeeperId: [
+        //   {
+        //     required: true,
+        //     message: this.$t(
+        //       "product_material.warehouse.warehouseKeeperIdRules"
+        //     ),
+        //     trigger: "change",
+        //   },
+        // ],
 
         name: [
           {
@@ -154,6 +158,6 @@ export default {
   height: calc(100vh - 280px);
   overflow: auto;
   box-sizing: border-box;
-  padding: 5px;
+  padding: 10px;
 }
 </style>

+ 47 - 27
src/views/product-material/warehouse/index.vue

@@ -18,22 +18,23 @@
       <el-table-column
         :label="$t('product_material.warehouse.warehouseType')"
         align="center"
-        prop="productName"
+        prop="type"
+        :formatter="(row) => dictDataEcho(row.type, warehouseTypeList)"
       />
       <el-table-column
         :label="$t('product_material.warehouse.warehouseName')"
         align="center"
-        prop="applicationName"
+        prop="name"
       />
       <el-table-column
         :label="$t('product_material.warehouse.storekeeper')"
         align="center"
-        prop="storekeeper"
+        prop="warehouseKeeperId"
       />
       <el-table-column
         :label="$t('product_material.warehouse.warehouseDescription')"
         align="center"
-        prop="applicationName"
+        prop="remarks"
       />
 
       <el-table-column :label="$t('operation')" align="center" width="120">
@@ -69,6 +70,7 @@
     >
       <add-warehouse
         :form="form"
+        :warehouseTypeList="warehouseTypeList"
         @submit="handleSubmit"
         @cancel="handleCancel"
         ref="addWarehouse"
@@ -82,7 +84,7 @@ import test from "@/components/form-test/index.vue";
 import query from "@/components/query/index.vue";
 import addWarehouse from "./addWarehouse.vue";
 
-import * as API from "@/api/product-material/product/index.js";
+import * as API from "@/api/product-material/warehouse/index.js";
 export default {
   components: {
     test,
@@ -91,14 +93,12 @@ export default {
   },
   data() {
     return {
+      warehouseTypeList: [],
       selectConfig: [
         {
           label: this.$t("product_material.warehouse.warehouseType"),
           prop: "type",
-          data: [
-            { label: "半成品", value: 0 },
-            { label: "成品", value: 1 },
-          ],
+          data: [],
         },
       ],
       queryParams: {
@@ -134,22 +134,30 @@ export default {
       },
     };
   },
-  created() {},
+  created() {
+    const businessDictData = JSON.parse(
+      window.localStorage.getItem("businessDict")
+    );
+    this.warehouseTypeList = businessDictData.find(
+      (item) => item.code === "warehouseType"
+    ).children;
+    this.selectConfig[0].data = this.warehouseTypeList.map((item) => ({
+      label: item.dictValue,
+      value: item.dictKey,
+    }));
+    this.getList();
+  },
   methods: {
-    handleEdit(row) {
-      this.titleText = "edit";
-      this.open = true;
-    },
     getList() {
       this.loading = true;
-      API.tdaDevicePage(this.queryParams).then(
+      API.warehouseList(this.queryParams).then(
         (res) => {
-          this.total = res.data.data.total;
           this.tableList = res.data.data.records;
+          this.total = res.data.data.total;
           this.loading = false;
         },
         (err) => {
-          console.log("tdaDevicePage: " + err);
+          console.log("warehouseList: " + err);
           this.loading = false;
         }
       );
@@ -173,31 +181,43 @@ export default {
       };
       this.open = false;
     },
+    handleEdit(row) {
+      this.titleText = "edit";
+      this.open = true;
+      this.$nextTick(() => {
+        this.$refs.addWarehouse.loading = true;
+        API.warehouseDetails({ id: row.id }).then((res) => {
+          this.form = res.data.data;
+          this.form.type = this.form.type + "";
+          this.$refs.addWarehouse.loading = false;
+        });
+      });
+    },
     handleSubmit() {
-      if (this.form.id) {
-        API.materialAdd(this.form).then(
+      if (!this.form.id) {
+        API.warehouseAdd(this.form).then(
           () => {
             this.msgSuccess(this.$t("addSuccess"));
-            this.$refs.addProduct.loading = false;
+            this.$refs.addWarehouse.loading = false;
             this.open = false;
             this.getList();
           },
           (err) => {
-            console.log("materialAdd: " + err);
-            this.$refs.addProduct.loading = false;
+            console.log("warehouseAdd: " + err);
+            this.$refs.addWarehouse.loading = false;
           }
         );
       } else {
-        API.materialEdit(this.form).then(
+        API.warehouseEdit(this.form).then(
           () => {
             this.msgSuccess(this.$t("editSuccess"));
             this.open = false;
-            this.$refs.addProduct.loading = false;
+            this.$refs.addWarehouse.loading = false;
             this.getList();
           },
           (err) => {
-            console.log("materialEdit: " + err);
-            this.$refs.addProduct.loading = false;
+            console.log("warehouseEdit: " + err);
+            this.$refs.addWarehouse.loading = false;
           }
         );
       }
@@ -208,7 +228,7 @@ export default {
         cancelButtonText: this.$t("cancelText"),
         type: "warning",
       }).then(() => {
-        API.tdaDeviceDelete({ id: row.id }).then(() => {
+        API.warehouseDel({ id: row.id }).then(() => {
           this.msgSuccess(this.$t("deleteSuccess"));
           this.getList();
         });