lion 3 days ago
parent 40b31a06b5
commit 1cba23ade8

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

@ -431,6 +431,8 @@
<el-button type="primary" style="margin-left: 10px" @click="resetMaterialSearch" <el-button type="primary" style="margin-left: 10px" @click="resetMaterialSearch"
>重置</el-button >重置</el-button
> >
<Button style="margin-left: 10px" @click="linkAllMaterials"></Button>
</div> </div>
</div> </div>
<xy-table <xy-table
@ -2067,6 +2069,7 @@ export default {
this.materialModal.isInitialLoad = true // this.materialModal.isInitialLoad = true //
try { try {
const res = await index({ const res = await index({
material_infos_plan_id: this.materialModal.currentPlanId,
page_size: this.materialModal.pageSize, page_size: this.materialModal.pageSize,
page: this.materialModal.pageIndex, page: this.materialModal.pageIndex,
table_name: 'inventorys', table_name: 'inventorys',
@ -2213,6 +2216,38 @@ export default {
this.materialModal.pageIndex = 1 this.materialModal.pageIndex = 1
this.searchMaterials() 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() { async handleMaterialSubmit() {
const planId = this.materialModal.currentPlanId const planId = this.materialModal.currentPlanId
if (!planId) { if (!planId) {

@ -68,6 +68,26 @@
style="width: 120px" style="width: 120px"
/> />
</div> </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"> <div class="search-item">
<span>关键词:</span> <span>关键词:</span>
<Input v-model="select.keyword" placeholder="维护物资" style="width: 120px" /> <Input v-model="select.keyword" placeholder="维护物资" style="width: 120px" />
@ -542,6 +562,8 @@ export default {
date_end: '', date_end: '',
end_date_start: '', end_date_start: '',
end_date_end: '', end_date_end: '',
maintenance_date_start: '',
maintenance_date_end: '',
keyword: '', keyword: '',
content: '' content: ''
}, },
@ -787,7 +809,7 @@ export default {
warehouse: this.select.warehouse, warehouse: this.select.warehouse,
// status: this.select.status, // status: this.select.status,
// date_start: this.select.date_start, // date_start: this.select.date_start,
date_end: this.select.date_end, // date_end: this.select.date_end,
keyword: this.select.keyword, keyword: this.select.keyword,
filter: [ filter: [
{ {
@ -813,6 +835,15 @@ export default {
this.formatDate(this.select.end_date_end) 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', key: 'content',
op: 'like', op: 'like',
@ -857,7 +888,11 @@ export default {
is_expire: '', is_expire: '',
date_start: '', date_start: '',
date_end: '', date_end: '',
keyword: '' end_date_start: '',
end_date_end: '',
keyword: '',
maintenance_date_start: '',
maintenance_date_end: ''
} }
this.getList() this.getList()
}, },
@ -1338,44 +1373,35 @@ export default {
is_export: 1, is_export: 1,
// warehouse: this.select.warehouse, // warehouse: this.select.warehouse,
keyword: this.select.keyword, keyword: this.select.keyword,
filter: [ 'filter[0][key]': 'status',
{ 'filter[0][op]': 'eq',
key: 'status', 'filter[0][value]': this.select.status ? this.select.status : this.select.status === 0 ? 0 : '',
op: 'eq', 'filter[1][key]': 'planned_maintenance_date',
value: this.select.status ? this.select.status : this.select.status === 0 ? 0 : '' 'filter[1][op]': 'eq',
}, 'filter[1][value]': this.select.date_start ? this.formatDate(this.select.date_start) : '',
{ 'filter[2][key]': 'end_date',
key: 'planned_maintenance_date', 'filter[2][op]': 'range',
op: 'eq', 'filter[2][value]': this.select.end_date_start
value: this.select.date_start ? this.formatDate(this.select.date_start) : '' ? this.formatDate(this.select.end_date_start) +
}, ',' +
{ this.formatDate(this.select.end_date_end) : '',
key: 'maintenance_date', 'filter[3][key]': 'maintenance_date',
op: 'range', 'filter[3][op]': 'range',
value: this.select.end_date_start 'filter[3][value]': this.select.maintenance_date_start
? this.formatDate(this.select.end_date_start) + ? this.formatDate(this.select.maintenance_date_start) +
',' + ',' +
this.formatDate(this.select.end_date_end) this.formatDate(this.select.maintenance_date_end) : '',
: '' 'filter[4][key]': 'content',
}, 'filter[4][op]': 'like',
{ 'filter[4][value]': this.select.content ? this.select.content : ''
key: 'content',
op: 'like',
value: this.select.content ? this.select.content : ''
}
]
} }
if(this.select.is_expire==1 || this.select.is_expire===0){ if(this.select.is_expire==1 || this.select.is_expire===0){
params.filter.push({ params['filter[5][key]'] = 'end_date'
key: 'end_date', params['filter[5][op]'] = this.select.is_expire ? 'lt' : 'egt'
op: this.select.is_expire ? 'lt' : 'egt', params['filter[5][value]'] = this.$moment().format('YYYY-MM-DD')
value: this.$moment().format('YYYY-MM-DD') params['filter[6][key]'] = 'status'
}) params['filter[6][op]'] = 'eq'
params.filter.push({ params['filter[6][value]'] = 0
key: 'status',
op: 'eq',
value: 0
})
} }
// const res = await getOperationList(params) // const res = await getOperationList(params)
download('/api/admin/equipment-operation/index', 'get', params, `运维记录${sheetName}.xlsx`) 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"> <Button type="error" style="margin-left: 8px;" @click="batchDisassociate" :disabled="!hasSelectedItems || isAssociating || isDisassociating" :loading="isDisassociating">
{{ isDisassociating ? '取消关联中...' : '批量取消关联' }} {{ isDisassociating ? '取消关联中...' : '批量取消关联' }}
</Button> </Button>
<Button type="primary" style="margin-left: 8px;" @click="linkAllMaterials"></Button>
<span style="margin-left: 15px; color: #666;">已选择 {{ selectedItems.length }} </span> <span style="margin-left: 15px; color: #666;">已选择 {{ selectedItems.length }} </span>
</div> </div>
<Table :columns="associateColumns" :data="associateList" :height="400" style="margin-top: 15px;" @on-selection-change="handleSelectionChange"> <Table :columns="associateColumns" :data="associateList" :height="400" style="margin-top: 15px;" @on-selection-change="handleSelectionChange">
@ -666,6 +667,7 @@ export default {
page: this.associateCurrentPage, page: this.associateCurrentPage,
'show_relation[0]': 'equipmentMaintainConfig', 'show_relation[0]': 'equipmentMaintainConfig',
'show_relation[1]': 'materialInfo.materialstorage', 'show_relation[1]': 'materialInfo.materialstorage',
equipment_maintain_config_id: this.currentRule?.id || '',
'materialstorages_cangkumingcheng': this.associateWarehouseName ? this.associateWarehouseName : '', 'materialstorages_cangkumingcheng': this.associateWarehouseName ? this.associateWarehouseName : '',
'materialstorages_suozaiquyu': this.select.area ? this.select.area : '', 'materialstorages_suozaiquyu': this.select.area ? this.select.area : '',
@ -849,14 +851,41 @@ export default {
this.$message.success(`批量关联成功,共关联 ${this.selectedItems.length} 项物资`) this.$message.success(`批量关联成功,共关联 ${this.selectedItems.length} 项物资`)
this.selectedItems = [] this.selectedItems = []
this.hasSelectedItems = false this.hasSelectedItems = false
this.handleAssociateCancel()
this.getList() this.getList()
this.searchMaterialsPost() // this.isAssociating = false
// this.searchMaterialsPost()
} catch (e) { } catch (e) {
this.$message.error('批量关联失败') this.$message.error('批量关联失败')
} finally { } finally {
this.isAssociating = false 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() { async batchDisassociate() {
if (this.selectedItems.length === 0) { if (this.selectedItems.length === 0) {
this.$message.warning('请先选择需要取消关联的物资') this.$message.warning('请先选择需要取消关联的物资')
@ -885,8 +914,9 @@ export default {
this.$message.success(`批量取消关联成功,共取消关联 ${this.selectedItems.length} 项物资`) this.$message.success(`批量取消关联成功,共取消关联 ${this.selectedItems.length} 项物资`)
this.selectedItems = [] this.selectedItems = []
this.hasSelectedItems = false this.hasSelectedItems = false
this.handleAssociateCancel()
this.getList() this.getList()
this.searchMaterialsPost() // this.searchMaterialsPost()
} catch (e) { } catch (e) {
this.$message.error('批量取消关联失败') this.$message.error('批量取消关联失败')
} finally { } finally {

Loading…
Cancel
Save