value
2023-08-24 dfce0fb8a38424408ef577984cc590c149b131b1
修改委托
已修改6个文件
368 ■■■■ 文件已修改
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inspection/commisioninspection.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inspectionManagement/commissionInspection/addCommision.vue 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inspectionManagement/commissionInspection/index.vue 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -26,7 +26,6 @@
    "path-to-regexp": "2.4.0",
    "postcss-pxtorem": "^5.1.1",
    "vue": "2.6.10",
    "vue-qr": "^4.0.9",
    "vue-router": "3.0.6",
    "vuex": "3.1.0"
  },
src/api/inspection/commisioninspection.js
@@ -56,3 +56,12 @@
    method: 'get'
  })
}
export function isIfViewUUID(params){
  return request({
    url: '/link-basic/isIfViewUUID',
    method: 'get',
        params
  })
}
src/main.js
@@ -41,6 +41,8 @@
    return JSON.parse(JSON.stringify(val))
}
Vue.prototype.vueIp = "http://localhost:8080/"
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明
src/router/index.js
@@ -54,6 +54,11 @@
    }]
  },
  {
      path: '/addCommision/:viewId',
      hidden: true,
      component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'),
    },
  {
    path: '/standardLibrary',
    component: Layout,
    redirect: '/standardLibrary/index',
@@ -164,16 +169,7 @@
        path: 'commissionInspection',
        name: 'CommissionInspection',
        component: () => import('@/views/inspectionManagement/commissionInspection/index'),
        meta: { title: '委托检验', icon: 'table' },
        children: [
          {
            path: 'addCommision/:viewId',
            name: 'AddCommision',
            hidden: true,
            component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'),
            meta: { title: '检测信息', icon: 'table' }
          }
        ]
        meta: { title: '委托检验', icon: 'table' }
      },
      {
        path: 'reportForInspection',
@@ -478,6 +474,7 @@
const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
    mode: 'history',
  routes: constantRoutes
})
src/views/inspectionManagement/commissionInspection/addCommision.vue
@@ -1,63 +1,27 @@
<template>
  <div v-if="!showDetail">
    <div class="add_commision">
  <div class="content-main">
    <div class="firstBox">
      <div class="title">检测信息</div>
                <div class="title">委托信息</div>
      <div class="tableBox">
        <div class="tableBox-header">
        <el-button class="split" @click="dialogueFormVisible = true" type="primary" size="small" style="background-color: rgb(1, 102, 226);">添加样品</el-button>
        <el-input
          v-model="searchData"
          class="input-form split"
          placeholder="扫描二维码录入样品..."
          prefix-icon="el-icon-search"
          style="width: 200px;"
        >
        </el-input>
                        <el-button class="split" @click="dialogueFormVisible = true" type="primary" size="small"
                            style="background-color: rgb(1, 102, 226);">添加样品</el-button>
                        <!-- <el-input v-model="searchData" class="input-form split" placeholder="扫描二维码录入样品..."
                            prefix-icon="el-icon-search" style="width: 200px;">
                        </el-input> -->
        <el-button type="primary" size="small" style="background-color: rgb(1, 102, 226);">重置</el-button>
      </div>
        <el-table
                ref="detectionInfo"
                :max-height="800"
                :cell-style="{textAlign: 'center'}"
                    <el-table ref="detectionInfo" :max-height="800" :cell-style="{textAlign: 'center'}"
                :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
                :data="detectionInfo"
                style="width: 100%"
              >
                <el-table-column
                  type="index"
                  label="序号"
                  min-width="10%"
                />
                <el-table-column
                  prop="sampleNumber"
                  label="样品编号"
                  min-width="8%"
                />
                <el-table-column
                  prop="sampleName"
                  label="样品名称"
                  min-width="10%"
                />
                <el-table-column
                  prop="specificationsModels"
                  label="规格型号"
                  min-width="10%"
                />
                <el-table-column
                  prop="unit"
                  label="单位"
                  min-width="8%"
                />
                <el-table-column
                  prop="samplesNumber"
                  label="数量"
                  min-width="8%"
                />
                <el-table-column
                  prop="addway"
                  label="添加方式"
                  min-width="8%">
                        :data="detectionInfo" style="width: 100%">
                        <el-table-column type="index" label="序号" min-width="10%" />
                        <el-table-column prop="sampleNumber" label="样品编号" min-width="8%" />
                        <el-table-column prop="sampleName" label="样品名称" min-width="10%" />
                        <el-table-column prop="specificationsModels" label="规格型号" min-width="10%" />
                        <el-table-column prop="unit" label="单位" min-width="8%" />
                        <el-table-column prop="samplesNumber" label="数量" min-width="8%" />
                        <el-table-column prop="addway" label="添加方式" min-width="8%">
                  <template slot-scope="scope">
                    <div v-if="scope.row.addway === 0">
                      <el-tag :type= 'success' disable-transitions>扫描</el-tag>
