lxp
2024-08-08 103d02733dba8942af2df34bcab948a10773b6be
src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -31,16 +31,16 @@
              style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 8px;padding: 0 12px;box-sizing: border-box;">
              <div class="search-item" style="margin-right: 10px;">
                <label>套管数目</label>
                <el-input v-model="packageInfo.num1" placeholder="请输入" size="small" @blur="addBushing" :disabled="active!=1"></el-input>
                <el-input v-model="packageInfo.num1" placeholder="请输入" size="small" @blur="addBushing" :disabled="active!=1" ></el-input>
              </div>
              <div class="search-item" style="margin-right: 10px;">
                <label style="width: 70px;">标准量</label>
                <el-input v-model="packageInfo.standNum" placeholder="请输入" size="small" @blur="addStandNum" :disabled="active!=1"></el-input>
                <label style="width: 100px">每根管抽检标准量</label>
                <el-input v-model="packageInfo.standNum" placeholder="请输入" size="small" @blur="addStandNum" :disabled="active!=1" style="width:100px"></el-input>
              </div>
              <div class="search-item">
                <label style="width: 70px;">检测量</label>
                <label style="width: 100px">每根管抽检检测量</label>
                <el-input v-model="packageInfo.testNum" placeholder="请输入" size="small" @blur="addTestNum"
                  :disabled="packageInfo.radio===0||active!=1"></el-input>
                  :disabled="packageInfo.radio===0||active!=1" style="width:100px"></el-input>
              </div>
            </div>
            <el-table ref="table0" :data="bushing" tooltip-effect="dark" style="width: 100%" height="203px" size="small"
@@ -78,7 +78,7 @@
              @select="upProductSelect"
              >
              <el-table-column type="selection" width="55"
              :selectable="()=>((currentDetectionItems||this.multiFiberList.length > 0)&&active==1)">
              :selectable="()=>((currentDetectionItems||this.selectFiberList.length > 0 || this.multiFiberList.length > 0)&&active==1)">
              </el-table-column>
              <el-table-column label="实验室" show-overflow-tooltip prop="sonLaboratory" ></el-table-column>
              <el-table-column prop="inspectionItem" label="检验项" show-overflow-tooltip>
@@ -134,7 +134,7 @@
              <div class="search-item" style="width: 50%;margin-right: 16px;">
                <label style="width: 80px;">纤带类型</label>
                <el-select v-model="miresModel" placeholder="请选择" size="small" style="width: 100%;"
                  :disabled="selectBushing.length===0||active!=1"
                  >
                  <el-option v-for="(item,a) in miresModels" :key="a" :label="item.label" :value="item.value">
                  </el-option>
