Commit a807664d by 张权

上传功能修改

1 parent 96e05b61
...@@ -22,9 +22,9 @@ export async function bootstrap({ history, common, messenger, globalState, route ...@@ -22,9 +22,9 @@ export async function bootstrap({ history, common, messenger, globalState, route
Vue.prototype.$messageBox = messageBox Vue.prototype.$messageBox = messageBox
Vue.prototype.$defaultStartDate = '2021-07-01' Vue.prototype.$defaultStartDate = '2021-07-01'
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: '5e4bbe11-305c-40ea-b41f-704559eede87' } })
Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: '5e4bbe11-305c-40ea-b41f-704559eede87' } }) // Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: '02a5b9fc-3b3b-4a93-a2fc-c208a8705eec' } })
// Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: '02a5b9fc-3b3b-4a93-a2fc-c208a8705eec' } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState // Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
const routesData = common.utils.deepClone(globalState.routers) const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData) routes = getRoutes(routesData)
......
...@@ -32,8 +32,13 @@ ...@@ -32,8 +32,13 @@
</div> </div>
<pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog> <pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog>
<glsx-dialog title="上传资料" :isVisible.sync="isFileVisible" width="547px" :noCancel="noCancel" btnOkLabel="关闭" @confirmDialog="handleUploadFileClose" @closeDialog="handleUploadFileClose"> <glsx-dialog title="上传资料" :isVisible.sync="isFileVisible" width="547px" :noCancel="noCancel" btnOkLabel="关闭" @confirmDialog="handleUploadFileClose" @closeDialog="handleUploadFileClose">
<div style="height: 284px; overflow-y: scroll;"> <div class="upload-wrap" style="height: 284px; overflow-y: scroll;">
<glsx-combi-form labelWidth="300px" :isBlock="isBlock" ref="uploadFormRef" formRef="uploadChildRef" :formRules="uploadRule" :formObj.sync="uploadForm" :formData="uploadFormData"></glsx-combi-form> <glsx-combi-form labelWidth="300px" :isBlock="isBlock" ref="uploadFormRef" formRef="uploadChildRef" :formRules="uploadRule" :formObj.sync="uploadForm" :formData="uploadFormData">
<span class="upload-slot" slot="uploadSlot" slot-scope="item">
上传
<input class="upload-input" type="file" :id="item.name + 'file'" ref="file" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</span>
</glsx-combi-form>
</div> </div>
</glsx-dialog> </glsx-dialog>
<el-dialog :visible.sync="isTipVisible" width="400px" class="tips-dialog" top="30%" title="提示"> <el-dialog :visible.sync="isTipVisible" width="400px" class="tips-dialog" top="30%" title="提示">
...@@ -541,6 +546,9 @@ export default { ...@@ -541,6 +546,9 @@ export default {
}, },
methods: { methods: {
handleUploadChange(e, item){
this.$refs.uploadFormRef.handleUploadChange(e, item.scope)
},
getCountNoData() { getCountNoData() {
this.$apis.ghBeforeSale.getCountNoDataApi({}).then(res => { this.$apis.ghBeforeSale.getCountNoDataApi({}).then(res => {
this.countNoData = res this.countNoData = res
...@@ -728,7 +736,8 @@ export default { ...@@ -728,7 +736,8 @@ export default {
type: res.code == '0' ? 'success' : 'error' type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
this.$set(this.uploadForm, targetItem.name, imgUrl) this.uploadForm[targetItem.name].push(imgUrl)
//this.$set(this.uploadForm, targetItem.name, imgUrl)
} }
}) })
}, },
...@@ -738,13 +747,14 @@ export default { ...@@ -738,13 +747,14 @@ export default {
var tempList = [] var tempList = []
this.uploadFormData = [] this.uploadFormData = []
this.packageList.forEach(item => { this.packageList.forEach(item => {
this.$set(this.uploadForm, item.attachmentCode, '') this.$set(this.uploadForm, item.attachmentCode, [])
this.uploadFormData.push({ this.uploadFormData.push({
label: item.attachmentName, label: item.attachmentName,
name: item.attachmentCode, name: item.attachmentCode,
type: 'uploadBtn', type: 'upload',
limitSize: 20, limitSize: 20,
maxPhotoNum: 1, maxPhotoNum: 10,
suffixSlot:'uploadSlot',
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
...@@ -764,8 +774,6 @@ export default { ...@@ -764,8 +774,6 @@ export default {
] ]
} }
}) })
console.log(this.uploadFormData)
console.log(this.uploadForm)
this.handleUploadFileClose() this.handleUploadFileClose()
}, },
handleUploadFileClose() { handleUploadFileClose() {
...@@ -776,10 +784,11 @@ export default { ...@@ -776,10 +784,11 @@ export default {
this.packageList = res this.packageList = res
this.uploadForm.contractNo = row.contractNo this.uploadForm.contractNo = row.contractNo
this.$apis.ghBeforeSale.getAllOrderValueApi({ contractNo: row.contractNo }).then(subRes => { this.$apis.ghBeforeSale.getAllOrderValueApi({ contractNo: row.contractNo }).then(subRes => {
console.log(subRes)
var idx = '' var idx = ''
this.packageList.forEach(item => { this.packageList.forEach(item => {
idx = subRes.findIndex(i => i.attachmentCode == item.attachmentCode) idx = subRes.findIndex(i => i.attachmentCode == item.attachmentCode)
this.uploadForm[item.attachmentCode] = idx != -1 ? subRes[idx].attachmentFile : '' this.uploadForm[item.attachmentCode] = idx != -1 ? [subRes[idx].attachmentFile] : []
}) })
}) })
this.autoGenerate() this.autoGenerate()
...@@ -970,4 +979,29 @@ export default { ...@@ -970,4 +979,29 @@ export default {
.tips-dialog .el-dialog__body { .tips-dialog .el-dialog__body {
padding: 10px 15px 20px !important; padding: 10px 15px 20px !important;
} }
/deep/ .upload-wrap{
.el-form-item__content{
.activity-img{
display: none;
}
}
.upload-slot{
position: absolute;
top: -32px;
height: 32px;
left: 300px;
color: #5f5efb;
white-space: nowrap;
cursor: pointer;
.upload-input{
opacity: 0;
position: absolute;
width: 100%;
left: 0;
height: 100%;
cursor: pointer;
}
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!