licp
2024-08-02 0479e3bcf39f458669ecd95bf43c20b7a1b1929e
数采升级-前端修改
已修改6个文件
203 ■■■■■ 文件已修改
src/assets/api/controller.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b1-ins-order/add.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b1-inspect-order-plan/Inspection.vue 138 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b3-work-time-management.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/worker0.js 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -157,6 +157,7 @@
  treeDevice: "/deviceScope/treeDevice", // 设备树形
  temDataAcquisition: "/deviceScope/temDataAcquisition", // PK8000数采
  temDataAcquisition2: "/deviceScope/temDataAcquisition2", // PK8000数采--多条
  formulaCalculation: "/deviceScope/formulaCalculation", // 数采-公式计算
}
const insOrder = {
src/components/do/b1-ins-order/add.vue
@@ -461,6 +461,16 @@
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="tell" label="要求描述" min-width="220px">
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求描述" v-model="scope.row.tell" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'tell')"
                v-if="active==1&&isAskOnlyRead"></el-input>
              <span v-else>
                <template >{{ scope.row.tell }}</template>
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="ask" label="要求值" min-width="220px" v-if="isAskOnlyRead">
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求值" v-model="scope.row.ask" clearable type="textarea"
@@ -477,16 +487,6 @@
                </template>
                <template v-else>{{ scope.row.ask }}</template> -->
                <template >{{ scope.row.ask }}</template>
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="tell" label="要求描述" min-width="220px">
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求描述" v-model="scope.row.tell" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'tell')"
                v-if="active==1&&isAskOnlyRead"></el-input>
              <span v-else>
                <template >{{ scope.row.tell }}</template>
              </span>
            </template>
          </el-table-column>
@@ -1370,6 +1370,11 @@
          let obj = this.productList.find(m => m.id == a.id)
          if(obj){
            a.state = obj.state
            a.section = obj.section
            a.ask = obj.ask
            a.manHour = obj.manHour
            a.price = obj.price
            a.tell = obj.tell
          }
        })
      },