@@ -68,20 +32,9 @@
                    <div v-else></div>
                </template>
                </el-table-column>
                <el-table-column
                  prop="experiment"
                  label="试验"
                  min-width="8%"
                />
                <el-table-column
                  prop="remarks"
                  label="备注"
                  min-width="8%"
                />
                <el-table-column
                  label="操作"
                  min-width="8%"
                >
                        <el-table-column prop="experiment" label="试验" min-width="8%" />
                        <el-table-column prop="remarks" label="备注" min-width="8%" />
                        <el-table-column label="操作" min-width="8%">
                  <template slot-scope="scope">
                    <el-button type="text" size="small">修改</el-button>
                    <el-button type="text" size="small" @click="deleteRow(scope.row)">删除</el-button>
@@ -90,15 +43,9 @@
              </el-table>
              <!-- 分页器 -->
              <div>
                <el-pagination
                  class="pagination"
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage"
                  :page-sizes="[100, 200, 300, 400]"
                  :page-size="100"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="400">
                        <el-pagination class="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page="currentPage" :page-sizes="[100, 200, 300, 400]" :page-size="100"
                            layout="total, sizes, prev, pager, next, jumper" :total="400">
                </el-pagination>
              </div>
      </div>
@@ -110,12 +57,14 @@
            <el-button type="primary" size="mini" style="background-color: rgb(1, 102, 226); ">打印委托单</el-button>
            </el-col>
        </el-row>
            <el-form :model="infoForm" ref="infoForm" class="infoForm" label-position="right" label-width="100px" size="mini" >
                    <el-form :model="infoForm" ref="infoForm" class="infoForm" label-position="right" label-width="100px"
                        size="mini">
              <div class="formwrapper">
                  <el-row :gutter="200">
                        <el-col :span="5">
                        <el-form-item label="委托编号:">
                            <el-input style="width: 160px" type="text" :value="infoForm.commisioncode" readonly disabled="true" autocomplete="off" />
                                        <el-input style="width: 160px" type="text" :value="infoForm.commisioncode" readonly disabled
                                            autocomplete="off" />
                        </el-form-item>
                        </el-col>
                        <el-col :span="5">
