This commit is contained in:
bb_pan 2025-03-24 18:35:25 +08:00
parent 7a73b10582
commit 04ee1aaea1
6 changed files with 74 additions and 875 deletions

View File

@ -233,7 +233,7 @@
<el-table-column align="center" label="序号" show-overflow-tooltip type="index" />
<el-table-column align="center" label="机具名称" prop="typeName" show-overflow-tooltip />
<el-table-column align="center" label="规格型号" prop="typeModelName" show-overflow-tooltip />
<el-table-column align="center" label="出库时间" prop="createTime" show-overflow-tooltip />
<el-table-column align="center" label="出库时间" prop="outTime" show-overflow-tooltip />
<el-table-column align="center" label="本次出库数量" prop="outNum" show-overflow-tooltip />
<el-table-column align="center" label="出库人" prop="userName" show-overflow-tooltip />
</el-table>
@ -269,6 +269,16 @@
<el-form-item label="备注" prop="remark">
<el-input v-model="codeOutForm.remark" maxlength="50" />
</el-form-item>
<el-form-item label="选择出库时间" prop="createTime">
<el-date-picker
type="date"
v-model="codeOutForm.createTime"
style="width: 240px"
value-format="yyyy-MM-dd"
placeholder="请选择出库时间"
:picker-options="pickerOptions"
/>
</el-form-item>
</el-form>
<el-form :model="outQuery" ref="outQuery" size="small" :inline="true" label-width="100px">
@ -340,6 +350,17 @@
<el-form-item label="备注" prop="remark">
<el-input v-model="numOutForm.remark" maxlength="50" />
</el-form-item>
<br />
<el-form-item label="选择出库时间" prop="createTime">
<el-date-picker
type="date"
v-model="numOutForm.createTime"
style="width: 240px"
value-format="yyyy-MM-dd"
placeholder="请选择出库时间"
:picker-options="pickerOptions"
/>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@ -527,6 +548,7 @@ export default {
//-
carCode: undefined,
remark: undefined,
createTime: '',
},
numOutForm: {
//-
@ -538,6 +560,7 @@ export default {
pageNum: 1,
pageSize: 10,
maCode: undefined,
createTime: '',
},
outTotal: 0, //-
outCodeList: [], //
@ -558,6 +581,13 @@ export default {
leaseOutData: {},
openFileVisible: false,
fileList: [],
pickerOptions: {
disabledDate(date) {
const today = new Date();
today.setHours(0, 0, 0, 0); // 便
return date.getTime() > today.getTime(); //
},
}
}
},
created() {
@ -744,6 +774,7 @@ export default {
leaseType: this.leaseType,
maModel: this.outObj.maModel,
maName: this.outObj.maName,
createTime: this.codeOutForm.createTime,
// remark: this.outCodeList.find((v) => v.maId == item).remark,
}
return obj
@ -765,6 +796,7 @@ export default {
saveNumOut() {
this.outNumList[0].carCode = this.numOutForm.carCode
this.outNumList[0].remark = this.numOutForm.remark
this.outNumList[0].createTime = this.numOutForm.createTime
this.outNumList[0].leaseType = this.leaseType
let param = this.outNumList
// console.log(param, '')
@ -804,6 +836,7 @@ export default {
this.leaseOutDetailParams.typeId = row.typeId
this.onHandleQuery().then(() => {
this.outRecordVisible = true
this.outTime = []
})
},
/* 打开出库单 */

View File

@ -238,6 +238,8 @@
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:data="{ fileType: 'sx' }"
:multiple="false"
accept="image/*,application/pdf"
:limit="5"
:file-list="scope.row.fileList"
@ -1131,9 +1133,9 @@ export default {
handlePreview(file) {
console.log('🚀 ~ handlePreview ~ file:', file)
if (file.response) {
window.open(file.response.data.fileUrl)
window.open(process.env.VUE_APP_BASE_API + '/system'+ file.response.data.fileUrl)
} else {
window.open(file.fileUrl)
window.open(process.env.VUE_APP_BASE_API + '/system'+ file.fileUrl)
}
},
handleExceed(files, fileList) {

View File

@ -123,9 +123,10 @@
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:data="{ fileType: 'sx' }"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:multiple="false"
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
@ -136,18 +137,18 @@
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
v-if="isPDF(file)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
v-else-if="isWord(file)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<img v-else class="el-upload-list__item-thumbnail" :src="file.fileUrl" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
@ -318,7 +319,7 @@
:headers="headers"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:multiple="false"
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
@ -329,18 +330,18 @@
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
v-if="isPDF(file)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
v-else-if="isWord(file)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<img v-else class="el-upload-list__item-thumbnail" :src="file.fileUrl" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
@ -702,19 +703,17 @@ export default {
this.isRequired = false
}
},
isPDF(file) {
console.log('🚀 ~ isPDF ~ file:', file)
console.log(file?.fileName && /\.(pdf)$/i.test(file.fileName))
return file?.fileName && /\.(pdf)$/i.test(file.fileName);
},
isWord(file) {
return file?.fileName && /\.(docx?|wps)$/i.test(file.fileName);
},
handleRemove(file, domain) {
// console.log('🚀 ~ handleRemove ~ this.$refs.upload_attach:', this.$refs.upload_attach[0].uploadFiles)
// console.log('🚀 ~ handleRemove ~ row:', domain.fileList)
// console.log('🚀 ~ handleRemove ~ file:', file)
let fileList = this.$refs.upload_attach[0].uploadFiles
this.$refs.upload_attach[0].uploadFiles = fileList.filter((item) => item.name !== file.name)
// console.log('🚀 ~ handleRemove ~ fileList:', fileList)
domain.fileList = this.$refs.upload_attach[0].uploadFiles.map((item) => {
return {
fileName: item.name,
fileUrl: item.url,
}
})
console.log('🚀 ~ handleRemove ~ file:', file)
domain.fileList.splice(domain.fileList.indexOf(file), 1)
console.log('🚀 ~ domain.fileList:', domain.fileList)
},
handlePreview(file) {
@ -738,9 +737,6 @@ export default {
}
return isLtMB
},
beforeRemove(file) {
return this.$confirm(`确定移除 ${file.name} `)
},
handleSuccess(file, fileList, row) {
console.log('🚀 ~ handleSuccess ~ row:', row)
console.log('🚀 ~ handleSuccess ~ file:', file)
@ -749,7 +745,7 @@ export default {
}
row.fileList.push({
fileName: file.response.data.fileName,
fileUrl: file.response.data.fileUrl,
fileUrl: process.env.VUE_APP_BASE_API + '/system'+ file.response.data.fileUrl,
})
},
//

View File

@ -1,825 +0,0 @@
<template>
<el-dialog
v-dialogDrag
v-loading.fullscreen.lock="fullscreenLoading"
:before-close="cancel"
:title="dialogTitle"
:visible.sync="dialogShowFlag"
append-to-body
width="600px"
>
<div class="form_box_one">
<el-form ref="dynamicValidateForm" :model="dynamicValidateForm" class="demo-dynamic" label-width="100px">
<div v-for="(domain, index) in dynamicValidateForm.premiumList" :key="domain.key" class="bor_box">
<p class="form_box_title">编码管理设备</p>
<div class="form_box_line"></div>
<div class="form_box_item">
<!-- :rules="{
required: true,
message: '保费不能为空',
trigger: 'blur',
}"
label="选择配件:" -->
<el-form-item :prop="'premiumList.' + index + '.repairRemark'" label="技术鉴定:">
<el-input
v-model="domain.repairRemark"
placeholder="请输入"
size="small"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item :prop="'premiumList.' + index + '.partName'" label="配件名称:">
<el-input
v-model="domain.partName"
placeholder="请输入"
size="small"
maxlength="50"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
:prop="'premiumList.' + index + '.partType'"
label="是否收费:"
required
:rules="{
required: true,
message: '请选择是否收费',
trigger: 'blur',
}"
>
<el-radio-group style="width: 350px" v-model="domain.partType">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="index == 0"
:prop="'premiumList.' + index + '.supplierId'"
label="选择厂家:"
:rules="{
message: '请选择厂家',
required: true,
trigger: 'blur',
}"
>
<el-select
v-model="domain.supplierId"
placeholder="请选择"
size="small"
filterable
style="width: 350px"
>
<el-option
v-for="dict in supplierSelectList"
:key="dict.supplierId"
:label="dict.supplier"
:value="dict.supplierId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item
:prop="'premiumList.' + index + '.partPrice'"
label="配件单价(元)"
label-width="120px"
:rules="{
required: false,
validator: meneyIntegerValidator,
trigger: 'blur',
}"
> -->
<el-form-item
v-if="domain.partType == 1"
:prop="'premiumList.' + index + '.partPrice'"
label="费用(元)"
>
<el-input
v-model="domain.partPrice"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
:prop="'premiumList.' + index + '.partNum'"
label="配件数量:"
:rules="{
required: false,
// validator: numberIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.partNum"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item :prop="'premiumList.' + index + '.repairContent'" label="维修内容:">
<el-input
v-model="domain.repairContent"
maxlength="100"
placeholder="请输入"
show-word-limit
size="small"
style="width: 350px"
type="textarea"
></el-input>
</el-form-item>
<el-form-item :prop="'premiumList.' + index + '.fileList'" label="附件:">
<el-upload
ref="upload_attach"
class="upload-demo"
:action="uploadUrl"
:headers="headers"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
:on-exceed="handleExceed"
:on-success="(res, file, fileList) => handleSuccess(file, fileList, domain)"
style="width: 350px"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
</span>
<span class="el-upload-list__item-delete" @click="handleRemove(file, domain)">
<i class="el-icon-delete" />
</span>
</span>
</div>
</el-upload>
</el-form-item>
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code !== null && rowObj.code !== ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submit">保存</el-button>
</div>
</div>
<div class="form_box_two">
<el-form
ref="dynamicValidateFormTwo"
:model="dynamicValidateFormTwo"
class="demo-dynamic"
label-width="100px"
>
<div v-for="(domain, index) in dynamicValidateFormTwo.premiumListTwo" :key="domain.key" class="bor_box">
<p class="form_box_title">数量管理设备</p>
<div class="form_box_line"></div>
<div class="form_box_item">
<!-- :rules="{
required: true,
message: '保费不能为空',
trigger: 'blur',
}"
label="选择配件:" -->
<el-form-item :prop="'premiumListTwo.' + index + '.repairRemark'" label="技术鉴定:">
<el-input
v-model="domain.repairRemark"
placeholder="请输入"
size="small"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
:prop="'premiumListTwo.' + index + '.repairNum'"
label="维修数量:"
:rules="{
required: true,
validator: numberIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.repairNum"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item label="配件名称:">
<el-input
v-model="domain.partName"
placeholder="请输入"
size="small"
maxlength="50"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
label="是否收费:"
required
:rules="{
required: true,
message: '请选择是否收费',
trigger: 'blur',
}"
>
<el-radio-group style="width: 350px" v-model="domain.partType">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="index == 0"
:prop="'premiumListTwo.' + index + '.supplierId'"
label="选择厂家:"
:rules="{
message: '请选择厂家',
required: true,
trigger: 'blur',
}"
>
<el-select
v-model="domain.supplierId"
placeholder="请选择"
size="small"
filterable
style="width: 350px"
>
<el-option
v-for="dict in supplierSelectList"
:key="dict.supplierId"
:label="dict.supplier"
:value="dict.supplierId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item
:prop="'premiumListTwo.' + index + '.partPrice'"
label="配件单价(元)"
label-width="120px"
:rules="{
required: false,
validator: meneyIntegerValidator,
trigger: 'blur',
}"
> -->
<el-form-item v-if="domain.partType == 1" label="配件单价(元)">
<el-input
v-model="domain.partPrice"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
label="配件数量:"
:rules="{
required: false,
validator: numberIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.partNum"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item label="维修内容:">
<el-input
v-model="domain.repairContent"
maxlength="100"
placeholder="请输入"
show-word-limit
size="small"
style="width: 350px"
type="textarea"
></el-input>
</el-form-item>
<el-form-item :prop="'premiumListTwo.' + index + '.fileList'" label="附件:">
<el-upload
ref="upload_attach"
class="upload-demo"
:action="uploadUrl"
:headers="headers"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
:on-exceed="handleExceed"
:on-success="(res, file, fileList) => handleSuccess(file, fileList, domain)"
style="width: 350px"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
</span>
<span class="el-upload-list__item-delete" @click="handleRemove(file, domain)">
<i class="el-icon-delete" />
</span>
</span>
</div>
</el-upload>
</el-form-item>
</div>
<!-- <el-button @click.prevent="removeDomain(domain, index)"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- <div class="add_box">
<el-button
icon="el-icon-plus"
size="mini"
type="success"
@click="addDomainTwo"
>添加配件
</el-button>
</div> -->
</div>
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code == null || rowObj.code == ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitTwo">保存</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import {
submitRepairApplyApi,
getUserSelectApi,
getRepairMaTypeListApi,
listPartType,
getSupplierSelectApi,
} from '@/api/repairTest/repair'
// import { listPartType, } from "@/api/store/tools";
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getInfo } from '@/api/login'
export default {
components: { Treeselect },
props: {
//
isShowFlag: {
type: Boolean,
default: false,
},
//
priKey: {
type: [String, Number],
default: '',
},
//
dialogTitle: {
type: String,
default: '',
},
//
rowObj: {
type: Object,
default: {},
},
},
watch: {
isShowFlag(val) {
if (val) {
this.init()
}
},
},
computed: {
dialogShowFlag: {
get() {
return this.isShowFlag
},
set(v) {
this.$emit('update:isShowFlag', v)
},
},
},
data() {
return {
uploadUrl: process.env.VUE_APP_BASE_API + '/system/sys/file/upload', //
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token'),
},
pdfImg: require('@/assets/images/pdf.png'),
wordImg: require('@/assets/images/word.png'),
supplierSelectList: [],
fullscreenLoading: false,
dynamicValidateForm: {
premiumList: [
{
selected: 'Y',
premium: undefined,
rate: undefined,
feeRate: undefined,
fee: undefined,
baofei1_unit: '',
shangyoufeiyonge_unit: '',
downRate: undefined,
downFee: undefined,
xiayoufeiyonge_unit: '',
fileList: [],
repairRemark: '', //
},
],
},
dynamicValidateFormTwo: {
premiumListTwo: [
{
selected: 'Y',
premium: undefined,
rate: undefined,
feeRate: undefined,
fee: undefined,
baofei1_unit: '',
shangyoufeiyonge_unit: '',
downRate: undefined,
downFee: undefined,
xiayoufeiyonge_unit: '',
fileList: [],
repairRemark: '', //
},
],
},
userSelectList: [],
companyId: '',
taskId: '',
}
},
mounted() {
this.$eventBus.$on('taskId', (taskId) => {
this.taskId = taskId
})
this.getTree()
},
methods: {
//
meneyIntegerValidator(rule, value, callback) {
const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
if (value === '' || reg.test(value)) {
callback()
} else {
callback(new Error('请输入大于0的数'))
}
},
//--
numberIntegerValidator(rule, value, callback) {
const reg = /^\+?[1-9][0-9]*$/
if (reg.test(value) && value <= this.rowObj.repairNum) {
callback()
} else {
callback(new Error('请输入大于0的并且小于维修总量的正整数'))
}
},
getTree() {
listPartType().then((response) => {
this.deptList = this.handleTree(response.data, 'paId')
})
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.paId,
label: node.paName,
children: node.children,
}
},
getList() {
let params = {
taskId: this.taskId,
}
this.loading = true
getRepairMaTypeListApi(params).then((res) => {
if (res.code == 200) {
this.repairList = res.rows
this.total = res.total
this.loading = false
}
})
},
init() {
if (this.rowObj.code !== null && this.rowObj.code !== '') {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
this.addDomainOne()
} else {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
this.addDomainTwo()
}
this.dynamicValidateForm.premiumList.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
getSupplierSelectApi().then((res) => {
this.supplierSelectList = res.data
})
},
//
cancel() {
this.dialogShowFlag = false
// this.$refs["form"].resetFields();
// this.dynamicValidateForm.premiumList = [];
},
addDomainOne() {
// partId
// partType
// partNum
// partCost
// repairContent
// repairNum
this.dynamicValidateForm.premiumList.push({
selected: 'N',
partName: '',
repairer: '',
partType: 0,
partNum: '',
partCost: '',
repairContent: '',
supplierId: '',
partPrice: '',
repairNum: 1,
key: Date.now(),
repairRemark: this.rowObj.repairRemark || '',
fileList: [],
})
},
addDomainTwo() {
this.dynamicValidateFormTwo.premiumListTwo.push({
selected: 'N',
partName: '',
repairer: '',
partType: 0,
partNum: '',
partCost: '',
repairContent: '',
repairNum: '',
key: Date.now(),
repairRemark: this.rowObj.repairRemark || '',
fileList: [],
})
},
submit() {
this.$refs['dynamicValidateForm'].validate((valid) => {
if (valid) {
this.dynamicValidateForm.premiumList.forEach((item) => {
item.partCost = item.partPrice
})
this.dynamicValidateForm.premiumList.forEach((e) => {
if (e.partType == 0) {
e.partCost = ''
}
})
// this.dynamicValidateForm.premiumList[0].partCost = this.dynamicValidateForm.premiumList[0].partPrice;
//
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
let params = {
taskId: this.rowObj.taskId,
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 2,
companyId: this.companyId,
repairNum: 1,
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
}
this.fullscreenLoading = true
submitRepairApplyApi(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$message.success('操作成功!')
this.$emit('domainChange', res.code)
}
})
.catch(() => {
this.fullscreenLoading = false
})
} else {
return false
}
})
},
submitTwo() {
this.$refs['dynamicValidateFormTwo'].validate((valid) => {
if (valid) {
// this.dynamicValidateFormTwo.premiumListTwo[0].partCost = this.dynamicValidateFormTwo.premiumListTwo[0].partPrice;
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.partCost = item.partPrice
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((e) => {
if (e.partType == 0) {
e.partCost = ''
}
})
console.log(
'this.dynamicValidateFormTwo.premiumListTwo2222',
this.dynamicValidateFormTwo.premiumListTwo,
)
//
let params = {
taskId: this.rowObj.taskId,
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 2,
companyId: this.companyId,
repairNum: 1,
partStrList: JSON.stringify(this.dynamicValidateFormTwo.premiumListTwo),
}
this.fullscreenLoading = true
submitRepairApplyApi(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$message.success('操作成功!')
this.$emit('domainChange', res.code)
}
})
.catch(() => {
this.fullscreenLoading = false
})
} else {
return false
}
})
},
handleRemove(file, domain) {
// console.log('🚀 ~ handleRemove ~ this.$refs.upload_attach:', this.$refs.upload_attach[0].uploadFiles)
// console.log('🚀 ~ handleRemove ~ row:', domain.fileList)
// console.log('🚀 ~ handleRemove ~ file:', file)
let fileList = this.$refs.upload_attach[0].uploadFiles
this.$refs.upload_attach[0].uploadFiles = fileList.filter((item) => item.name !== file.name)
// console.log('🚀 ~ handleRemove ~ fileList:', fileList)
domain.fileList = this.$refs.upload_attach[0].uploadFiles.map((item) => {
return {
fileName: item.name,
fileUrl: item.url,
}
})
console.log('🚀 ~ domain.fileList:', domain.fileList)
},
handlePreview(file) {
if (file.response) {
window.open(file.response.data.fileUrl)
} else {
window.open(file.fileUrl)
}
},
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
files.length + fileList.length
} 个文件`,
)
},
beforeUpload(file) {
const isLtMB = file.size / 1024 / 1024 < 20
if (!isLtMB) {
this.$message.error('上传文件大小不能超过 20MB!')
}
return isLtMB
},
beforeRemove(file) {
return this.$confirm(`确定移除 ${file.name} `)
},
handleSuccess(file, fileList, row) {
console.log('🚀 ~ handleSuccess ~ row:', row)
console.log('🚀 ~ handleSuccess ~ file:', file)
if (!row.fileList) {
row.fileList = []
}
row.fileList.push({
fileName: file.response.data.fileName,
fileUrl: file.response.data.fileUrl,
})
},
},
}
</script>
<style lang="scss" scoped>
.form_box_one {
width: 100%;
display: flex;
flex-direction: column;
.form_box_title {
display: flex;
flex-direction: row;
justify-content: flex-start;
font-size: 12px;
}
.form_box_line {
margin: 8px 0;
width: 100%;
border-bottom: 2px solid #1a1c22;
}
.form_box_item {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.add_box {
display: flex;
justify-content: flex-end;
margin-right: 3%;
}
}
.form_box_two {
display: flex;
flex-direction: column;
.form_box_title {
display: flex;
flex-direction: row;
justify-content: flex-start;
font-size: 12px;
}
.form_box_line {
margin: 8px 0;
width: 100%;
border-bottom: 2px solid #1a1c22;
}
.form_box_item {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.add_box {
display: flex;
justify-content: flex-end;
margin-right: 3%;
}
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
margin-right: 3%;
margin-top: 10px;
}
</style>

View File

@ -134,9 +134,10 @@
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:data="{ fileType: 'sx' }"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:multiple="false"
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
@ -147,18 +148,18 @@
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
v-if="/\.(pdf|PDF)$/i.test(file.fileName)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
v-else-if="/\.(doc|docx)$/i.test(file.fileName)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<img v-else class="el-upload-list__item-thumbnail" :src="file.fileUrl" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
@ -321,9 +322,10 @@
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:data="{ fileType: 'sx' }"
list-type="picture-card"
accept="image/*,application/pdf,.doc,.docx"
multiple
:multiple="false"
:limit="5"
:file-list="domain.fileList"
:before-upload="beforeUpload"
@ -334,18 +336,18 @@
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
v-if="/\.(pdf|PDF)$/i.test(file.name)"
v-if="/\.(pdf|PDF)$/i.test(file.fileName)"
class="el-upload-list__item-thumbnail"
:src="pdfImg"
alt=""
/>
<img
v-else-if="/\.(doc|docx)$/i.test(file.name)"
v-else-if="/\.(doc|docx)$/i.test(file.fileName)"
class="el-upload-list__item-thumbnail"
:src="wordImg"
alt=""
/>
<img v-else class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<img v-else class="el-upload-list__item-thumbnail" :src="file.fileUrl" alt="" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
<i class="el-icon-zoom-in" />
@ -697,18 +699,7 @@ export default {
})
},
handleRemove(file, domain) {
// console.log('🚀 ~ handleRemove ~ this.$refs.upload_attach:', this.$refs.upload_attach[0].uploadFiles)
// console.log('🚀 ~ handleRemove ~ row:', domain.fileList)
// console.log('🚀 ~ handleRemove ~ file:', file)
let fileList = this.$refs.upload_attach[0].uploadFiles
this.$refs.upload_attach[0].uploadFiles = fileList.filter((item) => item.name !== file.name)
// console.log('🚀 ~ handleRemove ~ fileList:', fileList)
domain.fileList = this.$refs.upload_attach[0].uploadFiles.map((item) => {
return {
fileName: item.name,
fileUrl: item.url,
}
})
domain.fileList.splice(domain.fileList.indexOf(file), 1)
console.log('🚀 ~ domain.fileList:', domain.fileList)
},
handlePreview(file) {
@ -743,7 +734,7 @@ export default {
}
row.fileList.push({
fileName: file.response.data.fileName,
fileUrl: file.response.data.fileUrl,
fileUrl: process.env.VUE_APP_BASE_API + '/system'+ file.response.data.fileUrl,
})
},
},

View File

@ -295,6 +295,8 @@
class="upload-demo"
:action="uploadUrl"
:headers="headers"
:data="{ fileType: 'sx' }"
:multiple="false"
accept="image/*,application/pdf,.doc,.docx"
:limit="5"
:on-preview="handlePreview"
@ -1138,9 +1140,9 @@ export default {
handlePreview(file) {
console.log('🚀 ~ handlePreview ~ file:', file)
if (file.response) {
window.open(file.response.data.fileUrl)
window.open(process.env.VUE_APP_BASE_API + '/system'+ file.response.data.fileUrl)
} else {
window.open(file.fileUrl)
window.open(process.env.VUE_APP_BASE_API + '/system'+ file.fileUrl)
}
},
handleExceed(files, fileList) {