适用班组数
This commit is contained in:
parent
56d62bdf32
commit
050ba909bc
|
|
@ -83,6 +83,16 @@
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="适用班组数" prop="fitNum">
|
||||||
|
<el-input
|
||||||
|
v-model="maForm.fitNum"
|
||||||
|
placeholder="请输入适用班组数"
|
||||||
|
maxlength="10"
|
||||||
|
type="number"
|
||||||
|
style="width: 240px"
|
||||||
|
@blur="fitNumChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="业务单号" prop="code" v-if="isEdit || isDetail">
|
<el-form-item label="业务单号" prop="code" v-if="isEdit || isDetail">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="maForm.code"
|
v-model="maForm.code"
|
||||||
|
|
@ -139,7 +149,7 @@
|
||||||
@mouseenter.native="showCustomTooltip(item, $event)"
|
@mouseenter.native="showCustomTooltip(item, $event)"
|
||||||
@mouseleave.native="hideCustomTooltip"
|
@mouseleave.native="hideCustomTooltip"
|
||||||
>
|
>
|
||||||
<span v-html="highlightText(item.fullPath, searchKeyword)"></span>
|
<span v-html="highlightText(item.fullPath, searchKeyword)"></span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div
|
<div
|
||||||
|
|
@ -150,7 +160,12 @@
|
||||||
top: tooltipPosition.y + 'px'
|
top: tooltipPosition.y + 'px'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<img :src="currentTooltipItem.imageUrl || defaultImage" style="max-width: 200px; max-height: 150px;" @load="imageLoaded" @error="imageLoadError"/>
|
<img
|
||||||
|
:src="currentTooltipItem.imageUrl || defaultImage"
|
||||||
|
style="max-width: 200px; max-height: 150px"
|
||||||
|
@load="imageLoaded"
|
||||||
|
@error="imageLoadError"
|
||||||
|
/>
|
||||||
<p>库存: {{ currentTooltipItem.storageNum }}</p>
|
<p>库存: {{ currentTooltipItem.storageNum }}</p>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -249,7 +264,7 @@
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
:disabled="isDetail"
|
:disabled="isDetail"
|
||||||
@change="(selectedIds) => getTypeList(scope.row, selectedIds, scope.$index)"
|
@change="selectedIds => getTypeList(scope.row, selectedIds, scope.$index)"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
|
|
||||||
<span v-else>{{ scope.row.maTypeName }}</span>
|
<span v-else>{{ scope.row.maTypeName }}</span>
|
||||||
|
|
@ -264,9 +279,14 @@
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择规格型号"
|
placeholder="请选择规格型号"
|
||||||
:disabled="isDetail"
|
:disabled="isDetail"
|
||||||
@change="(val) => changeTypeName(scope.row, val, getSelectedItemName(val,scope.row))"
|
@change="val => changeTypeName(scope.row, val, getSelectedItemName(val, scope.row))"
|
||||||
>
|
>
|
||||||
<el-option v-for="item in scope.row.typeList" :key="item.typeId" :label="item.name" :value="item.typeId"></el-option>
|
<el-option
|
||||||
|
v-for="item in scope.row.typeList"
|
||||||
|
:key="item.typeId"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.typeId"
|
||||||
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span v-else>{{ scope.row.typeName }}</span>
|
<span v-else>{{ scope.row.typeName }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -358,7 +378,6 @@
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -427,8 +446,10 @@ export default {
|
||||||
code: '', // 采购申请编号
|
code: '', // 采购申请编号
|
||||||
supplierTime: '', // 供货时间
|
supplierTime: '', // 供货时间
|
||||||
supplierPlace: '', // 供货地点
|
supplierPlace: '', // 供货地点
|
||||||
bmFileInfos: [] // 附件
|
bmFileInfos: [], // 附件
|
||||||
|
fitNum: 1
|
||||||
},
|
},
|
||||||
|
lastFitNum: 1,
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
// 禁用今天之前的日期
|
// 禁用今天之前的日期
|
||||||
|
|
@ -493,9 +514,7 @@ export default {
|
||||||
trigger: 'change'
|
trigger: 'change'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
deviceType: [
|
deviceType: [{ required: true, message: '请选择类型规格', trigger: 'blur' }]
|
||||||
{ required: true, message: '请选择类型规格', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
maTypeList: [], // 类型名称
|
maTypeList: [], // 类型名称
|
||||||
// 规格型号
|
// 规格型号
|
||||||
|
|
@ -610,27 +629,39 @@ export default {
|
||||||
console.log(this.$route.query, 'this.$route.query')
|
console.log(this.$route.query, 'this.$route.query')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showCustomTooltip(item, event) {
|
fitNumChange() {
|
||||||
clearTimeout(this.tooltipTimeout);
|
const newVal = Math.min(5, Math.max(1, parseInt(this.maForm.fitNum) || 1))
|
||||||
this.tooltipTimeout = setTimeout(() => {
|
const ratio = newVal / this.lastFitNum
|
||||||
this.currentTooltipItem = item;
|
this.equipmentList.forEach(item => {
|
||||||
this.tooltipPosition = {
|
if (typeof item.preNum === 'number') {
|
||||||
x: event.clientX + 15,
|
item.preNum = Math.max(1, Math.floor(item.preNum * ratio)) // 向下取整,且至少为1
|
||||||
y: event.clientY + 15
|
}
|
||||||
};
|
})
|
||||||
}, 300); // 300ms延迟显示,避免鼠标快速移动时频繁触发
|
|
||||||
},
|
|
||||||
imageLoaded() {
|
|
||||||
this.shouldShowTooltip = true; // 图片加载完成,显示悬浮框
|
|
||||||
},
|
|
||||||
imageLoadError() {
|
|
||||||
this.shouldShowTooltip = true; // 图片加载失败,也显示悬浮框
|
|
||||||
},
|
|
||||||
|
|
||||||
hideCustomTooltip() {
|
this.lastFitNum = newVal
|
||||||
clearTimeout(this.tooltipTimeout);
|
this.maForm.fitNum = newVal
|
||||||
this.currentTooltipItem = null;
|
},
|
||||||
},
|
showCustomTooltip(item, event) {
|
||||||
|
clearTimeout(this.tooltipTimeout)
|
||||||
|
this.tooltipTimeout = setTimeout(() => {
|
||||||
|
this.currentTooltipItem = item
|
||||||
|
this.tooltipPosition = {
|
||||||
|
x: event.clientX + 15,
|
||||||
|
y: event.clientY + 15
|
||||||
|
}
|
||||||
|
}, 300) // 300ms延迟显示,避免鼠标快速移动时频繁触发
|
||||||
|
},
|
||||||
|
imageLoaded() {
|
||||||
|
this.shouldShowTooltip = true // 图片加载完成,显示悬浮框
|
||||||
|
},
|
||||||
|
imageLoadError() {
|
||||||
|
this.shouldShowTooltip = true // 图片加载失败,也显示悬浮框
|
||||||
|
},
|
||||||
|
|
||||||
|
hideCustomTooltip() {
|
||||||
|
clearTimeout(this.tooltipTimeout)
|
||||||
|
this.currentTooltipItem = null
|
||||||
|
},
|
||||||
// 获取类型名称-tree
|
// 获取类型名称-tree
|
||||||
async getMaTypeNameOpt() {
|
async getMaTypeNameOpt() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -680,7 +711,7 @@ export default {
|
||||||
// console.log('🚀 ~ error:', error)
|
// console.log('🚀 ~ error:', error)
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
async getTypeList(row, typeIds, index) {
|
async getTypeList(row, typeIds, index) {
|
||||||
console.log('🚀 ~ getTypeList ~ row:', row)
|
console.log('🚀 ~ getTypeList ~ row:', row)
|
||||||
// 递归循环 获取类型名称
|
// 递归循环 获取类型名称
|
||||||
const filterData = data => {
|
const filterData = data => {
|
||||||
|
|
@ -710,30 +741,29 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('🚀 ~ error:', error)
|
console.log('🚀 ~ error:', error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSelectedItemName(typeId, row) {
|
||||||
getSelectedItemName(typeId,row) {
|
const selectedItem = row.typeList.find(item => item.typeId === typeId)
|
||||||
const selectedItem = row.typeList.find(item => item.typeId === typeId);
|
return selectedItem ? selectedItem.name : ''
|
||||||
return selectedItem ? selectedItem.name : '';
|
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
changeTypeName(row, val,name) {
|
changeTypeName(row, val, name) {
|
||||||
console.log('🚀 ~ changeTypeName ~ row:', row)
|
console.log('🚀 ~ changeTypeName ~ row:', row)
|
||||||
console.log('🚀 ~ changeTypeName ~ val:', val)
|
console.log('🚀 ~ changeTypeName ~ val:', val)
|
||||||
this.equipmentList.some(item => {
|
this.equipmentList.some(item => {
|
||||||
// 跳过当前行
|
// 跳过当前行
|
||||||
if (item === row) return false;
|
if (item === row) return false
|
||||||
if (item.typeId === val) {
|
if (item.typeId === val) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: `${name} 已添加到列表中`,
|
message: `${name} 已添加到列表中`,
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
})
|
||||||
row.typeId = '';
|
row.typeId = ''
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
});
|
})
|
||||||
// console.log('xxxxxxxxxxxxxxxxx', this.equipmentList.some(item => item.typeId === val))
|
// console.log('xxxxxxxxxxxxxxxxx', this.equipmentList.some(item => item.typeId === val))
|
||||||
// if (this.equipmentList.some(item => item.typeId === val)) {
|
// if (this.equipmentList.some(item => item.typeId === val)) {
|
||||||
// // console.log("yyyyyyyyyyy",item.typeId)
|
// // console.log("yyyyyyyyyyy",item.typeId)
|
||||||
|
|
@ -830,17 +860,17 @@ export default {
|
||||||
/** 租赁单位和工程-下拉选 */
|
/** 租赁单位和工程-下拉选 */
|
||||||
projectInfoList() {
|
projectInfoList() {
|
||||||
if (!this.isEdit) {
|
if (!this.isEdit) {
|
||||||
getListUnite({ projectId: null,enableFilter:true }).then(response => {
|
getListUnite({ projectId: null, enableFilter: true }).then(response => {
|
||||||
this.uniteList = response.data
|
this.uniteList = response.data
|
||||||
})
|
})
|
||||||
getListProject({ unitId: null,enableFilter:true }).then(response => {
|
getListProject({ unitId: null, enableFilter: true }).then(response => {
|
||||||
this.projectList = response.data
|
this.projectList = response.data
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
getListUnite({ projectId: null,enableFilter:true }).then(response => {
|
getListUnite({ projectId: null, enableFilter: true }).then(response => {
|
||||||
this.uniteList = response.data
|
this.uniteList = response.data
|
||||||
})
|
})
|
||||||
getListProject({ unitId: this.maForm.unitId,enableFilter:true }).then(response => {
|
getListProject({ unitId: this.maForm.unitId, enableFilter: true }).then(response => {
|
||||||
this.projectList = response.data
|
this.projectList = response.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1033,7 @@ export default {
|
||||||
this.$refs['maForm'].validate(async valid => {
|
this.$refs['maForm'].validate(async valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
for (let i = 0; i < this.equipmentList.length; i++) {
|
for (let i = 0; i < this.equipmentList.length; i++) {
|
||||||
if(!this.equipmentList[i].typeId){
|
if (!this.equipmentList[i].typeId) {
|
||||||
this.$message.error(`第 ${i + 1} 行的 ${'规格型号'} 不能为空`)
|
this.$message.error(`第 ${i + 1} 行的 ${'规格型号'} 不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1201,7 +1231,11 @@ export default {
|
||||||
handleDownload(file) {
|
handleDownload(file) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
if (file.status === 'ready') {
|
if (file.status === 'ready') {
|
||||||
downloadFile({ fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
downloadFile({
|
||||||
|
fileName: file.name,
|
||||||
|
fileData: file.raw,
|
||||||
|
fileType: 'application/vnd.ms-excel;charset=utf-8'
|
||||||
|
})
|
||||||
} else if (file.status === 'success') {
|
} else if (file.status === 'success') {
|
||||||
downloadFileData({ fileName: file.name, fileUrl: file.url })
|
downloadFileData({ fileName: file.name, fileUrl: file.url })
|
||||||
// downloadFileData({ fileName: file.name,fileUrl:file.url })
|
// downloadFileData({ fileName: file.name,fileUrl:file.url })
|
||||||
|
|
@ -1287,17 +1321,17 @@ export default {
|
||||||
// 导出数据
|
// 导出数据
|
||||||
handleExport() {
|
handleExport() {
|
||||||
try {
|
try {
|
||||||
const formatTime = (date) => {
|
const formatTime = date => {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear()
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||||
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
|
return `${year}${month}${day}_${hours}${minutes}${seconds}`
|
||||||
};
|
}
|
||||||
|
|
||||||
const currentTime = formatTime(new Date());
|
const currentTime = formatTime(new Date())
|
||||||
|
|
||||||
let fileName = `工器具清单_${currentTime}.xLsx`
|
let fileName = `工器具清单_${currentTime}.xLsx`
|
||||||
let url = '/material/leaseTask/export'
|
let url = '/material/leaseTask/export'
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
rows="2"
|
rows="2"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="适用班组数" prop="fitNum">
|
<!-- <el-form-item label="适用班组数" prop="fitNum">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="maForm.fitNum"
|
v-model="maForm.fitNum"
|
||||||
placeholder="请输入适用班组数"
|
placeholder="请输入适用班组数"
|
||||||
|
|
@ -141,7 +141,7 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
@blur="fitNumChange"
|
@blur="fitNumChange"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue