master
lion 4 months ago
parent 1ef6e21c06
commit 841967ef5a

@ -1,4 +1,24 @@
import request from '@/utils/request'
function customParamsSerializer(params) {
let result = '';
for (let key in params) {
if (params.hasOwnProperty(key)) {
if (Array.isArray(params[key])) {
params[key].forEach((item,index) => {
if(item.key){
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
}else{
result +=`${key}[${index}]=${item}&`
}
});
} else {
result += `${key}=${params[key]}&`;
}
}
}
return result.slice(0, -1);
}
// 设备运维规则配置
export function getMaintainConfigList(params) {
@ -38,7 +58,8 @@ export function getOperationList(params) {
return request({
url: '/api/admin/equipment-operation/index',
method: 'get',
params
params,
paramsSerializer: customParamsSerializer,
})
}

@ -18,3 +18,11 @@ export function delOutbounds(params) {
params
})
}
export function show(params) {
return request({
url: '/api/admin/outbounds/show',
method: 'get',
params
})
}

@ -28,3 +28,20 @@ export function saveFixAssets(data) {
data
})
}
export function excelShowFixAssets(data) {
return request({
url: '/api/admin/asset/excel-show',
method: 'post',
data
})
}
export function importAsset(data) {
return request({
url: '/api/admin/asset/import',
method: 'post',
data
})
}

@ -33,19 +33,19 @@
<div class="statistics-cards">
<el-row :gutter="20">
<el-col :span="6">
<el-col :span="12">
<el-card class="stat-card purple">
<div class="card-title">总里程</div>
<div class="card-value">{{ overviewData.totalMileage }}<span class="unit">km</span></div>
</el-card>
</el-col>
<el-col :span="6">
<el-col :span="12">
<el-card class="stat-card blue">
<div class="card-title">平均里程</div>
<div class="card-title">平均在线时长</div>
<div class="card-value">{{ overviewData.avgMileage }}<span class="unit">km</span></div>
</el-card>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-card class="stat-card orange">
<div class="card-title">最高里程</div>
<div class="card-value">{{ overviewData.maxMileage }}<span class="unit">km</span></div>
@ -56,7 +56,7 @@
<div class="card-title">最低里程</div>
<div class="card-value">{{ overviewData.minMileage }}<span class="unit">km</span></div>
</el-card>
</el-col>
</el-col> -->
</el-row>
</div>