@@ -1773,6 +1778,7 @@
      },
      saveMethod(sampleList){
        this.saveLoad = true
        console.log(333333,sampleList)
        this.$axios.post(this.$api.insOrder.addInsOrder, {
          str: JSON.stringify({
            insOrder: this.addObj,
@@ -2103,7 +2109,6 @@
          row.bsm1 = false
        }else if(arr.length>0){
          try{
          row.bsmRow = this.HaveJson(row)
          let section = arr[0].section
          let arr0 = JSON.parse(row.section)
          let arr1 = JSON.parse(row.ask)
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -784,7 +784,7 @@
        <el-button type="primary" @click="submit()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="数据采集" :visible.sync="dataGetDia" min-width="400px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeDataGetDia">
    <el-dialog title="数据采集-计算数据选择" :visible.sync="dataGetDia" min-width="400px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeDataGetDia">
      <div>
        <table border="1" cellpadding="10" class="thermal-table">
          <tr>
@@ -798,10 +798,8 @@
              <td>{{ item.child[0].name }}</td>
              <td>
                <el-checkbox-group
                  v-model="item.child[0].value"
                  :min="0"
                  :max="item.child[0].maxNum">
                  <el-checkbox v-for="(n,j) in item.child[0].arr" :label="n" :key="j+'ppppppppp'">{{n}}</el-checkbox>
                  v-model="getDataIndex">
                  <el-checkbox v-for="(n,j) in item.child[0].arr" :label="j" :key="j+'ppppppppp'">{{n}}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
@@ -809,10 +807,8 @@
              <td>{{ m.name }}</td>
              <td>
                <el-checkbox-group
                  v-model="m.value"
                  :min="0"
                  :max="m.maxNum">
                  <el-checkbox v-for="(n,j) in m.arr" :label="n" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox>
                  v-model="getDataIndex">
                  <el-checkbox v-for="(n,j) in m.arr" :label="j" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
@@ -821,7 +817,7 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="beforeDataGetDia()">取 消</el-button>
        <el-button type="primary" @click="submitDataGet()">确 定</el-button>
        <el-button type="primary" @click="submitDataGet()" :loading="getDataIndexLoading">确 定</el-button>
      </span>
    </el-dialog>
  </div>
@@ -988,6 +984,7 @@
        worker0: null,
        wareLength:[],
        dataAcquisitionInfo:{},
        dataAcquisitionInfoNew:{},
        dataAcquisitionEidt:0,
        dataAcquisitionEidtAble:false,
        dataAcquisitionLoading:false,
@@ -1008,15 +1005,11 @@
            child:[
              {
                name:'1285nm~1330nm',
                arr:[12,13],
                maxNum:1,
                value:[]
                arr:[12,13,14,15],
              },
              {
                name:'1525nm~1575nm',
                arr:[12,13],
                maxNum:1,
                value:[]
                arr:[12,13,14,15],
              },
            ]
          },
@@ -1026,12 +1019,12 @@
              {
                name:'截至波长',
                arr:[12,13,14,15],
                maxNum:3,
                value:[]
              }
            ]
          }
        ]
        ],
        getDataIndex:[],
        getDataIndexLoading:false
      }
    },
    computed: {
@@ -1267,27 +1260,58 @@
            if(res.code!=200){
              return
            }
            this.dataAcquisitionInfo = res.data
            try {
              // 向 Worker 发送消息,开始处理逻辑
              this.worker0.postMessage(JSON.stringify({
                dataAcquisitionInfo: this.dataAcquisitionInfo,
                list:this.tableList[0].arr
              }));
            } catch (error) {
              console.log(1111,error);
            }
            // 监听 Worker 返回的结果
            this.worker0.onmessage = (event) => {
              let result = JSON.parse(event.data);
              if(result.method=='changeInput'){
                let {list,n} = result.value
                this.$set(this.tableList[0],'arr',list)
                this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
              }
            };
            this.dataAcquisitionInfoNew = this.HaveJson(res.data)
            this.handleDataAcquisition(res.data)
          })
        }
      },
      handleDataAcquisition(data){
        this.dataAcquisitionInfo = {}
        this.getData = []
        for (let i in data){
          let obj = {
            faName:i,
            child:[]
          }
          for(let j in data[i]){
            if(j!='frequency'&&!data[i][j].isCalculation){
              this.dataAcquisitionInfo[i+','+j] = {
                value:data[i][j].result,
                frequency:data[i].frequency
              }
            }else if(j!='frequency'&&data[i][j].isCalculation){
              let obj0 = {
                name:j,
                arr:data[i][j].result
              }
              obj.child.push(obj0)
            }
          }
          if(obj.child.length>0){
            this.getData.push(obj)
          }
        }
        if(this.getData.length>0){
          this.dataGetDia = true
        }
        try {
          // 向 Worker 发送消息,开始处理逻辑
          this.worker0.postMessage(JSON.stringify({
            dataAcquisitionInfo: this.dataAcquisitionInfo,
            list:this.tableList[0].arr
          }));
        } catch (error) {
          console.log(1111,error);
        }
        // 监听 Worker 返回的结果
        this.worker0.onmessage = (event) => {
          let result = JSON.parse(event.data);
          if(result.method=='changeInput'){
            let {list,n} = result.value
            this.$set(this.tableList[0],'arr',list)
            this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
          }
        };
      },
      beforeDataGetDia(done){
        this.$confirm('是否取消数据采集?', "提示", {
@@ -1302,7 +1326,43 @@
          }
        }).catch(() => {})
      },
      submitDataGet(){},
      submitDataGet(){
        if(this.getDataIndex.length==0){
          this.$message.error('请选择需要计算的数据')
          return
        }
        this.getDataIndex.sort((a, b) => a - b);
        for (let i in this.dataAcquisitionInfoNew){
          for(let j in this.dataAcquisitionInfoNew[i]){
            if(j!='frequency'&&this.dataAcquisitionInfoNew[i][j].isCalculation){
              let arr = []
              for(let k = 0;k<this.dataAcquisitionInfoNew[i][j].result.length;k++){
                if(this.getDataIndex.includes(k)){
                  arr.push(this.dataAcquisitionInfoNew[i][j].result[k])
                }
              }
              if(arr.length>0){
                this.dataAcquisitionInfoNew[i][j].result = arr
              }
            }
          }
        }
        this.getDataIndexLoading = true;
        this.$axios.post(this.$api.deviceScope.formulaCalculation,{
          map:this.dataAcquisitionInfoNew
        }, {
          headers: {
            'Content-Type': 'application/json'
          },
          noQs:true
        }).then(res=>{
          this.getDataIndexLoading = false;
          if(res.code!=200){
            return
          }
          this.handleDataAcquisition(res.data.map)
        })
      },
      // 多线程
      startWorker() {
        if (this.worker) {
src/components/view/b3-work-time-management.vue
@@ -8,7 +8,7 @@
        <el-radio-button label="workTimeManagement" v-if="selectAuxiliaryOutputWorkingHours">
          日工时管理
        </el-radio-button>
        <el-radio-button label="workTimeConfig" v-if="selectAuxiliaryWorkingHours">
        <el-radio-button label="workTimeConfig" v-if="insertAuxiliaryWorkingHours">
          辅助工时配置
        </el-radio-button>
      </el-radio-group>
@@ -35,7 +35,7 @@
      currentComponent:'workTimeStatistics',
      selectAuxiliaryOriginalHours:false,
      selectAuxiliaryOutputWorkingHours:false,
      selectAuxiliaryWorkingHours:false
      insertAuxiliaryWorkingHours:false
    }
  },
  methods: {
@@ -43,7 +43,7 @@
      let power = JSON.parse(sessionStorage.getItem('power'))
      let selectAuxiliaryOriginalHours = false
      let selectAuxiliaryOutputWorkingHours = false
      let selectAuxiliaryWorkingHours = false
      let insertAuxiliaryWorkingHours = false
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == 'selectAuxiliaryOriginalHours') {
          selectAuxiliaryOriginalHours = true
@@ -51,18 +51,18 @@
        if (power[i].menuMethod == 'selectAuxiliaryOutputWorkingHours') {
          selectAuxiliaryOutputWorkingHours = true
        }
        if (power[i].menuMethod == 'selectAuxiliaryWorkingHours') {
          selectAuxiliaryWorkingHours = true
        if (power[i].menuMethod == 'insertAuxiliaryWorkingHours') {
          insertAuxiliaryWorkingHours = true
        }
      }
      this.selectAuxiliaryOriginalHours = selectAuxiliaryOriginalHours
      this.selectAuxiliaryOutputWorkingHours = selectAuxiliaryOutputWorkingHours
      this.selectAuxiliaryWorkingHours = selectAuxiliaryWorkingHours
      this.insertAuxiliaryWorkingHours = insertAuxiliaryWorkingHours
      if(this.selectAuxiliaryOriginalHours){
        this.currentComponent = 'workTimeStatistics'
      }else if(this.selectAuxiliaryOutputWorkingHours){
        this.currentComponent = 'workTimeManagement'
      }else if(this.selectAuxiliaryWorkingHours){
      }else if(this.insertAuxiliaryWorkingHours){
        this.currentComponent = 'workTimeConfig'
      }
    }
