Эх сурвалжийг харах

产品维护增加标签功能、移交产品功能

cz 2 жил өмнө
parent
commit
c222b44292

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

@@ -93,3 +93,69 @@ export function productDel(data = {}) {
   })
 }
 
+
+// 产品标签列表 
+export function getTagList(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productTag/tagMap',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 产品标签添加
+export function addTag(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productTag/add',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 产品标签编辑
+export function editTag(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productTag/edit',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 产品标签删除
+export function delTag(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productTag/delete',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 产品标签对象 
+export function getTagMap(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productTag/distinctTagNameList',
+    method: 'post',
+    data: data,
+  })
+}
+
+
+// 移交 
+export function moveProduct(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productInfo/submitTransferRequest',
+    method: 'post',
+    data: data,
+  })
+}
+
+// 接收 
+export function receiveProduct(data = {}) {
+  return request({
+    url: '/api/victoriatourist/productInfo/submitTransfer',
+    method: 'post',
+    data: data,
+  })
+}
+
+

+ 17 - 1
src/views/inbound-outbound/arrivalInspection/addInspection.vue

@@ -44,7 +44,6 @@
             </el-table-column>
             <el-table-column label="待质检数量" prop="totalQuantity">
             </el-table-column>
-
             <el-table-column label="质检合格" prop="qualifiedQuantity">
               <template slot-scope="scope">
                 <el-form-item
@@ -85,6 +84,23 @@
                 </el-form-item>
               </template>
             </el-table-column>
+            <el-table-column label="备注" prop="remark">
+              <template slot-scope="scope">
+                <el-form-item
+                  :prop="'changeProductList.' + scope.$index + '.remark'"
+                  :rules="formRules.remark"
+                  :inline-message="true"
+                  label-width="0"
+                >
+                  <el-input
+                    v-model="scope.row.remark"
+                    placeholder="请输入"
+                    size="mini"
+                  >
+                  </el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
           </el-table>
         </el-form-item>
       </el-form>

+ 198 - 218
src/views/product-material/product/index.vue

@@ -22,7 +22,11 @@
               }
             "
           ></query>
-          <el-table :data="tableList" v-loading="loading">
+          <el-table
+            :data="tableList"
+            v-loading="loading"
+            @filter-change="filterChange"
+          >
             <el-table-column
               label="产品类型"
               align="left"
@@ -90,12 +94,56 @@
             />
 
             <el-table-column
+              label="标签"
+              align="left"
+              width="200"
+              column-key="product"
+              :filters="nameList"
+            >
+              <template slot-scope="scope">
+                <div
+                  style="height: 8px"
+                  v-if="scope.row.tagNames && scope.row.tagNames.length > 0"
+                ></div>
+
+                <el-tooltip
+                  class="item"
+                  effect="dark"
+                  content="编辑标签"
+                  placement="bottom"
+                >
+                  <i
+                    style="padding: 0 5px; font-size: 14px; cursor: pointer"
+                    class="el-icon-edit-outline"
+                    @click="editLabel(scope.row)"
+                  ></i>
+                </el-tooltip>
+                <el-tag
+                  type="success"
+                  size="small"
+                  style="margin-left: 8px; margin-bottom: 8px"
+                  v-for="(item, index) in scope.row.tagNames"
+                  :key="index"
+                  >{{ item.tagName }}</el-tag
+                >
+              </template>
+            </el-table-column>
+            <el-table-column
               label="操作"
               align="center"
-              width="120"
+              width="180"
               fixed="right"
             >
               <template slot-scope="scope">
+                <el-button type="text" @click="handleMove(scope.row)"
+                  >移交
+                </el-button>
+                <el-button
+                  type="text"
+                  v-if="scope.row.receiveFlag"
+                  @click="handleReceivee(scope.row)"
+                  >接收
+                </el-button>
                 <el-button type="text" @click="handleEdit(scope.row)"
                   >修改
                 </el-button>
@@ -132,206 +180,60 @@
           </el-dialog>
 
           <el-dialog
-            :title="$t('seniorQuery')"
-            v-if="queryDialog"
-            :visible.sync="queryDialog"
-            width="50%"
-            top="60px"
+            title="产品移交"
+            :visible.sync="openOne"
+            v-if="openOne"
+            width="40%"
+            top="20vh"
           >
