zouyu
2023-09-12 40f0147e880d83e8ffb341994ab37e9e712fccf9
	modified:   src/assets/api/controller.js
modified: src/components/view/standard-table/product.vue
modified: src/components/view/standard-table/target.vue
modified: src/components/view/standard-table/technology.vue
modified: src/components/view/standard.vue
已修改5个文件
347 ■■■■■ 文件已修改
src/assets/api/controller.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/standard-table/product.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/standard-table/target.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/standard-table/technology.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/standard.vue 309 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -14,6 +14,10 @@
    leftAddOneTwo: "/material/add",//左侧新增1,2级
    leftAddThree: "/standard/add",//左侧三级新增
    leftAddFour: "/specifications/add",//左侧四级新增
    chooseTechByStandard:"/product/chooseTech",//右上角新增-->技术指标-->选择工序,工艺
    chooseFatherByStandard:"/product/chooseFather",//右上角新增-->技术指标-->选择项目父类
    addProductByStandard:"/product/add",//右上角新增-->技术指标
    // 技术管理-技术文件
    selectAllOrder: "/orders/selectAllOrder", //查询所有订单列表
    selectOrderById: "/orders/selectOrderById", //根据订单id查询订单详情
src/components/view/standard-table/product.vue
@@ -67,7 +67,12 @@
                <span>{{scope.row.device}}</span>
            </template>
        </el-table-column>
        <el-table-column prop="productFather" label="项目"></el-table-column>
        <el-table-column prop="productFather" label="项目">
          <template slot-scope="scope">
                <el-tag type="info" v-if="scope.row.productFather != null">03</el-tag>
                <span>{{scope.row.productFather}}</span>
            </template>
        </el-table-column>
        <el-table-column prop="unit" label="单位"></el-table-column>
        <el-table-column prop="product" label="指标"></el-table-column>
        </el-table>
