zhangherong
2025-03-18 66ff30cd4deee3dbfce6751e31392c072bf15dfc
art:设备管理-基础数据-附件管理,工艺参数,精度参数 新增
已添加8个文件
已修改1个文件
1508 ■■■■■ 文件已修改
src/components/jeecg/LxFilePreview.vue 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jeecg/LxUpload.vue 452 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jeecg/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/EamPrecisionParametersList.vue 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/EamProcessParametersList.vue 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/EamSysFilesList.vue 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/modules/EamPrecisionParametersModal.vue 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/modules/EamProcessParametersModal.vue 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/modules/EamSysFilesModal.vue 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jeecg/LxFilePreview.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    :footer="null"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <img v-if="isImage" :src="fileUrl" width="100%" height="100%" alt="图片预览" />
      <iframe v-else-if="isPdf" :src="fileUrl" width="100%" height="600px"></iframe>
      <video v-else-if="isVideo" controls>
        <source :src="fileUrl" type="video/mp4">
        æ‚¨çš„æµè§ˆå™¨ä¸æ”¯æŒ video æ ‡ç­¾ã€‚
      </video>
      <pre v-else-if="isText">{{ textContent }}</pre>
      <h1 v-else>不支持预览,请下载后查看</h1>
    </a-spin>
  </j-modal>
