From 55008d09e47511bcb241eb909dff3e36c89099db Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期日, 29 九月 2024 17:39:14 +0800
Subject: [PATCH] 优化能力范围弹框、添加下单文件上传功能
---
src/components/do/b1-ins-order/add.vue | 132 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 124 insertions(+), 8 deletions(-)
diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index a380c1e..245417d 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -264,7 +264,7 @@
</div>
</el-col>
<el-col class="search_thing" :span="6" v-if="addObj.formType!='鍏朵粬鎴愬搧'&&addObj.formType">
- <div class="search_label"><span class="required-span">* </span>涓嬪彂鑷冲璞★細</div>
+ <div class="search_label"><span class="required-span">* </span>閫氱煡鑷虫牱鏈哄憳锛�</div>
<div class="search_input">
<el-select v-model="addObj.issueUser" size="small" :disabled="active>1" style="width: 100%;">
<el-option v-for="(a,ai) in personList" :key="ai" :label="a.label" :value="a.value"></el-option>
@@ -369,6 +369,14 @@
v-model="addObj.remark" :readonly="active>1"></el-input>
</div>
</el-col>
+ <el-col class="search_thing upload" :span="4" style="align-items: flex-start;margin: 8px 0 0 50px;height: auto" v-if="active==1">
+ <el-upload
+ action="#"
+ :auto-upload="false"
+ accept='.jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv' :on-change="handleChangeUpload">
+ <el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
+ </el-upload>
+ </el-col>
<!-- <el-col class="search_thing" :span="6" v-if="active==1">
<div class="search_label">RTS锛�</div>
<div class="search_input">
@@ -400,8 +408,12 @@
</div>
</div>
</div>
+ <el-radio-group v-model="currentPage" v-if="active>1" size="small" style="margin-top: 20px;">
+ <el-radio-button :label="0">鏍峰搧</el-radio-button>
+ <el-radio-button :label="1">闄勪欢</el-radio-button>
+ </el-radio-group>
<el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" max-height="400px" tooltip-effect="dark"
- border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;">
+ border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;" v-show="currentPage==0">
<el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column>
<el-table-column type="index" label="搴忓彿" width="65" align="center"></el-table-column>
<el-table-column prop="sample" label="鏍峰搧鍚嶇О" align="center" min-width="100">
@@ -472,7 +484,7 @@
</el-table>
<el-table class="el-table" ref="productTable" :data="productList" max-height="400px" tooltip-effect="dark" border
@selection-change="selectProduct" style="margin-bottom: 10px;" @select="upProductSelect"
- :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll">
+ :row-class-name="tableRowClassName" v-loading="getProductLoad" @select-all="handleAll" v-show="currentPage==0">
<el-table-column type="selection" width="65" :selectable="selectable" v-if="active==1"></el-table-column>
<el-table-column prop="inspectionItemClass" v-if="PROJECT === '瑁呭鐢电紗'" label="妫�楠岄」鍒嗙被" min-width="140" show-overflow-tooltip></el-table-column>
<el-table-column prop="inspectionItemClassEn" v-if="PROJECT === '瑁呭鐢电紗'" label="妫�楠岄」鍒嗙被(EN)" min-width="140" show-overflow-tooltip></el-table-column>
@@ -554,6 +566,9 @@
<el-table-column prop="sonLaboratory" label="瀛愬疄楠屽" min-width="130" show-overflow-tooltip :filters="filters"
:filter-method="filterHandler"></el-table-column>
</el-table>
+ <ValueTable class="value-table" ref="fileList" :url="$api.insOrderPlan.getFileList"
+ :componentData="componentData0"
+ :delUrl="$api.insOrderPlan.delfile" style="height: 100%;margin-top: 16px;" v-show="currentPage==1"/>
</div>
</div>
<el-dialog title="閫夋嫨鍗曚綅" :visible.sync="selectUserDia" width="70%">
@@ -952,6 +967,13 @@
<el-button type="primary" @click="spliceTemperatureTest">淇濆瓨</el-button>
</span>
</el-dialog>
+ <el-dialog
+ title="鏂囦欢棰勮"
+ :visible.sync="lookFileVisible"
+ width="60%" fullscreen>
+ <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
+ :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
+ </el-dialog>
</div>
</template>
@@ -962,6 +984,7 @@
import equipConfig from './equip-config.vue'
import cableConfig from './cable-config.vue'
import Vue from 'vue'
+import filePreview from '../../tool/file-preview.vue'
export default {
components: {
@@ -969,7 +992,8 @@
fiberOpticConfig,
fiberOpticConfigTwo,
equipConfig,
- cableConfig
+ cableConfig,
+ filePreview
},
props: {
examine: {
@@ -987,6 +1011,8 @@
},
data() {
return {
+ currentFile:{},
+ lookFileVisible:false,
inspectionItemST: null,
sampleSelectionList: [],//鏍峰搧琛ㄦ牸閫変腑鏁版嵁
editTable:[],
@@ -1166,6 +1192,52 @@
deaprtEnum:[],
standard:[],
createState:1,//1:閫夋嫨濮旀墭鍗曚綅锛�2锛氶�夋嫨鐢熶骇鍗曚綅
+ fileList:[],
+ currentPage:0,//0:鏍峰搧淇℃伅锛�1锛氶檮浠�
+ componentData0: {
+ entity: {
+ insOrderId:''
+ },
+ isIndex: true,
+ showSelect: false,
+ select: false,
+ sort: false,
+ init:false,
+ do: [
+ {
+ id: 'handleDown',
+ font: '涓嬭浇',
+ type: 'text',
+ method: 'handleDown'
+ },
+ {
+ id: '1',
+ font: '棰勮',
+ type: 'text',
+ method: 'lookFile',
+ }
+ ],
+ isPage: false,
+ linkEvent: {},
+ tagField: {
+ type:{
+ select:[
+ {
+ value: 1,
+ label: '鍥剧墖'
+ },
+ {
+ value: 2,
+ label: '鏂囦欢'
+ }
+ ]
+ }
+ },
+ currentId: '',
+ selectField: {},
+ requiredAdd: [],
+ requiredUp: []
+ },
}
},
watch: {
@@ -1261,10 +1333,45 @@
}
})
})
+ // 鏂囦欢淇℃伅
+ this.componentData0.entity.insOrderId = this.currentId
+ this.$refs.fileList.selectList()
}
},
methods: {
+ lookFile(row){
+ this.currentFile = row;
+ if(row.type==1){
+ this.currentFile.url = this.javaApi+'/img/'+row.fileUrl
+ }else{
+ this.currentFile.url = this.javaApi+'/word/'+row.fileUrl
+ }
+ this.lookFileVisible = true
+ },
+ handleDown(row){
+ this.$axios.post(this.$api.insOrderPlan.downFile, {
+ id: row.id,
+ }).then(res => {
+ if (res.code === 200) {
+ let url = '';
+ if(res.data.type==1){
+ url = this.javaApi+'/img/'+res.data.fileUrl
+ file.downloadIamge(url,row.fileName)
+ }else{
+ url = this.javaApi+'/word/'+res.data.fileUrl
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = row.fileName;
+ link.click();
+ }
+ }
+ }).catch(error => {
+ })
+ },
+ handleChangeUpload(file, fileLists){
+ this.fileList = fileLists
+ },
//鐗规畩鍊煎~鍐欏鐞�
inputValueHandler(row,index){
if(row){
@@ -1687,7 +1794,7 @@
} else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
this.$message.error('璇烽�夋嫨妫�楠屾爣鍑�')
} else if(this.addObj.formType&&this.addObj.formType!='鍏朵粬鎴愬搧'&&!this.addObj.issueUser){
- this.$message.error('璇烽�夋嫨涓嬪彂瀵硅薄')
+ this.$message.error('璇烽�夋嫨閫氱煡鑷虫牱鏈哄憳')
}else{
//鏍¢獙妫�楠岄」鐨勮姹傚�煎拰瑕佹眰鎻忚堪,浠呭鎵樿姹�
// if(this.active==1&&this.isAskOnlyRead){
@@ -2058,8 +2165,12 @@
return false;
}
this.saveLoad = true
- this.$axios.post(this.$api.insOrder.addInsOrder, {
- str: JSON.stringify({
+ let fd = new FormData();
+ this.fileList.forEach((item,index)=>{
+ //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
+ fd.append("files",item.raw);
+ })
+ fd.append("str",JSON.stringify({
insOrder: this.addObj,
list: JSON.stringify(sampleList.map(a => {
if (this.PROJECT === '瑁呭鐢电紗') {
@@ -2082,7 +2193,12 @@
return a
})),
pairing: JSON.stringify(this.bsm2Val2)
- })
+ }));
+ this.$axios.post(this.$api.insOrder.addInsOrder, fd,{
+ headers: {
+ 'Content-Type': 'multipart/form-data'
+ },
+ noQs:true
}).then(res => {
this.saveLoad = false
if (res.code == 201) return
--
Gitblit v1.9.3