From 7e807f771796a68e799826ae4a5598ddb2eec0d8 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期一, 11 三月 2024 15:55:11 +0800 Subject: [PATCH] 质检:附件上传 --- src/views/quality/packageinspect/packageInspect-form.vue | 299 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 218 insertions(+), 81 deletions(-) diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue index 2cf2980..21a93ae 100644 --- a/src/views/quality/packageinspect/packageInspect-form.vue +++ b/src/views/quality/packageinspect/packageInspect-form.vue @@ -62,87 +62,165 @@ </el-row> </el-form> </div> - <div class="packageInspect-detail"> - <el-row :gutter="10" style="width:100%;z-index: 10;height:30px;"> - <el-col :span="12">妫�楠岄」鐩�</el-col> - <el-col :span="12" style="text-align: right;"> - <el-dropdown @command="handleCommand" v-if="isShow"> - <el-button size="mini" style="margin-right: 10px;" type="primary" > - 鍒囨崲妫�楠岄」妯℃澘<i class="el-icon-arrow-down el-icon--right"></i> - </el-button> - <el-dropdown-menu slot="dropdown"> - <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item> - </el-dropdown-menu> - </el-dropdown> - <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button> - <el-button v-if="resultVal=='' || resultVal==null" type="primary" size="mini" - @click="savePackIns()">淇濆瓨</el-button> - </el-col> - </el-row> - <el-row style="width:100%;"> - <el-col :span="24"> - <el-table - :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}" - :cell-style="{textAlign:'center'}" - ref="table" - :data="list" - border - style="width: 100%;" - height="400" - row-key="randomId" class="l-mes" - default-expand-all - :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> - <el-table-column type="index" prop="parentIndex" label="搴忓彿" width="60"> - <template scope="scope"> - <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span> - </template> - </el-table-column> - <el-table-column prop="name" label="椤圭洰" width="160"> - <template slot-scope="scope"> - <el-input :readonly="resultVal!=null || !scope.row.isEdit" v-if="scope.row.children" class="inline-input" style="width:80%;" v-model="scope.row.name" - placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input> - </template> - </el-table-column> - <el-table-column prop="required" label="瑕佹眰" width="160"> - <template slot-scope="scope"> - <div v-if="!scope.row.children"> - <el-tooltip :content="scope.row.required"> - <el-input :readonly="resultVal!=null || !scope.row.isEdit" - v-model="scope.row.required" - placeholder="璇疯緭鍏ヨ姹�"></el-input> - </el-tooltip> - </div> - </template> - </el-table-column> - <el-table-column prop="note" label="妫�楠屾弿杩�" width="160"> - <template slot-scope="scope"> - <div v-if="!scope.row.children"> - <el-input :readonly="resultVal!=null" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input> - </div> - </template> - </el-table-column> - <el-table-column prop="testState" label="缁撹" min-width="150"> - <template slot-scope="scope"> - <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children"> - <el-option label="鍚堟牸" value="鍚堟牸"></el-option> - <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option> - <el-option label="涓嶉�傜敤" value="涓嶉�傜敤"></el-option> - </el-select> - </template> - </el-table-column> - <el-table-column v-if="resultVal=='' || resultVal==null" fixed="right" style="background-color: white;" label="鎿嶄綔" width="200"> - <template slot-scope="scope"> - <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">娣诲姞琛�</el-button> - <el-button v-if="!scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" - @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍙栨秷</el-button> - <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" - @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍒犻櫎椤圭洰</el-button> + <div> + <el-tabs class="packageInspect-detail" @tab-click="tabsClick"> + <el-tab-pane label="妫�楠岄」鐩�"> + <el-row> + <el-col :span="24" style="text-align: right;"> + <el-dropdown @command="handleCommand" v-if="isShow && (resultVal==null || resultVal=='')"> + <el-button size="mini" style="margin-right: 10px;" type="primary" > + 鍒囨崲妫�楠岄」妯℃澘<i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> + <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button> + <el-button v-if="resultVal=='' || resultVal==null" type="primary" size="mini" + @click="savePackIns()">淇濆瓨</el-button> + </el-col> + </el-row> + <el-row> + <el-col :span="24"> + <el-table + :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}" + :cell-style="{textAlign:'center'}" + ref="table" + :data="list" + border + style="width: 100%;" + height="400" + row-key="randomId" class="l-mes" + default-expand-all + :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> + <el-table-column type="index" prop="parentIndex" label="搴忓彿" width="60"> + <template scope="scope"> + <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span> + </template> + </el-table-column> + <el-table-column prop="name" label="椤圭洰" min-width="160"> + <template slot-scope="scope"> + <el-input :readonly="resultVal!=null || !scope.row.isEdit" v-if="scope.row.children" class="inline-input" style="width:80%;" v-model="scope.row.name" + placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input> + </template> + </el-table-column> + <el-table-column prop="required" label="瑕佹眰" min-width="160"> + <template slot-scope="scope"> + <div v-if="!scope.row.children"> + <el-tooltip :content="scope.row.required"> + <el-input :readonly="resultVal!=null || !scope.row.isEdit" + v-model="scope.row.required" + placeholder="璇疯緭鍏ヨ姹�"></el-input> + </el-tooltip> + </div> + </template> + </el-table-column> + <el-table-column prop="note" label="妫�楠屾弿杩�" min-width="160"> + <template slot-scope="scope"> + <div v-if="!scope.row.children"> + <el-input :readonly="resultVal!=null" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input> + </div> + </template> + </el-table-column> + <el-table-column prop="testState" label="缁撹" min-width="150"> + <template slot-scope="scope"> + <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children"> + <el-option label="鍚堟牸" value="鍚堟牸"></el-option> + <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option> + <el-option label="涓嶉�傜敤" value="涓嶉�傜敤"></el-option> + </el-select> + </template> + </el-table-column> + <el-table-column v-if="resultVal=='' || resultVal==null" fixed="right" style="background-color: white;" label="鎿嶄綔" width="200"> + <template slot-scope="scope"> + <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">娣诲姞琛�</el-button> + <el-button v-if="!scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" + @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍙栨秷</el-button> + <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text" + @click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍒犻櫎椤圭洰</el-button> + </template> + </el-table-column> + </el-table> + </el-col> + </el-row> + </el-tab-pane> + <el-tab-pane label="闄勪欢涓婁紶" type="card"> + <div style="display: flex;justify-content:flex-end;"> + <div></div> + </div> + <div + v-loading="progrecessFileLoading" + element-loading-text="璇风◢绛夛紝鏂囦欢涓婁紶涓�" + > + <el-upload + drag + ref="upload" + action="/mes/attachment/upload" + :auto-upload="true" + :headers="headers" + :before-upload="submitUpload" + :on-success="uploadSuccess" + :data="paramData" + :with-credentials="true" + :show-file-list="false" + > + <i class="el-icon-upload"></i> + <div class="el-upload__text"> + 灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em> + </div> + </el-upload> + </div> + <el-table :data="processConfigFileTableData" height="260px"> + <el-table-column + prop="rawInsNo" + align="center" + width="120" + label="鍘熸潗鏂欐楠岀紪鍙�" + show-overflow-tooltip + ></el-table-column> + <el-table-column + prop="originalFileName" + align="center" + label="鍘熸枃浠跺悕" + width="200" + ></el-table-column> + <el-table-column prop="fileName" align="center" label="鏂囦欢鍚庣紑"></el-table-column> + <el-table-column prop="createUser" align="center" label="涓婁紶浜�"></el-table-column> + <el-table-column + prop="createTime" + align="center" + label="涓婁紶鏃堕棿" + show-overflow-tooltip + ></el-table-column> + <el-table-column prop="updateUser" align="center" label="鏇存柊浜�"> + </el-table-column> + <el-table-column + prop="updateTime" + align="center" + label="鏇存柊鏃堕棿" + show-overflow-tooltip + ></el-table-column> + <el-table-column align="center" label="鎿嶄綔"> + <template slot-scope="scope"> + <el-button + @click="delProcessConfigFile(scope.row)" + type="text" + size="small" + :disabled="(resultVal!=null && resultVal!='')" + >鍒犻櫎</el-button + > + <el-button + @click="downloadProcessConfigFile(scope.row)" + type="text" + size="small" + >涓嬭浇</el-button + > </template> - </el-table-column> + </el-table-column> </el-table> - </el-col> - </el-row> + </el-tab-pane> + </el-tabs> </div> <div class="packageInspect-result"> <el-row> @@ -197,7 +275,13 @@ updatePackageInspectById, getCustomer, } from '@/api/quality/packageInspect' +import { + getProcessConfigFiles, + deleteProcessConfigFile, + downloadProcessConfigFile + } from '@/api/quality/attachment' import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp' +import { getStore } from '@/util/store' export default { computed:{ }, @@ -205,6 +289,16 @@ }, data(){ return{ + progrecessFileLoading: false, + processConfigFileTableData: [], + headers: { + Authorization: 'Bearer ' + getStore({ name: 'access_token' }) + }, + paramData: { + rawInsNo: '', + lineNumber: '', + type: 4 + }, inspectMoulds: [], isShow: true, submitData: { @@ -269,6 +363,49 @@ } }, methods:{ + delProcessConfigFile(row) { + this.$confirm('鏄惁鍒犻櫎璇ラ檮浠�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + closeOnClickModal: false + }).then(function() { + return deleteProcessConfigFile(row.id) + }).then((data) => { + this.getConfigFiles() + }) + }, + getConfigFiles() { + const param = { + no: this.dataForm.packInsNo, + lineNumber: this.dataForm.id, + type: 4 + } + getProcessConfigFiles(param).then((res) => { + this.processConfigFileTableData = res.data.data + }) + }, + downloadProcessConfigFile(row) { + downloadProcessConfigFile({ + bucket: row.bucketName, + fileName: row.fileName, + originalFileName: row.originalFileName + }) + }, + submitUpload() { + this.paramData.no = this.dataForm.packInsNo + this.paramData.lineNumber = this.dataForm.id + this.progrecessFileLoading = true + }, + uploadSuccess() { + this.progrecessFileLoading = false + this.getConfigFiles() + }, + tabsClick(tab,even){ + if(tab.index == 1){ + this.getConfigFiles(); + } + }, checkShowState(){ let num = 0 this.list.forEach(ele=>{ @@ -539,14 +676,14 @@ <style> .packageInspect-detail { width: 100%; - height: 490px; + height: 520px; padding: 10px 20px; - display: flex; border: 1px solid #ddd; background-color: #fff; margin-top: 10px; box-sizing: border-box; - flex-wrap: wrap; + /* display: flex; + flex-wrap: wrap; */ } .packageInspect-result { -- Gitblit v1.9.3