yangfeng
2023-12-11 14101bd42ce17dfb9d951d0738abe9d303fb3fe5
src/components/bomDialog.vue
@@ -58,9 +58,16 @@
</template>
<script>
import { addMaterial, updateMaterial } from "@/api/ProductiveTask/inventory";
import { getCodeStandardList } from "@/api/basic/standard";
import { getCodeStandardList } from "@/api/basic/standard";
import {
  NetworkCard,
  getMiniDictList,
  addMiniDict,
  deleteMiniDict,
  updateMiniDict,
  sendProcessParams
} from "@/api/home/index";
export default {
  name: "",
  props: {
@@ -131,11 +138,13 @@
  watch: {
    editDialogVisible(newVal){
      if(newVal){
       this.BomTableData=this.workList;
       this.BomTableData=  JSON.parse(
        JSON.stringify(this.workList))
      }
    },
    workList(newVal){
      this.BomTableData=this.workList;
      this.BomTableData=JSON.parse(
        JSON.stringify(this.workList))
    }  
  },
  mounted() {
@@ -145,6 +154,7 @@
      this.BomTableData.push({name:'',isDefault:false});
    },
    handleDelete(id) {
      this.BomTableData=this.BomTableData.filter(i=>{
        return i.id!=id
      })
@@ -203,30 +213,7 @@
        this.$emit('handleConfirmSave',this.BomTableData)
      }
    },
    async validate() {
      try {
        if (this.flag == "add")
          this.form.id = this.codenumberList.replace(/,/g, "");
        this.form.explain = this.explain;
        let fn = this.flag == "set" ? updateMaterial : addMaterial;
        const res = await fn(this.form);
        this.shutdown();
        this.$sucessSet('sucessSet')
        if(res.code==200){
          this.$message({
            message: this.flag == "set"?'修改成功!':'添加成功!',
            type: "success",
          });
        }
      } catch (err) {
        console.log(err);
        this.$message({
          message: err.message.data.data,
          type: "warning",
        });
      }
    },
    shutdown() {
      this.editDialogVisible = false;