| | |
| | | <template /> |
| | | <template> |
| | | <div> |
| | | <div class="body" :style="{height:mainHeight+'px'}"> |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between;align-items: center"> |
| | | <el-button v-waves 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 v-waves type="primary" style="margin-left: 30px" icon="el-icon-search" @click="search">查询 |
| | | </el-button> |
| | | <el-button v-waves 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="filename" |
| | | label="文件名称" |
| | | min-width="160" |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.filename">{{ row.filename }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="filetypename" |
| | | label="文件类型" |
| | | min-width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.filetypename">{{ row.filetypename }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="version" |
| | | label="版本号" |
| | | min-width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.version">{{ row.version }}</div> |
| | | <div v-else>/</div> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | prop="materielcode" |
| | | label="产品编码" |
| | | |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="materielname" |
| | | label="产品名称" |
| | | |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | v-if="mesSetting.route" |
| | | prop="routename" |
| | | label="工艺路线" |
| | | |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="stepname" |
| | | label="工序名称" |
| | | |
| | | show-tooltip-when-overflow |
| | | sortable="custom" |
| | | /> |
| | | <!-- <el-table-column--> |
| | | <!-- prop="eqptypename"--> |
| | | <!-- label="设备类型"--> |
| | | <!-- min-width="110"--> |
| | | <!-- show-tooltip-when-overflow--> |
| | | <!-- sortable="custom"--> |
| | | <!-- />--> |
| | | <!-- <el-table-column--> |
| | | <!-- prop="eqpname"--> |
| | | <!-- label="设备信息"--> |
| | | <!-- min-width="110"--> |
| | | <!-- show-tooltip-when-overflow--> |
| | | <!-- sortable="custom"--> |
| | | /> |
| | | <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" style="cursor: pointer;color:#42b983;" @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="getProcessSopSearch" |
| | | /> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | v-el-drag-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="partcode"> |
| | | <el-select |
| | | v-model="dialogForm.partcode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="partcodeChange" |
| | | > |
| | | <el-option |
| | | v-for="item in partcodeArr" |
| | | :key="item.partcode" |
| | | :label="item.partname" |
| | | :value="item.partcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="mesSetting.route" |
| | | label="工艺信息" |
| | | prop="route" |
| | | > |
| | | <el-select |
| | | v-model="dialogForm.route" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | collapse-tags |
| | | :popper-append-to-body="false" |
| | | @change="routeChange" |
| | | > |
| | | <el-option |
| | | v-for="item in routeArr" |
| | | :key="item.route_code" |
| | | :label="item.route_name" |
| | | :value="item.route_code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="工序信息" prop="stepcode"> |
| | | <el-select |
| | | v-model="dialogForm.stepcode" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | collapse-tags |
| | | :popper-append-to-body="false" |
| | | @change="stepcodeChange" |
| | | > |
| | | <el-option |
| | | v-for="item in stepcodeArr" |
| | | :key="item.step_code" |
| | | :label="item.step_name" |
| | | :value="item.step_code" |
| | | /> |
| | | </el-select> |
| | | </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="stepcodeChange" |
| | | > |
| | | <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 |
| | | v-waves |
| | | 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 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 { ProcessSopAddSeave, ProcessSopDeleteSeave, ProcessSopSearch, ProcessSopMaxVersion } from '@/api/SopManager' |
| | | import waves from '@/directive/waves' |
| | | import elDragDialog from '@/directive/el-drag-dialog' |
| | | import { PartSelect } from '@/api/ProductModel' |
| | | import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings' |
| | | |
| | | export default { |
| | | name: 'SopRoute' |
| | | name: 'Zzjg', |
| | | directives: { waves, elDragDialog }, |
| | | 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: { |
| | | partcode: '', // 设备类型编码 |
| | | route: '', // 物料编码 |
| | | stepcode: '', |
| | | defilename: '', |
| | | filetypecode: '', // 文件类型编码 |
| | | Files: '', // 文件 |
| | | |
| | | fileversion: ''// 文件版本号 |
| | | }, |
| | | dialogFormRules: { |
| | | partcode: [ |
| | | { required: true, message: '请选择设备类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | route: [ |
| | | { required: true, message: '请选择设备信息', trigger: ['blur', 'change'] } |
| | | ], |
| | | stepcode: [ |
| | | { required: true, message: '请选择工序信息', trigger: ['blur', 'change'] } |
| | | ], |
| | | defilename: [ |
| | | { required: true, message: '请输入名文件称', trigger: ['blur', 'change'] } |
| | | ], |
| | | filetypecode: [ |
| | | { required: true, message: '请选择文件类型', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | partcodeArr: [], |
| | | routeArr: [], |
| | | stepcodeArr: [], |
| | | filetypeArr: [// 文件类型下拉数组 |
| | | { code: 'P001', name: '作业指导书' }, |
| | | { code: 'P002', name: '检验指导书' }, |
| | | { code: 'P003', name: '图纸' } |
| | | ], |
| | | mesSetting: JSON.parse(localStorage.getItem('mesSetting')) |
| | | |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | this.getProcessSopSearch() |
| | | this.getPartSelect() |
| | | }, |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | }, |
| | | methods: { |
| | | async getPartSelect() { |
| | | const { data: res } = await PartSelect() |
| | | this.partcodeArr = res |
| | | }, |
| | | async getProcessSopSearch() { |
| | | const res = await ProcessSopSearch(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.getProcessSopSearch() |
| | | }, |
| | | // 查询 |
| | | search() { |
| | | this.getProcessSopSearch() |
| | | }, |
| | | // 最新版本改变时触发 |
| | | checkedChange(val) { |
| | | this.form.check = val ? 'Y' : 'N' |
| | | this.getProcessSopSearch() |
| | | }, |
| | | // 文件数量超过限定触发 |
| | | handleExceed() { |
| | | this.$message.info('暂不支持多文件上传!') |
| | | }, |
| | | async partcodeChange(partcode) { |
| | | const { data: res } = await PartSelectRpute({ partcode }) |
| | | if (this.mesSetting.route) { |
| | | this.routeArr = res |
| | | } else { |
| | | this.stepcodeArr = res |
| | | } |
| | | this.dialogForm.route = '' |
| | | this.dialogForm.stepcode = '' |
| | | await this.stepcodeChange() |
| | | }, |
| | | async routeChange() { |
| | | const data = { |
| | | partcode: this.dialogForm.partcode, |
| | | routecode: this.dialogForm.route |
| | | } |
| | | const { data: res } = await RouteSelectStep(data) |
| | | this.stepcodeArr = res |
| | | this.dialogForm.stepcode = '' |
| | | await this.stepcodeChange() |
| | | }, |
| | | async stepcodeChange() { |
| | | if (this.dialogForm.partcode && this.dialogForm.stepcode && this.dialogForm.filetypecode) { |
| | | const data = { |
| | | partcode: this.dialogForm.partcode, |
| | | routecode: this.dialogForm.route, |
| | | stepcode: this.dialogForm.stepcode, |
| | | filetypecode: this.dialogForm.filetypecode |
| | | } |
| | | const { data: res } = await ProcessSopMaxVersion(data) |
| | | this.dialogForm.fileversion = res |
| | | } |
| | | }, |
| | | |
| | | // 重置 |
| | | reset() { |
| | | this.form.search = '' |
| | | this.getProcessSopSearch() |
| | | }, |
| | | // 新增按钮 |
| | | add() { |
| | | this.dialogVisible = true |
| | | }, |
| | | // 预览 |
| | | async check(row) { |
| | | window.open(process.env.VUE_APP_BASE_API_FILE + row.filepath) |
| | | }, |
| | | // 删除按钮 |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const data = { |
| | | id: row.id, |
| | | partcode: row.materielcode, |
| | | routecode: row.routecode ? row.routecode : '', |
| | | stepcode: row.stepcode, |
| | | filepath: row.filepath |
| | | } |
| | | ProcessSopDeleteSeave(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | if (this.form.page > 1 && this.tableData.length === 1) { |
| | | this.form.page-- |
| | | } |
| | | this.getProcessSopSearch() |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.partcode = '' |
| | | this.dialogForm.route = '' |
| | | this.dialogForm.defilename = '' |
| | | this.dialogForm.filetypecode = '' |
| | | this.dialogForm.fileversion = '' |
| | | this.dialogForm.stepcode = '' |
| | | 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('partcode', this.dialogForm.partcode) |
| | | formData.append('routecode', this.dialogForm.route) |
| | | formData.append('stepcode', this.dialogForm.stepcode) |
| | | formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name) |
| | | formData.append('filetypecode', this.dialogForm.filetypecode) |
| | | formData.append('version', this.dialogForm.fileversion) |
| | | formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw) |
| | | // for (var [key, value] of formData) { |
| | | // console.log(key, value) |
| | | // } |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | ProcessSopAddSeave(formData).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('文件上传成功!') |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getProcessSopSearch() |
| | | } 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> |
| | | .el-table .custom-row { |
| | | background: #f8f8fa; |
| | | } |
| | | </style> |