-            <div class="search-box">
-              <el-form
-                :form="req"
-                label-position="top"
-                label-width="100px"
-                @submit.native.prevent
-              >
-                <el-form-item
-                  :label="$t('product_material.product.productType')"
-                >
-                  <el-radio-group v-model="req.type">
-                    <el-radio-button label="">
-                      {{ $t("product_material.product.all") }}
-                    </el-radio-button>
-                    <el-radio-button
-                      v-for="item in productTypeList"
-                      :key="item.id"
-                      :label="item.dictKey"
-                    >
-                      {{ item.dictValue }}</el-radio-button
-                    >
-                  </el-radio-group>
-                </el-form-item>
-                <el-row :gutter="10">
-                  <el-col :span="6">
-                    <el-form-item
-                      :label="$t('product_material.product.productCode')"
-                    >
-                      <el-input
-                        v-model="req.code"
-                        placeholder="请输入"
-                      ></el-input>
-                    </el-form-item>
-                  </el-col>
-                  <el-col :span="18">
-                    <el-form-item
-                      :label="$t('product_material.product.productName')"
-                    >
-                      <el-input
-                        v-model="req.name"
-                        placeholder="请输入"
-                      ></el-input>
-                    </el-form-item>
-                  </el-col>
-                </el-row>
-                <el-form-item
-                  :label="$t('product_material.product.combination')"
-                >
-                  <el-radio-group v-model="req.combination">
-                    <el-radio-button label="">
-                      {{ $t("product_material.product.all") }}</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>
-                <el-row>
-                  <el-col :span="8">
-                    <el-form-item
-                      :label="$t('product_material.product.deptId')"
-                    >
-                      <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')"
-                >
-                  <el-row>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.jdPurchasePriceMin"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                    <el-col :span="2" style="text-align: center"> ~ </el-col>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.jdPurchasePriceMax"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                  </el-row>
-                </el-form-item>
-                <el-form-item
-                  :label="$t('product_material.product.sellingPrice')"
-                >
-                  <el-row>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.sellingPriceMin"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                    <el-col :span="2" style="text-align: center"> ~ </el-col>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.sellingPriceMax"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                  </el-row>
-                </el-form-item>
-                <el-form-item
-                  :label="$t('product_material.product.purchasePrice')"
-                >
-                  <el-row>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.purchasePriceMin"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                    <el-col :span="2" style="text-align: center"> ~ </el-col>
-                    <el-col :span="4">
-                      <el-form-item label-width="0px">
-                        <el-input
-                          v-model="req.purchasePriceMax"
-                          placeholder="请输入"
-                        ></el-input>
-                      </el-form-item>
-                    </el-col>
-                  </el-row>
-                </el-form-item>
-                <el-form-item :label="$t('product_material.product.lifeCycle')">
-                  <el-radio-group v-model="req.lifeCycle">
-                    <el-radio-button label="">
-                      {{ $t("product_material.product.all") }}</el-radio-button
-                    >
-                    <el-radio-button label="1">
-                      {{
-                        $t("product_material.product.newProductsExpectedSales")
-                      }}</el-radio-button
-                    >
-                    <el-radio-button label="2">
-                      {{
-                        $t("product_material.product.growUpExpectedSales")
-                      }}</el-radio-button
-                    >
-                    <el-radio-button
-                      :label="
-                        $t('product_material.product.matureExpectedSales')
-                      "
-                      name="3"
-                    ></el-radio-button>
-                  </el-radio-group>
-                </el-form-item>
-                <el-form-item
-                  :label="$t('product_material.product.clearancePeriod')"
+            <el-form
+              ref="moveForm"
+              :model="moveForm"
+              :rules="moveRules"
+              label-width="80px"
+            >
+              <el-form-item label="移交部门" prop="transferDetpId">
+                <el-cascader
+                  v-model="moveForm.transferDetpId"
+                  :options="deptList"
+                  :props="{
+                    expandTrigger: 'hover',
+                    value: 'id',
+                    label: 'deptName',
+                  }"
+                  style="width: 100%"
+                  @change="handleDeptChange"
+                ></el-cascader>
+              </el-form-item>
+              <!-- <el-form-item label="移交备注" prop="remarks">
+                <el-input
+                  v-model="moveForm.code"
+                  type="textarea"
+                  size="mini"
+                  placeholder="请输入"
+                ></el-input>
+              </el-form-item> -->
+              <div style="text-align: center; margin-top: 15px">
+                <el-button size="small" @click="moveCancel">取消 </el-button>
+                <el-button type="primary" size="small" @click="moveSubmit">
+                  确定</el-button
                 >