@@ -358,6 +358,7 @@
      return {
        detectionType: null,
        detectionSelect: [],
        selectFiberList: [],
        type:1,
        saveLoad: false,
        packageInfo: {
@@ -467,9 +468,8 @@
              // 光纤带
              this.fibersList.push(b)
              // 光纤
              b.fiber.forEach(c=>{
                this.fiberList.push(c)
              })
              // this.fiberList = []
              // this.fiberList = b.fiber
            })
            } else {
              a.fiber.forEach(b=>{
@@ -478,6 +478,7 @@
            }
            
          }else{
            this.fiberList = []
            a.fiber.forEach(b=>{
              this.fiberList.push(b)
            })
@@ -492,8 +493,11 @@
    },
    methods: {
      handleSelectionChange(val) {
        this.selectFibers = val
        // this.selectFibers = val
        this.multiFiberList = val
        if(val.length > 0) {
          this.rowClickFiber(val[val.length-1],null,null,1)
        }
      },
      handleSelectionChange1(val) {
        this.selectBushing = val
@@ -502,27 +506,47 @@
        this.detectionSelect = val
        // 赋值检测项信息 光纤带
        if(this.detectionItems.type == 1) {
          for(let i= 0; i < this.fibersList.length; i++){
            this.multiFiberList.forEach(item => {
              if(this.fibersList[i].ident == item.ident){
          this.multiFiberList.forEach(item => {
            this.fibersList.forEach(a => {
              if(a.ident == item.ident){
                a.productList  =  []
                this.fibersList.find(a => a.ident == item.ident).productList = this.detectionSelect
              }
            })
        }
          })
      }
      if(this.detectionItems.type == 0) {
        // 赋值检测项信息 光纤
        this.multiFiberList.forEach(item => {
        this.selectFiberList.forEach(item => {
            this.fiberList.forEach(a => {
              if(a.ident == item.ident){
                a.productList  =  []
                this.fiberList.find(a => a.ident == item.ident).productList = this.detectionSelect
              }
            })
          })
          if(this.multiFiberList.length == 1) {
            this.multiFiberList.forEach(item => {
            this.fibersList.forEach(a => {
              if(a.ident == item.ident){
                a.fiber = this.fiberList
              }
            })
          })
          }else if(this.multiFiberList.length > 1) {
            this.fibersList.forEach(item => {
              item.fiber = this.fiberList
            })
          }
        }
      },
      handleSelectionChange4(val){
        this.multiFiberList = val
        this.selectFiberList = val
        if(val != 0) {
          this.rowClickFiber(val[val.length-1],null,null,0)
        }
      },
      outConfig() {
        this.$parent.configShow = false
@@ -563,6 +587,11 @@
      },
      // 套管检测量赋值
      addTestNum() {
        if(parseInt(this.packageInfo.testNum) > parseInt(this.packageInfo.standNum)) {
          this.packageInfo.testNum = this.packageInfo.standNum
          this.$message.error('检测量不能大于标准量')
        }
        if(this.selectBushing.length > 0) {
          this.bushing.forEach(item => {
          this.selectBushing.forEach(a => {
@@ -588,7 +617,7 @@
            this.packageInfo.testNum = this.packageInfo.standNum
            this.selectBushing = this.bushing
            this.addFibers()
            this.selectFibers = this.fibersList
            this.multiFiberList = this.fibersList
            // 默认勾选
            setTimeout(() => {
              this.selectBushing.forEach(item =>{
@@ -596,7 +625,7 @@
              this.$refs.table0.toggleRowSelection(rowToSelect, true)
              })
              this.selectFibers.forEach(item =>{
              this.multiFiberList.forEach(item =>{
              let rowToSelect =  this.fibersList.find(a => a.ident == item.ident)
              this.$refs.table2.toggleRowSelection(rowToSelect, true)
              })
@@ -609,7 +638,6 @@
              this.packageInfo.testNum = this.packageInfo.standNum
              this.selectBushing = this.bushing
              this.addFiber()
              // 默认勾选
            setTimeout(() => {
              this.selectBushing.forEach(item =>{
@@ -759,11 +787,11 @@
        // })
        
          // 将下拉框值赋值给光纤  监听去除
          if(this.multiFiberList.length == 0) {
          if(this.selectFiberList.length == 0) {
            this.$message.error('请选择数据')
            return
          }
          this.multiFiberList.forEach(item => {
          this.selectFiberList.forEach(item => {
            this.fiberList.forEach(a => {
              if(a.ident == item.ident){
                a.model = this.mireModel.split(' - ')[1] // 光纤规格
@@ -863,7 +891,6 @@
      })
      },
      addFiber() {
        // 最新
        let colors2 = []
        if (this.packageInfo.num1 / this.colors.length > 1) {
@@ -878,8 +905,8 @@
        this.fiberList = []
        // 选择了光纤带
        if (this.packageInfo.ismiers) {
          if(this.selectFibers.length != 0){
          this.selectFibers.forEach((a,index) => {
          if(this.multiFiberList.length != 0){
          this.multiFiberList.forEach((a,index) => {
            a.fiber = []
            for (var i = 0; i < parseInt(a.num); i++) {
              let fiber = {
@@ -904,6 +931,7 @@
                bushColor: a.color,
                color: colors2[(i+(parseInt(a.testNum))*index)>colors2.length?0:i+(parseInt(a.testNum))*index].label,
                model: null,
                noSplitModel: null,
                standard: null,
                productList: []
              }
@@ -1131,6 +1159,11 @@
        //   })
        // }, 200)
        if(type == 1) {
          this.fiberList = row.fiber
          if((row.model == null || row.model == '') && (row.standard == null || row.standard == '')){
            this.detectionItems = []
            return
          }
          if(row.model != null && row.model != ''){
          this.miresModel = row.model
          this.selectsStandardMethodByFLSSM2()
@@ -1151,28 +1184,28 @@
          // 将获取的检测项信息赋值
          this.detectionItems = []
          if(res.data != null && res.data.length != 0){
            res.data.forEach(a => {
              a.state = 0
            })
            this.detectionItems = res.data
            this.detectionType = 1
            this.$set(this.detectionItems,'type',1)
            if (row.productList != null && row.productList.length > 0) {
            if (row.productList != null && row.productList.length > 0) {
              let product =  JSON.parse(JSON.stringify(row.productList))
              setTimeout(() => {
                row.productList.forEach(product => {
                let rowToSelect = this.detectionItems.find(item => item.id === product.id);
                product.forEach(p => {
                let rowToSelect = this.detectionItems.find(item => item.id === p.id);
                if (rowToSelect) {  
                  this.toggleSelection(rowToSelect);
                }
                  this.toggleSelection(rowToSelect);
                }
              });  
              },200)
            },200)
            }
          }
        })
        },1000)
      }else if(type == 0) {
        if((row.noSplitModel == null || row.noSplitModel == '') && (row.standard == null || row.standard == '')){
            this.detectionItems = []
            return
          }
        if(row.model != null && row.model != ''){
          this.mireModel = row.noSplitModel
          this.selectsStandardMethodByFLSSM()
@@ -1198,19 +1231,19 @@
          this.detectionItems = res.data
          this.detectionType = 0
          this.$set(this.detectionItems,'type',0)
          if (row.productList != null && row.productList.length > 0) {
          if (row.productList != null && row.productList.length > 0) {
            let product =  JSON.parse(JSON.stringify(row.productList))
            setTimeout(() => {
              row.productList.forEach(product => {
                let rowToSelect = this.detectionItems.find(item => item.id === product.id);
              product.forEach(p => {
                let rowToSelect = this.detectionItems.find(item => item.id === p.id);
                if (rowToSelect) {  
                  this.toggleSelection(rowToSelect);
                  this.toggleSelection(rowToSelect);
                }  
              });  
            },200)
            }
          }
        })
        },1000);
      }
@@ -1330,8 +1363,8 @@
      },
      upProductSelect(selection, row) {
        row.state = row.state == 1 ? 0 : 1
        if(this.multiFiberList.length > 0){
          this.multiFiberList.map(item => {
        if(this.selectFiberList.length > 0){
          this.selectFiberList.map(item => {
            item.productList.map(m=>{
              if(m.id == row.id){
                m.state = row.state;
@@ -1430,9 +1463,9 @@
        this.bushing.forEach(item=>{
          // 如果光纤带有值
          if(this.fibersList.length != 0) {
              this.fibersList.forEach(a=>{
                a.fiber = this.fiberList.filter(b=>b.fibersIdent == a.ident)
              })
              // this.fibersList.forEach(a=>{
              //   a.fiber = this.fiberList
              // })
              item.fibers = this.fibersList // 光纤带
              item.fiber = [] // 光纤
          }else {