</template>
<script>
import { getFileAccessHttpUrl } from '@/api/manage'
export default {
  props: {
    fileUrl: String
  },
  data() {
    return {
      title: '预览',
      textContent: '',
      confirmLoading: false,
      visible: false
    }
  },
  computed: {
    isImage() {
      return /\.(jpeg|jpg|png|gif|bmp|webp)$/i.test(this.fileUrl)
    },
    isPdf() {
      return /\.pdf$/i.test(this.fileUrl)
    },
    isVideo() {
      return /\.(mp4|webm|ogg)$/i.test(this.fileUrl)
    },
    isText() {
      return /\.(txt|md|json|xml|yaml|yml)$/i.test(this.fileUrl)
    }
  },
  watch: {
    fileUrl: 'fetchTextContent'
  },
  mounted() {
    if (this.isText) {
      this.fetchTextContent()
    }
  },
  methods: {
    async fetchTextContent() {
      try {
        const response = await fetch(this.fileUrl)
        if (!response.ok) throw new Error('网络响应不是OK')
        const text = await response.text()
        this.textContent = text
      } catch (error) {
        console.error('获取文本内容失败:', error)
        this.textContent = '无法加载文本内容'
      }
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    preview(fileUrl) {
      let url = getFileAccessHttpUrl(fileUrl)
      this.visible = true
      this.fileUrl = url
    },
    handleOk() {
      this.close()
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
<style lang="less" scoped>
/deep/ .ant-modal {
  height: 80%;
  /* æ»šåŠ¨æ¡ä¼˜åŒ– start */
  ::-webkit-scrollbar{
    width:8px;
    height:8px;
  }
  .ant-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    .ant-modal-body {
      flex: 1;
      overflow: auto;
    }
  }
}
pre {
  overflow: visible;
}
</style>
src/components/jeecg/LxUpload.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,452 @@
<template>
  <div :id="containerId" style="position: relative">
    <!--  ---------------------------- begin å›¾ç‰‡å·¦å³æ¢ä½ç½® ------------------------------------- -->
    <div class="movety-container" :style="{top:top+'px',left:left+'px',display:moveDisplay}"
         style="padding:0 8px;position: absolute;z-index: 91;height: 32px;width: 104px;text-align: center;">
      <div :id="containerId+'-mover'" :class="showMoverTask?'uploadty-mover-mask':'movety-opt'"
           style="margin-top: 12px">
        <a @click="moveLast" style="margin: 0 5px;">
          <a-icon type="arrow-left" style="color: #fff;font-size: 16px" />
        </a>
        <a @click="moveNext" style="margin: 0 5px;">
          <a-icon type="arrow-right" style="color: #fff;font-size: 16px" />
        </a>
      </div>
    </div>
    <!--  ---------------------------- end å›¾ç‰‡å·¦å³æ¢ä½ç½® ------------------------------------- -->
    <a-upload
      name="file"
      :multiple="multiple"
      :action="uploadAction"
      :headers="headers"
      :data="{'biz':bizPath}"
      :fileList="fileList"
      :beforeUpload="doBeforeUpload"
      @change="handleChange"
      :disabled="disabled"
      :listType="complistType"
      @preview="handlePreview"
      :class="{'uploadty-disabled':disabled}">
      <template>
        <div v-if="isImageComp">
          <a-icon type="plus" />
          <div class="ant-upload-text">{{ text }}</div>
        </div>
        <a-button v-else-if="buttonVisible">
          <a-icon type="upload" />
          {{ text }}
        </a-button>
      </template>
    </a-upload>
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
      <img alt="example" style="width: 100%" :src="previewImage" />
    </a-modal>
  </div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getFileAccessHttpUrl } from '@/api/manage'
const FILE_TYPE_ALL = 'all'
const FILE_TYPE_IMG = 'image'
const FILE_TYPE_TXT = 'file'
const uidGenerator = () => {
  return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
const getFileName = (path) => {
  if (path.lastIndexOf('\\') >= 0) {
    let reg = new RegExp('\\\\', 'g')
    path = path.replace(reg, '/')
  }
  return path.substring(path.lastIndexOf('/') + 1)
}
export default {
  name: 'LXUpload',
  data() {
    return {
      uploadAction: window._CONFIG['domianURL'] + '/eam/sysFiles/upload',
      headers: {},
      fileList: [],
      newFileList: [],
      uploadGoOn: true,
      previewVisible: false,
      //---------------------------- begin å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
      previewImage: '',
      containerId: '',
      top: '',
      left: '',
      moveDisplay: 'none',
      showMoverTask: false,
      moverHold: false,
      currentImg: ''
      //---------------------------- end å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
    }
  },
  props: {
    text: {
      type: String,
      required: false,
      default: '点击上传'
    },
    fileType: {
      type: String,
      required: false,
      default: FILE_TYPE_ALL
    },
    /*这个属性用于控制文件上传的业务路径*/
    bizPath: {
      type: String,
      required: false,
      default: 'temp'
    },
    value: {
      type: [String, Array],
      required: false
    },
    // update-begin- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击
    disabled: {
      type: Boolean,
      required: false,
      default: false
    },
    // update-end- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击
    //此属性被废弃了
    triggerChange: {
      type: Boolean,
      required: false,
      default: false
    },
    /**
     * update -- author:lvdandan -- date:20190219 -- for:Jupload组件增加是否返回url,
     * true:仅返回url
     * false:返回fileName filePath fileSize
     */
    // returnUrl: {
    //   type: Boolean,
    //   required: false,
    //   default: true
    // },
    number: {
      type: Number,
      required: false,
      default: 0
    },
    buttonVisible: {
      type: Boolean,
      required: false,
      default: true
    },
    multiple: {
      type: Boolean,
      default: true
    },
    beforeUpload: {
      type: Function
    }
  },
  watch: {
    value: {
      immediate: true,
      handler() {
        let val = this.value
        if (val instanceof Array) {
          this.initFileListArr(val)
        } else {
          this.initFileList(val)
        }
      }
    }
  },
  computed: {
    isImageComp() {
      return this.fileType === FILE_TYPE_IMG
    },
    complistType() {
      return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text'
    }
  },
  created() {
    const token = Vue.ls.get(ACCESS_TOKEN)
    //---------------------------- begin å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
    this.headers = { 'X-Access-Token': token }
    this.containerId = 'container-ty-' + new Date().getTime()
    //---------------------------- end å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
  },
  methods: {
    initFileListArr(val) {
      if (!val || val.length == 0) {
        this.fileList = []
        return
      }
      let fileList = []
      for (var a = 0; a < val.length; a++) {
        let url = getFileAccessHttpUrl(val[a].filePath)
        fileList.push({
          uid: uidGenerator(),
          name: val[a].fileName,
          status: 'done',
          url: url,
          response: {
            status: 'history',
            message: val[a].filePath
          }
        })
      }
      this.fileList = fileList
    },
    initFileList(paths) {
      if (!paths || paths.length == 0) {
        //return [];
        // update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
        this.fileList = []
        return
        // update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
      }
      let fileList = []
      let arr = paths.split(',')
      for (var a = 0; a < arr.length; a++) {
        let url = getFileAccessHttpUrl(arr[a])
        fileList.push({
          uid: uidGenerator(),
          name: getFileName(arr[a]),
          status: 'done',
          url: url,
          response: {
            status: 'history',
            message: arr[a]
          }
        })
      }
      this.fileList = fileList
    },
    doBeforeUpload(file) {
      this.uploadGoOn = true
      var fileType = file.type
      if (this.fileType === FILE_TYPE_IMG) {
        if (fileType.indexOf('image') < 0) {
          this.$message.warning('请上传图片')
          this.uploadGoOn = false
          return false
        }
      }
      // æ‰©å±• beforeUpload éªŒè¯
      if (typeof this.beforeUpload === 'function') {
        return this.beforeUpload(file)
      }
      return true
    },
    handleChange(info) {
      console.log('--文件列表改变--')
      if (!info.file.status && this.uploadGoOn === false) {
        info.fileList.pop()
      }
      let fileList = info.fileList
      if (info.file.status === 'done') {
        if (this.number > 0) {
          fileList = fileList.slice(-this.number)
        }
        if (info.file.response.success) {
          fileList = fileList.map((file) => {
            if (file.response) {
              let reUrl = file.response.result.filePath;
              file.url = getFileAccessHttpUrl(reUrl)
            }
            return file
          })
        }
        //this.$message.success(`${info.file.name} ä¸Šä¼ æˆåŠŸ!`);
      } else if (info.file.status === 'error') {
        this.$message.error(`${info.file.name} ä¸Šä¼ å¤±è´¥.`)
      } else if (info.file.status === 'removed') {
        this.handleDelete(info.file)
      }
      this.fileList = fileList
      if (info.file.status === 'done' || info.file.status === 'removed') {
        //returnUrl为false时返回文件名称、文件路径及文件大小
        this.newFileList = []
        for (var a = 0; a < fileList.length; a++) {
          // update-begin-author:lvdandan date:20200603 for:【TESTA-514】【开源issue】多个文件同时上传时,控制台报错
          if (fileList[a].status === 'done') {
            let fileJson = {
              fileName: fileList[a].name,
              filePath: fileList[a].response.result.filePath,
              fileSize: fileList[a].size,
              fileEncodeName: fileList[a].response.result.fileEncodeName,
              fileSuffix: fileList[a].response.result.fileSuffix,
            }
            this.newFileList.push(fileJson)
          } else {
            return
          }
          // update-end-author:lvdandan date:20200603 for:【TESTA-514】【开源issue】多个文件同时上传时,控制台报错
        }
        this.$emit('change', this.newFileList)
      }
    },
    handleDelete(file) {
      //如有需要新增 åˆ é™¤é€»è¾‘
      console.log(file)
    },
    handlePreview(file) {
      if (this.fileType === FILE_TYPE_IMG) {
        this.previewImage = file.url || file.thumbUrl
        this.previewVisible = true
      } else {
        location.href = file.url
      }
    },
    handleCancel() {
      this.previewVisible = false
    },
    //---------------------------- begin å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
    moveLast() {
      //console.log(ev)
      //console.log(this.fileList)
      //console.log(this.currentImg)
      let index = this.getIndexByUrl()
      if (index == 0) {
        this.$message.warn('未知的操作')
      } else {
        let curr = this.fileList[index].url
        let last = this.fileList[index - 1].url
        let arr = []
        for (let i = 0; i < this.fileList.length; i++) {
          if (i == index - 1) {
            arr.push(curr)
          } else if (i == index) {
            arr.push(last)
          } else {
            arr.push(this.fileList[i].url)
          }
        }
        this.currentImg = last
        this.$emit('change', arr.join(','))
      }
    },
    moveNext() {
      let index = this.getIndexByUrl()
      if (index == this.fileList.length - 1) {
        this.$message.warn('已到最后~')
      } else {
        let curr = this.fileList[index].url
        let next = this.fileList[index + 1].url
        let arr = []
        for (let i = 0; i < this.fileList.length; i++) {
          if (i == index + 1) {
            arr.push(curr)
          } else if (i == index) {
            arr.push(next)
          } else {
            arr.push(this.fileList[i].url)
          }
        }
        this.currentImg = next
        this.$emit('change', arr.join(','))
      }
    },
    getIndexByUrl() {
      for (let i = 0; i < this.fileList.length; i++) {
        if (this.fileList[i].url === this.currentImg || encodeURI(this.fileList[i].url) === this.currentImg) {
          return i
        }
      }
      return -1
    }
  },
  mounted() {
    const moverObj = document.getElementById(this.containerId + '-mover')
    if (moverObj) {
      moverObj.addEventListener('mouseover', () => {
        this.moverHold = true
        this.moveDisplay = 'block'
      })
      moverObj.addEventListener('mouseout', () => {
        this.moverHold = false
        this.moveDisplay = 'none'
      })
    }
    let picList = document.getElementById(this.containerId) ? document.getElementById(this.containerId).getElementsByClassName('ant-upload-list-picture-card') : []
    if (picList && picList.length > 0) {
      picList[0].addEventListener('mouseover', (ev) => {
        ev = ev || window.event
        let target = ev.target || ev.srcElement
        if ('ant-upload-list-item-info' == target.className) {
          this.showMoverTask = false
          let item = target.parentElement
          this.left = item.offsetLeft
          this.top = item.offsetTop + item.offsetHeight - 50
          this.moveDisplay = 'block'
          this.currentImg = target.getElementsByTagName('img')[0].src
        }
      })
      picList[0].addEventListener('mouseout', (ev) => {
        ev = ev || window.event
        let target = ev.target || ev.srcElement
        //console.log('移除',target)
        if ('ant-upload-list-item-info' == target.className) {
          this.showMoverTask = true
          setTimeout(() => {
            if (this.moverHold === false) {
              this.moveDisplay = 'none'
            }
          }, 100)
        }
        if ('ant-upload-list-item ant-upload-list-item-done' == target.className || 'ant-upload-list ant-upload-list-picture-card' == target.className) {
          this.moveDisplay = 'none'
        }
      })
      //---------------------------- end å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
    }
  },
  model: {
    prop: 'value',
    event: 'change'
  }
}
</script>
<style lang="less">
.uploadty-disabled {
  .ant-upload-list-item {
    .anticon-close {
      display: none;
    }
    .anticon-delete {
      display: none;
    }
  }
  /*update-begin-author:taoyan date:2022-12-5 for: issues/4250 å»ºè®®JUpload组件,disabled为true的时候上传button能够变灰或者其他样式图案,便于知晓无法再点击上传*/
  .ant-btn, .ant-upload-disabled {
    cursor: not-allowed;
    color: rgba(0, 0, 0, 0.25);
    background-color: #f5f5f5;
    border-color: #d9d9d9;
  }
  /*update-end-author:taoyan date:2022-12-5 for: issues/4250 å»ºè®®JUpload组件,disabled为true的时候上传button能够变灰或者其他样式图案,便于知晓无法再点击上传*/
}
//---------------------------- begin å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
.uploadty-mover-mask {
  background-color: rgba(0, 0, 0, 0.5);
  opacity: .8;
  color: #fff;
  height: 28px;
  line-height: 28px;
}
//---------------------------- end å›¾ç‰‡å·¦å³æ¢ä½ç½® -------------------------------------
</style>
src/components/jeecg/index.js
@@ -27,6 +27,8 @@
import JTime from './JTime.vue'
import JTreeTable from './JTreeTable.vue'
import JEasyCron from '@/components/jeecg/JEasyCron'
import LxUpload from './LxUpload.vue'
import LxFilePreview from './LxFilePreview.vue'
//jeecgbiz
import JSelectDepart from '../jeecgbiz/JSelectDepart.vue'
import JSelectMultiUser from '../jeecgbiz/JSelectMultiUser.vue'
@@ -71,6 +73,8 @@
    Vue.component('JTreeSelect', JTreeSelect)
    Vue.component('JTreeTable', JTreeTable)
    Vue.component('JUpload', JUpload)
    Vue.component('LxUpload', LxUpload)
    Vue.component('LxFilePreview', LxFilePreview)
    //jeecgbiz
    Vue.component('JSelectDepart', JSelectDepart)
src/views/eam/base/EamPrecisionParametersList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,170 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="删除标记">
              <a-input placeholder="请输入删除标记" v-model="queryParam.delFlag"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="参数编码">
              <a-input placeholder="请输入参数编码" v-model="queryParam.parameterCode"></a-input>
            </a-form-item>
          </a-col>
        <template v-if="toggleSearchStatus">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="检测项目">
              <a-input placeholder="请输入检测项目" v-model="queryParam.parameterName"></a-input>
            </a-form-item>
          </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('精度参数维护')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <eamPrecisionParameters-modal ref="modalForm" @ok="modalFormOk"></eamPrecisionParameters-modal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import EamPrecisionParametersModal from './modules/EamPrecisionParametersModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: "EamPrecisionParametersList",
    mixins:[JeecgListMixin],
    components: {
      EamPrecisionParametersModal
    },
    data () {
      return {
        description: '精度参数维护管理页面',
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
           {
            title: '删除标记',
            align:"center",
            dataIndex: 'delFlag'
           },
           {
            title: '参数编码',
            align:"center",
            dataIndex: 'parameterCode'
           },
           {
            title: '检测项目',
            align:"center",
            dataIndex: 'parameterName'
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/eam/eamPrecisionParameters/list",
          delete: "/eam/eamPrecisionParameters/delete",
          deleteBatch: "/eam/eamPrecisionParameters/deleteBatch",
          exportXlsUrl: "eam/eamPrecisionParameters/exportXls",
          importExcelUrl: "eam/eamPrecisionParameters/importExcel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/base/EamProcessParametersList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,190 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="删除标记">
              <a-input placeholder="请输入删除标记" v-model="queryParam.delFlag"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="参数编码">
              <a-input placeholder="请输入参数编码" v-model="queryParam.parameterCode"></a-input>
            </a-form-item>
          </a-col>
        <template v-if="toggleSearchStatus">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="参数名称">
              <a-input placeholder="请输入参数名称" v-model="queryParam.parameterName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="参数分类">
              <a-input placeholder="请输入参数分类" v-model="queryParam.parameterCategory"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计量单位">
              <a-input placeholder="请输入计量单位" v-model="queryParam.parameterUnit"></a-input>
            </a-form-item>
          </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('工序参数维护')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <eamProcessParameters-modal ref="modalForm" @ok="modalFormOk"></eamProcessParameters-modal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import EamProcessParametersModal from './modules/EamProcessParametersModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: "EamProcessParametersList",
    mixins:[JeecgListMixin],
    components: {
      EamProcessParametersModal
    },
    data () {
      return {
        description: '工序参数维护管理页面',
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
           {
            title: '删除标记',
            align:"center",
            dataIndex: 'delFlag'
           },
           {
            title: '参数编码',
            align:"center",
            dataIndex: 'parameterCode'
           },
           {
            title: '参数名称',
            align:"center",
            dataIndex: 'parameterName'
           },
           {
            title: '参数分类',
            align:"center",
            dataIndex: 'parameterCategory'
           },
           {
            title: '计量单位',
            align:"center",
            dataIndex: 'parameterUnit'
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/eam/eamProcessParameters/list",
          delete: "/eam/eamProcessParameters/delete",
          deleteBatch: "/eam/eamProcessParameters/deleteBatch",
          exportXlsUrl: "eam/eamProcessParameters/exportXls",
          importExcelUrl: "eam/eamProcessParameters/importExcel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/base/EamSysFilesList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,204 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="文件名称">
              <j-input placeholder="请输入文件名称" v-model="queryParam.fileName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete" />
            åˆ é™¤
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ
          <a-icon type="down" />
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                 <a @click="handlePreview(record)">预览</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定下载文件吗?" @confirm="() => handleDownload(record)">
                  <a>下载</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <eamSysFiles-modal ref="modalForm" @ok="modalFormOk"></eamSysFiles-modal>
    <lx-file-preview ref="lxFilePreview" :fileUrl="fileUrl"></lx-file-preview>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import EamSysFilesModal from './modules/EamSysFilesModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { downFile } from '@/api/manage';
export default {
  name: 'EamSysFilesList',
  mixins: [JeecgListMixin],
  components: {
    EamSysFilesModal
  },
  data() {
    return {
      description: '设备附件管理管理页面',
      fileUrl: '',
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '文件加密名',
          align: 'center',
          dataIndex: 'fileEncodeName',
          ellipsis: true,
        },
        {
          title: '文件名称',
          align: 'center',
          dataIndex: 'fileName',
          ellipsis: true,
        },
        {
          title: '文件路径',
          align: 'center',
          dataIndex: 'filePath',
          ellipsis: true,
        },
        {
          title: '文件后缀名',
          align: 'center',
          dataIndex: 'fileSuffix'
        },
        {
          title: '文件大小',
          align: 'center',
          dataIndex: 'fileSize'
        },
        {
          title: '描述',
          align: 'center',
          dataIndex: 'description',
          ellipsis: true,
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/eam/sysFiles/list',
        delete: '/eam/sysFiles/delete',
        deleteBatch: '/eam/sysFiles/deleteBatch',
        download: '/eam/sysFiles/downloadFile',
      }
    }
  },
  computed: {},
  methods: {
    handleDownload(record) {
      downFile(this.url.download, { id: record.id }).then((res) => {
        if (!res) {
          this.$message.warning('文件下载失败')
          return
        } else {
          let fileName = record.fileName;
          if (typeof window.navigator.msSaveBlob !== 'undefined') {
            window.navigator.msSaveBlob(new Blob([res]), fileName);
          } else {
            let url = window.URL.createObjectURL(new Blob([res]));
            let link = document.createElement('a');
            link.style.display = 'none';
            link.href = url;
            link.setAttribute('download', fileName);
            document.body.appendChild(link);
            link.click()
            document.body.removeChild(link) //下载完成移除元素
            window.URL.revokeObjectURL(url) //释放掉blob对象
          }
        }
      })
    },
    handlePreview: function (record) {
      this.$refs.lxFilePreview.preview(record.filePath);
    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/base/modules/EamPrecisionParametersModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag" label="删除标记">
          <a-input-number v-model="model.delFlag"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterCode" label="参数编码">
          <a-input placeholder="请输入参数编码" v-model="model.parameterCode" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterName" label="检测项目">
          <a-input placeholder="请输入检测项目" v-model="model.parameterName" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { httpAction } from '@/api/manage'
  import moment from "moment"
  export default {
    name: "EamPrecisionParametersModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules:{
        },
        url: {
          add: "/eam/eamPrecisionParameters/add",
          edit: "/eam/eamPrecisionParameters/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        //初始化默认值
        this.edit({});
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        const that = this;
        // è§¦å‘表单验证
         this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }else{
             return false;
          }
        })
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>
<style lang="less" scoped>
</style>
src/views/eam/base/modules/EamProcessParametersModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag" label="删除标记">
          <a-input-number v-model="model.delFlag"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterCode" label="参数编码">
          <a-input placeholder="请输入参数编码" v-model="model.parameterCode" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterName" label="参数名称">
          <a-input placeholder="请输入参数名称" v-model="model.parameterName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterCategory" label="参数分类">
          <a-input placeholder="请输入参数分类" v-model="model.parameterCategory" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameterUnit" label="计量单位">
          <a-input placeholder="请输入计量单位" v-model="model.parameterUnit" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { httpAction } from '@/api/manage'
  import moment from "moment"
  export default {
    name: "EamProcessParametersModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules:{
        },
        url: {
          add: "/eam/eamProcessParameters/add",
          edit: "/eam/eamProcessParameters/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        //初始化默认值
        this.edit({});
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        const that = this;
        // è§¦å‘表单验证
         this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }else{
             return false;
          }
        })
      },
      handleCancel () {
        this.close()
      },
    }
  }
</script>
<style lang="less" scoped>
</style>
src/views/eam/base/modules/EamSysFilesModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,129 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-form-model-item
          label="上传"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          v-if="!editable"
          prop="fileList">
         <lx-upload :returnUrl="false"
                    :isMultiple="false"
                    v-model="model.fileList"
                    biz="test">
         </lx-upload>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fileName" label="文件名称" v-if="editable">
          <a-input placeholder="请输入文件名称" v-model="model.fileName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description" label="描述">
          <a-textarea placeholder="请输入描述" v-model="model.description" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
export default {
  name: 'EamSysFilesModal',
  data() {
    return {
      title: '操作',
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      validatorRules: {
        fileName: [
          { required: true, message: '请输入文件名称!' }
        ]
      },
      url: {
        add: '/eam/sysFiles/add',
        edit: '/eam/sysFiles/edit',
      },
      editable: false,
    }
  },
  created() {
  },
  methods: {
    add() {
      this.editable = false;
      //初始化默认值
      this.model = {};
      this.visible = true
    },
    edit(record) {
      this.editable = true;
      this.model = Object.assign({}, record)
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.clearValidate()
    },
    handleOk() {
      const that = this
      // è§¦å‘表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }
          httpAction(httpurl, this.model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
              that.close()
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        } else {
          return false
        }
      })
    },
    handleCancel() {
      this.close()
    },
  }
}
</script>
<style lang="less" scoped>
</style>