@ -211,7 +211,7 @@ export default {
console.log("res.list.data",res.list.data)
let arr = res.list.data
if(!this.isHuiku){
let arr = this.processInventoryData(res.list.data)
arr = this.processInventoryData(res.list.data)
}
for (var m of arr) {

@ -64,12 +64,12 @@
<span class="selector-item__label"></span>
<Input v-model="select.max" clearable style="width: 60px;margin:0 3px" placeholder="" />
</div> -->
<el-button type="primary" style="margin-left: 10px;" @click="getindex"></el-button>
<el-button type="primary" style="margin-left: 10px;" @click="toprint"></el-button>
<el-button type="primary" style="margin-left: 10px;"
@click="exportExcel(new Date().getTime().toString())">导出</el-button>
<div>
<el-button type="primary" style="margin-left: 10px;" @click="getindex"></el-button>
<el-button type="primary" style="margin-left: 10px;" @click="toprint"></el-button>
<el-button type="primary" style="margin-left: 10px;"
@click="exportExcel(new Date().getTime().toString())">导出</el-button>
</div>
</div>
</slot>
</lx-header>
@ -86,14 +86,7 @@
</template>
</el-table-column>
</template> -->
<template v-slot:shifouweigudingzichan>
<el-table-column
align="center" label="操作" width="120" header-align="center">
<template slot-scope="scope">
123
</template>
</el-table-column>
</template>
<template v-slot:btns>
<!-- <div></div> -->

@ -167,8 +167,8 @@
</FormItem>
<FormItem label="盘点类型" prop="type">
<Select v-model="planModal.form.type" style="width: 200px">
<Option :value="1">日常检查</Option>
<Option :value="2">年度盘点</Option>
<Option :value="1">年度</Option>
<Option :value="2">季度</Option>
</Select>
</FormItem>
<FormItem label="备注" prop="remark">
@ -500,7 +500,7 @@
<tr>
<td class="sign-cell">签字区</td>
<td style="text-align: center">
</td>
</tr>
</table>
@ -570,13 +570,13 @@ export default {
{ title: '计划编号', key: 'no' },
{ title: '计划名称', key: 'name' },
{ title: '对象数量', key: 'chart_total' },
{
title: '盘点类型',
{
title: '盘点类型',
key: 'type',
render: (h, params) => {
const typeMap = {
1: '日常检查',
2: '年度盘点'
1: '年度',
2: '季度'
}
return h('span', typeMap[params.row.type] || '-')
}

@ -4,35 +4,36 @@
<lx-header icon="md-apps" text="维护记录" style="margin-bottom: 10px; border: 0px;">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<div class="search-item">
<!-- <div class="search-item">
<span>仓库:</span>
<Select v-model="select.warehouse" style="width: 120px">
<Option value="">全部</Option>
<Option value="wt">外塘河仓库</Option>
<Option value="xk">胥口仓库</Option>
</Select>
</div>
</div> -->
<div class="search-item">
<span>状态:</span>
<Select v-model="select.status" style="width: 120px">
<Option value="">全部</Option>
<Option value="pending">待处理</Option>
<Option value="completed">已完成</Option>
<Option :value="0">待处理</Option>
<Option :value="1">已完成</Option>
</Select>
</div>
<div class="search-item">
<span>计划日期:</span>
<DatePicker v-model="select.date_start" type="date" placeholder="开始日期" style="width: 120px" />
<DatePicker v-model="select.date_start" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" placeholder="开始日期" style="width: 120px" />
<span>-</span>
<DatePicker v-model="select.date_end" type="date" placeholder="结束日期" style="width: 120px" />
<DatePicker v-model="select.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: 200px" />
<Input v-model="select.keyword" placeholder="编号/负责人" style="width: 200px" />
</div>
<Button type="primary" style="margin-left: 8px;" @click="getList"></Button>
<Button type="primary" style="margin-left: 8px;" @click="resetSearch"></Button>
<Button type="primary" style="margin-left: 8px;" @click="createMaintenance"></Button>
<Button type="primary" style="margin-left: 8px;" @click="exportExcel(new Date().getTime().toString())">导出</Button>
</div>
</slot>
</lx-header>
@ -81,6 +82,13 @@
min-width="120"
align="center"
/>
<el-table-column
prop="end_date"
label="截止日期"
min-width="120"
align="center"
/>
<el-table-column
label="实际维护日期/状态"
min-width="150"
@ -198,7 +206,7 @@
width="900"
:mask-closable="true"
>
<div class="modal-body">
<div class="modal-body" id="printmodal">
<div class="form-group">
<label>记录编号:</label>
<div class="form-value">{{ currentRecord.no }}</div>
@ -257,7 +265,9 @@
</div>
</div>
<template slot="footer">
<Button @click="closeViewModal"></Button>
<Button v-print="'#printmodal'"></Button>
</template>
</Modal>
@ -353,8 +363,15 @@ import { getStorehouseTypeList } from '@/api/system/storehouseType'
import { getparameteritem } from '@/api/system/dictionary.js'
import { index } from '@/api/system/baseForm.js'
import request from '@/utils/request'
import {
download
} from "@/utils/downloadRequest";
import qs from 'qs'
import * as XLSX from 'xlsx'
import {
saveAs
} from 'file-saver'
import Cookies from 'js-cookie'
export default {
components: {
Button,
@ -560,10 +577,24 @@ export default {
page: this.select.page,
page_size: this.select.page_size,
warehouse: this.select.warehouse,
status: this.select.status,
date_start: this.select.date_start,
// status: this.select.status,
// date_start: this.select.date_start,
date_end: this.select.date_end,
keyword: this.select.keyword
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:'eq',
value:this.select.date_end?this.formatDate(this.select.date_end):''
}],
//
}
const res = await getOperationList(params)
if (res && res.list) {
@ -985,7 +1016,60 @@ export default {
console.error('获取仓库名称列表失败:', e)
this.$Message.error('获取仓库名称列表失败')
}
}
},
async exportExcel(sheetName) {
let export_fields ={}
// export_fields['no'] = ''
// export_fields["material_info.zichanmingcheng"] = ""
// export_fields["planned_maintenance_date"] = ""
// export_fields["end_date"] = ''
// export_fields["maintenance_date"] = "/"
// export_fields["responsible_admin.name"] = ""
// export_fields['status_text'] = ""
try {
const params = {
page: 1,
page_size: 9999,
// export_fields:export_fields,
"export_fields[no]" : '记录编号',
'export_fields[material_info.zichanmingcheng]' : "维护物资",
'export_fields[planned_maintenance_date]' : "计划维护日期",
'export_fields[end_date]' : '截止日期',
'export_fields[maintenance_date]' : "实际维护日期/状态",
'export_fields[responsible_admin.name]' : "负责人",
"export_fields[status_text]" : "状态",
is_export:1,
// warehouse: this.select.warehouse,
// status: this.select.status,
// date_start: this.select.date_start,
date_end: this.select.date_end,
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:'eq',
value:this.select.date_end?this.formatDate(this.select.date_end):''
}],
//
}
// const res = await getOperationList(params)
download(
'/api/admin/equipment-operation/index',
'get', params,
`运维记录${sheetName}.xlsx`)
} catch (e) {
this.$message.error('导出维护记录失败')
}
},
}
}
</script>