-                  <el-date-picker
-                    v-model="timeArr"
-                    type="daterange"
-                    range-separator="-"
-                    value-format="yyyy-MM-dd"
-                    start-placeholder="开始日期"
-                    end-placeholder="结束日期"
-                    @change="handleDateChange"
-                  >
-                  </el-date-picker>
-                </el-form-item>
-              </el-form>
-            </div>
-            <div style="text-align: center; margin-top: 15px">
-              <el-button size="small" @click="handleReset"
-                >{{ $t("reset") }}
-              </el-button>
-              <el-button type="primary" size="small" @click="handleQuery">
-                确定</el-button
-              >
-            </div>
+              </div>
+            </el-form>
+          </el-dialog>
+
+          <el-dialog
+            title="编辑标签"
+            v-if="openEditorLabel"
+            :visible.sync="openEditorLabel"
+            width="30%"
+            append-to-body
+          >
+            <product-label
+              :rowData="rowData"
+              @clickCancel="clickCancelLabel"
+              @update="handleTagUpdate"
+            ></product-label>
           </el-dialog>
         </el-card>
       </el-col>
@@ -343,6 +245,7 @@
 import addProduct from "./addProduct.vue";
 import query from "@/components/query/index.vue";
 import tree from "./tree.vue";
+import productLabel from "./productLabel.vue";
 
 import byTable from "@/components/by-table/index.js";
 import test from "@/components/form-test/index.vue";
@@ -358,6 +261,7 @@ export default {
     byTable,
     test,
     addProduct,
+    productLabel,
     query,
   },
   data() {
@@ -389,6 +293,7 @@ export default {
         endTime: null,
         productSpuId: "",
         definition: "2",
+        tagNameList: [], //标签集合名称,2023-2-21新增
       },
       tableList: [],
       total: 0,
@@ -436,6 +341,22 @@ export default {
       queryDialog: false,
       timeArr: [],
       fileData: {},
+      openOne: false,
+      moveForm: {
+        transferDetpId: "",
+        id: "",
+      },
+      moveRules: {
+        transferDetpId: [
+          {
+            required: true,
+            message: "请选择移交部门",
+            trigger: "change",
+          },
+        ],
+      },
+      openEditorLabel: false,
+      nameList: [],
     };
   },
   created() {
@@ -447,6 +368,9 @@ export default {
         console.log("getDeptData:" + err);
       }
     );
+    API.getTagMap().then((res) => {
+      this.nameList = res.data.data.map((x) => ({ text: x, value: x }));
+    });
     const businessDictData = JSON.parse(
       window.localStorage.getItem("businessDict")
     );
@@ -515,6 +439,7 @@ export default {
         warehouseId: "",
         definition: "2",
         fileInfoList: [],
+        tagNameList: [],
       };
       this.timeArr = [];
       this.getList();
@@ -529,22 +454,24 @@ export default {
           this.tableList = res.data.data.records;
           this.total = res.data.data.total;
           this.loading = false;
+          const arr = this.tableList.map((x) => x.id);
+          API.getTagList(arr).then((res) => {
+            for (let i = 0; i < this.tableList.length; i++) {
+              for (let key in res.data.data) {
+                if (this.tableList[i].id === key) {
+                  this.tableList[i].tagNames = res.data.data[key];
+                }
+              }
+            }
+            this.$forceUpdate();
+          });
         },
         (err) => {
           console.log("productList: " + err);
           this.loading = false;
         }
       );
-      // API.productCount(this.req).then(
-      //   (res) => {
-      //     this.total = res.data.data.count;
-      //   },
-      //   (err) => {
-      //     console.log("productCount: " + err);
-      //   }
-      // );
     },
-
     handleCancel() {
       this.open = false;
     },
