瀏覽代碼

2022-08-25 23:02

王克恕 2 年之前
父節點
當前提交
9b0b9d0e78
共有 1 個文件被更改,包括 718 次插入701 次删除
  1. 718 701
      imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/goods/goodsManage/formula.vue

+ 718 - 701
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/goods/goodsManage/formula.vue

@@ -1,701 +1,718 @@
-<template>
-  <el-dialog
-    :close-on-click-modal="false"
-    :close-on-press-escape="true"
-    :title="title"
-    :type="type"
-    :visible.sync="isVisible"
-    :width="width"
-    top="50px">
-    <div class="dialog-footer" slot="footer">
-      <el-button @click="isVisible = false" plain type="warning">
-        {{ $t("common.cancel") }}
-      </el-button>
-      <el-button @click="submitForm" plain type="primary">
-        {{ $t("common.confirm") }}
-      </el-button>
-    </div>
-
-    <el-form :model="productConfig" :rules="rules" label-position="left" label-width="100px" ref="form">
-
-<!--      <el-form-item :label="$t('bt.productConfig.productType')" prop="pcType">-->
-<!--        <el-select v-model="productConfig.pcType" placeholder="请选择" size="small">-->
-<!--          <el-option-->
-<!--            v-for="item in pcTypeOpt"-->
-<!--            :key="item.value"-->
-<!--            :label="item.label"-->
-<!--            :value="item.value">-->
-<!--          </el-option>-->
-<!--        </el-select>-->
-<!--      </el-form-item>-->
-
-<!--      <el-form-item :label="$t('bt.productConfig.productTime')" prop="pcTime">-->
-<!--        <el-input v-model="productConfig.pcTime" controls-position="right"></el-input>-->
-<!--      </el-form-item>-->
-
-
-      <!--      配方-->
-      <!--      prop="formula" v-model="productConfig.formula"-->
-      <!--      <el-form-item :label="$t('bt.productConfig.formula')">-->
-      <!--                      <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddFormula">配方设置</el-button>-->
-      <!--              <el-button type="success" icon="el-icon-delete" size="mini" @click="handleDeleteSpec">删除</el-button>-->
-      <!--              <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteAllDetails">清空</el-button>-->
-      <!--        <el-table-->
-      <!--          v-loading="loading"-->
-      <!--          border-->
-      <!--          :data="productConfig.formula"-->
-      <!--          :row-class-name="rowClassName"-->
-      <!--          @selection-change="handleSelectionChange"-->
-      <!--          ref="table"-->
-      <!--        >-->
-
-      <!--          <el-table-column label="原料名称" align="center" prop="formulaMtId">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;原料名称-->
-      <!--              </p>-->
-      <!--            </template>-->
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item-->
-      <!--                :prop="'formula'+scope.$index+'formulaMtId'"-->
-      <!--              >-->
-      <!--                <el-select-->
-      <!--                  v-model="scope.row.formulaMtId"-->
-      <!--                  filterable-->
-      <!--                  placeholder="请选择原料"-->
-      <!--                  @change="-->
-      <!--                    fillMaterial(val,scope.$index)-->
-      <!--                  "-->
-      <!--                >-->
-      <!--                  <el-option-->
-      <!--                    v-for="item in materialData"-->
-      <!--                    :key="item.id"-->
-      <!--                    :label="item.mtName"-->
-      <!--                    :value="item.id"-->
-      <!--                  >-->
-      <!--                  </el-option>-->
-      <!--                </el-select>-->
-      <!--              </el-form-item>-->
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-
-      <!--          <el-table-column label="类型" align="center" width="60" :prop="'formula'+scope.$index+'formulaMtType'">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;类型-->
-      <!--              </p>-->
-      <!--            </template>-->
-
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaMtType'"-->
-      <!--              >-->
-      <!--                <el-input v-model="scope.row.formulaMtType" disabled></el-input>-->
-      <!--              </el-form-item>-->
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-
-      <!--          <el-table-column label="配量" align="center" :prop="'formula'+scope.$index+'formulaMtType'">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;配量-->
-      <!--              </p>-->
-      <!--            </template>-->
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item prop="productConfig.formula[scope.$index].formulaMtQuantity">-->
-      <!--                <el-input-number v-model="productConfig.formula[scope.$index].formulaMtQuantity"></el-input-number>-->
-      <!--              </el-form-item>-->
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-
-      <!--          <el-table-column label="单位" align="center" width="60" prop="formulaMtUnit">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;单位-->
-      <!--              </p>-->
-      <!--            </template>-->
-
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaMtUnit'">-->
-      <!--                <el-input v-model="scope.row.formulaMtUnit" disabled></el-input>-->
-      <!--              </el-form-item>-->
-
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-
-      <!--          <el-table-column label="是否加热" align="center" width="150" prop="formulaIsHot">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;是否加热-->
-      <!--              </p>-->
-      <!--            </template>-->
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaIsHot'">-->
-      <!--                <el-radio v-model="scope.row.formulaIsHot" label="1">是</el-radio>-->
-      <!--                <el-radio v-model="scope.row.formulaIsHot" label="0">否</el-radio>-->
-      <!--              </el-form-item>-->
-
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-
-      <!--          <el-table-column label="权重" align="center" width="60" prop="formulaWeight">-->
-      <!--            <template slot="header">-->
-      <!--              <p>-->
-      <!--                <span style="color: red; font-size: 16px">*</span-->
-      <!--                >&nbsp;权重-->
-      <!--              </p>-->
-      <!--            </template>-->
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaWeight'">-->
-      <!--                <el-input v-model="scope.row.formulaWeight" type="number"></el-input>-->
-      <!--              </el-form-item>-->
-
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-      <!--          <el-table-column label="操作" align="center">-->
-      <!--            <template slot-scope="scope">-->
-      <!--              <el-button icon="el-icon-plus" type="primary" circle-->
-      <!--                         @click.prevent="addFormula()"></el-button>-->
-
-      <!--              <el-button icon="el-icon-delete" type="danger" circle-->
-      <!--                         @click.prevent="delFormula(scope.$index)"></el-button>-->
-      <!--            </template>-->
-      <!--          </el-table-column>-->
-      <!--        </el-table>-->
-      <!--      </el-form-item>-->
-
-
-      <el-table
-        v-loading="loading"
-        border
-        :data="productConfig.formula"
-        :row-class-name="rowClassName"
-        @selection-change="handleSelectionChange"
-        ref="table"
-      >
-
-        <el-table-column label="原料名称" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;原料名称
-            </p>
-          </template>
-          <template slot-scope="scope">
-            <el-form-item
-              :prop="'formula.'+scope.$index+'.formulaMtId'" :rules="rules.formulaMtId"
-
-            >
-              <el-select
-                v-model="scope.row.formulaMtId"
-                filterable
-                placeholder="请选择原料"
-                @change="(val)=>{ fillMaterial(val,scope.$index)}"
-              >
-                <el-option
-                  v-for="item in materialData"
-                  :key="item.id"
-                  :label="item.mtName"
-                  :value="item.id"
-                >
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="类型" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;类型
-            </p>
-          </template>
-
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtType'"
-            >
-              <el-input v-model="scope.row.formulaMtType" disabled></el-input>
-            </el-form-item>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="配量" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;配量
-            </p>
-          </template>
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtQuantity'" :rules="rules.formulaMtQuantity">
-              <el-input-number v-model="scope.row.formulaMtQuantity"></el-input-number>
-            </el-form-item>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="单位" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;单位
-            </p>
-          </template>
-
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtUnit'">
-              <el-input v-model="scope.row.formulaMtUnit" disabled></el-input>
-            </el-form-item>
-
-          </template>
-        </el-table-column>
-
-        <el-table-column label="是否有操作动作" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;是否有操作动作
-            </p>
-          </template>
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaIsHot'" :rules="rules.formulaIsHot">
-              <el-radio v-model="scope.row.formulaIsHot" label="1">是</el-radio>
-              <el-radio v-model="scope.row.formulaIsHot" label="0">否</el-radio>
-            </el-form-item>
-
-          </template>
-        </el-table-column>
-
-        <el-table-column label="时间(s)" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;时间(s)
-            </p>
-          </template>
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtQuantity'" :rules="rules.formulaMtQuantity">
-              <el-input-number v-model="scope.row.formulaMtQuantity"></el-input-number>
-            </el-form-item>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="权重" align="center">
-          <template slot="header">
-            <p>
-                      <span style="color: red; font-size: 16px">*</span
-                      >&nbsp;权重
-            </p>
-          </template>
-          <template slot-scope="scope">
-            <el-form-item :prop="'formula.'+scope.$index+'.formulaWeight'">
-              <el-input v-model="scope.row.formulaWeight" type="number"></el-input>
-            </el-form-item>
-
-          </template>
-        </el-table-column>
-        <el-table-column label="操作" align="center">
-          <template slot-scope="scope">
-            <el-button icon="el-icon-plus" type="primary" circle
-                       @click.prevent="addFormula()"></el-button>
-
-            <el-button icon="el-icon-delete" type="danger" circle
-                       @click.prevent="delFormula(scope.$index)"></el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-
-
-    </el-form>
-    {{ this.productConfig }}
-  </el-dialog>
-</template>
-<script>
-import GoodsApi from "@/api/goods/Goods.js";
-import {initDicts} from "@/utils/commons";
-import MaterialApi from "@/api/material"
-import ProductConfigApi from "@/api/ProductConfig"
-import Select from "@/views/zuihou/runManageCenter/planMgr/components/Plan";
-
-export default {
-  name: "formula",
-  components: {Select},
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false
-    },
-    type: {
-      type: String,
-      default: "addProductCfg"
-    },
-  },
-  data() {
-    return {
-      unitOptions: [{
-        value: '1',
-        label: '杯'
-      }, {
-        value: '2',
-        label: '个'
-      }, {
-        value: '3',
-        label: '件'
-      }, {
-        value: '4',
-        label: '包'
-      }, {
-        value: '5',
-        label: '份'
-      }],
-      pcTypeOpt: [{
-        value: '1',
-        label: '热饮'
-      }, {
-        value: '2',
-        label: '常温'
-      }, {
-        value: '3',
-        label: '冷饮'
-      }],
-      productConfig: this.initProductConfig(),
-      screenWidth: 0,
-      width: this.initWidth(),
-      rules: {
-        pcType:
-          {
-            required: true,
-            message: this.$t("rules.require"),
-            trigger: "blur"
-          },
-
-        pcTime: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        },
-
-        formulaMtId: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        },
-
-
-        formulaMtQuantity: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        },
-        formulaIsHot: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        },
-
-        formulaWeight: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        },
-
-
-      },
-      // filterText: '',
-      loading: false,
-      dicts:
-
-        {
-          NATION: {}
-          ,
-          POSITION_STATUS: {}
-          ,
-          EDUCATION: {}
-          ,
-        }
-      ,
-
-
-      saleTypeList: [{
-        value: '1',
-        label: '成品销售'
-      }, {
-        value: '2',
-        label: '生产型销售'
-      }],
-      checkedDetail:
-        [],
-      materialData:
-        [],
-
-    }
-      ;
-  },
-
-  created() {
-    // 加载【字典】
-    initDicts(['NATION'], this.dicts);
-  },
-  computed: {
-    isVisible: {
-      get() {
-        return this.dialogVisible;
-      },
-      set() {
-        this.close();
-        this.reset();
-      }
-    },
-    title() {
-      return this.type === "addProductCfg"
-        ? "配置工艺"
-        : "更改工艺";
-    }
-  },
-  watch: {},
-  mounted() {
-    window.onresize = () => {
-      return (() => {
-        this.width = this.initWidth();
-      })();
-    };
-    this.getMaterial()
-  },
-  methods: {
-    fillMaterial(val, index) {
-      console.log("待填充的material对象为" + JSON.stringify(val))
-      console.log("select的change方法,val="+val)
-      for (const mt of this.materialData) {
-        if (val == mt.id) {
-          this.productConfig.formula[index].formulaMtId = mt.id;
-          this.productConfig.formula[index].formulaMtName = mt.mtName;
-          this.productConfig.formula[index].formulaMtUnit = mt.mtUnit;
-          this.productConfig.formula[index].formulaMtType = mt.mtType;
-        }
-      }
-
-    },
-
-    addFormula() {
-      if (this.productConfig.formula == undefined) {
-        this.productConfig.formula = new Array();
-      }
-      this.productConfig.formula.push(
-        {
-          id: "",
-          formulaMtId: "",
-          formulaMtName: "",
-          formulaMtType: "",
-          formulaMtUnit: "",
-          formulaWeight: "",
-          formulaMtQuantity: "",
-        }
-      )
-    },
-
-    delFormula(index) {
-      console.log("lalalalal")
-      if (this.productConfig.formula[index].id && index > 0) {
-        //  删除配方
-        ProductConfigApi.delFormula({"formulaId": this.productConfig.formula[index].id}).then(res => {
-          res = res.data
-          if (res.isSuccess) {
-            this.$message({
-              message: this.$t("tips.deleteSuccess"),
-              type: "success"
-            });
-          }
-        })
-        this.productConfig.formula.splice(index, 1)
-
-      } else {
-        if (index > 0) {
-          console.log("开始删除")
-          this.productConfig.formula.splice(index, 1)
-        }
-      }
-    },
-
-    //单选框选中数据
-    handleSelectionChange(rows) {
-      rows.forEach(item => {
-        this.checkedDetail.push(item.index);
-      });
-    },
-
-    initProductConfig() {
-      return {
-        id: "",
-        pcType: "",
-        pcSpeId: "",
-        pcSepcName: "",
-        pcTime: "",
-        formula: [
-          {
-            id: "",
-            formulaMtId: "",
-            formulaMtName: "",
-            formulaMtType: "",
-            formulaMtQuantity: "",
-            formulaMtUnit: "",
-            formulaIsHot: "",
-            formulaWeight: "",
-
-          }
-        ],
-      };
-    },
-
-    setProCfg(val) {
-      console.log("setProCfg传参val=" + JSON.stringify(val))
-
-
-      if (val['isProCfg'] == '1') {
-        console.log("getPfg(specId)即将传参" + val['id'])
-        this.getPfg(val['id']);
-
-      }
-      console.log("else ,未配置")
-      this.productConfig.pcSpeId = val['id'];
-      this.productConfig.pcSepcName = val['specName'];
-
-    },
-
-
-    rowClassName({row, rowIndex}) {
-
-      row.index = rowIndex;
-    },
-
-
-    initWidth() {
-      this.screenWidth = document.body.clientWidth;
-      if (this.screenWidth < 991) {
-        return "90%";
-      } else if (this.screenWidth < 1400) {
-        return "60%";
-      } else {
-        return "1400px";
-      }
-    },
-
-    filterNode(value, data) {
-      if (!value) return true;
-      return data.label.indexOf(value) !== -1;
-    },
-
-    getMaterial() {
-      MaterialApi.getMaterial({}).then(res => {
-
-        res = res.data
-        if (res.isSuccess) {
-          this.materialData = res.data
-          console.log("原材料列表为"+JSON.stringify(this.materialData))
-
-        }
-      })
-    },
-    getPfg(specId) {
-      console.log("执行了gtpfg")
-      ProductConfigApi.getPfg({"pcSpeId": specId}).then(res => {
-        res = res.data
-        if (res.isSuccess) {
-          console.log("拿到了" + res.data)
-          this.productConfig = res.data
-        }
-      })
-    },
-
-
-    close() {
-      this.$emit("close");
-    },
-    reset() {
-      // 先清除校验,再清除表单,不然有奇怪的bug
-      console.log("执行了reset")
-      this.$refs.form.clearValidate();
-      this.$refs.form.resetFields();
-      this.productConfig = this.initProductConfig()
-      console.log("执行了" + "resetFilds")
-    },
-    submitForm() {
-      const vm = this;
-      this.$refs.form.validate(valid => {
-        if (valid) {
-          vm.editSubmit();
-        } else {
-          return false;
-        }
-      });
-    },
-    editSubmit() {
-      const vm = this;
-      if (vm.type === "editProductCfg") {
-        vm.update();
-      } else {
-        vm.save();
-      }
-    },
-
-
-    save() {
-      const vm = this;
-      console.log("保存的生产配置表数据" + JSON.stringify(this.productConfig))
-      if (this.productConfig.formula.length == 0 || this.productConfig.formula == null) {
-        alert("配方不可为空!")
-        return;
-      }
-      ProductConfigApi.save(this.productConfig).then(response => {
-        const res = response.data;
-        if (res.isSuccess) {
-          //更新配方的工艺配置状态
-          this.updatePfgStatus('1', res.data.id)
-          console.log("aaaaa" + JSON.stringify(res.data))
-          vm.isVisible = false;
-          vm.$message({
-            message: vm.$t("tips.createSuccess"),
-            type: "success"
-          });
-          vm.$emit("success");
-
-        }
-      });
-    },
-
-    updatePfgStatus(pfgStatus, pfgId) {
-      GoodsApi.updatePfgStatus({'isProCfg': pfgStatus, 'proCfgId': pfgId}).then(response => {
-        const res = response.data;
-        if (res.isSuccess) {
-          this.isVisible = false;
-          this.$message({
-            message: this.$t("tips.updateSuccess"),
-            type: "success"
-          });
-          this.$emit("success");
-        }
-      });
-
-    },
-
-
-    update() {
-      ProductConfigApi.updateConfig(this.productConfig).then(response => {
-        const res = response.data;
-        if (res.isSuccess) {
-          this.isVisible = false;
-          this.$message({
-            message: this.$t("tips.updateSuccess"),
-            type: "success"
-          });
-          this.$emit("success");
-        }
-      });
-    }
-  }
-};
-</script>
-<style lang="scss" scoped></style>
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="true"
+    :title="title"
+    :type="type"
+    :visible.sync="isVisible"
+    :width="width"
+    top="50px">
+    <div class="dialog-footer" slot="footer">
+      <el-button @click="isVisible = false" plain type="warning">
+        {{ $t("common.cancel") }}
+      </el-button>
+      <el-button @click="submitForm" plain type="primary">
+        {{ $t("common.confirm") }}
+      </el-button>
+    </div>
+
+    <el-form :model="productConfig" :rules="rules" label-position="left" ref="form">
+
+<!--      <el-form-item :label="$t('bt.productConfig.productType')" prop="pcType">-->
+<!--        <el-select v-model="productConfig.pcType" placeholder="请选择" size="small">-->
+<!--          <el-option-->
+<!--            v-for="item in pcTypeOpt"-->
+<!--            :key="item.value"-->
+<!--            :label="item.label"-->
+<!--            :value="item.value">-->
+<!--          </el-option>-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+
+<!--      <el-form-item :label="$t('bt.productConfig.productTime')" prop="pcTime">-->
+<!--        <el-input v-model="productConfig.pcTime" controls-position="right"></el-input>-->
+<!--      </el-form-item>-->
+
+
+      <!--      配方-->
+      <!--      prop="formula" v-model="productConfig.formula"-->
+      <!--      <el-form-item :label="$t('bt.productConfig.formula')">-->
+      <!--                      <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddFormula">配方设置</el-button>-->
+      <!--              <el-button type="success" icon="el-icon-delete" size="mini" @click="handleDeleteSpec">删除</el-button>-->
+      <!--              <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteAllDetails">清空</el-button>-->
+      <!--        <el-table-->
+      <!--          v-loading="loading"-->
+      <!--          border-->
+      <!--          :data="productConfig.formula"-->
+      <!--          :row-class-name="rowClassName"-->
+      <!--          @selection-change="handleSelectionChange"-->
+      <!--          ref="table"-->
+      <!--        >-->
+
+      <!--          <el-table-column label="原料名称" align="center" prop="formulaMtId">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;原料名称-->
+      <!--              </p>-->
+      <!--            </template>-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item-->
+      <!--                :prop="'formula'+scope.$index+'formulaMtId'"-->
+      <!--              >-->
+      <!--                <el-select-->
+      <!--                  v-model="scope.row.formulaMtId"-->
+      <!--                  filterable-->
+      <!--                  placeholder="请选择原料"-->
+      <!--                  @change="-->
+      <!--                    fillMaterial(val,scope.$index)-->
+      <!--                  "-->
+      <!--                >-->
+      <!--                  <el-option-->
+      <!--                    v-for="item in materialData"-->
+      <!--                    :key="item.id"-->
+      <!--                    :label="item.mtName"-->
+      <!--                    :value="item.id"-->
+      <!--                  >-->
+      <!--                  </el-option>-->
+      <!--                </el-select>-->
+      <!--              </el-form-item>-->
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+
+      <!--          <el-table-column label="类型" align="center" width="60" :prop="'formula'+scope.$index+'formulaMtType'">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;类型-->
+      <!--              </p>-->
+      <!--            </template>-->
+
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaMtType'"-->
+      <!--              >-->
+      <!--                <el-input v-model="scope.row.formulaMtType" disabled></el-input>-->
+      <!--              </el-form-item>-->
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+
+      <!--          <el-table-column label="配量" align="center" :prop="'formula'+scope.$index+'formulaMtType'">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;配量-->
+      <!--              </p>-->
+      <!--            </template>-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item prop="productConfig.formula[scope.$index].formulaMtQuantity">-->
+      <!--                <el-input-number v-model="productConfig.formula[scope.$index].formulaMtQuantity"></el-input-number>-->
+      <!--              </el-form-item>-->
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+
+      <!--          <el-table-column label="单位" align="center" width="60" prop="formulaMtUnit">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;单位-->
+      <!--              </p>-->
+      <!--            </template>-->
+
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaMtUnit'">-->
+      <!--                <el-input v-model="scope.row.formulaMtUnit" disabled></el-input>-->
+      <!--              </el-form-item>-->
+
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+
+      <!--          <el-table-column label="是否加热" align="center" width="150" prop="formulaIsHot">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;是否加热-->
+      <!--              </p>-->
+      <!--            </template>-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaIsHot'">-->
+      <!--                <el-radio v-model="scope.row.formulaIsHot" label="1">是</el-radio>-->
+      <!--                <el-radio v-model="scope.row.formulaIsHot" label="0">否</el-radio>-->
+      <!--              </el-form-item>-->
+
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+
+      <!--          <el-table-column label="权重" align="center" width="60" prop="formulaWeight">-->
+      <!--            <template slot="header">-->
+      <!--              <p>-->
+      <!--                <span style="color: red; font-size: 16px">*</span-->
+      <!--                >&nbsp;权重-->
+      <!--              </p>-->
+      <!--            </template>-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-form-item :prop="'formula'+scope.$index+'formulaWeight'">-->
+      <!--                <el-input v-model="scope.row.formulaWeight" type="number"></el-input>-->
+      <!--              </el-form-item>-->
+
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+      <!--          <el-table-column label="操作" align="center">-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-button icon="el-icon-plus" type="primary" circle-->
+      <!--                         @click.prevent="addFormula()"></el-button>-->
+
+      <!--              <el-button icon="el-icon-delete" type="danger" circle-->
+      <!--                         @click.prevent="delFormula(scope.$index)"></el-button>-->
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+      <!--        </el-table>-->
+      <!--      </el-form-item>-->
+
+			<!--  添加修改删除-->
+      <el-row class="filter-container">
+        <el-col>
+           <el-button icon="el-icon-plus" type="primary" @click.prevent="addFormula()"></el-button>
+        </el-col>
+      </el-row>
+      
+      <!-- 内容 -->
+      <el-table
+        v-loading="loading"
+        border
+        :data="productConfig.formula"
+        :row-class-name="rowClassName"
+        @selection-change="handleSelectionChange"
+        ref="table"
+      >
+
+        <el-table-column label="原料名称" align="center">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;原料名称
+            </div>
+          </template>
+          <template slot-scope="scope">
+            <el-form-item
+              :prop="'formula.'+scope.$index+'.formulaMtId'" :rules="rules.formulaMtId"
+
+            >
+              <el-select
+                v-model="scope.row.formulaMtId"
+                filterable
+                placeholder="请选择原料"
+                @change="(val)=>{ fillMaterial(val,scope.$index)}"
+              >
+                <el-option
+                  v-for="item in materialData"
+                  :key="item.id"
+                  :label="item.mtName"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="类型" align="center">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;类型
+            </div>
+          </template>
+
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtType'"
+            >
+	            {{ scope.row.formulaMtType === '1' ? $t("btMaterial.mtType.guti") : '' }}
+		          {{ scope.row.formulaMtType === '2' ? $t("btMaterial.mtType.yeti") : '' }}
+		          {{ scope.row.formulaMtType === '3' ? $t("btMaterial.mtType.fenmo") : '' }}
+		          {{ scope.row.formulaMtType === '4' ? $t("btMaterial.mtType.beizi") : '' }}
+		          {{ scope.row.formulaMtType === '5' ? $t("btMaterial.mtType.beigai") : '' }}
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="配量" align="center" width="195">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;配量
+            </div>
+          </template>
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtQuantity'" :rules="rules.formulaMtQuantity">
+              <el-input-number v-model="scope.row.formulaMtQuantity"></el-input-number>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="单位" align="center">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;单位
+            </div>
+          </template>
+
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtUnit'">
+              {{ scope.row.formulaMtUnit === '1' ? $t("btMaterial.mtUnit.g") : '' }}
+		          {{ scope.row.formulaMtUnit === '2' ? $t("btMaterial.mtUnit.ml") : '' }}
+		          {{ scope.row.formulaMtUnit === '3' ? $t("btMaterial.mtUnit.ge") : '' }}
+            </el-form-item>
+
+          </template>
+        </el-table-column>
+
+        <el-table-column label="是否有操作动作" align="center">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;是否有操作动作
+            </div>
+          </template>
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaIsHot'" :rules="rules.formulaIsHot">
+            	<el-select
+                v-model="scope.row.formulaIsHot"
+                filterable
+                placeholder="请选择是否有操作动作"
+                @change="(val)=>{ fillMaterial(val,scope.$index)}"
+              >
+                <el-option label="是" value="1"></el-option>
+                <el-option label="否" value="0"></el-option>
+              </el-select>
+            </el-form-item>
+
+          </template>
+        </el-table-column>
+
+        <el-table-column label="时间(s)" align="center" width="195">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;时间(s)
+            </div>
+          </template>
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaMtQuantity'" :rules="rules.formulaMtQuantity">
+              <el-input-number v-model="scope.row.formulaMtQuantity"></el-input-number>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="权重" align="center">
+          <template slot="header">
+            <div>
+                      <span style="color: red; font-size: 16px">*</span
+                      >&nbsp;权重
+            </div>
+          </template>
+          <template slot-scope="scope">
+            <el-form-item :prop="'formula.'+scope.$index+'.formulaWeight'">
+              <el-input v-model="scope.row.formulaWeight" type="number"></el-input>
+            </el-form-item>
+
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" width="80">
+          <template slot-scope="scope">
+            <el-button icon="el-icon-delete" type="danger" circle
+                       @click.prevent="delFormula(scope.$index)"></el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+
+    </el-form>
+    <!--{{ this.productConfig }}-->
+  </el-dialog>
+</template>
+<script>
+import GoodsApi from "@/api/goods/Goods.js";
+import {initDicts} from "@/utils/commons";
+import MaterialApi from "@/api/material"
+import ProductConfigApi from "@/api/ProductConfig"
+import Select from "@/views/zuihou/runManageCenter/planMgr/components/Plan";
+
+export default {
+  name: "formula",
+  components: {Select},
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    type: {
+      type: String,
+      default: "addProductCfg"
+    },
+  },
+  data() {
+    return {
+      unitOptions: [{
+        value: '1',
+        label: '杯'
+      }, {
+        value: '2',
+        label: '个'
+      }, {
+        value: '3',
+        label: '件'
+      }, {
+        value: '4',
+        label: '包'
+      }, {
+        value: '5',
+        label: '份'
+      }],
+      pcTypeOpt: [{
+        value: '1',
+        label: '热饮'
+      }, {
+        value: '2',
+        label: '常温'
+      }, {
+        value: '3',
+        label: '冷饮'
+      }],
+      productConfig: this.initProductConfig(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      rules: {
+        pcType:
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur"
+          },
+
+        pcTime: {
+          required: true,
+          message: this.$t("rules.require"),
+          trigger: "blur"
+        },
+
+        formulaMtId: {
+          required: true,
+          message: this.$t("rules.require"),
+          trigger: "blur"
+        },
+
+
+        formulaMtQuantity: {
+          required: true,
+          message: this.$t("rules.require"),
+          trigger: "blur"
+        },
+        formulaIsHot: {
+          required: true,
+          message: this.$t("rules.require"),
+          trigger: "blur"
+        },
+
+        formulaWeight: {
+          required: true,
+          message: this.$t("rules.require"),
+          trigger: "blur"
+        },
+
+
+      },
+      // filterText: '',
+      loading: false,
+      dicts:
+
+        {
+          NATION: {}
+          ,
+          POSITION_STATUS: {}
+          ,
+          EDUCATION: {}
+          ,
+        }
+      ,
+
+
+      saleTypeList: [{
+        value: '1',
+        label: '成品销售'
+      }, {
+        value: '2',
+        label: '生产型销售'
+      }],
+      checkedDetail:
+        [],
+      materialData:
+        [],
+
+    }
+      ;
+  },
+
+  created() {
+    // 加载【字典】
+    initDicts(['NATION'], this.dicts);
+  },
+  computed: {
+    isVisible: {
+      get() {
+        return this.dialogVisible;
+      },
+      set() {
+        this.close();
+        this.reset();
+      }
+    },
+    title() {
+      return this.type === "addProductCfg"
+        ? "配置工艺"
+        : "更改工艺";
+    }
+  },
+  watch: {},
+  mounted() {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth();
+      })();
+    };
+    this.getMaterial()
+  },
+  methods: {
+    fillMaterial(val, index) {
+      console.log("待填充的material对象为" + JSON.stringify(val))
+      console.log("select的change方法,val="+val)
+      for (const mt of this.materialData) {
+        if (val == mt.id) {
+          this.productConfig.formula[index].formulaMtId = mt.id;
+          this.productConfig.formula[index].formulaMtName = mt.mtName;
+          this.productConfig.formula[index].formulaMtUnit = mt.mtUnit;
+          this.productConfig.formula[index].formulaMtType = mt.mtType;
+        }
+      }
+
+    },
+
+    addFormula() {
+      if (this.productConfig.formula == undefined) {
+        this.productConfig.formula = new Array();
+      }
+      this.productConfig.formula.push(
+        {
+          id: "",
+          formulaMtId: "",
+          formulaMtName: "",
+          formulaMtType: "",
+          formulaMtUnit: "",
+          formulaWeight: "",
+          formulaMtQuantity: "",
+        }
+      )
+    },
+
+    delFormula(index) {
+      console.log("lalalalal")
+      if (this.productConfig.formula[index].id && index > 0) {
+        //  删除配方
+        ProductConfigApi.delFormula({"formulaId": this.productConfig.formula[index].id}).then(res => {
+          res = res.data
+          if (res.isSuccess) {
+            this.$message({
+              message: this.$t("tips.deleteSuccess"),
+              type: "success"
+            });
+          }
+        })
+        this.productConfig.formula.splice(index, 1)
+
+      } else {
+        if (index > 0) {
+          console.log("开始删除")
+          this.productConfig.formula.splice(index, 1)
+        }
+      }
+    },
+
+    //单选框选中数据
+    handleSelectionChange(rows) {
+      rows.forEach(item => {
+        this.checkedDetail.push(item.index);
+      });
+    },
+
+    initProductConfig() {
+      return {
+        id: "",
+        pcType: "",
+        pcSpeId: "",
+        pcSepcName: "",
+        pcTime: "",
+        formula: [
+          {
+            id: "",
+            formulaMtId: "",
+            formulaMtName: "",
+            formulaMtType: "",
+            formulaMtQuantity: "",
+            formulaMtUnit: "",
+            formulaIsHot: "",
+            formulaWeight: "",
+
+          }
+        ],
+      };
+    },
+
+    setProCfg(val) {
+      console.log("setProCfg传参val=" + JSON.stringify(val))
+
+
+      if (val['isProCfg'] == '1') {
+        console.log("getPfg(specId)即将传参" + val['id'])
+        this.getPfg(val['id']);
+
+      }
+      console.log("else ,未配置")
+      this.productConfig.pcSpeId = val['id'];
+      this.productConfig.pcSepcName = val['specName'];
+
+    },
+
+
+    rowClassName({row, rowIndex}) {
+
+      row.index = rowIndex;
+    },
+
+
+    initWidth() {
+      this.screenWidth = document.body.clientWidth;
+      if (this.screenWidth < 991) {
+        return "90%";
+      } else if (this.screenWidth < 1400) {
+        return "60%";
+      } else {
+        return "1400px";
+      }
+    },
+
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+
+    getMaterial() {
+      MaterialApi.getMaterial({}).then(res => {
+
+        res = res.data
+        if (res.isSuccess) {
+          this.materialData = res.data
+          console.log("原材料列表为"+JSON.stringify(this.materialData))
+
+        }
+      })
+    },
+    getPfg(specId) {
+      console.log("执行了gtpfg")
+      ProductConfigApi.getPfg({"pcSpeId": specId}).then(res => {
+        res = res.data
+        if (res.isSuccess) {
+          console.log("拿到了" + res.data)
+          this.productConfig = res.data
+        }
+      })
+    },
+
+
+    close() {
+      this.$emit("close");
+    },
+    reset() {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      console.log("执行了reset")
+      this.$refs.form.clearValidate();
+      this.$refs.form.resetFields();
+      this.productConfig = this.initProductConfig()
+      console.log("执行了" + "resetFilds")
+    },
+    submitForm() {
+      const vm = this;
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          vm.editSubmit();
+        } else {
+          return false;
+        }
+      });
+    },
+    editSubmit() {
+      const vm = this;
+      if (vm.type === "editProductCfg") {
+        vm.update();
+      } else {
+        vm.save();
+      }
+    },
+
+
+    save() {
+      const vm = this;
+      console.log("保存的生产配置表数据" + JSON.stringify(this.productConfig))
+      if (this.productConfig.formula.length == 0 || this.productConfig.formula == null) {
+        alert("配方不可为空!")
+        return;
+      }
+      ProductConfigApi.save(this.productConfig).then(response => {
+        const res = response.data;
+        if (res.isSuccess) {
+          //更新配方的工艺配置状态
+          this.updatePfgStatus('1', res.data.id)
+          console.log("aaaaa" + JSON.stringify(res.data))
+          vm.isVisible = false;
+          vm.$message({
+            message: vm.$t("tips.createSuccess"),
+            type: "success"
+          });
+          vm.$emit("success");
+
+        }
+      });
+    },
+
+    updatePfgStatus(pfgStatus, pfgId) {
+      GoodsApi.updatePfgStatus({'isProCfg': pfgStatus, 'proCfgId': pfgId}).then(response => {
+        const res = response.data;
+        if (res.isSuccess) {
+          this.isVisible = false;
+          this.$message({
+            message: this.$t("tips.updateSuccess"),
+            type: "success"
+          });
+          this.$emit("success");
+        }
+      });
+
+    },
+
+
+    update() {
+      ProductConfigApi.updateConfig(this.productConfig).then(response => {
+        const res = response.data;
+        if (res.isSuccess) {
+          this.isVisible = false;
+          this.$message({
+            message: this.$t("tips.updateSuccess"),
+            type: "success"
+          });
+          this.$emit("success");
+        }
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped></style>