@@ -137,33 +86,27 @@
                    <el-row :gutter="200">
                        <el-col :span="5">
                        <el-form-item label="联系地址:" >
                          <el-input style="width: 160px;" v-model="infoForm.address" placeholder="请输入联系地址" autocomplete="off" />
                                        <el-input style="width: 160px;" v-model="infoForm.address" placeholder="请输入联系地址"
                                            autocomplete="off" />
                        </el-form-item>
                        </el-col>
                        <el-col :span="5">
                        <el-form-item label="完成期限:">
                            <el-date-picker
                              v-model="infoForm.deadline"
                              type="date"
                              placeholder="选择日期"
                              style="width: 160px;">
                                        <el-date-picker v-model="infoForm.deadline" type="date" placeholder="选择日期" style="width: 160px;">
                            </el-date-picker>
                          </el-form-item>
                        </el-col>
                        <el-col :span="5">
                        <el-form-item label="送样时间:">
                            <el-date-picker
                              v-model="infoForm.time"
                              type="date"
                              placeholder="选择日期"
                              style="width: 160px;">
                                        <el-date-picker v-model="infoForm.time" type="date" placeholder="选择日期" style="width: 160px;">
                            </el-date-picker>
                        </el-form-item>
                        </el-col>
                        <el-col :span="5">
                        <el-form-item label="送样方式:">
                          <el-select style="width: 160px;" v-model="infoForm.way" size="small" placeholder="送样">
                                <el-option v-for="options in sampleDeliveryMode" :key="options.key" :value="options.value">{{ options.value }}</el-option>
                                            <el-option v-for="options in sampleDeliveryMode" :key="options.key"
                                                :value="options.value">{{ options.value }}</el-option>
                            </el-select>
                        </el-form-item>
                        </el-col>
@@ -176,7 +119,8 @@
                        </el-col>
                        <el-col :span="5">
                        <el-form-item label="送样人电话:" >
                          <el-input style="width: 160px;" v-model="infoForm.sendertel" placeholder="请输入送样人电话" autocomplete="off" />
                                        <el-input style="width: 160px;" v-model="infoForm.sendertel" placeholder="请输入送样人电话"
                                            autocomplete="off" />
                        </el-form-item>
                        </el-col>
                        <el-col :span="5">
@@ -192,30 +136,32 @@
                    </el-row>
                    </div>
                    <div class="submitBtn">
                      <el-button type="primary" size="small" @click="submitInspection" style="background-color: rgb(1, 102, 226);">提交</el-button>
                            <el-button type="primary" size="small" @click="submitInspection"
                                style="background-color: rgb(1, 102, 226);">提交</el-button>
                    </div>
                </el-form>
      </div>
    </div>
    <div class="checkType">
      <el-dialog
        title="添加指标"
        :visible.sync="dialogueFormVisible"
        width="40%"
      >
        <el-form :model="addPointerForm" ref="addPointerForm" class="addPointerForm" label-position="right" label-width="100px" size="mini">
                <el-dialog title="添加指标" :visible.sync="dialogueFormVisible" width="40%">
                    <el-form :model="addPointerForm" ref="addPointerForm" class="addPointerForm" label-position="right"
                        label-width="100px" size="mini">
          <el-row :gutter="50">
            <el-col :span="10">
              <el-form-item label="样品编号:">
                <el-select style="width: 160px;" v-model="addPointerForm.sampleNumber" size="small" placeholder="请选择样品编号">
                  <el-option v-for="options in samplecodeoptions" :value="options.value" :key="options.key" >{{ options.value }}</el-option>
                                    <el-select style="width: 160px;" v-model="addPointerForm.sampleNumber" size="small"
                                        placeholder="请选择样品编号">
                                        <el-option v-for="options in samplecodeoptions" :value="options.value"
                                            :key="options.key">{{ options.value }}</el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="样品名称:">
                <el-select style="width: 160px;" v-model="addPointerForm.sampleName" size="small" placeholder="请选择样品名称">
                  <el-option v-for="options in sampleoptions" :value="options.value" :key="options.key">{{ options.value }}</el-option>
                                    <el-select style="width: 160px;" v-model="addPointerForm.sampleName" size="small"
                                        placeholder="请选择样品名称">
                                        <el-option v-for="options in sampleoptions" :value="options.value"
                                            :key="options.key">{{ options.value }}</el-option>
                </el-select>
              </el-form-item>
            </el-col>