src/main.js
@@ -20,7 +20,7 @@
//本地
// Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
// const javaApi = 'http://127.0.0.1:8001';
const javaApi = 'http://192.168.92.249:8001';
const javaApi = 'http://172.20.10.4:8001';
//云
// Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080";
static/js/worker0.js
@@ -13,7 +13,6 @@
}
function handleData(){
  // console.log(33333,dataAcquisitionInfo)
  list.forEach((item,index)=>{
    let num = 0;
    let str = ''
@@ -40,15 +39,15 @@
          list[index].forEach((n,i)=>{
            if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('检验值')){
              let arr = n.v.ps.value.split('值')
              if(arr[1] ==dataAcquisitionInfo.frequency){
              if(arr[1] ==dataAcquisitionInfo[str].frequency){
                setTimeout(()=>{
                  let num = 0
                  let num0 = 0
                  if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
                    let str = n.v.ct.fa.split('.')[1]
                    num = str.length
                    n.v.v = dataAcquisitionInfo[str]?dataAcquisitionInfo[str].toFixed(num):dataAcquisitionInfo[str]
                    num0 = str.length
                    n.v.v = dataAcquisitionInfo[str].value?dataAcquisitionInfo[str].value.toFixed(num0):dataAcquisitionInfo[str].value
                  }else{
                    n.v.v = dataAcquisitionInfo[str]
                    n.v.v = dataAcquisitionInfo[str].value
                  }
                  result = {
                    method:'changeInput',
@@ -59,16 +58,16 @@
                  }
                  self.postMessage(JSON.stringify(result))
                },2000)
              }else if(Number(dataAcquisitionInfo.frequency)>num){
              }else if(Number(dataAcquisitionInfo[str].frequency)>num){
                if(n.v.ps.value.includes(num)){
                  setTimeout(()=>{
                    let num = 0
                    let num0 = 0
                    if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
                      let str = n.v.ct.fa.split('.')[1]
                      num = str.length
                      n.v.v = dataAcquisitionInfo[str]?Number(dataAcquisitionInfo[str]).toFixed(num):dataAcquisitionInfo[str]
                      num0 = str.length
                      n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value
                    }else{
                      n.v.v = dataAcquisitionInfo[str]
                      n.v.v = dataAcquisitionInfo[str].value
                    }
                    result = {
                      method:'changeInput',