loulijun2021
2023-02-12 adb74c51618faf025fe1d46bf6b22db895c2608f
src/views/sbgl/djjl.vue
@@ -2,27 +2,27 @@
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
        <!--        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
        <!--        <el-button icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button type="primary" icon="el-icon-download" @click="download">导出</el-button>
        <!--        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button v-waves type="primary" icon="el-icon-download" @click="download">导出</el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          label-width="100px"
          inline
          style="display: flex;justify-content: space-between"
          style="display: flex;"
        >
          <div class="elForm">
          <div class="elForm" style="justify-content: flex-start">
            <el-form-item label="生产车间" style=" display: flex;">
              <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in wkshopSelectArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                  :key="item.org_code"
                  :label="item.org_name"
                  :value="item.org_code"
                />
              </el-select>
            </el-form-item>
@@ -35,29 +35,61 @@
            <el-form-item label="标准名称" style=" display: flex;">
              <el-input v-model="form.stanedname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="点检人员" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label="点检人员" style=" display: flex;">
              <el-input v-model="form.checkuser" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="点检时间" style=" display: flex;">
              <el-input v-model="form.checkdate" style="width: 200px" placeholder="请输入" />
            <el-form-item v-show="isExpandForm" label="点检时间" style=" display: flex;font-size:14px;align-items: center">
              <el-date-picker
                v-model="form.checkdate"
                type="daterange"
                :clearable="false"
                class="timeMini"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 200px;display: flex;line-height: 34px ;height: 34px;"
                end-placeholder="结束日期"
                size="mini"
              />
            </el-form-item>
            <!--            <el-form-item v-show="isExpandForm" label="点检结果" style=" display: flex;">-->
            <!--              <el-select v-model="form.isOK" style="width: 200px" placeholder="请选择">-->
            <!--                <el-option-->
            <!--                  v-for="item in wkshopSelectArr"-->
            <!--                  :key="item.code"-->
            <!--                  :label="item.name"-->
            <!--                  :value="item.code"-->
            <!--                />-->
            <!--              </el-select>-->
            <!--            </el-form-item>-->
          </div>
          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          <div 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="search">查询</el-button>
            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
        >
          <svg-icon
            v-show="mouseHoverType==='mouseout'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
            @mouseenter="mouseHoverType=$event.type"
          />
          <svg-icon
            v-show="mouseHoverType==='mouseenter'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
            @click="isExpandForm=!isExpandForm"
            @mouseout="mouseHoverType=$event.type"
          />
        </div>
      </div>
      <div
        class="bodyTopFormExpand"
        @click="isExpandForm=!isExpandForm"
      >
        <i
          :class="!isExpandForm?'el-icon-arrow-down':'el-icon-arrow-up'"
          :style="{color:'#42B983'}"
        /></div>
      <div class="elTableDiv" style="margin-top: 0">
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          border
@@ -75,56 +107,80 @@
            label="序号"
          />
          <el-table-column
            prop="org_code"
            prop="djwo"
            label="点检单号"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="org_name"
            label="生产车间"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="description"
            prop="eqp_code"
            label="设备编号"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="parentorg_name"
            prop="eqp_name"
            label="设备名称"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="lm_user"
            prop="stanedcode"
            label="点检标准编码"
            width="160"
            sortable="custom"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="lm_date"
            prop="stanedname"
            label="点检标准名称"
            show-tooltip-when-overflow
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            prop="chk_user"
            label="点检人员"
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="djjg"
            label="点检结果"
            width="160"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.djjg==='Y'" style="display: flex;align-items: center"><div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />正常</div>
              <div v-if="row.djjg==='N'" style="display: flex;align-items: center"><div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />异常</div>
              <div v-if="row.chk_user&&row.chk_user!=='null'">{{ row.chk_user }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="lm_date"
            prop="chk_result"
            label="点检结果"
            width="160"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.chk_result==='OK'" style="display: flex;align-items: center">
                <!--                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />-->
                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                正常
              </div>
              <div v-if="row.chk_result==='NG'" style="display: flex;align-items: center">
                <!--                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />-->
                <i class="el-icon-info" style="margin-right: 2px" />
                异常
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="chk_date"
            label="点检时间"
            show-tooltip-when-overflow
            width="160"
            sortable="custom"
          />
@@ -144,7 +200,8 @@
              <!--              </div>-->
              <i
                class="el-icon-tickets"
                style="cursor: pointer;color: #42b983;margin-right: 15px"
                :style="{color:$store.state.settings.theme}"
                style="cursor: pointer;margin-right: 15px"
                @click="edit('edit',row)"
              />
            </template>
@@ -164,6 +221,7 @@
    </div>
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'点检明细'"
      :visible.sync="dialogVisible"
      width="800px"
@@ -186,39 +244,53 @@
          @sort-change="sortChange"
        >
          <el-table-column
            prop="RowNum"
            prop="seq"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
            prop="RowNum"
            prop="itemcode"
            label="部位编码"
          />
          <el-table-column
            prop="RowNum"
            prop="itemname"
            label="部位名称"
          />
          <el-table-column
            prop="RowNum"
            prop="result"
            label="点检结果"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.result==='OK'" style="display: flex;align-items: center">
                <!--                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />-->
                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                正常
              </div>
              <div v-if="row.result==='NG'" style="display: flex;align-items: center">
                <!--                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />-->
                <i class="el-icon-info" style="margin-right: 2px" />
                异常
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="RowNum"
            prop="chk_value"
            label="数值"
          />
          <el-table-column
            prop="bz"
            prop="remark"
            label="备注"
            show-tooltip-when-overflow
          />
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisible = false">返 回</el-button>
          <!--          <el-button @click="dialogVisibleCancel">取 消</el-button>-->
          <!--          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>-->
          <el-button v-waves @click="dialogVisible = false">返 回</el-button>
          <!--          <el-button v-waves @click="dialogVisibleCancel">取 消</el-button>-->
          <!--          <el-button v-waves type="primary" @click="dialogVisibleConfirm">确 定</el-button>-->
        </div>
      </span>
    </el-dialog>
@@ -241,16 +313,21 @@
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
import { validateCode } from '@/utils/global'
import { handleDatetime, validateCode } from '@/utils/global'
import { DeviceCheckSubTakeSearch, DeviceCheckTakeOutExcel, DeviceCheckTakeSearch } from '@/api/sbgl'
import { ShopSearch } from '@/api/dzkb'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
export default {
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
  },
  directives: { elDragDialog, waves },
  data() {
    return {
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
@@ -261,7 +338,7 @@
        stanedname: '', // 标准名称
        checkuser: '', // 点检人员
        checkdate: '', // 点检时间
        prop: 'eqp_code', // 排序字段
        prop: 'chk_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
@@ -295,20 +372,48 @@
    }
  },
  created() {
    this.getDeviceCheckTakeSearch()
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    handleRequest() {
      this.getDeviceCheckTakeSearch().then(res => {
        if (res.code === '200') {
          this.getShopSearch()
        }
      })
    },
    async getDeviceCheckTakeSearch() {
      const res = await DeviceCheckTakeSearch(this.form)
      // this.tableData = res.data
      this.tableData = [
        { RowNum: 1, djjg: 'N' }
      ]
      let tempDate = this.form.checkdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        wkshopcode: this.form.wkshopcode,
        eqpcode: this.form.eqpcode,
        eqpname: this.form.eqpname,
        stanedname: this.form.stanedname,
        checkuser: this.form.checkuser,
        checkdate: tempDate,
        prop: this.form.prop, // 排序字段
        order: this.form.order, // 排序字段
        page: this.form.page, // 第几页
        rows: this.form.rows // 每页多少条
      }
      const res = await DeviceCheckTakeSearch(data)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    // 获取执行车间下拉数组
    async getShopSearch() {
      const { data: res } = await ShopSearch()
      this.wkshopSelectArr = res
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
@@ -352,15 +457,13 @@
      this.dialogVisible = true
    },
    // 修改按钮
    async  edit(operation, row) {
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      // const res = await DeviceCheckSubTakeSearch({djwo:row.id})
      const res = await DeviceCheckSubTakeSearch({ djwo: row.djwo })
      this.tableDataDialog = [
        { bz: '1231' }
      ]
      this.tableDataDialog = res.data
      // this.$nextTick(() => {
      //   this.dialogForm.OrgCode = row.org_code
      //   this.dialogForm.OrgName = row.org_name
@@ -423,14 +526,28 @@
      })
    },
    async download() {
      const { data: res } = await DeviceCheckTakeOutExcel(this.form)
      let tempDate = this.form.checkdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        wkshopcode: this.form.wkshopcode,
        eqpcode: this.form.eqpcode,
        eqpname: this.form.eqpname,
        stanedname: this.form.stanedname,
        checkuser: this.form.checkuser,
        checkdate: tempDate
      }
      const { data: res } = await DeviceCheckTakeOutExcel(data)
      window.location.href = res
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 245
        this.tableHeight = this.mainHeight - 255
        this.$refs.tableDataRef.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
@@ -444,6 +561,24 @@
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-range__icon {
  line-height: 28px !important;
}
::v-deep .el-range-separator {
  line-height: 28px !important;
}
::v-deep .el-range-input {
  font-size: 14px;
}
::v-deep .el-range-separator {
  display: flex;
  justify-content: center;
  align-items: center;
}
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
@@ -545,6 +680,16 @@
  align-items: center;
  justify-content: center;
}
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}
</style>
<style>