@@ -76,7 +81,11 @@
<script>
export default ({
    data() {
      return {
        deviceGroupDialog:false,
        selects: [],
        isAllSelect:false,
      }
    },
    props:['tableData','tableType'],
    methods:{
src/components/view/standard-table/target.vue
@@ -19,11 +19,16 @@
                <span>{{scope.row.tname}}</span>
            </template>  
        </el-table-column>
        <el-table-column prop="pfather" label="项目">
            <template slot-scope="scope">
                <el-tag type="info" color="#faf2ff" v-if="scope.row.pfather != null">
                  <span style="color: #e1affb">03</span>
                </el-tag>
                <span>{{scope.row.pfather}}</span>
            </template>
        </el-table-column>
        <el-table-column prop="pname" label="指标名称">
            <template slot-scope="scope">
                <el-tag type="info" color="#faf2ff" v-if="scope.row.pname != null">
                    <span style="color: #e1affb">03</span>
                </el-tag>
                <span>{{scope.row.pname}}</span>
            </template>
        </el-table-column>
@@ -31,14 +36,14 @@
        <el-table-column prop="internal" label="内控值">
          <template slot-scope="scope">
            <el-input v-model="scope.row.internal" 
            v-if="scope.row.internal != null"
            v-if="scope.row.pname != null"
            @blur="updateVal(scope.row)"></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="required" label="标准值">
          <template slot-scope="scope">
            <el-input v-model="scope.row.required" 
            v-if="scope.row.required != null"
            v-if="scope.row.pname != null"
            @blur="updateVal(scope.row)"></el-input>
          </template>
        </el-table-column>
src/components/view/standard-table/technology.vue
@@ -35,7 +35,7 @@
            <el-table-column prop="pq" label="生产定额(个/天)">
              <template slot-scope="scope">
                  <el-input v-model="scope.row.pq" 
                  v-if="scope.row.pq != null"
                  v-if="scope.row.dg != null"
                  @blur="updatePq(scope.row)"
                  ></el-input>
              </template>
@@ -65,9 +65,7 @@
      }
    },
    props:['tableData','tableType'],
    created() {
      console.log(this.tableData)
    },
    created() {},
    mounted() {
      
    },
src/components/view/standard.vue
@@ -7,7 +7,6 @@
          <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;"
            @click="showBomAddModel">新增</el-button>
          <el-button icon="el-icon-plus">新增版本</el-button>
          <el-button @click="bomRightUp=true" icon="el-icon-edit-outline">修改</el-button>
          <el-button @click="bomRightDl=true" icon="el-icon-delete">删除</el-button>
        </el-col>
      </el-row>
@@ -76,64 +75,97 @@
    <div class="bom-add-model">
      <el-dialog title="BOM新增" :visible.sync="bomAddModelVisible" width="35%">
      <el-dialog title="BOM新增" :visible.sync="bomAddModelVisible" width="45%">
        <!-- 工艺路线 -->
        <div v-if="typeselect == 0">、
          <el-form :model="technologyForm" :inline="true" class="demo-form-inline" label-position="right"
          :rules="boomRules" ref="boomForm" label-width="90px">
            <el-form-item label="工序:" prop="father" width="250">
              <el-select v-model="technologyForm.father"
              style="width:200px;" placeholder="请输入或选择工序">
        <div v-if="typeselect == 0">
          <el-form :model="technologyForm" :inline="true" label-position="right"
           ref="technologyForm" :rules="technologyRules" label-width="90px">
            <el-form-item label="工序:" prop="tefather">
              <el-select id="tefather" size="small"
              filterable allow-create default-first-option
              v-model="technologyForm.tefather" placeholder="请输入或选择工序">
                <el-option :value="item.father" :label="item.father" v-for="(item,index) in fatherList" :key="index"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="工艺名称:" prop="name" width="250">
              <el-input placeholder="请输入工艺名称" style="width:200px;"
              v-model="technologyForm.name"></el-input>
            <el-form-item label="工艺名称:" prop="tename">
              <el-input id="tename" size="small" placeholder="请输入工艺名称"
              clearable v-model="technologyForm.tename"></el-input>
            </el-form-item>
            <el-form-item label="设备组:" prop="deviceGroup" width="250">
              <el-select placeholder="请选择设备组"
              style="width:200px;"
            <el-form-item label="设备组:" prop="deviceGroup">
              <el-select id="deviceGroup" placeholder="请选择设备组" size="small"
              v-model="technologyForm.deviceGroup">
              <el-option :value="item.father" 
              v-for="(item,index) in deviceList" :key="index" :label="item.father"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="生产定额:" prop="productionQuota" width="250">
              <el-input style="width:200px;" v-model.number="technologyForm.productionQuota" placeholder="请输入生产定额" />
            <el-form-item label="生产定额:" prop="productionQuota">
              <el-input id="productionQuota" size="small" clearable v-model.number="technologyForm.productionQuota" placeholder="请输入生产定额" />
            </el-form-item>
          </el-form>
          <div style="width:100%;text-align: right;">
            <span slot="footer" class="dialog-footer" >
              <el-button type="primary" @click="confirmAdd('technologyForm')">确 定</el-button>
              <el-button @click="bomAddModelVisible = false">取 消</el-button>
            </span>
          </div>
        </div>
        <!-- 技术指标 -->
        <div v-if="typeselect == 1">
          <el-form :model="targetForm" :inline="true" class="demo-form-inline" label-position="right"
          label-width="80px">
            <el-form-item label="指标名称:" prop="father" width="250">
              <el-input style="width:200px;" v-model="targetForm.pname" placeholder="请输入单位"/>
          <el-form :model="targetForm" :inline="true" label-position="right"
          :rules="targetRules" ref="targetForm" label-width="90px">
            <el-form-item label="工序:" prop="pfather">
              <el-select v-model="targetForm.pfather"
              @change="changeFather"
              style="width:200px;" placeholder="请选择工序">
                <el-option :value="item.name" :label="item.name" v-for="(item,index) in targetFormList" :key="index"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="单位:" prop="name" width="250">
            <el-form-item label="工艺名称:" prop="technologyId">
              <el-select v-model="targetForm.technologyId"
              @change="changeTechnologyId"
              style="width:200px;" placeholder="请选择工艺名称">
                <el-option :value="item.id" :label="item.name" v-for="(item,index) in technologyIdList" :key="index"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="项目:" prop="father">
              <el-select v-model="targetForm.father"
              filterable allow-create default-first-option
              style="width:200px;" placeholder="请输入或选择项目">
                <el-option :value="item.father" :label="item.father" v-for="(item,index) in projectList" :key="index"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="指标名称:" prop="name">
              <el-input style="width:200px;" v-model="targetForm.name" placeholder="请输入指标名称"/>
            </el-form-item>
            <el-form-item label="单位:" prop="unit">
              <el-input style="width:200px;" v-model="targetForm.unit" placeholder="请输入单位"/>
            </el-form-item>
            <el-form-item label="内控值:" prop="dg" width="250">
              <el-input style="width:200px;" v-model="targetForm.internal" placeholder="请输入单位"/>
            <el-form-item label="内控值:" prop="internal">
              <el-input style="width:200px;" v-model="targetForm.internal" placeholder="请输入内控值"/>
            </el-form-item>
            <el-form-item label="标准值:" prop="unit" width="250">
              <el-input style="width:200px;" v-model="targetForm.required" placeholder="请输入单位"/>
            <el-form-item label="标准值:" prop="required">
              <el-input style="width:200px;" v-model="targetForm.required" placeholder="请输入标准值"/>
            </el-form-item>
          </el-form>
          <div style="width:100%;text-align: right;">
            <span slot="footer" class="dialog-footer" >
              <el-button type="primary" @click="confirmAdd('targetForm')">确 定</el-button>
              <el-button @click="bomAddModelVisible = false">取 消</el-button>
            </span>
          </div>
        </div>
        <!-- 物料清单 -->
        <div v-if="typeselect == 2">
          <el-form :model="materialForm" class="demo-form-inline" label-position="right"
          label-width="80px">
          <el-form :model="materialForm" label-position="right"
          :rules="materialRules" ref="materialForm" label-width="80px">
          <el-row>
            <el-col :span="12">
              <el-form-item label="规格型号:" prop="father" width="250">
              <el-form-item label="规格型号:" width="250">
                <el-input style="width:200px;" v-model="materialForm.pname" placeholder="请输入单位"/>
              </el-form-item>
              </el-col>
              <el-col :span="12" style="text-align: right;">
              <el-form-item label="产品大类:" prop="name" width="250">
              <el-form-item label="产品大类:" width="250">
                <el-select placeholder="请选择产品大类"
                style="width:240px;" v-model="materialForm.dg">
                <el-option value="1">1</el-option>
@@ -163,13 +195,19 @@
            </el-col>
          </el-row>
          </el-form>
          <div style="width:100%;text-align: right;">
            <span slot="footer" class="dialog-footer" >
              <el-button type="primary" @click="confirmAdd('materialForm')">确 定</el-button>
              <el-button @click="bomAddModelVisible = false">取 消</el-button>
            </span>
          </div>
        </div>
        <!-- 生产工艺 -->
        <div v-if="typeselect == 3">
          <el-form :model="technologyForm" :inline="true" class="demo-form-inline" label-position="right"
          <el-form :model="productForm" :inline="true" label-position="right"
          label-width="80px">
            <el-form-item label="工序:" prop="father" width="250">
              <el-select v-model="technologyForm.father"
            <el-form-item label="工序:" width="250">
              <el-select v-model="productForm.father"
              style="width:200px;"
              placeholder="请输入或选择生产定额">
                <el-option value="1">1</el-option>
@@ -178,48 +216,50 @@
                <el-option value="4">4</el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="工艺名称:" prop="name" width="250">
            <el-form-item label="工艺名称:" width="250">
              <el-select placeholder="请输入或选择工艺名称"
              style="width:200px;"
              v-model="technologyForm.name">
              v-model="productForm.name">
              <el-option value="1">1</el-option>
                <el-option value="2">2</el-option>
                <el-option value="3">3</el-option>
                <el-option value="4">4</el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="设备:" prop="dg" width="250">
            <el-form-item label="设备:" width="250">
              <el-select placeholder="请选择设备"
              style="width:200px;"
              v-model="technologyForm.dg">
              v-model="productForm.dg">
              <el-option value="1">1</el-option>
                <el-option value="2">2</el-option>
                <el-option value="3">3</el-option>
                <el-option value="4">4</el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="项目:" prop="dg" width="250">
            <el-form-item label="项目:" width="250">
              <el-select placeholder="请选择项目"
              style="width:200px;"
              v-model="technologyForm.dg">
              v-model="productForm.dg">
              <el-option value="1">1</el-option>
                <el-option value="2">2</el-option>
                <el-option value="3">3</el-option>
                <el-option value="4">4</el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="单位:" prop="unit" width="250">
              <el-input style="width:200px;" v-model="technologyForm.unit" placeholder="请输入单位"/>
            <el-form-item label="单位:" width="250">
              <el-input style="width:200px;" v-model="productForm.unit" placeholder="请输入单位"/>
            </el-form-item>
            <el-form-item label="指标:" prop="pq" width="250">
              <el-input style="width:200px;" v-model="technologyForm.pq" placeholder="请输入指标" />
            <el-form-item label="指标:" width="250">
              <el-input style="width:200px;" v-model="productForm.pq" placeholder="请输入指标" />
            </el-form-item>
          </el-form>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="bomAddModelVisible = false">取 消</el-button>
          <el-button type="primary" @click="confirmAdd('boomForm')">确 定</el-button>
        </span>
          <div style="width:100%;text-align: right;">
              <span slot="footer" class="dialog-footer" >
                <el-button type="primary" @click="confirmAdd('productForm')">确 定</el-button>
                <el-button @click="bomAddModelVisible = false">取 消</el-button>
              </span>
            </div>
          </div>
      </el-dialog>
      <!-- 左侧点击+按钮 -->
      <el-dialog title="BOM新增" :visible.sync="bomLeftAdd" width="29%">
@@ -245,16 +285,6 @@
          <el-button type="primary" @click="submitForm('leftAdd')">确 定</el-button>
        </span>
      </el-dialog>
            <!-- 右上侧点击修改按钮 -->
      <el-dialog title="BOM修改" :visible.sync="bomRightUp" width="30%">
        <el-form>
            修改
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="bomRightUp = false">取 消</el-button>
          <el-button type="primary" @click="bomRightUp = false">确 定</el-button>
        </span>
      </el-dialog>
        <!-- 右上侧点击删除按钮 -->
      <el-dialog title="BOM删除" :visible.sync="bomRightDl" width="30%">
        <el-form>
@@ -278,33 +308,66 @@
export default {
  components: { technology,material,target,product,bomClickAdd },
  data() {
    var checkPq = (rule,value,callback)=>{
      if(value!='' && !Number.isInteger(value)){
        return callback(new Error('请输入数字值'));
      }
      callback();
    };
    var checkVal = (rule,value,callback)=>{
      let arr = [">","<","="];
      if(value!='' && arr.indexOf(value.substring(0,1))==-1){
        callback(new Error("开头需包含 > 或 < 或 = "))
      }
      callback();
    };
    return {
      //技术指标-新增-工序,工艺下拉框数据
      targetFormList:[],
      technologyIdList:[],
      //技术指标-新增-项目下拉框数据
      projectList:[],
      //工序列表
      fatherList:[],
      //设备组列表
      deviceList:[],
      technologyForm:{
        father:'',
        name:'',
        tefather:'',
        tename:'',
        deviceGroup:'',
        productionQuota:''
      },
      targetForm:{
        pname:'',
        pfather:'',
        father: '',
        technologyId:'',
        name:'',
        unit:'',
        internal:'',
        required: ''
      },
      formTypeOptions:[],
      materialForm:{},
      boomRules:{
        father:{required:true,message:'工序不能为空',trigger:'change'},
        name:{required:true,message:'工艺名称不能为空',trigger:'blur'},
      productForm:{},
      technologyRules:{
        tefather:{required:true,message:'工序不能为空',trigger:'change'},
        tename:{required:true,message:'工艺名称不能为空',trigger:'blur'},
        deviceGroup:{required:true,message:'设备组不能为空',trigger:'change'},
        productionQuota:[
          {required:true,message:'生产定额不能为空',trigger:'blur'},
          {type:'number',required:true,message:'数据类型必须是纯数字',trigger:'blur'}
        ]
        productionQuota:{validator:checkPq,trigger:'change'}
      },
      targetRules:{
        pfather:{required:true,message:'工序不能为空',trigger:'change'},
        technologyId:{required:true,message:'工艺名称不能为空',trigger:'change'},
        father:{required:true,message:'项目不能为空',trigger:'change'},
        name:{required:true,message:'指标名称不能为空',trigger:'blur'},
        unit:{required:true,message:'单位不能为空',trigger:'change'},
        internal:{validator:checkVal,trigger:'change'},
        required:{validator:checkVal,trigger:'change'}
      },
      materialRules:{
      },
      productRules:{
      },
      // BOM树数据结构
      list: [],
@@ -339,19 +402,10 @@
      isLeftAdd: true
    }
  },
  // watch: {
  //   search(val) {
  //     this.$refs.tree.filter(val);
  //   },
  //   tableType(val){
  //     this.selectProductTableData()
  //   }
  // },
  mounted() {
    this.tableType=0
    this.selectMaterialTree()
    this.selectVersion()
    console.log(this.formTypeOptions);
  },
  methods: {
    changeLeftAdd(){
@@ -466,26 +520,77 @@
    confirmAdd(formName){
      this.$refs[formName].validate(valid=>{
        if(valid){
          console.log(this.technologyForm);
          this.$axios.post(this.$api.url.addTechnology,
          {
            "specificationsId": this.returntree.id,
            "technologyDto": JSON.stringify({
          let type = this.typeselect;
          let obj = {}
          if(type == 0){
            obj = {
                specificationsId: Number.parseInt(this.returntree.id),
                deviceGroup: this.technologyForm.deviceGroup,
                father: this.technologyForm.father,
                name: this.technologyForm.name,
                productionQuota: this.technologyForm.productionQuota,
              })
          },{
            headers: { "Content-Type": "application/json" }
          }).then(res=>{
            this.$message.success(res.message);
          }).catch(error=>{
            this.$message.error(error.message);
          })
          this.bomAddModelVisible = false;
                father: this.technologyForm.tefather,
                name: this.technologyForm.tename,
                productionQuota: Number.parseInt(this.technologyForm.productionQuota),
              }
              this.submitBomAdd(this.$api.url.addTechnology,obj);
          }else if(type == 1){
            this.submitBomAdd(this.$api.url.addProductByStandard,this.targetForm);
          }
        }
      })
    },
    submitBomAdd(url,data){
      this.$axios.post(
          url,data,
          {headers: { "Content-Type": "application/json" }}
      ).then(res=>{
        this.selectAll();
        this.$message.success(res.message);
      }).catch(error=>{
        this.$message.error(error.message);
      })
      this.bomAddModelVisible = false;
    },
    clearBomAddModel(){
      if(this.typeselect == 0){
        this.$refs["technologyForm"].resetFields();
      }else if(this.typeselect == 1){
        this.$refs["targetForm"].resetFields();
      }else if(this.typeselect == 2){
        this.$refs["materialForm"].resetFields();
      }else{
        this.$refs["productForm"].resetFields();
      }
    },
    changeTechnologyId(val){
      this.$axios.get(this.$api.url.chooseFatherByStandard,{
        params:{technologyId : val}
      }).then(res=>{
        this.projectList = res.data;
      }).catch(error=>{
        this.$message.error(error.message);
      });
    },
    changeFather(val){
      let arr = this.targetFormList.filter(item=>{
        return item.name == val;
      });
      if(arr != undefined || arr.children != null){
        this.technologyIdList = arr[0].children;
      }
    },
    //获取工序,工艺列表
    getTargetFormList(){
      this.$axios.get(this.$api.url.chooseTechByStandard,{
        params:{specificationsId : this.returntree.id}
      }).then(res=>{
        this.targetFormList = res.data;
      }).catch(error=>{
        this.$message.error(error.message);
      })
    },
    //获取项目列表
    getProjectFormList(){
    },
    //获取工序列表
    getFatherList(){
@@ -508,6 +613,7 @@
    showBomAddModel(){
      this.getFatherList();
      this.getDeviceList();
      this.getTargetFormList();
      this.bomAddModelVisible = true
    },
    startLeftAdd(){
@@ -786,6 +892,11 @@
       this.restaurants=this.loadFatherType()
      }
    }
  },
  bomAddModelVisible(newVal){
    if(!newVal){
      this.clearBomAddModel();
    }
  }
  }
}
@@ -793,7 +904,15 @@
<style scoped>
.standard {}
.standard .bom-add-model{
  width: 100%;
}
.standard .bom-add-model form{
  width: 90%;
  margin-left: 5%;
}
.standard .title .el-button {
  height: 32px;