
7 changed files with 513 additions and 226 deletions
@ -0,0 +1,167 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState ==1"> |
|||
<button-bar view-title="油罐信息" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
|||
<div class="main-content"> |
|||
<div class="listtop"> |
|||
<div class="tit">油罐列表</div> |
|||
</div> |
|||
<div > |
|||
<el-table ref="looktable" v-loading="listLoading" height="585" :data="list" border :summary-method="getSummaries" show-summary style="width: 100%;" > |
|||
<!-- <el-table-column type="selection" align="center" width="50"/> --> |
|||
<el-table-column label="序号" type="index" width="80" :index="indexMethod" align="center" /> |
|||
<el-table-column label="油罐编号" prop="number" align="center" /> |
|||
<el-table-column label="原油名称" prop="crudeName" align="center" /> |
|||
<el-table-column label="原油编号" prop="crudeNumber" align="center" /> |
|||
<el-table-column label="油罐容量" prop="capacity" align="center" /> |
|||
<el-table-column label="油罐库存(吨)" prop="inventory" align="center" /> |
|||
<el-table-column label="油罐现有库存(吨)" prop="existingInventory" align="center" /> |
|||
<el-table-column label="油罐总价值(元)" prop="totalValue" align="center" /> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/oilTank/oilTank' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
// import oilTypeInfo from './oilTypeInfo.vue' |
|||
export default { |
|||
name: 'CustomerManagement', |
|||
components: { |
|||
pageye, |
|||
ButtonBar |
|||
}, |
|||
data() { |
|||
return { |
|||
listLoading: false, |
|||
btndisabled: false, |
|||
editDialog: false, |
|||
form: {}, |
|||
btnList: [{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
list: [], |
|||
listQuery: { |
|||
current: 1, |
|||
size: 50, |
|||
params: { |
|||
entryName: '', |
|||
}, |
|||
total: 0 |
|||
}, |
|||
viewState: 1 |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
created() { |
|||
this.init() |
|||
// 加载列表 |
|||
}, |
|||
methods: { |
|||
btnHandle(btnKey) { |
|||
switch (btnKey) { |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
// 初始化 |
|||
init() { |
|||
this.getList() |
|||
}, |
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
// 查询列表信息 |
|||
getList() { |
|||
this.listLoading = true |
|||
req.selectTankInformation().then((response) => { |
|||
this.listLoading = false |
|||
if (response.success) { |
|||
this.list = response.data |
|||
this.$nextTick(() => {this.$refs.looktable.doLayout()}) // 初始化显示合计 |
|||
} else { |
|||
this.list = [] |
|||
} |
|||
}) |
|||
}, |
|||
// 打开添加 |
|||
toAdd() { |
|||
this.viewState = 2 |
|||
}, |
|||
reset() { |
|||
this.form = {}; |
|||
}, |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
}, |
|||
// 处理数据 |
|||
accAdd(arg1, arg2) { |
|||
var r1, r2, m; |
|||
try { |
|||
r1 = arg1.toString().split(".")[1].length; |
|||
} catch(e) { |
|||
r1 = 0; |
|||
} |
|||
try { |
|||
r2 = arg2.toString().split(".")[1].length; |
|||
}catch(e){ |
|||
r2 = 0; |
|||
} |
|||
//解决JS浮点数精度问题 |
|||
m = Math.pow(10, Math.max(r1, r2)); |
|||
//保留两位小数 |
|||
return parseFloat((arg1 * m + arg2 * m) / m).toFixed(2); |
|||
}, |
|||
getSummaries(param) { |
|||
const { columns, data } = param |
|||
const sums = [] |
|||
columns.forEach((column, index) => { |
|||
if (index === 0) { |
|||
sums[index] = '合计'; |
|||
return; |
|||
} |
|||
const values = data.map(item => Number(item[column.property])); |
|||
if (column.property === 'inventory' || column.property === 'existingInventory' || column.property === 'totalValue') { |
|||
sums[index] = values.reduce((prev, curr) => { |
|||
const value = Number(curr); |
|||
if (!isNaN(value)) { |
|||
return this.accAdd(prev,curr); |
|||
} else { |
|||
return prev; |
|||
} |
|||
}, 0); |
|||
sums[index]; |
|||
} |
|||
}); |
|||
|
|||
return sums |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
</style> |
@ -1,271 +1,339 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState ==1"> |
|||
<button-bar ref="btnbar" view-title="油罐库存记录" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar |
|||
ref="btnbar" |
|||
view-title="油罐库存记录" |
|||
:btndisabled="btndisabled" |
|||
@btnhandle="btnHandle" |
|||
/> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow"> |
|||
{{ searchxianshitit }} |
|||
</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form ref="queryParams" :model="jmdListQuery" :inline="true" class="tab-header"> |
|||
<el-form |
|||
ref="queryParams" |
|||
:model="jmdListQuery" |
|||
:inline="true" |
|||
class="tab-header" |
|||
> |
|||
<el-form-item label="油罐编号"> |
|||
<el-input v-model="jmdListQuery.number" maxlength="20" placeholder="请输入油罐编号" class="addinputw" |
|||
clearable /> |
|||
<el-input |
|||
v-model="jmdListQuery.number" |
|||
maxlength="20" |
|||
placeholder="请输入油罐编号" |
|||
class="addinputw" |
|||
clearable |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="日期"> |
|||
<el-date-picker v-model="jmdListQuery.date" :picker-options="pickerOptions" type="date" clearable value-format="yyyy-MM-dd" |
|||
placeholder="选择日期" /> |
|||
<el-date-picker |
|||
v-model="jmdListQuery.date" |
|||
:picker-options="pickerOptions" |
|||
type="date" |
|||
clearable |
|||
value-format="yyyy-MM-dd" |
|||
placeholder="选择日期" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" size="small" icon="el-icon-search" @click="dosearch">查询</el-button> |
|||
<el-button type="primary" size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
|||
<div class="btn" style="text-align: center"> |
|||
<el-button |
|||
type="primary" |
|||
size="small" |
|||
icon="el-icon-search" |
|||
@click="dosearch" |
|||
>查询</el-button |
|||
> |
|||
<el-button |
|||
type="primary" |
|||
size="small" |
|||
icon="el-icon-refresh" |
|||
@click="resetQuery" |
|||
>重置</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<el-table v-loading="tableLoading1" :data="logList" border style="width: 100%"> |
|||
<el-table-column fixed width="100" type="index" label="序号" :index="indexMethod" align="center" /> |
|||
<el-table-column prop="tankNumber" label="油罐编号" align="center" /> |
|||
<el-table-column prop="existingInventory" label="油罐登记库存" align="center" /> |
|||
<el-table-column prop="recordDate" label="登记日期" align="center" /> |
|||
<el-table-column label="操作" width='150px' align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
type="primary" |
|||
size="mini" |
|||
@click="purchase(scope.row)" |
|||
> |
|||
查看详情 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table |
|||
v-loading="tableLoading1" |
|||
:data="logList" |
|||
border |
|||
style="width: 100%" |
|||
> |
|||
<el-table-column |
|||
fixed |
|||
width="100" |
|||
type="index" |
|||
label="序号" |
|||
:index="indexMethod" |
|||
align="center" |
|||
/> |
|||
<el-table-column |
|||
prop="tankNumber" |
|||
label="油罐编号" |
|||
align="center" |
|||
/> |
|||
<el-table-column |
|||
prop="existingInventory" |
|||
label="油罐登记库存" |
|||
align="center" |
|||
/> |
|||
<el-table-column |
|||
prop="recordDate" |
|||
label="登记日期" |
|||
align="center" |
|||
/> |
|||
<el-table-column label="操作" width="150px" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
type="primary" |
|||
size="mini" |
|||
@click="purchase(scope.row)" |
|||
> |
|||
查看详情 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<div class="pages"> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="logListTotal > 0" :total="logListTotal" :page.sync="logListQuery.current" |
|||
:limit.sync="logListQuery.size" class="pagination" @pagination="loadLogList" /> |
|||
<pagination |
|||
v-show="logListTotal > 0" |
|||
:total="logListTotal" |
|||
:page.sync="logListQuery.current" |
|||
:limit.sync="logListQuery.size" |
|||
class="pagination" |
|||
@pagination="loadLogList" |
|||
/> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</div> |
|||
<el-dialog |
|||
:title="dialogTitle + '详细信息'" |
|||
:visible.sync="editDialog" |
|||
width="37%" |
|||
> |
|||
<el-form ref="form" :model="form" label-width="80px"> |
|||
<el-form-item label="油罐编号:"> |
|||
<span>{{ form.number }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="登记日期:"> |
|||
<span>{{ form.recordDate }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="库存高度:"> |
|||
<span>{{ form.height }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="描述:" prop="url"> |
|||
<el-popover placement="left" trigger="hover"> |
|||
<img :src="form.url" style="width: 500px;height: 400px"> |
|||
<img slot="reference" :src="form.url" style="width: 200px;height: 150px"> |
|||
</el-popover> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-form ref="form" :model="form" label-width="80px"> |
|||
<el-form-item label="油罐编号:"> |
|||
<span>{{ form.number }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="登记日期:"> |
|||
<span>{{ form.recordDate }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="库存高度:"> |
|||
<span>{{ form.height }}</span> |
|||
</el-form-item> |
|||
<el-form-item label="描述:" prop="url"> |
|||
<el-popover placement="left" trigger="hover"> |
|||
<img :src="form.url" style="width: 500px; height: 500px" /> |
|||
<img |
|||
slot="reference" |
|||
:src="form.url" |
|||
style="width: 150px; height: 150px" |
|||
/> |
|||
</el-popover> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/oilTank/oilTank' |
|||
import Pagination from '@/components/pagination' |
|||
import { |
|||
parseTime |
|||
} from '@/utils/index' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
export default { |
|||
components: { |
|||
ButtonBar, |
|||
Pagination, |
|||
}, |
|||
data() { |
|||
return { |
|||
viewState: 1, |
|||
tabActiveName: 'uplog', |
|||
index: "0", |
|||
isSearchShow: false, |
|||
dialogTitle:'', |
|||
editDialog:false, |
|||
searchxianshitit: '显示查询条件', |
|||
btndisabled: false, |
|||
tableLoading1: false, |
|||
tableLoading2: false, |
|||
btnList: [ // 右上角按钮 |
|||
// { |
|||
// type: 'success', |
|||
// size: 'small', |
|||
// icon: 'export', |
|||
// btnKey: 'build', |
|||
// btnLabel: '导出' |
|||
// }, |
|||
// { |
|||
// type: 'primary', |
|||
// size: 'small', |
|||
// icon: 'plus', |
|||
// btnKey: 'toAdd1', |
|||
// btnLabel: '新增入库记录' |
|||
// }, |
|||
// { |
|||
// type: 'primary', |
|||
// size: 'small', |
|||
// icon: 'plus', |
|||
// btnKey: 'toAdd2', |
|||
// btnLabel: '新增出库记录' |
|||
// }, |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
logList: [], |
|||
form:{}, |
|||
logListQuery: { |
|||
current: 1, |
|||
size: 10 |
|||
import req from "@/api/oilTank/oilTank"; |
|||
import Pagination from "@/components/pagination"; |
|||
import { parseTime } from "@/utils/index"; |
|||
import ButtonBar from "@/components/ButtonBar"; |
|||
export default { |
|||
components: { |
|||
ButtonBar, |
|||
Pagination, |
|||
}, |
|||
data() { |
|||
return { |
|||
viewState: 1, |
|||
tabActiveName: "uplog", |
|||
index: "0", |
|||
isSearchShow: false, |
|||
dialogTitle: "", |
|||
editDialog: false, |
|||
searchxianshitit: "显示查询条件", |
|||
btndisabled: false, |
|||
tableLoading1: false, |
|||
tableLoading2: false, |
|||
btnList: [ |
|||
// 右上角按钮 |
|||
// { |
|||
// type: 'success', |
|||
// size: 'small', |
|||
// icon: 'export', |
|||
// btnKey: 'build', |
|||
// btnLabel: '导出' |
|||
// }, |
|||
// { |
|||
// type: 'primary', |
|||
// size: 'small', |
|||
// icon: 'plus', |
|||
// btnKey: 'toAdd1', |
|||
// btnLabel: '新增入库记录' |
|||
// }, |
|||
// { |
|||
// type: 'primary', |
|||
// size: 'small', |
|||
// icon: 'plus', |
|||
// btnKey: 'toAdd2', |
|||
// btnLabel: '新增出库记录' |
|||
// }, |
|||
{ |
|||
type: "info", |
|||
size: "small", |
|||
icon: "cross", |
|||
btnKey: "doClose", |
|||
btnLabel: "关闭", |
|||
}, |
|||
logListTotal: 1, |
|||
], |
|||
logList: [], |
|||
form: {}, |
|||
logListQuery: { |
|||
current: 1, |
|||
size: 10, |
|||
}, |
|||
logListTotal: 1, |
|||
|
|||
jmdListQuery: { |
|||
number: "", |
|||
date: "" |
|||
jmdListQuery: { |
|||
number: "", |
|||
date: "", |
|||
}, |
|||
pickerOptions: { |
|||
disabledDate(time) { |
|||
return time.getTime() > Date.now(); // 如果没有后面的-8.64e7就是不可以选择今天的 |
|||
}, |
|||
pickerOptions:{ |
|||
disabledDate(time){ |
|||
return time.getTime()> Date.now()- 8.64e7;// 如果没有后面的-8.64e7就是不可以选择今天的 |
|||
} |
|||
} |
|||
}, |
|||
}; |
|||
}, |
|||
mounted() { |
|||
// 初始化按钮 |
|||
this.$refs["btnbar"].setButtonList(this.btnList); |
|||
}, |
|||
created() { |
|||
// 初始化变量 |
|||
this.init(); |
|||
}, |
|||
methods: { |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow; |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = "隐藏查询条件"; |
|||
} else { |
|||
this.searchxianshitit = "显示查询条件"; |
|||
} |
|||
}, |
|||
mounted() { |
|||
// 初始化按钮 |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
dosearch() { |
|||
this.loadLogList(); |
|||
}, |
|||
created() { |
|||
// 初始化变量 |
|||
this.init() |
|||
resetQuery() { |
|||
this.jmdListQuery = { |
|||
contractNumber: "", |
|||
date: "", |
|||
}; |
|||
this.loadLogList(); |
|||
}, |
|||
methods: { |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
dosearch() { |
|||
|
|||
this.loadLogList() |
|||
|
|||
}, |
|||
resetQuery() { |
|||
this.jmdListQuery = { |
|||
contractNumber: "", |
|||
date: "" |
|||
} |
|||
this.loadLogList() |
|||
}, |
|||
// 右上角点击事件 |
|||
btnHandle(btnKey) { |
|||
switch (btnKey) { |
|||
case 'toAdd1': // 新增入库 |
|||
this.doAdd1() |
|||
break |
|||
case 'toAdd2': // 新增出库 |
|||
this.doAdd2() |
|||
break |
|||
case 'build': // 导出 |
|||
this.doBuild() |
|||
break |
|||
case 'doClose': // 关闭 |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
init() { |
|||
this.loadLogList() |
|||
}, |
|||
loadLogList() { |
|||
req.crudeinventoryList({ |
|||
// 右上角点击事件 |
|||
btnHandle(btnKey) { |
|||
switch (btnKey) { |
|||
case "toAdd1": // 新增入库 |
|||
this.doAdd1(); |
|||
break; |
|||
case "toAdd2": // 新增出库 |
|||
this.doAdd2(); |
|||
break; |
|||
case "build": // 导出 |
|||
this.doBuild(); |
|||
break; |
|||
case "doClose": // 关闭 |
|||
this.doClose(); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}, |
|||
init() { |
|||
this.loadLogList(); |
|||
}, |
|||
loadLogList() { |
|||
req |
|||
.crudeinventoryList({ |
|||
current: this.logListQuery.current, |
|||
size: this.logListQuery.size, |
|||
params: this.jmdListQuery |
|||
}).then(response => { |
|||
if (response.code === '200' && response.data && response.data.total > 0) { |
|||
this.logList = response.data.records |
|||
this.logListTotal = response.data.total |
|||
this.logListQuery.current = response.data.current |
|||
this.logListQuery.size = response.data.size |
|||
params: this.jmdListQuery, |
|||
}) |
|||
.then((response) => { |
|||
if ( |
|||
response.code === "200" && |
|||
response.data && |
|||
response.data.total > 0 |
|||
) { |
|||
this.logList = response.data.records; |
|||
this.logListTotal = response.data.total; |
|||
this.logListQuery.current = response.data.current; |
|||
this.logListQuery.size = response.data.size; |
|||
} else { |
|||
this.logList = [] |
|||
this.logListTotal = 0 |
|||
this.logList = []; |
|||
this.logListTotal = 0; |
|||
} |
|||
}) |
|||
}, |
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.logListQuery.current - 1) * this.logListQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
doAdd1() { |
|||
this.viewState = 2 |
|||
}, |
|||
doAdd2() { |
|||
this.viewState = 3 |
|||
}, |
|||
purchase(row){ |
|||
this.dialogTitle = "数据"; |
|||
this.editDialog = true; |
|||
req.selectRecordBySid(row.sid).then((res)=>{ |
|||
this.form=res.data |
|||
}) |
|||
}, |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.logListQuery.current - 1) * this.logListQuery.size; |
|||
var pageindex = index + 1 + pagestart; |
|||
return pageindex; |
|||
}, |
|||
doAdd1() { |
|||
this.viewState = 2; |
|||
}, |
|||
doAdd2() { |
|||
this.viewState = 3; |
|||
}, |
|||
purchase(row) { |
|||
this.dialogTitle = "数据"; |
|||
this.editDialog = true; |
|||
req.selectRecordBySid(row.sid).then((res) => { |
|||
this.form = res.data; |
|||
}); |
|||
}, |
|||
resetState() { |
|||
this.viewState = 1; |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch("tagsView/delView", this.$route); |
|||
this.$router.go(-1); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
.wenjiantit { |
|||
font-size: 16px; |
|||
font-weight: bold; |
|||
margin: 25px 0 10px 0; |
|||
} |
|||
span{ |
|||
margin-left: 20px; |
|||
} |
|||
.forminfo { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
.wenjiantit { |
|||
font-size: 16px; |
|||
font-weight: bold; |
|||
margin: 25px 0 10px 0; |
|||
} |
|||
span { |
|||
margin-left: 20px; |
|||
} |
|||
.forminfo { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
.listcon { |
|||
height: calc(100vh - 250px); |
|||
overflow-y: auto; |
|||
overflow-x: hidden; |
|||
} |
|||
.listcon { |
|||
height: calc(100vh - 250px); |
|||
overflow-y: auto; |
|||
overflow-x: hidden; |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue