licp
2024-06-05 142ba3ed00220dcadf2a94e59664d5f1f027dbf4
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 => {
        })
      }
    }
  }