@ -54,7 +54,7 @@
<Option v-for="item in startStandardOptions" :key="item.value" :value="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
<FormItem label="生成计划时机" prop="timing">
<!-- <FormItem label="生成计划时机" prop="timing">
<div class="timing-controls">
<Select v-model="form.timingUnit" style="width: 80px">
<Option value="days">提前</Option>
@ -64,7 +64,7 @@
<Option value="days"></Option>
</Select>
</div>
</FormItem>
</FormItem> -->
<FormItem label="未完成时下次计划" prop="nextPlan">
<Select v-model="form.nextPlan">
<Option v-for="item in nextPlanOptions" :key="item.value" :value="item.value">{{ item.label }}</Option>
@ -96,7 +96,7 @@
<Option v-for="item in startStandardOptions" :key="item.value" :value="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
<FormItem label="生成计划时机" prop="timing">
<!-- <FormItem label="生成计划时机" prop="timing">
<div class="timing-controls">
<Select v-model="editForm.timingUnit" style="width: 80px">
<Option value="days">提前</Option>
@ -106,7 +106,7 @@
<Option value="days"></Option>
</Select>
</div>
</FormItem>
</FormItem> -->
<FormItem label="未完成时下次计划" prop="nextPlan">
<Select v-model="editForm.nextPlan">
<Option v-for="item in nextPlanOptions" :key="item.value" :value="item.value">{{ item.label }}</Option>
@ -240,11 +240,12 @@ export default {
table: [
{ label: '序号', type: 'index', width: 60 },
{ label: '规则名称', prop: 'name', minWidth: 160 },
{ label: '重复周期', prop: 'month_frequency', minWidth: 120, formatter: row => this.cycleOptions.find(opt => opt.value === row.month_frequency)?.label || row.month_frequency },
{ label: '起始日期设定', prop: 'start_standard', minWidth: 160, formatter: row => this.startStandardOptions.find(opt => opt.value === row.start_standard)?.label || row.start_standard },
{ label: '生成计划时机(天)', prop: 'advance_days', minWidth: 120 },
{ label: '重复周期', prop: 'month_frequency', minWidth: 120, formatter: row => this.cycleOptions.find(opt => opt.value == row.month_frequency)?.label || row.month_frequency },
{ label: '起始日期设定', prop: 'start_standard', minWidth: 160, formatter: row => this.startStandardOptions.find(opt => opt.value == row.start_standard)?.label || row.start_standard },
// { label: '()', prop: 'advance_days', minWidth: 120 },
// { label: '()', prop: 'advance_days', minWidth: 120 },
{ label: '已用于物资数', prop: 'stocks_items_count', minWidth: 120 },
{ label: '未完成时下次计划', prop: 'next_plan_type', minWidth: 160, formatter: row => this.nextPlanOptions.find(opt => opt.value === row.next_plan_type)?.label || row.next_plan_type }
{ label: '未完成时下次计划', prop: 'next_plan_type', minWidth: 160, formatter: row => this.nextPlanOptions.find(opt => opt.value == row.next_plan_type)?.label || row.next_plan_type }
],
tableHeight: 550,
showModal: false,

@ -381,11 +381,12 @@
import {
save,
index,
show,
destroy
} from '@/api/system/baseForm.js'
import {
saveOutbounds
saveOutbounds,
show
} from '@/api/outbounds.js'
import {
index as indexDiaoling
@ -523,7 +524,13 @@ export default {
label: '入库批次',
prop: 'rukupici',
width: 120
}, {
},
// {
// label: '',
// prop: 'shunxuhao',
// width: 120
// },
{
label: '在库数量',
prop: 'zaikushuliang',
width: 80
@ -808,15 +815,6 @@ export default {
//
selectInventorysMx(e) {
console.log("e",e)
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.rukupici = e.rukupici
this.mingxiObj.zaikushuliang = e.zaikushuliang
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
this.mingxiObj.inventorys_id = e.id
this.mingxiObj.guigexinghao = e.guigexinghao
this.mingxiObj.shengchanriqi = e.shengchanriqi
//
if(e.wuzileixing==='一物一码'){
@ -827,6 +825,16 @@ export default {
this.mingxiObj.jieyongshuliang = 1
console.log("arr",arr)
}
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.rukupici = e.rukupici
this.mingxiObj.zaikushuliang = e.zaikushuliang
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
this.mingxiObj.inventorys_id = e.id
this.mingxiObj.guigexinghao = e.guigexinghao
this.mingxiObj.shengchanriqi = e.shengchanriqi
console.log("this.mingxiObj",this.mingxiObj)
if(e.wuzileixing==='一类一码'){
this.mingxiList.map(item => {
if (item.inventorys_id === this.mingxiObj.inventorys_id) {
@ -839,6 +847,7 @@ export default {
}
})
}
this.$forceUpdate()
},
//
/**
@ -976,7 +985,6 @@ export default {
delete this.form.id
}
saveOutbounds({
table_name: this.tableName,
...this.form
}).then(res => {
if(this.$route.query.oaType==='wuzi' || this.type==='add'){

@ -1,8 +1,9 @@
<template>
<div class="printwrap">
<Modal v-model="isShow" width="70" title="出库">
<div class="printwrap">
<Modal v-model="isShow" width="70" title="出库" :loading="showLoading">
<!-- :class="{'watermark':!showwatermark}" -->
<div id="printmodal" class="print">
<div class="print" id="printmodal">
<div class="printtitle">苏州市河道管理处物资出库记录单</div>
<div class="printtop">
<span>业务科室:{{ form.jieyongbumen }}</span>
@ -12,27 +13,39 @@
<tr>
<td>出库日期</td>
<td>物资名称</td>
<td>批次</td>
<td>物资类型</td>
<td>批次</td>
<td>批内序号</td>
<td>数量</td>
<td>规格</td>
<td>型号</td>
<td>型号</td>
<td v-if="isChange"></td>
</tr>
<tr v-for="item in mingxiList">
<td>{{ form.chukushijian }}</td>
<td>{{ item.zichanmingcheng }}</td>
<td>{{ item.rukupici }}</td>
<td>{{ item.jieyongshuliang }}</td>
<td>{{ item.zichanmingcheng }}</td>
<td>{{ item.wuzileixing }}</td>
<td>{{ item.rukupici }}</td>
<td>
<div v-for="inven in item.inventorys">
{{inven?inven.shunxuhao:''}}
</div>
</td>
<td>{{ item.wuzileixing==='一物一码'?item.inventorys.length:item.jieyongshuliang }}</td>
<td>{{ item.wuziguige }}</td>
<td>{{ item.guigexinghao }}</td>
<td>{{ item.guigexinghao }}</td>
<td v-if="isChange" @click="changeWz(item)">
<el-button size="small" type="primary">更改出库序号</el-button>
</td>
</tr>
<tr>
<td colspan="6">
<td :colspan="isChange?9:8">
<p>备注</p>
<p>{{form.beizhu}}</p>
</td>
</tr>
<tr class="printbottom">
<td colspan="3" rowspan="3">
<td :colspan="isChange?4:4" rowspan="4">
<p>经办人签字区</p>
<p>
<span></span>
@ -40,7 +53,7 @@
<span></span>
</p>
</td>
<td colspan="3" rowspan="3">
<td :colspan="isChange?5:4" rowspan="4">
<p>仓库管理员签字区</p>
<p><span></span>
<span></span>
@ -112,21 +125,45 @@
</div> -->
<template v-slot:footer>
<Button type="info" style="margin-left:5px;margin-bottom:5px;" @click="isShow=false"></Button>
<Button v-print="'#printmodal'" type="primary" style="margin-left:5px;margin-bottom:5px;"></Button>
<Button ref="prints" v-print="'#printmodal'" @click="clickPrint" type="primary" style="margin-left:5px;margin-bottom:5px;"></Button>
<Button type="primary" style="margin-left:5px;margin-bottom:5px;" @click="submit"></Button>
</template>
</Modal>
<Modal
v-model="isShowMingxi"
width="600"
title="更改出库序号"
>
<div class="mingxiwrap">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>出库序号
</div>
<div class="xy-table-item-content">
<el-select multiple v-model="mingxiObj.inventorys_id" style="width: 300px;" placeholder="请选择">
<el-option v-for="item in sxhList" :key="item.id" :label="item.shunxuhao" :value="item.id" />
</el-select>
</div>
</div>
</div>
<template v-slot:footer>
<Button type="info" style="margin-left:5px;margin-bottom:5px;" @click="mingxiCancel"></Button>
<Button type="primary" style="margin-left:5px;margin-bottom:5px;" @click="mingxiConfirm"></Button>
</template>
</Modal>
</div>
</template>
<script>
// import {
// show,
// save,
// } from '@/api/system/baseForm.js'
import {
show,
save,
} from '@/api/system/baseForm.js'
import {
saveOutbounds
saveOutbounds,
show
} from '@/api/outbounds.js'
import {
@ -137,17 +174,24 @@ import {
} from '@/api/system/log.js'
import {
getToken
} from '@/utils/auth'
} from '@/utils/auth'
import {
index
} from '@/api/inventory.js'
import {deepCopy} from "@/utils/index.js"
export default {
data() {
return {
isShow: false,
isShow: false,
showLoading:false,
isShowMingxi:false,
type: 'print',
id: '',
chukuType: '',
tableName: 'outbounds',
showwatermark: true,
showwatermark: true,
isChange:true,
form: {
chukushijian: '',
chukuleixing: '',
@ -157,13 +201,16 @@ export default {
jilurenyuan: '',
beizhu: '',
chukumingxi: ''
},
},
ywymList:[], //
sxhList:[],
mingxiList: [],
fileList: [],
action: process.env.VUE_APP_UPLOAD_API,
headers: {
token: ''
},
},
mingxiObj:{},
}
},
watch: {
@ -176,16 +223,22 @@ export default {
this.id = ''
this.type = 'print'
this.showwatermark = true
this.isChange = true
this.form = {}
this.fileList = []
this.mingxiList = []
this.mingxiList = []
this.ywymList = []
this.sxhList = []
}
}
},
created() {
this.headers.token = getToken()
this.headers.token = getToken()
},
methods: {
methods: {
clickPrint(){
this.isChange = false
},
beforeUpload(file) {
// if (file.size / 1000 > 500) {
// this.$message({
@ -223,16 +276,162 @@ export default {
},
async getDetail() {
const res = await show({
id: this.id,
table_name: this.tableName
id: this.id
})
this.form = res
// if (res.zhuangtai == 2) {
// this.showwatermark = true
// } else {
// this.showwatermark = false
// }
this.mingxiList = res.id_outbounds_items_outbounds_id_relation
// }
// res.id_outbounds_items_outbounds_id_relation.map(item=>{
// })
this.ywymList = deepCopy(res.id_outbounds_items_outbounds_id_relation)
this.mingxiList = this.mergeSameWuzibianma(res.id_outbounds_items_outbounds_id_relation)
console.log("this.mingxiList",this.mingxiList,this.ywymList)
},
//
mergeSameWuzibianma(arr) {
// 1. wuzileixing = ""
const yiwuData = arr.filter(item => item.wuzileixing === "一物一码");
// 2. wuzileixing = ""
const yileiData = arr.filter(item => item.wuzileixing === "一类一码");
// 3. wuzibianma
const groups = yiwuData.reduce((acc, item) => {
const key = item.wuzibianma; // wuzibianma
if (!acc[key]) {
acc[key] = []; //
}
acc[key].push(item);
return acc;
}, {});
// 4.
const mergedYiwuData = Object.values(groups).map(group => {
//
const base = { ...group[0] };
// idinventorys_idinventorys
const ids = group.map(item => item.id);
const inventorysIds = group.map(item => Number(item.inventorys_id));
const inventorysList = group.map(item => item.inventorys);
//
return {
...base,
id: ids, // id
inventorys_id: inventorysIds, // inventorys_id
inventorys: inventorysList // inventorys
};
});
// 5.
return [...mergedYiwuData, ...yileiData];
},
changeWz(row){
this.showLoading = true
this.mingxiObj = deepCopy(row)
console.log("this.mingxiObj",this.mingxiObj)
this.$forceUpdate()
this.getInventory(row.wuzibianma)
this.isShowMingxi = true
this.showLoading = false
},
async getInventory(wzbm){
const res = await index({
page:1,
page_size:999,
filter: [ {
'key': 'wuzibianma',
'op': 'like',
'value': wzbm
}]
})
this.sxhList = res.list.data.filter(item=> (Number(item.zaikushuliang) - item.wait_num)>0)
},
mingxiConfirm(){
console.log("obj",this.mingxiObj)
if(this.mingxiObj.inventorys_id.length>this.mingxiObj.inventorys.length || this.mingxiObj.inventorys_id.length<this.mingxiObj.inventorys.length){
Message({
type: 'warning',
message: `需出库${this.mingxiObj.inventorys.length}件物资`
})
return
}
console.log("list",this.replaceAndSplit(this.mingxiList,this.mingxiObj))
let list = this.replaceAndSplit(this.mingxiList,this.mingxiObj)
saveOutbounds({
...this.form,
id_outbounds_items_outbounds_id_relation:list
}).then(res => {
Message({
type: 'success',
message: '更改成功'
})
this.mingxiObj = {}
this.mingxiList = []
this.getDetail()
this.isShowMingxi = false
})
},
mingxiCancel(){
this.mingxiObj = {}
this.mingxiList = []
this.isShowMingxi = false
},
replaceAndSplit(mergedArr, mingxiObj) {
// 1.
const newMergedArr = [...mergedArr];
// 2. wuzibianma
const targetIndex = newMergedArr.findIndex(
item => item.wuzibianma === mingxiObj.wuzibianma
);
// 3.
if (targetIndex !== -1) {
newMergedArr[targetIndex] = mingxiObj;
} else {
console.warn('未找到匹配的 wuzibianma无法替换');
}
// 4.
return this.splitMergedArray(newMergedArr);
},
//
splitMergedArray(mergedArr) {
const result = [];
mergedArr.forEach(item => {
if (item.wuzileixing === "一类一码") {
result.push(item);
return;
}
if (item.wuzileixing === "一物一码") {
const len = Math.min(
item.id?.length || 0,
item.inventorys_id?.length || 0,
item.inventorys?.length || 0
);
for (let i = 0; i < len; i++) {
const splitItem = { ...item };
splitItem.id = item.id[i];
splitItem.inventorys_id = item.inventorys_id[i];
splitItem.inventorys = item.inventorys[i];
result.push(splitItem);
}
}
});
return result;
},
handlePrint() {
if (this.chukuType == '领用') {

@ -64,8 +64,8 @@
<Button v-if="scope.row.zhuangtai==0 || scope.row.zhuangtai==4" style="margin-right: 10px;" type="primary" size="small"
@click="toOaFollow(scope.row,scope.row.chukuleixing)">发起流程</Button>
<Button v-if="scope.row.zhuangtai==2" style="margin-right: 10px;" type="primary" size="small"
<!-- v-if="scope.row.zhuangtai==2 &&(isCkName=='仓库管理员'||roleName=='系统管理员')" -->
<Button style="margin-right: 10px;" type="primary" size="small"
@click="printChuku(scope.row.id)">确认出库</Button>
<Poptip v-if="scope.row.zhuangtai==0" transfer confirm title="确认要删除该出库记录?"

@ -70,7 +70,7 @@
<div v-show="activeStep === 1">
<div class="operation-bar" style="margin-bottom: 20px;">
<el-button size="mini" type="primary" @click="addStockItems"></el-button>
<el-button size="mini" type="primary" @click="importsRuku"></el-button>
<!-- <el-button size="mini" type="primary" @click="importsRuku"></el-button> -->
</div>
<xy-table style="width: 100%" :height="260" :is-page="false" :list="mingxiList" :table-item="mingxiTable">
<template v-slot:btns>

@ -0,0 +1,198 @@
<template>
<div>
<el-dialog style="z-index:19009" :visible.sync="dialogVisible" title="数据导入" width="740px">
<div class="title">模板下载123</div>
<el-button
style="margin-top: 10px"
size="small"
type="primary"
@click="exportExcel(new Date().getTime().toString())"
>模板下载</el-button>
<div style="color: red; margin-top: 10px">
导入的时候请勿修改模版的标题名称
</div>
<el-upload
style="margin-top: 10px"
drag
:action="action"
:data="{
}"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
:on-success="uploadSuccess"
:on-error="uploadFail"
>
<i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
<div class="title" style="margin-top: 10px;">数据预览</div>
<Table :data="tableList" :columns="table" :height="400" style="margin-top: 10px;" />
<div style="font-size: 12px;zoom: 0.8;">总共数据{{ tableList.length }}</div>
<el-button type="primary" size="small" style="margin-top: 10px;" @click="imports"></el-button>
</el-dialog>
</div>
</template>
<script>
import * as XLSX from 'xlsx'
import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth'
import { importAsset } from '@/api/system/fixAssets.js'
export default {
keys: {
formInfo: {
type: Array,
default: () => []
},
tableName: String,
},
data() {
return {
action: `${process.env.VUE_APP_BASE_API}api/admin/asset/excel-show`,
dialogVisible: false,
headers: [{ title: '资产编号', key: 'asset_number', minWidth: 120 },
{ title: '资产名称', key: 'name', minWidth: 120 },
{ title: '国标分类', key: 'category', minWidth: 120 },
{ title: '类别名称', key: 'category_name', minWidth: 120 },
{ title: '规格型号', key: 'model', minWidth: 120 },
{ title: '数量', key: 'quantity', minWidth: 80 },
{ title: '计量单位', key: 'unit', minWidth: 80 },
{ title: '购置时间', key: 'purchase_date', minWidth: 120 },
{ title: '使用期限', key: 'expire_date', minWidth: 100 },
{ title: '原值', key: 'value', minWidth: 100 },
{ title: '使用科室', key: 'usage_department', minWidth: 120 },
{ title: '保管人', key: 'custodian', minWidth: 100 },
{ title: '存放地点', key: 'storage_location', minWidth: 120 },
{ title: '所属库', key: 'storehouse', minWidth: 120 },
{ title: '使用方向', key: 'usage_direction', minWidth: 120 },
{ title: '备注', key: 'remarks', minWidth: 120 }],
tableList: [],
table: [{ title: '资产编号', key: 'asset_number', minWidth: 120 },
{ title: '资产名称', key: 'name', minWidth: 120 },
{ title: '国标分类', key: 'category', minWidth: 120 },
{ title: '类别名称', key: 'category_name', minWidth: 120 },
{ title: '规格型号', key: 'model', minWidth: 120 },
{ title: '数量', key: 'quantity', minWidth: 80 },
{ title: '计量单位', key: 'unit', minWidth: 80 },
{ title: '购置时间', key: 'purchase_date', minWidth: 120 },
{ title: '使用期限', key: 'expire_date', minWidth: 100 },
{ title: '原值', key: 'value', minWidth: 100 },
{ title: '使用科室', key: 'usage_department', minWidth: 120 },
{ title: '保管人', key: 'custodian', minWidth: 100 },
{ title: '存放地点', key: 'storage_location', minWidth: 120 },
{ title: '所属库', key: 'storehouse', minWidth: 120 },
{ title: '使用方向', key: 'usage_direction', minWidth: 120 },
{ title: '备注', key: 'remarks', minWidth: 120 }]
}
},
computed: {},
watch: {
// formInfo(newVal) {
// comsole.log("newval",newval)
// if (newVal && newVal instanceof Array) {
// this.table = this.headers = newVal.map((i) => {
// return {
// key: i.key,
// title: i.title
// }
// })
// console.log('this.table', this.table)
// }
// },
dialogVisible(newval){
if(newval){
}else{
this.tableList = []
}
}
},
methods: {
getToken,
show() {
this.dialogVisible = true
},
hidden() {
this.dialogVisible = false
},
//
uploadFail(err) {
console.log(err)
this.$message({
message: '上传失败',
type: 'error'
})
},
uploadSuccess(response) {
this.tableList = response
this.$message({
message: `上传成功`,
type: 'success'
})
},
exportExcel(sheetName) {
const data = [this.headers.map((header) => header.title)]
console.log("data",data)
// return
const wb = XLSX.utils.book_new()
const ws = XLSX.utils.aoa_to_sheet(data)
XLSX.utils.book_append_sheet(wb, ws, sheetName)
const wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array'
})
saveAs(
new Blob([wbout], { type: 'application/octet-stream' }),
`${sheetName}.xlsx`
)
},
imports() {
importAsset({
data: this.tableList
}).then(res => {
console.log(res)
this.$message({
type: 'success',
message: res.fail > 0 ? `${res.fail}条未导入` : `成功导入${res.total}`
})
this.tableList = []
this.$emit('refresh')
})
this.hidden()
}
}
}
</script>
<style scoped lang="scss">
.title {
font-size: 15px;
font-weight: 600;
padding: 8px 4px;
position: relative;
&::before {
content: '';
width: 4px;
background: $primaryColor;
position: absolute;
top: 8px;
bottom: 8px;
left: -8px;
}
}
</style>

@ -11,6 +11,8 @@
<Input v-model="select.custodian" style="width: 200px;margin-right: 10px;" placeholder="保管人" clearable />
<Button type="primary" style="margin-left: 8px;" @click="resetSelect"></Button>
<Button type="primary" style="margin-left: 8px;" @click="getWarehouseList"></Button>
<Button type="primary" style="margin-left: 8px;" @click="$refs['imports'].show()"></Button>
<Button type="primary" style="margin-left: 8px;" @click="handleAdd"></Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@ -31,6 +33,29 @@
@pageSizeChange="pageSizeChange"
@pageIndexChange="pageChange"
>
<template v-slot:asset_number>
<el-table-column label="资产编码" align="center" min-width="140" header-align="center" class-name="table-col-action">
<template slot-scope="scope">
<el-popover v-if="scope.row.inventory" trigger="click" title="物资详情" placement="bottom-start" width="850">
<div>
<xy-table v-loading="loading" :height="250" :isPage="false" :list="inventoryList" :table-item="table_inventory"
>
<template v-slot:btns>
<div></div>
</template>
</xy-table>
<!-- <div>物资名称:{{scope.row.inventory.zichanmingcheng}}</div>
<div>物资类型:{{scope.row.inventory.wuzileixing}}</div>
<div>在库数量:{{scope.row.inventory.zaikushuliang}}</div> -->
</div>
<div slot="reference">
<span @click="showInventory(scope.row.inventory)" style="color:blue;cursor: pointer;">{{scope.row.asset_number?scope.row.asset_number:''}}</span>
</div>
</el-popover>
<div v-else>{{scope.row.asset_number?scope.row.asset_number:''}}</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column fixed="right" label="操作" align="center" min-width="140" header-align="center" class-name="table-col-action">
<template slot-scope="scope">
@ -43,11 +68,19 @@
</template>
</xy-table>
<AddFixAssets ref="addFixAssets" :warehouse-list="list" @refresh="getWarehouseList" />
</div>
<imports ref="imports" :form-info="table" @refresh="getWarehouseList" />
</div>
</template>
<script>
import imports from './components/imports.vue'
import {
index as invenGet
} from '@/api/inventory.js'
import {
destroy,
index
@ -62,7 +95,8 @@ import AddFixAssets from './components/addFixAssets.vue'
import { getFixAssetsList, destroyFixAssets, saveFixAssets } from '@/api/system/fixAssets.js'
export default {
components: {
AddFixAssets
AddFixAssets,
imports
},
data() {
return {
@ -82,6 +116,7 @@ export default {
areaList: [],
total: 0,
list: [],
importForm: [],
table: [
{ label: '序号', type: 'index', width: 60 },
{ label: '资产编号', prop: 'asset_number', minWidth: 120 },
@ -101,7 +136,187 @@ export default {
{ label: '使用方向', prop: 'usage_direction', minWidth: 120 },
{ label: '备注', prop: 'remarks', minWidth: 120 }
],
tableHeight: 550 //
tableHeight: 550,//
inventoryList:[],
table_inventory: [
{
label: '物资信息',
align: 'left',
prop: 'wuzibianma_material_infos_wuzibianma_relation',
multiHd: [
{
label: '一级分类',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.material_info_type',
align: 'center',
formatter: (cell, data, value) => {
return value ? value.split("-")[0] : ''
}
},
{
label: '二级分类',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.material_info_type',
align: 'center',
formatter: (cell, data, value) => {
return value ? (value.split("-").length>1?value.split("-")[1]:value.split("-")[0]) : ''
}
},
{
label: '所属种类',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.fenlei_detail.name',
align: 'center'
},{
label: '物资名称',
prop: 'zichanmingcheng',
align: 'center',
width: 180,
fixed: 'left'
},
// {
// label: '',
// width: 120,
// prop: 'wuzibianma',
// align: 'center'
// },
{
label: '物资类型',
width: 120,
prop: 'wuzileixing',
align: 'center'
},
{
label: '物资型号',
prop: 'guigexinghao',
align: 'center',
width: 180
},
{
label: '物资规格',
prop: 'wuziguige',
align: 'center',
width: 180
},
{
label: '单位',
width: 120,
prop: 'jiliangdanwei',
align: 'center'
}
]
},
{
label: '库存信息',
prop: 'kucun',
align: 'left',
multiHd: [{
label: '入库批次',
width: 120,
prop: 'rukupici'
},
{
label: '在库数量',
width: 120,
prop: 'zaikushuliang',
customFn: (row) => {
console.log("row",row)
return (<span>{row.row.zaikushuliang}{row.row.jiliangdanwei?row.row.jiliangdanwei:''}</span>)
}
},
{
label: '顺序号',
width: 180,
prop: 'shunxuhao',
customFn: (row) => {
console.log("row",row)
return (<span>{row.row.shunxuhao?row.row.shunxuhao:''}</span>)
}
},
{
label: '待出库',
width: 120,
prop: 'wait_num'
},
]
},
{
label: '物资明细',
prop: 'stocks_items_info',
align: 'left',
multiHd: [{
label: '生产日期',
width: 120,
prop: 'stocks_items_info.shengchanriqi'
},
{
label: '入库日期',
width: 120,
prop: 'stocks_items_info.rukuriqi'
},
{
label: '物资状态',
width: 120,
prop: 'stocks_items_info.wuzizhuangtai_detail.value'
},
{
label: '储备方式',
width: 120,
prop: 'stocks_items_info.chubeifangshi_detail.value'
},
{
label: '所在仓库',
width: 120,
prop: 'stocks_items_info.materialstorages.cangkumingcheng'
},
{
label: '所在货架',
width: 120,
prop: 'stocks_items_info.shelfs.huojiamingcheng'
},
{
label: '等级分类',
width: 120,
prop: 'stocks_items_info.dengjifenlei_detail.value'
},
{
label: '产权信息',
width: 120,
prop: 'stocks_items_info.chanquanxinxi_detail.value'
}, {
label: '储备年限',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.chubeinianxian'
}, {
label: '存放要求',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.cunfangyaoqiu'
},
{
label: '维护要求',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.weihuyaoqiu'
},
{
label: '保养频次',
width: 120,
prop: 'wuzibianma_material_infos_wuzibianma_relation.equipment_maintain_config.name'
},{
label: '是否为固定资产',
width: 120,
prop: 'shifouweigudingzichan',
},{
label: '固定资产编码',
width: 120,
prop: 'gudingzichanbianma',
}]
}
],
}
},
created() {
@ -115,6 +330,30 @@ export default {
window.removeEventListener('resize', this.calcTableHeight)
},
methods: {
async showInventory(item){
this.loading = true
this.inventoryList = []
const res = await invenGet({
page:1,
page_size:999,
filter: [
{
'key': 'id',
'op': 'eq',
'value': item.id
},
]
})
let stocks_items_arr = []
res.list.data.map(item => {
stocks_items_arr = item.stocks_items.filter(f => f.rukupici === item.rukupici)
item.stocks_items_info = stocks_items_arr.length > 0 ? stocks_items_arr[0] : {}
})
this.inventoryList = res.list.data
this.loading = false
this.$forceUpdate()
},
async getTypeList() {
try {
const formData = new FormData()

@ -8,7 +8,20 @@
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>开始日期
</div>
<div class="xy-table-item-content">
<el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="form.start_date" style="width:300px" type="date" placeholder="选择日期">
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.start_date"
style="width:300px" type="datetime" placeholder="选择时间">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:rax_end_time>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />抢险结束时间
</div>
<div class="xy-table-item-content">
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.rax_end_time"
style="width:300px" type="datetime" placeholder="选择时间">
</el-date-picker>
</div>
</div>
@ -16,10 +29,11 @@
<template v-slot:end_date>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />结束日期
<span style="color: red;font-weight: 600;padding-right: 4px;" />回仓库时间
</div>
<div class="xy-table-item-content">
<el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="form.end_date" style="width:300px" type="date" placeholder="选择日期">
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" v-model="form.end_date"
style="width:300px" type="datetime" placeholder="选择时间">
</el-date-picker>
</div>
</div>
@ -30,7 +44,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;" />出动队伍
</div>
<div class="xy-table-item-content">
<el-select v-model="form.team_ids" multiple style="width:300px" placeholder="请选择">
<el-select v-model="form.team_ids" collapse-tags multiple style="width:300px" placeholder="请选择">
<el-option v-for="item in teamList" :key="item.id" :label="item.mingcheng" :value="item.id" />
</el-select>
</div>
@ -42,11 +56,11 @@
<span style="color: red;font-weight: 600;padding-right: 4px;" />出动人数
</div>
<div class="xy-table-item-content">
<el-input v-model="form.total" type="number" style="width:300px" />
<el-input v-model="form.total" type="number" style="width:300px" />
</div>
</div>
</template>
<template v-slot:destination>
<!-- <template v-slot:destination>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />目的地
@ -55,7 +69,63 @@
<el-input v-model="form.destination" style="width:300px" />
</div>
</div>
</template> -->
<template v-slot:travel_info>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />行程信息
</div>
<div class="xy-table-item-content">
<el-button type="primary" style="margin-bottom:10px" size="small" @click="addRow"></el-button>
<xy-table style="width:850px" :list="form.travel_info" :isPage="false" :height="350"
:table-item="detail_item">
<template v-slot:start>
<el-table-column align='left' label="出发地" width="180">
<template slot-scope="scope">
<el-input placeholder="请输入出发地" style="width:100%" v-model="scope.row.start"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:end>
<el-table-column align='left' label="目的地" width="180">
<template slot-scope="scope">
<el-input placeholder="请输入目的地" style="width:100%" v-model="scope.row.end"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:start_time>
<el-table-column align='left' label="开始时间" width="180">
<template slot-scope="scope">
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
v-model="scope.row.start_time" style="width:300px" type="datetime" placeholder="选择时间">
</el-date-picker>
</template>
</el-table-column>
</template>
<template v-slot:end_time>
<el-table-column align='left' label="结束时间" width="180">
<template slot-scope="scope">
<el-date-picker format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
v-model="scope.row.end_time" style="width:300px" type="datetime" placeholder="选择时间">
</el-date-picker>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='left' fixed="right" label="操作" width="100" header-align="center">
<template slot-scope="scope">
<el-popconfirm confirm-button-text="" cancel-button-text="" style="margin:0 10px"
@confirm="delRow(scope.row,scope.$index)" title="确认删除?">
<el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</template>
</xy-table>
</div>
</div>
</template>
</xy-dialog>
</div>
@ -81,20 +151,35 @@
id: '',
form: {
start_date: '',
rax_end_time: '',
end_date: '',
team_ids: '',
total: '',
destination: '',
travel_info: []
},
teamList: [],
detail_item: [{
label: "出发地",
prop: 'start'
}, {
label: "目的地",
prop: 'end'
}, {
label: "开始时间",
prop: 'start_time'
}, {
label: "结束时间",
prop: 'end_time'
}],
rules: {
start_date: [{
required: true,
message: '请选择开始日期'
}],
total: [{
required: true,
message: '请输入出动人数'
}],
total: [{
required: true,
message: '请输入出动人数'
}]
}
@ -117,6 +202,18 @@
this.getTeams()
},
methods: {
addRow() {
var len = this.form.travel_info.length;
this.form.travel_info.push({
start: '',
end: '',
start_time: '',
end_time: '',
})
},
delRow(obj, index) {
this.form.travel_info.splice(index, 1);
},
async getTeams() {
const res = await index({
table_name: 'teams',
@ -129,10 +226,46 @@
const res = await show({
id: this.id
})
this.$integrateData(this.form, res)
this.$integrateData(this.form, res)
this.form.travel_info = res.travel_info?res.travel_info:[]
},
submit() {
if (this.form.travel_info.length > 0) {
//
for (var p of this.form.travel_info) {
if (!p.start) {
this.$message({
type: 'warning',
message: `行程信息出发地不能为空`
})
return
}
if (!p.end) {
this.$message({
type: 'warning',
message: `行程信息目的地不能为空`
})
return
}
if (!p.start_time) {
this.$message({
type: 'warning',
message: `行程信息开始时间不能为空`
})
return
}
if (!p.end_time) {
this.$message({
type: 'warning',
message: `行程信息结束时间不能为空`
})
return
}
}
}
submit() {
if (this.type === 'add') {
save({
...this.form

@ -76,15 +76,21 @@ export default {
fixed: 'left',
width: 80
}, {
label: '开始日期',
label: '开始时间',
prop: 'start_date',
width: 120,
width: 180,
align: 'center',
},{
label: '抢险结束时间',
prop: 'rax_end_time',
align: 'center',
width: 180
}, {
label: '结束日期',
label: '回仓库时间',
prop: 'end_date',
align: 'center',
width: 120
width: 180
}, {
label: '出动队伍',
prop: 'team_ids',
@ -101,11 +107,6 @@ export default {
prop: 'total',
width: 120,
align: 'center',
}, {
label: '目的地',
prop: 'destination',
width: 240,
align: 'left',
}]
}
},

Loading…
Cancel
Save