lion 3 days ago
parent 40b31a06b5
commit 1cba23ade8

@ -164,6 +164,10 @@ export default {
pageSize: {
type: Number
},
pageIndex: {
type: Number,
default: 1
},
pageSizeOpts: {
type: Array,
default: () => [10, 20, 30, 40]
@ -187,7 +191,7 @@ export default {
totalData: 0,
listData: [],
selectOpt: {
page: 1,
page: this.pageIndex || 1,
page_size: 10,
sort_name: '',
sort_type: ''
@ -204,6 +208,12 @@ export default {
watch: {
tableItem(newVal) {
this.checkTable = newVal.map((item) => item?.prop)
},
pageIndex(newVal) {
//
if (newVal && this.selectOpt.page !== newVal) {
this.selectOpt.page = newVal
}
}
},
created() {
@ -539,8 +549,9 @@ export default {
this.$emit('pageSizeChange', e)
},
'on-change': (e) => {
if (this.action) {
// action
this.selectOpt.page = e
if (this.action) {
this.getTableData()
}
this.$emit('pageIndexChange', e)

@ -431,6 +431,8 @@
<el-button type="primary" style="margin-left: 10px" @click="resetMaterialSearch"
>重置</el-button
>
<Button style="margin-left: 10px" @click="linkAllMaterials"></Button>
</div>
</div>
<xy-table
@ -2067,6 +2069,7 @@ export default {
this.materialModal.isInitialLoad = true //
try {
const res = await index({
material_infos_plan_id: this.materialModal.currentPlanId,
page_size: this.materialModal.pageSize,
page: this.materialModal.pageIndex,
table_name: 'inventorys',
@ -2213,6 +2216,38 @@ export default {
this.materialModal.pageIndex = 1
this.searchMaterials()
},
async linkAllMaterials() {
const planId = this.materialModal.currentPlanId
if (!planId) {
this.$Message.error('未找到计划ID')
return
}
try {
const confirmed = await this.$confirm('是否关联所有物资?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => true)
.catch(() => false)
if (confirmed) {
const params = {
id: planId,
material_infos_plan_links_all: 1
}
await saveStocktakingPlan(params)
this.$Message.success('关联所有物资成功')
this.handleMaterialModalClose()
this.searchPlans()
}
} catch (error) {
this.$Message.error('关联所有物资失败')
console.error('关联所有物资失败:', error)
}
},
async handleMaterialSubmit() {
const planId = this.materialModal.currentPlanId
if (!planId) {

@ -68,6 +68,26 @@
style="width: 120px"
/>
</div>
<div class="search-item">
<span>实际维护日期:</span>
<DatePicker
v-model="select.maintenance_date_start"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="实际维护日期"
style="width: 120px"
/>
<span>-</span>
<DatePicker
v-model="select.maintenance_date_end"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="实际维护日期"
style="width: 120px"
/>
</div>
<div class="search-item">
<span>关键词:</span>
<Input v-model="select.keyword" placeholder="维护物资" style="width: 120px" />
@ -542,6 +562,8 @@ export default {
date_end: '',
end_date_start: '',
end_date_end: '',
maintenance_date_start: '',
maintenance_date_end: '',
keyword: '',
content: ''
},
@ -787,7 +809,7 @@ export default {
warehouse: this.select.warehouse,
// status: this.select.status,
// date_start: this.select.date_start,
date_end: this.select.date_end,
// date_end: this.select.date_end,
keyword: this.select.keyword,
filter: [
{
@ -813,6 +835,15 @@ export default {
this.formatDate(this.select.end_date_end)
: ''
},
{
key: 'maintenance_date',
op: 'range',
value: this.select.maintenance_date_start
? this.formatDate(this.select.maintenance_date_start) +
',' +
this.formatDate(this.select.maintenance_date_end)
: ''
},
{
key: 'content',
op: 'like',
@ -857,7 +888,11 @@ export default {
is_expire: '',
date_start: '',
date_end: '',
keyword: ''
end_date_start: '',
end_date_end: '',
keyword: '',
maintenance_date_start: '',
maintenance_date_end: ''
}
this.getList()
},
@ -1338,44 +1373,35 @@ export default {
is_export: 1,
// warehouse: this.select.warehouse,
keyword: this.select.keyword,
filter: [
{
key: 'status',
op: 'eq',
value: this.select.status ? this.select.status : this.select.status === 0 ? 0 : ''
},
{
key: 'planned_maintenance_date',
op: 'eq',
value: this.select.date_start ? this.formatDate(this.select.date_start) : ''
},
{
key: 'maintenance_date',
op: 'range',
value: this.select.end_date_start
'filter[0][key]': 'status',
'filter[0][op]': 'eq',
'filter[0][value]': this.select.status ? this.select.status : this.select.status === 0 ? 0 : '',
'filter[1][key]': 'planned_maintenance_date',
'filter[1][op]': 'eq',
'filter[1][value]': this.select.date_start ? this.formatDate(this.select.date_start) : '',
'filter[2][key]': 'end_date',
'filter[2][op]': 'range',
'filter[2][value]': this.select.end_date_start
? this.formatDate(this.select.end_date_start) +
',' +
this.formatDate(this.select.end_date_end)
: ''
},
{
key: 'content',
op: 'like',
value: this.select.content ? this.select.content : ''
}
]
this.formatDate(this.select.end_date_end) : '',
'filter[3][key]': 'maintenance_date',
'filter[3][op]': 'range',
'filter[3][value]': this.select.maintenance_date_start
? this.formatDate(this.select.maintenance_date_start) +
',' +
this.formatDate(this.select.maintenance_date_end) : '',
'filter[4][key]': 'content',
'filter[4][op]': 'like',
'filter[4][value]': this.select.content ? this.select.content : ''
}
if(this.select.is_expire==1 || this.select.is_expire===0){
params.filter.push({
key: 'end_date',
op: this.select.is_expire ? 'lt' : 'egt',
value: this.$moment().format('YYYY-MM-DD')
})
params.filter.push({
key: 'status',
op: 'eq',
value: 0
})
params['filter[5][key]'] = 'end_date'
params['filter[5][op]'] = this.select.is_expire ? 'lt' : 'egt'
params['filter[5][value]'] = this.$moment().format('YYYY-MM-DD')
params['filter[6][key]'] = 'status'
params['filter[6][op]'] = 'eq'
params['filter[6][value]'] = 0
}
// const res = await getOperationList(params)
download('/api/admin/equipment-operation/index', 'get', params, `运维记录${sheetName}.xlsx`)

@ -152,6 +152,7 @@
<Button type="error" style="margin-left: 8px;" @click="batchDisassociate" :disabled="!hasSelectedItems || isAssociating || isDisassociating" :loading="isDisassociating">
{{ isDisassociating ? '取消关联中...' : '批量取消关联' }}
</Button>
<Button type="primary" style="margin-left: 8px;" @click="linkAllMaterials"></Button>
<span style="margin-left: 15px; color: #666;">已选择 {{ selectedItems.length }} </span>
</div>
<Table :columns="associateColumns" :data="associateList" :height="400" style="margin-top: 15px;" @on-selection-change="handleSelectionChange">
@ -666,6 +667,7 @@ export default {
page: this.associateCurrentPage,
'show_relation[0]': 'equipmentMaintainConfig',
'show_relation[1]': 'materialInfo.materialstorage',
equipment_maintain_config_id: this.currentRule?.id || '',
'materialstorages_cangkumingcheng': this.associateWarehouseName ? this.associateWarehouseName : '',
'materialstorages_suozaiquyu': this.select.area ? this.select.area : '',
@ -849,14 +851,41 @@ export default {
this.$message.success(`批量关联成功,共关联 ${this.selectedItems.length} 项物资`)
this.selectedItems = []
this.hasSelectedItems = false
this.handleAssociateCancel()
this.getList()
this.searchMaterialsPost()
// this.isAssociating = false
// this.searchMaterialsPost()
} catch (e) {
this.$message.error('批量关联失败')
} finally {
this.isAssociating = false
}
},
linkAllMaterials() {
if (!this.currentRule || !this.currentRule.id) {
this.$message.warning('请先选择维护规则')
return
}
this.$confirm('是否确认关联所有物资?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
try {
await saveMaintainConfig({
id: this.currentRule.id,
equipment_maintain_config_material_infos_all: 1
})
this.$message.success('关联所有物资成功')
this.handleAssociateCancel()
this.getList()
} catch (e) {
this.$message.error('关联所有物资失败')
console.error('关联所有物资失败:', e)
}
})
},
async batchDisassociate() {
if (this.selectedItems.length === 0) {
this.$message.warning('请先选择需要取消关联的物资')
@ -885,8 +914,9 @@ export default {
this.$message.success(`批量取消关联成功,共取消关联 ${this.selectedItems.length} 项物资`)
this.selectedItems = []
this.hasSelectedItems = false
this.handleAssociateCancel()
this.getList()
this.searchMaterialsPost()
// this.searchMaterialsPost()
} catch (e) {
this.$message.error('批量取消关联失败')
} finally {

Loading…
Cancel
Save