loulijun2021
2023-10-12 e791d1fd270f3414be3f11ab6792e382373d806d
1.模具清单  70%
已添加1个文件
已修改2个文件
622 ■■■■■ 文件已修改
src/api/GeneralBasicData.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/MouldManager.js 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mouldManager/mouldList.vue 586 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/GeneralBasicData.js
@@ -118,3 +118,11 @@
    params: data
  })
}
// å­˜è´§æ ‘型基础资料
export function InventoryTreePermissions(data) {
  return request({
    url: 'GeneralBasicData/InventoryTreePermissions',
    method: 'get',
    params: data
  })
}
src/api/MouldManager.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
import request from '@/utils/request'
// æ¨¡å…·æ¸…单列表查询
export function MouldMangerSearch(data) {
  return request({
    url: 'MouldManager/MouldMangerSearch',
    method: 'get',
    params: data
  })
}
// æ¨¡å…·æ¸…单新增编辑
export function AddUpdateMouldManger(data) {
  return request({
    url: 'MouldManager/AddUpdateMouldManger',
    method: 'post',
    data
  })
}
// æ¨¡å…·æ¸…单删除
export function DeleteMouldManger(data) {
  return request({
    url: 'MouldManager/DeleteMouldManger',
    method: 'post',
    params: data
  })
}
src/views/mouldManager/mouldList.vue
@@ -1,11 +1,591 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <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="primary" icon="el-icon-download" @click="download">导出</el-button>-->
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="100px"
          inline
          style="display: flex;"
        >
          <div class="elForm">
            <el-form-item label="工单状态" style=" display: flex;">
              <el-select v-model="form.mouldstaus" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in mouldstausArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="使用状态" style=" display: flex;">
              <el-select v-model="form.onstate" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in onstateArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="模具编号" style=" display: flex;">
              <el-input v-model="form.mouldcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="模具名称" style=" display: flex;">
              <el-input v-model="form.mouldname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="规格型号" style=" display: flex;">
              <el-input v-model="form.mouldspec" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="规格型号" style=" display: flex;">
              <el-input v-model="form.createuser" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="单据日期" style="display: flex;align-items: center">
              <el-date-picker
                v-model="form.createdate"
                type="daterange"
                range-separator="~"
                class="timeMini"
                size="mini"
                style="width: 200px;display: flex;line-height: 34px;height: 34px;"
                :clearable="false"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
            </el-form-item>
          </div>
          <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="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <el-table-column
            prop="rowNum"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
            prop="status"
            label="模具状态"
            sortable="custom"
          >
            <template slot-scope="{row}">
              {{ row.status === 'Y' ? '正常' : '故障' }}
            </template>
          </el-table-column>
          <el-table-column
            prop="onstate"
            label="使用状态"
            sortable="custom"
          >
            <template slot-scope="{row}">
              {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestaus)).name }}
            </template>
          </el-table-column>
          <el-table-column
            prop="code"
            label="模具编号"
            sortable="custom"
          />
          <el-table-column
            prop="name"
            label="模具名称"
            sortable="custom"
          />
          <el-table-column
            prop="spec"
            label="规格型号"
            sortable="custom"
          />
          <el-table-column
            prop="warehousename"
            label="仓库名称"
            sortable="custom"
          />
          <el-table-column
            prop="surp_life"
            label="预计寿命"
            sortable="custom"
          />
          <el-table-column
            prop="is_part"
            label="产品关联"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <el-tag v-if="row.is_part==='Y'" size="small" type="success">是</el-tag>
              <el-tag v-if="row.is_part==='N'" size="small" type="danger">否</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="serlife"
            label="使用寿命"
            sortable="custom"
          />
          <el-table-column
            prop="resi_life"
            label="剩余寿命"
            sortable="custom"
          />
          <el-table-column
            prop="username"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i
                    class="el-icon-edit-outline"
                    :style="{color:$store.state.settings.theme}"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" :style="{color:$store.state.settings.theme}" @click="del(row)" />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total,prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getMouldMangerSearch"
      />
    </div>
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="7vh"
      class="dialogFormClass"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px">
        <el-divider content-position="left">基本信息</el-divider>
        <el-form-item label="模具编码" prop="mouldcode">
          <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="模具名称" prop="mouldname">
          <el-input v-model="dialogForm.mouldname" style="width: 200px" />
        </el-form-item>
        <el-form-item label="规格型号">
          <el-input v-model="dialogForm.mouldspec" style="width: 200px" />
        </el-form-item>
        <el-form-item label="仓库信息" prop="warehousecode">
          <el-select
            v-model="dialogForm.warehousecode"
            style="width:200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in wareHouseArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="预计寿命">
          <el-input v-model="dialogForm.surplife" style="width: 200px" />
        </el-form-item>
        <el-form-item label="剩余寿命">
          <el-input v-model="dialogForm.resilife" style="width: 200px" />
        </el-form-item>
        <el-form-item required label="使用状态">
          <el-radio-group v-model="dialogForm.status">
            <el-radio label="Y">正常</el-radio>
            <el-radio label="N">故障</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <el-divider content-position="left">关联产品</el-divider>
      <el-input
        v-model="filterText"
        placeholder="输入关键字进行过滤"
      />
      <div style="height: 300px;overflow:auto;margin-top: 25px;">
        <el-tree
          ref="tree"
          class="filter-tree"
          :data="Inventory"
          :props="defaultProps"
          show-checkbox
          node-key="code"
          default-expand-all
          :filter-node-method="filterNode"
        />
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 æ¶ˆ</el-button>
          <el-button
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >ç¡® å®š</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { handleDatetime, validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import {
  ProductionScheduleReportExcelSearch,
  ProductionScheduleReportSearch
} from '@/api/ReportManager'
import { MouldMangerSearch } from '@/api/MouldManager'
import { InventoryTreePermissions, WareHouse } from '@/api/GeneralBasicData'
import arrayToTree from 'array-to-tree'
export default {
  name: 'MouldList'
  name: 'Zzjg',
  components: {
    Pagination
  },
  directives: { elDragDialog, waves },
  data() {
    return {
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      form: {
        mouldstaus: '', // æ¨¡å…·çŠ¶æ€
        onstate: '', // ä½¿ç”¨çŠ¶æ€
        mouldcode: '', // æ¨¡å…·ç¼–码
        mouldname: '', // æ¨¡å…·åç§°
        mouldspec: '', // æ¨¡å…·è§„格型号
        createuser: '', // åˆ›å»ºäººå‘˜
        createdate: '', // å•据日期
        prop: 'code', // æŽ’序字段
        order: 'desc', // æŽ’序字段
        page: 1, // ç¬¬å‡ é¡µ
        rows: 20 // æ¯é¡µå¤šå°‘条
      },
      mouldstausArr: [
        { code: 'Y', name: '正常' },
        { code: 'N', name: '故障' }
      ],
      onstateArr: [
        { code: 0, name: '在库' },
        { code: 1, name: '出库' },
        { code: 2, name: '上机' },
        { code: 3, name: '下机' },
        { code: 4, name: 'ç»´ä¿®' },
        { code: 5, name: '外借' }
      ],
      total: 10,
      tableData: [],
      operation: '',
      dialogVisible: false,
      dialogForm: {
        mouldcode: '',
        mouldname: '',
        mouldspec: '',
        warehousecode: '',
        surplife: '',
        resilife: '',
        status: 'Y',
        mouldpart: '',
        opertype: ''
      },
      dialogFormRules: {
        mouldcode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        mouldname: [
          { required: true, message: '请输入模具名称', trigger: ['blur', 'change'] }
        ],
        warehousecode: [
          { required: true, message: '请输入选择仓库信息', trigger: ['blur', 'change'] }
        ]
      },
      filterText: '',
      defaultProps: {
        children: 'children',
        label: 'name'
      },
      Inventory: [
        { code: '-1',
          name: '全部'
        }
      ],
      wareHouseArr: []
    }
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val)
    }
  },
  created() {
    this.getMouldMangerSearch()
    this.getInventoryTreePermissions()
    this.getWareHouse()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    async  getInventoryTreePermissions() {
      const res = await InventoryTreePermissions()
      res.data.forEach(i => {
        i.name = i.code + ' ' + i.name
      })
      this.Inventory = arrayToTree(this.Inventory.concat(res.data), {
        parentProperty: 'parentid',
        customID: 'code',
        childrenProperty: 'children'
      })
    },
    async getWareHouse() {
      const { data: res } = await WareHouse()
      this.wareHouseArr = res
    },
    async getMouldMangerSearch() {
      let tempDate = this.form.createdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        mouldstaus: this.form.mouldstaus,
        mouldcode: this.form.mouldcode,
        wkshopcode: this.form.wkshopcode,
        mouldname: this.form.mouldname,
        mouldspec: this.form.mouldspec,
        partname: this.form.partname,
        partspec: this.form.partspec,
        createdate: tempDate,
        prop: this.form.prop,
        order: this.form.order,
        page: this.form.page,
        rows: this.form.rows
      }
      const res = await MouldMangerSearch(data)
      this.tableData = res.data
      this.total = res.count
    },
    // å¯¼å‡º
    async download() {
      let tempDate = this.form.createdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        mouldstaus: this.form.mouldstaus,
        mouldcode: this.form.mouldcode,
        wkshopcode: this.form.wkshopcode,
        mouldname: this.form.mouldname,
        mouldspec: this.form.mouldspec,
        partname: this.form.partname,
        partspec: this.form.partspec,
        createdate: tempDate
      }
      const res = await ProductionScheduleReportExcelSearch(data)
      // console.log(res)
      window.location.href = res.data
    },
    // æŽ’序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getMouldMangerSearch()
    },
    // æŸ¥è¯¢
    search() {
      this.getMouldMangerSearch()
    },
    // é‡ç½®
    reset() {
      this.form.mouldstaus = ''
      this.form.onstate = ''
      this.form.mouldcode = ''
      this.form.mouldname = ''
      this.form.mouldspec = ''
      this.form.createuser = ''
      this.form.createdate = ''
      this.getMouldMangerSearch()
    },
    add() {
      this.operation = 'add'
      this.dialogVisible = true
    },
    handleClose() {
    },
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    dialogVisibleConfirm() {
      console.log(this.$refs.tree.getCheckedKeys())
    },
    filterNode(value, data) {
      if (!value) return true
      return data.name.indexOf(value) !== -1
    },
    // èŽ·å–é¡µé¢é«˜åº¦
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 255
        this.$refs.tableDataRef.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    }
  }
}
</script>
<style scoped lang="scss">
::v-deep .el-select__caret {
  display: flex;
  align-items: center;
  justify-content: center;
}
<style scoped>
::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-progress-bar__innerText {
  display: none !important;
}
.dialogFormClass ::v-deep .el-form-item {
  margin-bottom: 0;
}
</style>