@@ -223,26 +169,31 @@
          <el-row :gutter="50">
            <el-col :span="10">
              <el-form-item label="规格型号:">
                <el-select style="width: 160px;" v-model="addPointerForm.specificationsModels" size="small" placeholder="请选择样品名称">
                  <el-option v-for="options in model_spe_options" :value="options.value" :key="options.key">{{ options.value }}</el-option>
                                    <el-select style="width: 160px;" v-model="addPointerForm.specificationsModels" size="small"
                                        placeholder="请选择样品名称">
                                        <el-option v-for="options in model_spe_options" :value="options.value"
                                            :key="options.key">{{ options.value }}</el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="样品单位:">
                <el-input style="width: 160px" type="text" v-model="addPointerForm.unit" placeholder="请输入单位" autocomplete="off" />
                                    <el-input style="width: 160px" type="text" v-model="addPointerForm.unit" placeholder="请输入单位"
                                        autocomplete="off" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="50">
            <el-col :span="10">
              <el-form-item label="样品数量:">
                <el-input style="width: 160px" type="text" v-model="addPointerForm.samplesNumber" placeholder="请输入数量" autocomplete="off" />
                                    <el-input style="width: 160px" type="text" v-model="addPointerForm.samplesNumber" placeholder="请输入数量"
                                        autocomplete="off" />
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-form-item label="备注:">
                <el-input style="width: 160px" type="text" v-model="addPointerForm.remarks" placeholder="请输入备注" autocomplete="off" />
                                    <el-input style="width: 160px" type="text" v-model="addPointerForm.remarks" placeholder="请输入备注"
                                        autocomplete="off" />
              </el-form-item>
            </el-col>
          </el-row>
@@ -250,7 +201,8 @@
            <el-col :span="10">
              <el-form-item label="添加实验:">
                <el-checkbox-group v-model="addPointerForm.experiment" style="display: flex; flex-direction: column;">
                  <el-checkbox v-for="expers in experList" :label="expers.label" :key="expers.key">{{ expers.label }}</el-checkbox>
                                        <el-checkbox v-for="expers in experList" :label="expers.label"
                                            :key="expers.key">{{ expers.label }}</el-checkbox>
                </el-checkbox-group>
              </el-form-item>
            </el-col>
@@ -264,13 +216,19 @@
          </div>
  </div>
</div>
<div v-else>
  <router-view></router-view>
</div>
</template>
<script>
import {getSampleName, getModelSpecification, getlink, addInspection} from '@/api/inspection/commisioninspection'
    import {
        getSampleName,
        getModelSpecification,
        getlink,
        addInspection,
        isIfViewUUID
    } from '@/api/inspection/commisioninspection'
    import {
        time
    } from 'echarts';