@@ -583,7 +510,6 @@ export default {
         if (file.data.data.length > 0) {
           this.fileData = file.data.data[0];
         }
-
         if (row.combination === 1) {
           this.$nextTick(() => {
             this.$refs.addProduct.loading = true;
@@ -659,14 +585,7 @@ export default {
         );
       }
     },
-    showType(row) {
-      const current = this.productTypeList.find(
-        (item) => item.dictKey == row.type
-      );
-      if (current) {
-        return current.dictValue;
-      }
-    },
+
     showCycleSales(row) {
       if (row.lifeCycle) {
         switch (row.lifeCycle) {
@@ -689,6 +608,67 @@ export default {
       }
       return row.name;
     },
+
+    editLabel(row) {
+      this.rowData = row;
+      this.openEditorLabel = true;
+    },
+    clickCancelLabel() {
+      this.openEditorLabel = false;
+    },
+    handleTagUpdate() {
+      this.handleQuery();
+      API.getTagMap().then((res) => {
+        this.nameList = res.data.data.map((x) => ({ text: x, value: x }));
+      });
+    },
+    filterChange(val) {
+      if (val.product) {
+        this.req.tagNameList = val.product;
+        this.getList();
+      }
+    },
+    handleMove(row) {
+      this.openOne = true;
+      this.moveForm = {
+        id: row.id,
+        transferDetpId: "",
+      };
+    },
+    handleDeptChange() {
+      this.moveForm.transferDetpId =
+        this.moveForm.transferDetpId[this.moveForm.transferDetpId.length - 1];
+    },
+    moveSubmit() {
+      this.$refs.moveForm.validate((valid) => {
+        if (valid) {
+          API.moveProduct(this.moveForm).then(() => {
+            this.msgSuccess("移交成功");
+            this.openOne = false;
+            this.getList();
+          });
+        }
+      });
+    },
+    handleReceivee(row) {
+      this.$confirm("请问是否确认接收 ?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          API.receiveProduct({ id: row.id }).then(() => {
+            this.msgSuccess("接收成功");
+            this.getList();
+          });
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    moveCancel() {
+      this.openOne = false;
+    },
   },
 };
 </script>

+ 170 - 0
src/views/product-material/product/productLabel.vue

@@ -0,0 +1,170 @@
+<template>
+  <div
+    v-loading="loadingStatus"
+    element-loading-text="提交数据中,请稍后"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.2)"
+  >
+    <el-form
+      ref="ruleForm"
+      :model="form"
+      :rules="formRules"
+      label-width="90px"
+      @submit.native.prevent
+    >
+      <el-row>
+        <el-col :span="18">
+          <el-form-item label="标签名称:" prop="tagName">
+            <el-autocomplete
+              v-model="form.tagName"
+              :fetch-suggestions="getPayeeList"
+              size="small"
+              style="width: 100%"
+              class="inline-input"
+              placeholder="请输入标签名称"
+              @keyup.enter.native="clickAdd"
+            >
+            </el-autocomplete>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6" style="text-align: center">
+          <el-button type="primary" size="small" @click="clickAdd" v-db-click
+            >添加</el-button
+          >
+        </el-col>
+      </el-row>
+      <el-table
+        :data="tableList"
+        :cell-style="{ padding: '0' }"
+        :row-style="{ height: '35px' }"
+        header-row-class-name="tableHeader"
+      >
+        <el-table-column label="标签名称" prop="tagName" />
+        <el-table-column label="操作" align="center" width="80">
+          <template slot-scope="scope">
+            <el-button type="text" @click="handleDelete(scope.row)" v-db-click
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="padding-top: 16px; text-align: center">
+        <el-button type="primary" size="small" @click="clickSubmit" v-db-click
+          >确 定</el-button
+        >
+        <el-button
+          style="margin-left: 16px !important"
+          size="small"
+          @click="clickCancel"
+          >取 消</el-button
+        >
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import * as API from "@/api/product-material/product/index.js";
+
+export default {
+  name: "ProductLabel",
+  props: {
+    rowData: Object,
+  },
+  data() {
+    return {
+      loadingStatus: false,
+      nameList: [],
+      tableList: [],
+      form: {
+        productInfoId: "",
+        tagName: "",
+      },
+      formRules: {
+        tagName: [
+          {
+            required: true,
+            message: "请输入标签名称",
+            trigger: ["blur", "change"],
+          },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getTag();
+    API.getTagMap().then((res) => {
+      this.nameList = res.data.data.map((x) => ({ value: x }));
+    });
+  },
+  mounted() {},
+  watch: {},
+  methods: {
+    getTag() {
+      this.loadingStatus = true;
+      API.getTagList([this.rowData.id]).then((res) => {
+        this.tableList = res.data.data[this.rowData.id];
+        this.loadingStatus = false;
+      });
+    },
+    getPayeeList(queryString, cb) {
+      let restaurants = this.nameList;
+      let results = queryString
+        ? restaurants.filter(this.createFilter(queryString))
+        : restaurants;
+      // 调用 callback 返回建议列表的数据
+      cb(results);
+    },
+    createFilter(queryString) {
+      return (restaurant) => {
+        return (
+          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
+          0
+        );
+      };
+    },
+    clickAdd() {
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          this.loadingStatus = true;
+          const data = {
+            productInfoId: this.rowData.id,
+            tagName: this.form.tagName,
+          };
+          API.addTag(data).then(
+            () => {
+              this.msgSuccess("保存完成");
+              this.getTag();
+              this.$emit("update");
+              this.form = {
+                productInfoId: "",
+                tagName: "",
+              };
+              this.loadingStatus = false;
+            },
+            (err) => {
+              console.log("addTag : " + err);
+              this.loadingStatus = false;
+            }
+          );
+        }
+      });
+    },
+    handleDelete(row) {
+      API.delTag({ id: row.id }).then(() => {
+        this.msgSuccess("删除成功!");
+        this.$emit("update");
+        this.getTag();
+      });
+    },
+    clickSubmit() {
+      this.$emit("clickCancel", true);
+    },
+    clickCancel() {
+      this.$emit("clickCancel", true);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>