| | |
| | | <template /> |
| | | <template> |
| | | <div> |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between"> |
| | | <el-button icon="el-icon-circle-plus-outline" type="primary" @click="add">文件上传</el-button> |
| | | <div style="display: flex;align-items: center"> |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | label-width="100px" |
| | | inline |
| | | > |
| | | <div class="elForm" style="justify-content: flex-start"> |
| | | <el-form-item style="margin-right: 30px"> |
| | | <el-checkbox v-model="checked" @change="checkedChange">最新版本</el-checkbox> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-input v-model="form.search" placeholder="请输入关键字" style="width: 260px" /> |
| | | </el-form-item> |
| | | </div> |
| | | </el-form> |
| | | <el-button type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">查询</el-button> |
| | | <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button> |
| | | </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="define_name" |
| | | label="文件名称" |
| | | min-width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.define_name">{{ row.define_name }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="filetype_name" |
| | | label="文件类型" |
| | | min-width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.filetype_name">{{ row.filetype_name }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="file_version" |
| | | label="版本号" |
| | | min-width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.file_version">{{ row.file_version }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="partcode" |
| | | label="物料编码" |
| | | min-width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.partcode">{{ row.partcode }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="partname" |
| | | label="物料名称" |
| | | min-width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.partname">{{ row.partname }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="eqptype_name" |
| | | label="设备类型" |
| | | min-width="110" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.eqptype_name">{{ row.eqptype_name }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="username" |
| | | min-width="110" |
| | | label="上传人员" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.username">{{ row.username }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | label="上传时间" |
| | | min-width="160" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.lm_date">{{ row.lm_date }}</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 v-del-tab-index class="item" effect="dark" content="预览" placement="top"> |
| | | <i class="el-icon-files" style="cursor: pointer;color:#42b983;margin-right: 15px" @click="check(row)" /> |
| | | </el-tooltip> |
| | | <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top"> |
| | | <i class="el-icon-delete" @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="getSystemSopSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | title="文件上传" |
| | | :visible.sync="dialogVisible" |
| | | width="800px" |
| | | :close-on-click-modal="false" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="设备类型" prop="devicetvpecode"> |
| | | <el-select |
| | | v-model="dialogForm.devicetvpecode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="val=>fileversionChange(val,'devicetvpecode')" |
| | | > |
| | | <el-option |
| | | v-for="item in devicetvpeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="物料名称" prop="partcode"> |
| | | <el-select |
| | | v-model="dialogForm.partcode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="val=>fileversionChange(val,'partcode')" |
| | | > |
| | | <el-option |
| | | v-for="item in partArr" |
| | | :key="item.partcode" |
| | | :label="item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="文件名称" prop="defilename">--> |
| | | <!-- <el-form-item label="文件名称">--> |
| | | <!-- <el-input v-model="dialogForm.defilename" disabled style="width: 200px" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="文件类型" prop="filetypecode"> |
| | | <el-select |
| | | v-model="dialogForm.filetypecode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="val=>fileversionChange(val,'filetypecode')" |
| | | > |
| | | <el-option |
| | | v-for="item in filetypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="版本号"> |
| | | <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="文件上传" prop="Files"> |
| | | <div style="width: 200px;"> |
| | | <el-upload |
| | | ref="uploadFileRef" |
| | | style="display: inline-block;" |
| | | action="#" |
| | | :limit="1" |
| | | :show-file-list="true" |
| | | :on-exceed="handleExceed" |
| | | :auto-upload="false" |
| | | :multiple="false" |
| | | accept=".mp4,.pdf" |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | style="width: 200px;display: flex;justify-content: center" |
| | | icon="el-icon-upload2" |
| | | >选择文件 |
| | | </el-button> |
| | | </el-upload> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button @click="dialogVisibleCancel">取 消</el-button> |
| | | <el-button |
| | | 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 { |
| | | SystemSopDelete, |
| | | SystemSopDeviceSearch, |
| | | SystemSopMaxVersion, |
| | | SystemSopSava, |
| | | SystemSopSearch, |
| | | SystemSopView |
| | | } from '@/api/xtsz' |
| | | import { PartSelect } from '@/api/zzmx' |
| | | |
| | | export default { |
| | | name: 'Sc' |
| | | name: 'Zzjg', |
| | | components: { |
| | | Pagination |
| | | }, |
| | | data() { |
| | | return { |
| | | mouseHoverType: 'mouseout', |
| | | isExpandForm: false, |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | | form: { |
| | | check: 'N', // 是否选中最高版本 |
| | | search: '', // 搜索关键字 |
| | | prop: 'lm_date', // 排序字段 |
| | | order: 'desc', // 排序字段 |
| | | page: 1, // 第几页 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | checked: false, |
| | | |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | devicetvpecode: '', // 设备类型编码 |
| | | partcode: '', // 物料编码 |
| | | defilename: '', |
| | | filetypecode: '', // 文件类型编码 |
| | | Files: '', // 文件 |
| | | fileversion: ''// 文件版本号 |
| | | }, |
| | | dialogFormRules: { |
| | | devicetvpecode: [ |
| | | { required: true, message: '请选择设备类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | partcode: [ |
| | | { required: true, message: '请选择物料名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | defilename: [ |
| | | { required: true, message: '请输入名文件称', trigger: ['blur', 'change'] } |
| | | ], |
| | | filetypecode: [ |
| | | { required: true, message: '请选择文件类型', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | devicetvpeArr: [], // 设备类型下拉列表 |
| | | partArr: [], // 物料下拉列表 |
| | | filetypeArr: [// 文件类型下拉数组 |
| | | { code: 'P001', name: '作业指导书' }, |
| | | { code: 'P002', name: '检验指导书' }, |
| | | { code: 'P003', name: '图纸' } |
| | | ] |
| | | |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | this.getSystemSopSearch() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | async getSystemSopSearch() { |
| | | const res = await SystemSopSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | }, |
| | | // 排序改变时 |
| | | 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.getSystemSopSearch() |
| | | }, |
| | | // 查询 |
| | | search() { |
| | | this.getSystemSopSearch() |
| | | }, |
| | | // 最新版本改变时触发 |
| | | checkedChange(val) { |
| | | this.form.check = val ? 'Y' : 'N' |
| | | this.getSystemSopSearch() |
| | | }, |
| | | // 文件数量超过限定触发 |
| | | handleExceed() { |
| | | this.$message.info('暂不支持多文件上传!') |
| | | }, |
| | | |
| | | // 重置 |
| | | reset() { |
| | | this.form.search = '' |
| | | this.getSystemSopSearch() |
| | | }, |
| | | // 新增按钮 |
| | | add() { |
| | | this.dialogVisible = true |
| | | this.getSystemSopDeviceSearch() |
| | | this.getPartSelect() |
| | | }, |
| | | // 获取设备类型 |
| | | async getSystemSopDeviceSearch() { |
| | | const { data: res } = await SystemSopDeviceSearch() |
| | | this.devicetvpeArr = res |
| | | }, |
| | | // 获取物料名称 |
| | | async getPartSelect() { |
| | | const { data: res } = await PartSelect() |
| | | this.partArr = res |
| | | }, |
| | | // 文件类型值改变时 |
| | | async fileversionChange(val, type) { |
| | | const data = { |
| | | devicetypecode: type === 'devicetvpecode' ? val : this.dialogForm.devicetvpecode, |
| | | filetypecode: type === 'filetypecode' ? val : this.dialogForm.filetypecode, |
| | | partcode: type === 'partcode' ? val : this.dialogForm.partcode |
| | | } |
| | | const { data: res } = await SystemSopMaxVersion(data) |
| | | |
| | | this.dialogForm.fileversion = res |
| | | }, |
| | | // 预览 |
| | | async check(row) { |
| | | const { data: res } = await SystemSopView({ id: row.id, filepath: row.file_path }) |
| | | window.open(res) |
| | | }, |
| | | |
| | | // 删除按钮 |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const data = { |
| | | id: row.id, |
| | | filepath: row.file_path |
| | | } |
| | | SystemSopDelete(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | if (this.form.page > 1 && this.tableData.length === 1) { |
| | | this.form.page-- |
| | | } |
| | | this.getSystemSopSearch() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.devicetvpecode = '' |
| | | this.dialogForm.partcode = '' |
| | | this.dialogForm.defilename = '' |
| | | this.dialogForm.filetypecode = '' |
| | | this.dialogForm.fileversion = '' |
| | | this.dialogForm.Files = '' |
| | | this.$refs.uploadFileRef.clearFiles() |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | | dialogVisibleCancel() { |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | }, |
| | | // 对话框确认 |
| | | dialogVisibleConfirm() { |
| | | console.log(this.$refs.uploadFileRef.uploadFiles[0]) |
| | | if (!this.$refs.uploadFileRef.uploadFiles[0]) { |
| | | this.$message.info('请选择文件上传!') |
| | | } |
| | | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const formData = new FormData() |
| | | formData.append('devicetypecode', this.dialogForm.devicetvpecode) |
| | | formData.append('partcode', this.dialogForm.partcode) |
| | | formData.append('defilename', this.$refs.uploadFileRef.uploadFiles[0].name) |
| | | formData.append('filetypecode', this.dialogForm.filetypecode) |
| | | formData.append('fileversion', this.dialogForm.fileversion) |
| | | formData.append('Files', this.$refs.uploadFileRef.uploadFiles[0].raw) |
| | | // for (var [key, value] of formData) { |
| | | // console.log(key, value) |
| | | // } |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | SystemSopSava(formData).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('文件上传成功!') |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getSystemSopSearch() |
| | | } else { |
| | | this.$message.error('文件上传失败!') |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 获取页面高度 |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 85 |
| | | this.tableHeight = this.mainHeight - 185 |
| | | this.$refs.tableDataRef.doLayout() |
| | | }) |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | return 'custom-row' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <!--公共页面样式--> |
| | | <style lang="scss" scoped> |
| | | $main_color: #42b983; |
| | | ::v-deep .el-button--text { |
| | | font-size: 14px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-icon-share, .el-icon-delete, .el-icon-edit-outline { |
| | | color: $main_color; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .el-icon-edit-outline { |
| | | margin-right: 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary, .el-button--default, .el-button--info { |
| | | height: 34px; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 15px; |
| | | } |
| | | |
| | | ::v-deep .el-button--primary { |
| | | //background-color: $main_color !important; |
| | | } |
| | | |
| | | ::v-deep .el-button--default { |
| | | background-color: #f8f8fa; |
| | | border: none; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner { |
| | | height: 34px; |
| | | line-height: 34px; |
| | | //color: #a7a7a7; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__body { |
| | | padding: 20px 100px !important; |
| | | } |
| | | |
| | | ::v-deep .dialogVisibleRoles .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .importPickerClass .el-dialog__body { |
| | | padding: 20px 20px !important; |
| | | } |
| | | |
| | | ::v-deep .el-dialog__footer { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | ::v-deep .el-table .caret-wrapper { |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | ::v-deep .cell { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | ::v-deep .el-table::before { |
| | | height: 0; |
| | | } |
| | | |
| | | ::v-deep .el-table__body-wrapper { |
| | | background-color: #f8f8fa; |
| | | } |
| | | |
| | | ::v-deep .el-table__body .el-table__row.hover-row td { |
| | | background-color: #eaecef; |
| | | } |
| | | |
| | | ::v-deep .el-form--inline .el-form-item__label { |
| | | color: #a7a7a7; |
| | | } |
| | | |
| | | .body ::v-deep .el-divider { |
| | | border: 1px solid #eee; |
| | | width: 99%; |
| | | margin: 10px auto; |
| | | } |
| | | |
| | | .body ::v-deep .el-form-item { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .userDialogVisible ::v-deep .el-form-item { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | ::v-deep .el-select__caret { |
| | | display: flex; |
| | | 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> |
| | | |
| | | .el-table .custom-row { |
| | | background: #f8f8fa; |
| | | } |
| | | </style> |