licp
2024-09-29 55008d09e47511bcb241eb909dff3e36c89099db
src/components/do/b1-ins-order/add.vue
@@ -264,7 +264,7 @@
            </div>
          </el-col>
          <el-col class="search_thing" :span="6" v-if="addObj.formType!='其他成品'&&addObj.formType">
            <div class="search_label"><span class="required-span">* </span>下发至对象:</div>
            <div class="search_label"><span class="required-span">* </span>通知至样机员:</div>
            <div class="search_input">
              <el-select v-model="addObj.issueUser" size="small" :disabled="active>1" style="width: 100%;">
                <el-option v-for="(a,ai) in personList" :key="ai" :label="a.label" :value="a.value"></el-option>
@@ -369,6 +369,14 @@
                v-model="addObj.remark" :readonly="active>1"></el-input>
            </div>
          </el-col>
          <el-col class="search_thing upload" :span="4" style="align-items: flex-start;margin: 8px 0 0 50px;height: auto" v-if="active==1">
            <el-upload
              action="#"
              :auto-upload="false"
              accept='.jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv' :on-change="handleChangeUpload">
              <el-button size="small" type="primary">上传附件</el-button>
            </el-upload>
          </el-col>
          <!-- <el-col class="search_thing" :span="6" v-if="active==1">
            <div class="search_label">RTS:</div>
            <div class="search_input">
@@ -400,8 +408,12 @@
            </div>
          </div>
        </div>
        <el-radio-group v-model="currentPage" v-if="active>1" size="small" style="margin-top: 20px;">
          <el-radio-button :label="0">样品</el-radio-button>
          <el-radio-button :label="1">附件</el-radio-button>
        </el-radio-group>
        <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" max-height="400px" tooltip-effect="dark"
          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;">
          border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;" v-show="currentPage==0">
          <el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column>
          <el-table-column type="index" label="序号" width="65" align="center"></el-table-column>
          <el-table-column prop="sample" label="样品名称" align="center" min-width="100">
@@ -472,7 +484,7 @@
        </el-table>
        <el-table class="el-table" ref="productTable" :data="productList" max-height="400px" tooltip-effect="dark" border
          @selection-change="selectProduct" style="margin-bottom: 10px;" @select="upProductSelect"
          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll">
          :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll" v-show="currentPage==0">
          <el-table-column type="selection" width="65" :selectable="selectable" v-if="active==1"></el-table-column>
          <el-table-column prop="inspectionItemClass" v-if="PROJECT === '装备电缆'" label="检验项分类" min-width="140" show-overflow-tooltip></el-table-column>
          <el-table-column prop="inspectionItemClassEn" v-if="PROJECT === '装备电缆'" label="检验项分类(EN)" min-width="140" show-overflow-tooltip></el-table-column>
@@ -554,6 +566,9 @@
          <el-table-column prop="sonLaboratory" label="子实验室" min-width="130" show-overflow-tooltip :filters="filters"
            :filter-method="filterHandler"></el-table-column>
        </el-table>
        <ValueTable class="value-table" ref="fileList" :url="$api.insOrderPlan.getFileList"
        :componentData="componentData0"
        :delUrl="$api.insOrderPlan.delfile" style="height: 100%;margin-top: 16px;" v-show="currentPage==1"/>
      </div>
    </div>
    <el-dialog title="选择单位" :visible.sync="selectUserDia" width="70%">
@@ -952,6 +967,13 @@
        <el-button type="primary" @click="spliceTemperatureTest">保存</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="文件预览"
      :visible.sync="lookFileVisible"
      width="60%" fullscreen>
      <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
      :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
    </el-dialog>
  </div>
</template>
@@ -962,6 +984,7 @@
import equipConfig from './equip-config.vue'
import cableConfig from './cable-config.vue'
import Vue from 'vue'
import filePreview from '../../tool/file-preview.vue'
export default {
    components: {
@@ -969,7 +992,8 @@
      fiberOpticConfig,
      fiberOpticConfigTwo,
      equipConfig,
      cableConfig
      cableConfig,
      filePreview
    },
    props: {
      examine: {
@@ -987,6 +1011,8 @@
    },
    data() {
      return {
        currentFile:{},
        lookFileVisible:false,
        inspectionItemST: null,
        sampleSelectionList: [],//样品表格选中数据
        editTable:[],
@@ -1166,6 +1192,52 @@
        deaprtEnum:[],
        standard:[],
        createState:1,//1:选择委托单位,2:选择生产单位
        fileList:[],
        currentPage:0,//0:样品信息,1:附件
        componentData0: {
          entity: {
            insOrderId:''
          },
          isIndex: true,
          showSelect: false,
          select: false,
          sort: false,
          init:false,
          do: [
          {
                  id: 'handleDown',
                  font: '下载',
                  type: 'text',
                  method: 'handleDown'
               },
          {
                  id: '1',
                  font: '预览',
                  type: 'text',
                  method: 'lookFile',
               }
          ],
          isPage: false,
          linkEvent: {},
          tagField: {
            type:{
              select:[
                {
                  value: 1,
                  label: '图片'
                },
                {
                  value: 2,
                  label: '文件'
                }
              ]
            }
          },
          currentId: '',
          selectField: {},
          requiredAdd: [],
          requiredUp: []
        },
      }
    },
    watch: {
@@ -1261,10 +1333,45 @@
            }
          })
        })
        // 文件信息
        this.componentData0.entity.insOrderId = this.currentId
        this.$refs.fileList.selectList()
      }
    },
    methods: {
      lookFile(row){
        this.currentFile = row;
        if(row.type==1){
          this.currentFile.url = this.javaApi+'/img/'+row.fileUrl
        }else{
          this.currentFile.url = this.javaApi+'/word/'+row.fileUrl
        }
        this.lookFileVisible = true
      },
      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.fileUrl
              file.downloadIamge(url,row.fileName)
            }else{
              url = this.javaApi+'/word/'+res.data.fileUrl
              const link = document.createElement('a');
              link.href = url;
              link.download = row.fileName;
              link.click();
            }
          }
        }).catch(error => {
        })
      },
      handleChangeUpload(file, fileLists){
        this.fileList = fileLists
      },
      //特殊值填写处理
      inputValueHandler(row,index){
        if(row){
@@ -1687,7 +1794,7 @@
        } else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
          this.$message.error('请选择检验标准')
        } else if(this.addObj.formType&&this.addObj.formType!='其他成品'&&!this.addObj.issueUser){
          this.$message.error('请选择下发对象')
          this.$message.error('请选择通知至样机员')
        }else{
          //校验检验项的要求值和要求描述,仅委托要求
          // if(this.active==1&&this.isAskOnlyRead){
@@ -2058,8 +2165,12 @@
          return false;
        }
        this.saveLoad = true
        this.$axios.post(this.$api.insOrder.addInsOrder, {
          str: JSON.stringify({
        let fd = new FormData();
        this.fileList.forEach((item,index)=>{
            //文件信息中raw才是真的文件
            fd.append("files",item.raw);
        })
        fd.append("str",JSON.stringify({
            insOrder: this.addObj,
            list: JSON.stringify(sampleList.map(a => {
              if (this.PROJECT === '装备电缆') {
@@ -2082,7 +2193,12 @@
              return a
            })),
            pairing: JSON.stringify(this.bsm2Val2)
          })
          }));
        this.$axios.post(this.$api.insOrder.addInsOrder, fd,{
          headers: {
            'Content-Type': 'multipart/form-data'
          },
          noQs:true
        }).then(res => {
          this.saveLoad = false
          if (res.code == 201) return