小小儁爺
2024-06-19 f2cf3c86f4c76ac5471c4c8bccb0c6dab5e0b280
src/views/deviceManager/deviceList.vue
@@ -63,7 +63,13 @@
        >
          <div class="bodyTopButtonGroup" style="justify-content: space-between">
            <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
            <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=9')">导入</el-button>
            <el-button
              v-waves
              type="success"
              icon="el-icon-download"
              @click="$router.push('./../systemSetting/dataImport?fileCode=9')"
            >导入
            </el-button>
          </div>
          <div class="bodyTopFormGroup">
@@ -128,7 +134,13 @@
                class="bodySearchReset"
                :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
              >
                <el-button v-waves type="primary" icon="el-icon-search" @click="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())">查询</el-button>
                <el-button
                  v-waves
                  type="primary"
                  icon="el-icon-search"
                  @click="getDeviceMangerSearch($refs.treeLeftRef.getCurrentNode())"
                >查询
                </el-button>
                <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
              </div>
            </el-form>
@@ -225,6 +237,15 @@
              >
                <template slot-scope="{row}">
                  <div class="operationClass">
                    <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP预览" placement="top">
                      <i
                        v-if="mesSetting.device"
                        class="el-icon-files"
                        style="cursor: pointer;color:#42b983;margin-right: 15px"
                        @click="pre(row)"
                      />
                    </el-tooltip>
                    <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                      <i
                        class="el-icon-edit-outline"
@@ -361,6 +382,63 @@
      </span>
    </el-dialog>
    <!--    sop预览-->
    <el-dialog
      v-el-drag-dialog
      title="设备SOP预览"
      :visible.sync="SopDialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleSopClose"
      @close="handleSopClose"
    >
      <el-form ref="dialogClassForm" inline :rules="dialogClassFormRules" :model="dialogClassForm" label-width="110px">
        <el-form-item label="设备SOP">
          <el-select
            v-model="dialogSopForm.sop"
            style="width:200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
            @change="sopChange"
          >
            <el-option
              v-for="item in sopArr"
              :key="item.filepath"
              :label="item.filename"
              :value="item.filepath"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="Sop版本">
          <el-input v-model="dialogSopForm.v" disabled style="width: 200px" />
        </el-form-item>
      </el-form>
      <el-button
        v-waves
        type="primary"
        style="margin-left: 37px"
        @click="view"
      >预 览/下 载</el-button>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="handleSopClose">取 消</el-button>
          <!--          <el-button-->
          <!--            v-waves-->
          <!--            type="primary"-->
          <!--            :loading="$store.state.app.buttonIsDisabled"-->
          <!--            :disabled="$store.state.app.buttonIsDisabled"-->
          <!--            @click="handleSopConfirm"-->
          <!--          >确 定</el-button>-->
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -375,7 +453,7 @@
  AddUpdateDeviceManger,
  AddUpdateDeviceType, DeleteDeviceManger,
  DeleteDeviceType,
  DeviceMangerSearch,
  DeviceMangerSearch, DeviceSopSearch,
  DeviceTypeSearch
} from '@/api/DeviceManager'
@@ -387,6 +465,7 @@
  },
  data() {
    return {
      mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
@@ -469,8 +548,14 @@
        storgcode: [
          { required: true, message: '请选择所属组织', trigger: ['blur', 'change'] }
        ]
      },
      }
      SopDialogVisible: false,
      dialogSopForm: { // 设备SOP表单
        sop: '',
        v: ''
      },
      sopArr: []
    }
  },
@@ -486,6 +571,32 @@
    this.getPrentOrganization()
  },
  methods: {
    // 弹出框关闭
    handleSopClose() {
      this.SopDialogVisible = false
      this.dialogSopForm = { // 设备SOP表单
        sop: '',
        v: ''
      }
    },
    // 预览
    view() {
      window.open(process.env.VUE_APP_BASE_API_FILE + this.dialogSopForm.sop)
    },
    // sop预览
    async pre(row) {
      const data = {
        eqptypecode: row.eqptype_code,
        eqpcode: row.code
      }
      const { data: res } = await DeviceSopSearch(data)
      this.sopArr = res
      this.SopDialogVisible = true
    },
    sopChange(val) {
      this.dialogSopForm.v = this.sopArr.find(i => i.filepath === val).version
    },
    async getDeviceTypeSearch() {
      const res = await DeviceTypeSearch()
      res.data.forEach(i => {