licp
2024-06-05 142ba3ed00220dcadf2a94e59664d5f1f027dbf4
新增附件上传
已修改9个文件
349 ■■■■■ 文件已修改
src/assets/api/controller.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b1-ins-order/add.vue 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b1-inspect-order-plan/Inspection.vue 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b3-work-time-management/work-time-management.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b3-work-time-management/work-time-statistics.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/a6-device-management.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/util/file.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/view/notice.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -180,6 +180,11 @@
  submitPlan: "/insOrderPlan/submitPlan", //检验任务提交
  inspectionOrderDetailsTaskSwitching: "/insOrderPlan/inspectionOrderDetailsTaskSwitching", // 检验单详情-任务切换
  getInsProduct: "/insOrderPlan/getInsProduct", // 获取检验项目和模板内容
  getFileList: "/insOrderPlan/getFileList", // 查看检验单下的附件列表
  delfile: "/insOrderPlan/delfile", // 附件删除
  uploadFile: "/insOrderPlan/uploadFile", // 附件上传
  downFile: "/insOrderPlan/downFile", // 附件下载
  checkSubmitPlan: "/insOrderPlan/checkSubmitPlan", // 校验检验任务提交
}
const systemLog = {
@@ -341,4 +346,5 @@
const auxiliaryOriginalHours = {
  selectAuxiliaryOriginalHours: "/auxiliaryOriginalHours/selectAuxiliaryOriginalHours", //查询原始工时
  exportOriginalHours: "/auxiliaryOriginalHours/exportOriginalHours", //导出原始工时
}
src/components/do/b1-ins-order/add.vue
@@ -281,6 +281,12 @@
              v-model="addObj.remark" :readonly="active>1"></el-input>
          </div>
        </el-col>
        <el-col class="search_thing" :span="6" v-if="active==1">
          <div class="search_label">RTS:</div>
          <div class="search_input">
            <el-input size="small" placeholder="请输入" clearable v-model="RTS"></el-input>
          </div>
        </el-col>
      </el-row>
    </div>
    <div v-show="!configShow">
@@ -631,6 +637,8 @@
        bsm1Val: null,
        bsm1Dia: false,
        total:0,
        RTS:'',
        totalArr:[]
      }
    },
    watch: {
@@ -726,6 +734,32 @@
        this.addObj.companyId = selects.id
        this.selectUserDia = false
      },
      handleAsk(ask){
        let code = [">","<","=",">","<","≥","≤","±"];
        if(ask.includes('RTS')){
          if(ask.includes('&')){
            // 多个条件
            let arr0 = ask.split('&')
            arr0.forEach(m=>{
                let index = code.findIndex(b=>m.includes(b))
              if(index>-1){
                let arr = m.split(code[index]).find(b=>b)
                let num = eval(arr[0].replace(/RTS/g, this.RTS))
                m = code[index] + ''+ num
              }
            })
            return arr0.join('&')
          }else{
            // 单个条件
            let index = code.findIndex(b=>ask.includes(b))
            if(index>-1){
              let arr = ask.split(code[index]).find(b=>b)
              let num = eval(arr[0].replace(/RTS/g, this.RTS))
              return code[index] + ''+ num
            }
          }
        }
      },
      save() {
        if (!this.addObj.companyId) {
          this.$message.error('未选择客户单位')
@@ -749,11 +783,68 @@
          this.$message.error('请输入样品型号')
        } else if (!this.sampleList.every(m => m.standardMethodListId)) {
          this.$message.error('请选择检验标准')
        }else if (this.totalArr.find(a=>a.ask.includes('RTS'))&&!this.RTS) {
          this.$message.error('请输入RTS')
        } else {
          let sampleList = this.HaveJson(this.sampleList)
          let isRTS = this.totalArr.find(a=>a.ask.includes('RTS'))
          if(isRTS){
            sampleList.forEach(item=>{
              if(item.insProduct&&item.insProduct.length>0){
                item.insProduct.forEach(a=>{
                  let ask = this.handleAsk(a.ask)
                  if(ask){
                    a.ask = ask
                  }
                })
              }
              // 光纤带项目
              if(item.bushing&&item.bushing.length>0){
                item.bushing.forEach(a=>{
                  if(a.fiber&&a.fiber.length>0){
                    a.fiber.forEach(b=>{
                      if(b.productList&&b.productList.length>0){
                        b.productList.forEach(c=>{
                          let ask = this.handleAsk(c.ask)
                          if(ask){
                            c.ask = ask
                          }
                        })
                      }
                    })
                  }
                  if(a.fibers&&a.fibers.length>0){
                    a.fibers.forEach(b=>{
                      if(b.productList&&b.productList.length>0){
                        b.productList.forEach(c=>{
                          let ask = this.handleAsk(c.ask)
                          if(ask){
                            c.ask = ask
                          }
                        })
                      }
                      if(b.fiber&&b.fiber.length>0){
                        b.fiber.forEach(c=>{
                          if(c.productList&&c.productList.length>0){
                            c.productList.forEach(d=>{
                              let ask = this.handleAsk(d.ask)
                              if(ask){
                                d.ask = ask
                              }
                            })
                          }
                        })
                      }
                    })
                  }
                })
              }
            })
          }
          this.saveLoad = true
          this.$axios.post(this.$api.insOrder.addInsOrder, {
            insOrder: this.addObj,
            list: JSON.stringify(this.sampleList.map(a => {
            list: JSON.stringify(sampleList.map(a => {
              a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : (
                '-' + a.modelNum))
              return a
@@ -1352,12 +1443,12 @@
        done()
      },
      getTotal(){
        let arr = []
        this.totalArr = []
        this.total = 0;
        this.sampleList.forEach(item=>{
          if(item.insProduct&&item.insProduct.length>0){
            item.insProduct.forEach(a=>{
              arr.push(a)
               this.totalArr.push(a)
            })
          }
          if(item.bushing&&item.bushing.length>0){
@@ -1366,7 +1457,7 @@
                a.fiber.forEach(b=>{
                  if(b.productList&&b.productList.length>0){
                    b.productList.forEach(c=>{
                      arr.push(c)
                       this.totalArr.push(c)
                    })
                  }
                })
@@ -1375,14 +1466,14 @@
                a.fibers.forEach(b=>{
                  if(b.productList&&b.productList.length>0){
                    b.productList.forEach(c=>{
                      arr.push(c)
                       this.totalArr.push(c)
                    })
                  }
                  if(b.fiber&&b.fiber.length>0){
                    b.fiber.forEach(c=>{
                      if(c.productList&&c.productList.length>0){
                        c.productList.forEach(d=>{
                          arr.push(d)
                           this.totalArr.push(d)
                        })
                      }
                    })
@@ -1393,7 +1484,7 @@
          }
        })
        let mySet = new Set();
        let arr0 = arr.filter(item=>{
        let arr0 =  this.totalArr.filter(item=>{
          if(item.state == 1){
            let num1= mySet.size
            if(item.manHourGroup===''||!item.manHourGroup){
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -320,6 +320,19 @@
          </tbody>
        </table>
      </div>
      <el-upload :action="action"
      :data="{
        orderId:id
      }"
      v-show="state==1"
      :on-success="handleSuccessUp" :show-file-list="false"
        accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers" :on-change="beforeUpload"
        :on-error="onError" ref='upload'>
        <el-button size="small" type="primary" :loading="upLoading">附件上传</el-button></el-upload>
      <ValueTable class="value-table" ref="fileList" :url="$api.insOrderPlan.getFileList"
        :componentData="componentData0"
        :delUrl="$api.insOrderPlan.delfile"
        :key="upIndex" style="height: 100%;margin-top: 16px;"/>
    </div>
    <el-drawer title="光纤切换" :visible.sync="fiberOpticVisible" :size="500">
      <el-table class="el-table" ref="fiberOpticTable" :data="fiberOptic" height="100%" tooltip-effect="dark" border
@@ -422,6 +435,7 @@
<script>
  import ValueTable from '../../tool/value-table.vue'
  import file from '../../../util/file'
  export default {
    props: ['sonLaboratory', 'orderId', 'state'],
    components: {
@@ -457,6 +471,53 @@
            insState: {
              select: []
            },
          },
          currentId: '',
          selectField: {},
          requiredAdd: [],
          requiredUp: []
        },
        componentData0: {
          entity: {
            insOrderId:''
          },
          isIndex: true,
          showSelect: false,
          select: false,
          selectMethod: '',
          sort: false,
          init:false,
          do: [
          {
                        id: 'delete',
                        font: '删除',
                        type: 'text',
                        method: 'doDiy',
            disabFun: (row, index) => {
                                return this.state!=1
                            }
                    }, {
                        id: 'handleDown',
                        font: '下载',
                        type: 'text',
                        method: 'handleDown'
                    },
          ],
          isPage: false,
          linkEvent: {},
          tagField: {
            type:{
              select:[
                {
                  value: 1,
                  label: '图片'
                },
                {
                  value: 2,
                  label: '文件'
                }
              ]
            }
          },
          currentId: '',
          selectField: {},
@@ -499,8 +560,19 @@
        currentFiberOptic:null,//当前光纤
        currentBushing:null,//当前套管
        tableLoading:false,
        upLoading:false
      }
    },
    computed: {
            headers() {
                return {
                    'token': sessionStorage.getItem('token')
                }
            },
            action() {
                return this.javaApi + this.$api.insOrderPlan.uploadFile
            }
        },
    created() {
      this.componentData.entity.sonLaboratory = this.sonLaboratory;
      this.id = this.orderId;
@@ -521,6 +593,8 @@
          laboratory: this.sonLaboratory
        }).then(async res => {
          this.insOrder = res.data.insOrder;
          this.componentData0.entity.insOrderId = val;
          this.$refs.fileList.selectList()
          this.urgentList.forEach(m => {
            if (m.value == this.insOrder.type) {
              this.insOrder.typeName = m.label
@@ -1414,20 +1488,67 @@
        }
        this.addVerifyDia = false
        this.submitLoading = true;
        this.$axios.post(this.$api.insOrderPlan.submitPlan, {
        this.$axios.post(this.$api.insOrderPlan.checkSubmitPlan, {
          orderId: this.orderId,
          laboratory: this.sonLaboratory,
          verifyUser: this.verifyUser
        }).then(res => {
          if (res.code === 200) {
            this.$message.success("操作成功")
            this.$emit('goback')
            console.log(res.data)
            if(!res.data||res.data.length==0){
              this.$axios.post(this.$api.insOrderPlan.submitPlan, {
                orderId: this.orderId,
                laboratory: this.sonLaboratory,
                verifyUser: this.verifyUser
              }).then(res => {
                if (res.code === 200) {
                  this.$message.success("操作成功")
                  this.$emit('goback')
                }
                this.submitLoading = false;
              }).catch(error => {
                console.error(error)
                this.submitLoading = false;
              })
            }else{
              let newData = []
              const h = this.$createElement
              for (let i in res.data) {
                const lastChar = res.data[i].slice(-1);
                if(lastChar=='-'){
                  res.data[i] = res.data[i].slice(0, -1);
                }
                newData.push(h('p', {style: 'font-size: 12px;'}, (Number(i)+1)+'、'+res.data[i]))
              }
              newData.push(h('p',  { style: 'font-size: 16px;color:#000;margin-top:12px' },'以上项目不合格,确定提交?'))
              this.$confirm('提示',{
                title:'提示',
                message: h('div', null, newData),
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: ""
              }).then(() => {
                this.$axios.post(this.$api.insOrderPlan.submitPlan, {
                  orderId: this.orderId,
                  laboratory: this.sonLaboratory,
                  verifyUser: this.verifyUser
                }).then(res => {
                  if (res.code === 200) {
                    this.$message.success("操作成功")
                    this.$emit('goback')
                  }
                }).catch(error => {
                  console.error(error)
                })
              }).catch(() => {})
            }
          }
          this.submitLoading = false;
        }).catch(error => {
          console.error(error)
          this.submitLoading = false;
        })
        return
      },
      saveInsContext() {
        this.$axios.post(this.$api.insOrderPlan.saveInsContext, {
@@ -1515,6 +1636,48 @@
          }
        })
        this.getTableLists()
      },
      handleSuccessUp(response, ) {
        this.upLoading = false;
                if (response.code == 200) {
          this.$message.success('上传成功');
          this.$refs.fileList.selectList()
                }
            },
      beforeUpload(file) {
                if (file.size > 1024 * 1024 * 10) {
                    this.$message.error('上传文件不超过10M');
                    this.$refs.upload.clearFiles()
                    return false;
                } else {
          this.upLoading = true;
                    return true;
                }
            },
      onError(err, file, fileList) {
                this.$message.error('上传失败')
                this.$refs.upload.clearFiles()
            },
      handleDown(row){
        this.$axios.post(this.$api.insOrderPlan.downFile, {
          id: row.id,
        }).then(res => {
          if (res.code === 200) {
            let url = '';
            if(res.data.type==1){
              url = this.javaApi+'/img/'+res.data.url
              file.downloadIamge(url,row.fileName)
            }else{
              url = this.javaApi+'/word/'+res.data.url
              const link = document.createElement('a');
              link.href = url;
              link.download = row.fileName;
              link.click();
            }
          }
        }).catch(error => {
        })
      }
    }
  }
src/components/do/b3-work-time-management/work-time-management.vue
@@ -333,6 +333,7 @@
                    requiredAdd: [],
                    requiredUp: []
            },
      addFileVisible:false,
      entityCopy1: {},
      upIndex1:100,
      weekList:[
src/components/do/b3-work-time-management/work-time-statistics.vue
@@ -10,7 +10,8 @@
            format="yyyy-MM"
            value-format="yyyy-MM"
            placeholder="选择月" size="small" style="width: 100%;"
            :clearable="false">
            :clearable="false"
            @change="refreshTable()">
          </el-date-picker>
        </div>
            </div>
@@ -39,8 +40,8 @@
                <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
            </div>
      <div class="search_thing">
        <el-button size="small" type="primary"  @click="handleDown" v-show="currentTable == 'value0'">导 出</el-button>
        <el-button size="small" type="primary" @click="handleUp" v-show="currentTable == 'value1'">导 入</el-button>
        <el-button size="small" type="primary"  @click="handleDown" v-show="currentTable == 'value0'" :loading="outLoading">导 出</el-button>
        <el-button size="small" type="primary"  @click="handleUp" v-show="currentTable == 'value1'">导 入</el-button>
      </div>
        </div>
    <el-radio-group v-model="currentTable" size="small" :key="'111'" style="margin-top: 10px;">
@@ -55,7 +56,7 @@
      <ValueTable ref="ValueTable0"
        v-if="currentTable == 'value0'"
                :url="$api.auxiliaryOriginalHours.selectAuxiliaryOriginalHours"
                :componentData="componentData" :downUrl="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours" :key="upIndex" />
                :componentData="componentData" :key="upIndex" />
      <ValueTable ref="ValueTable1"
        v-if="currentTable == 'value1'"
                :url="$api.auxiliaryCorrectionHours.selectAuxiliaryCorrectionHours"
@@ -130,7 +131,8 @@
      upIndex1:100,
      weekList:[],
      personList:[],
      currentTable:'value0'
      currentTable:'value0',
      outLoading:false
    }
  },
  mounted(){
@@ -185,7 +187,23 @@
        })
    },
    handleDown(){
      this.$refs.ValueTable0.downFile(false)
      // this.$refs.ValueTable0.downFile(false)
      let entity = {...this.entity}
      entity.month = entity.month.split('-')[0]+'-'+entity.month.split('-')[1]
      this.outLoading = true
      this.$axios.get(this.$api.auxiliaryOriginalHours.exportOriginalHours,{
        params:entity,
      },{responseType: "blob"}).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res],{ type: 'application/octet-stream' });
        console.log(blob)
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = entity.month+'工时统计表.xlsx';
        link.click();
      })
    },
    handleUp(){
      this.$refs.ValueTable1.openUpload()
src/components/view/a6-device-management.vue
@@ -750,7 +750,7 @@
                delete this.formData.updateTime
                delete this.formData.createUser
                delete this.formData.updateUser
        this.formData.insProductIds = this.formData.insProductIds.join()
        this.formData.insProductIds = this.formData.insProductIds?this.formData.insProductIds.join():''
        this.upLoad = true;
                this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.formData, {
                    headers: {
src/main.js
@@ -13,8 +13,8 @@
//本地
Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
const javaApi = 'http://192.168.11.200:8001';//李
// const javaApi = 'http://192.168.11.249:8001';//张
// const javaApi = 'http://192.168.11.200:8001';//李
const javaApi = 'http://192.168.11.249:8001';//张
// const javaApi = 'http://172.20.10.3:8001';//姜
// const javaApi = 'http://192.168.11.2:8001';//柴
//  const javaApi = 'http://127.0.0.1:8001';//晏
@@ -68,7 +68,11 @@
axios.interceptors.response.use(res => {
    if(res.data.code === 201){
        Message.error(res.data.message)
        Message({
      type: 'error',
      dangerouslyUseHTMLString: true,
      message: `${res.data.message}`
    })
    }
    return res.data
}, async function(err) {
src/util/file.js
@@ -38,4 +38,24 @@
    })
    return await xhrPromise
  },
  downloadIamge(imgsrc, name) {//下载图片地址和图片名
    var image = new Image();
    // 解决跨域 Canvas 污染问题
    image.setAttribute("crossOrigin", "anonymous");
    image.onload = function() {
      var canvas = document.createElement("canvas");
      canvas.width = image.width;
      canvas.height = image.height;
      var context = canvas.getContext("2d");
      context.drawImage(image, 0, 0, image.width, image.height);
      var url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
      var a = document.createElement("a"); // 生成一个a元素
      var event = new MouseEvent("click"); // 创建一个单击事件
      a.download = name || "photo"; // 设置图片名称
      a.href = url; // 将生成的URL设置为a.href属性
      a.dispatchEvent(event); // 触发a的单击事件
    };
    image.src = imgsrc;
  }
};
src/view/notice.vue
@@ -11,9 +11,9 @@
        class="notice-content-item"
        v-for="(m,i) in list"
        :key="i"
        :class="{readStyle:!m.viewStatus}"
        :class="{readStyle:m.viewStatus}"
        @click="goNoticeDetail(m)">
          <img :src="`../../static/img/notice-${m.viewStatus?0:1}-${m.messageType}.svg`" alt="" style="margin-right: 6px;">
          <img :src="`../../static/img/notice-${m.viewStatus?1:0}-${m.messageType}.svg`" alt="" style="margin-right: 6px;">
          <div class="notice-content-item-left">
            <p>{{ m.theme }}</p>
            <p style="width: 100%;display: flex;align-items: center;justify-content: space-between;">