export default {
  data() {
    return {
@@ -339,28 +297,36 @@
        key: '2',
        value: '上门'
      }],
      dialogueFormVisible: false,
      showDetail: false
                dialogueFormVisible: false
    }
  },
  created(){
    this.getlink()
            this.getlink(this.$route.params.viewId)
            console.log();
  },
  mounted(){
    this.getSampleName()
    this.getModelSpecification()
            // this.getSampleName()
            // this.getModelSpecification()
  },
  methods: {
    // 获取链接link
    getlink(){
      getlink().then((result)=>{
        this.$store.commit('settings/SAVE_LINK',result.data)
        console.log(this.$store.state.settings.link)
            getlink(viewId) {
                if (viewId == null) {
                    this.$message.error('当前链接不在有效期内,系统自动关闭')
                    this.$router.push('/404')
                    return
                }
                isIfViewUUID({
                    viewId
                }).then(res => {
                    if (!res.data) {
                        this.$message.error('当前链接不在有效期内,系统自动关闭')
                        this.$router.push('/404')
                    }
      })
    },
    async getSampleName(){
      const res = await getSampleName()
      // console.log('res',res.data)
      this.sampleoptions = res.data.map((item)=>{
        return{
          key:item.id.toString(),
@@ -375,8 +341,9 @@
      })
    },
    async getModelSpecification(){
      const res = await getModelSpecification({materialId: '1'})
      // console.log(res)
                const res = await getModelSpecification({
                    materialId: '1'
                })
      this.model_spe_options = res.data.map((item)=>{
        return{
          key:item.specificationsId,
@@ -390,7 +357,6 @@
      for(let i=1;i<this.addPointerForm.experiment.length;i++){
        exper += ',' + this.addPointerForm.experiment[i]
      }
      // console.log(exper)
      this.addPointerForm.experiment = exper
      let tmp = this.addPointerForm
      this.detectionInfo.push(tmp)
@@ -413,7 +379,8 @@
      }else{
        sampledeliveryway = 2
      }
      const res = await addInspection({completionDeadline: this.infoForm.deadline,
                const res = await addInspection({
                    completionDeadline: this.infoForm.deadline,
        contactAddress: this.infoForm.address,
        contactNumber: this.infoForm.tel,
        contacts: this.infoForm.contacter,
@@ -424,32 +391,8 @@
        reportNumber: parseInt(this.infoForm.num),
        sampleDeliveryMode: sampledeliveryway,
        sampleDeliveryPhone: this.infoForm.sendertel,
        sampleSender: this.infoForm.sender})
//       const res = await addInspection({
//   completionDeadline: "2023-08-03",
//   contactAddress: "江苏南通",
//   contactNumber: "12321423432",
//   contacts: "小黑",
//   entrustRemarks: "委托备注YPBH123456789YPBH123456789YPBH123456789",
//   entrusted: "阿里巴巴",
//   inspectionTime: "2023-08-03",
//   linkDetectionList: [
//     {
//       "experiment": "做梦",
//       "remarks": "通过了",
//       "sampleName": "发动机",
//       "sampleNumber": "YPBH123456789",
//       "samplesNumber": 20,
//       "specificationsModels": "GGXH-AAAAA",
//       "unit": "百度"
//     }
//   ],
//   reportNumber: 23,
//   sampleDeliveryMode: 1,
//   sampleDeliveryPhone: "123456789676",
//   sampleSender: "小白"
// })
      // console.log(res)
                    sampleSender: this.infoForm.sender
                })
      this.infoForm.commisioncode = res.data
      if(res.data){
        this.$message({
@@ -458,7 +401,6 @@
        })
        // 跳转页面
        this.$router.push('/inspectionManagement/commissionInspection')
        this.showDetail = true
      }else{
        this.$message.error(res.message)
      }
@@ -478,10 +420,19 @@
</script>
<style lang="scss" scoped>
    .add_commision{
        padding: 20px;
    }
.firstBox{
  .title{
    padding:0px 10px 10px 10px;
            padding: 15px 10px;
            font-size: 18px;
            background-color: #0166e2;
            color: #fff;
            border-radius: 4px;
  }
  .tableBox{
    background-color: #fff;
    padding: 0px 20px;
@@ -491,15 +442,19 @@
    /* padding: 20px 20px 10px 20px; */
    display: flex;
    flex-direction: column;
    .tableBox-header{
      padding: 20px 0px;
      .split{
        margin-right: 15px;
      }
    }
          .el-table {
            flex: 1;
          }
          >div:nth-child(3){
            display: flex;
            justify-content: end;
@@ -507,14 +462,17 @@
          }
  }
}
.secondBox{
  margin: 0px -15px;
  .header{
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    margin-top: 10px;
  }
  .submitBtn{
    display: flex;
    justify-content: end;
@@ -522,6 +480,7 @@
    margin-top: 20px;
  }
}
.infoForm{
  background-color: #fff;
  padding: 20px 50px;
src/views/inspectionManagement/commissionInspection/index.vue
@@ -24,11 +24,20 @@
                        </el-form-item>
                    </el-form>
                    <el-form>
                        <el-popover placement="left" width="130" trigger="click">
                        <el-popover placement="left" width="350" trigger="click">
                            <div class="vue_qr_div">
                                <span style="color: #0078ff;">扫描二维码<br />获取委托单</span>
                                <vue-qr :text="viewId" :size="100" :margin="0" style="margin-top: 10px;">
                                </vue-qr>
                                <el-row>
                                    <el-col>
                                        <el-input v-model="view" readonly size="medium" style="width: 250px;margin-right: 10px;"></el-input>
                                        <el-button size="small" type="primary" v-if="viewId==null" @click="viewDia=true">生成</el-button>
                                        <el-button size="small" type="primary" v-else-if="viewId!=null" @click="copy">复制</el-button>
                                    </el-col>
                                </el-row>
                                <el-row style="margin-top: 10px;">
                                    <el-col v-if="viewId==null">当前链接已过期,请点击生成按钮重新生成</el-col>
                                    <el-col
                                        v-else-if="viewId!=null">当前链接将在{{(parseInt(viewTime)/60/60)>1?(parseInt(viewTime)/60/60).toFixed(1)+'小时':Math.round(parseInt(viewTime)/60)+'分钟'}}后过期</el-col>
                                </el-row>
                            </div>
                            <el-button slot="reference" class="rightBtn" type="primary" @click="goToaddCommision">新增委托</el-button>
                        </el-popover>
@@ -93,6 +102,30 @@
        <div v-else>
            <router-view />
        </div>
        <el-dialog title="链接时长设置" :visible.sync="viewDia" width="30%">
            <div>
                <el-row style="line-height: 46px;">
                    <el-col :span="6" style="font-size: 14px;text-align: right;">时长设置:</el-col>
                    <el-col :span="14" :offset="1">
                        <el-select v-model="viewTime" size="medium">
                            <el-option label="1 天" :value="1"></el-option>
                            <el-option label="2 天" :value="2"></el-option>
                            <el-option label="3 天" :value="3"></el-option>
                            <el-option label="4 天" :value="4"></el-option>
                            <el-option label="5 天" :value="5"></el-option>
                            <el-option label="6 天" :value="6"></el-option>
                            <el-option label="1 周" :value="7"></el-option>
                        </el-select>
                    </el-col>
                </el-row>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="getViewId()">提 交</el-button>
                <el-button @click="viewDia = false">取 消</el-button>
            </span>
        </el-dialog>
        <!-- 隐藏域输入框用来复制 -->
        <input id="copyContext" style="position: absolute;top: 0;left: 0;opacity: 0;z-index: -10;" />
    </div>
</template>
@@ -102,11 +135,7 @@
        getViewUUID,
        selectViewUUID
    } from '@/api/inspection/commisioninspection'
    import vueQr from 'vue-qr'
    export default {
        components: {
            vueQr
        },
        data() {
            return {
                form: [],
@@ -151,7 +180,10 @@
                total: 100,
                showDetail: false,
                day: 1,
                viewId: ''
                view: null,
                viewId: null,
                viewTime: 1,
                viewDia: false
            }
        },
        created() {
@@ -269,13 +301,32 @@
                }
            },
            goToaddCommision() {
                // this.$router.push('/inspectionManagement/commissionInspection/addCommision')
                // this.showDetail = true
                selectViewUUID({
                    day: this.day
                }).then(res => {
                    this.viewId = res.data
                    this.view = `${this.vueIp}addCommision/${res.data.id}`
                    this.viewId = res.data.id
                    this.viewTime = res.data.time
                })
            },
            getViewId() {
                getViewUUID({
                    day: this.viewTime == null ? 1 : this.viewTime
                }).then(res => {
                    this.viewId = res.data
                    this.view = `${this.vueIp}addCommision/${res.data.id}`
                    this.viewDia = false
                    this.$message.success('链接已生成,点击复制按钮进行复制')
                })
            },
            copy() {
                document.getElementById('copyContext').value = this.view
                const input = document.querySelector('#copyContext');
                input.select()
                if (document.execCommand('copy')) {
                    this.$message.success('已复制到剪贴板')
                }
            }
        }
    }
@@ -339,5 +390,6 @@
    
    .vue_qr_div{
        text-align: center;
        color: #0166e2;
    }
</style>