xiaozy_0517
xiaozhiyong 2 years ago
parent 3b2691214e
commit e73db5d59f
  1. 152
      src/views/product/components/record.vue
  2. 313
      src/views/product/index.vue
  3. 247
      src/views/refineryInfo/index.vue

@ -1,12 +1,5 @@
<template>
<el-drawer
title="调价记录"
direction="ltr"
size="60%"
:visible.sync="controlWindows.record"
:before-close="closeWindow"
@opened="openDrawer"
>
<el-drawer title="调价记录" direction="ltr" size="60%" :visible.sync="controlWindows.record" :before-close="closeWindow" @opened="openDrawer">
<div class="record">
<div class="frame record-frame">
<el-date-picker
@ -23,47 +16,29 @@
<div class="buttons">
<el-button icon="el-icon-search" @click="search">查询</el-button>
<el-button icon="el-icon-refresh" @click="initDateTime"
>重置</el-button
>
<el-button icon="el-icon-refresh" @click="initDateTime">重置</el-button>
</div>
</div>
<div class="table">
<el-table
v-if="tableHeight"
ref="multipleTable"
:height="tableHeight"
:data="tableData"
style="width: 100%"
:header-cell-style="$utils.cellStyle"
:cell-style="$utils.cellStyle"
>
<el-table v-if="tableHeight" ref="multipleTable" :height="tableHeight" :data="tableData" style="width: 100%">
<el-table-column label="成本价">
<template slot-scope="{ row }">
<p v-if="row.floorPrice">
{{ row.floorPrice }}/{{ row.measurement }}
</p>
<p v-if="row.floorPrice">{{ row.floorPrice }}/{{ row.measurement }}</p>
</template>
</el-table-column>
<el-table-column label="上次成本价">
<template slot-scope="{ row }">
<p v-if="row.lastFloorPrice">
{{ row.lastFloorPrice }}/{{ row.measurement }}
</p>
<p v-if="row.lastFloorPrice">{{ row.lastFloorPrice }}/{{ row.measurement }}</p>
</template>
</el-table-column>
<el-table-column label="企业销售价">
<template slot-scope="{ row }">
<p v-if="row.salePrice2company">
{{ row.salePrice2company }}/{{ row.measurement }}
</p>
<p v-if="row.salePrice2company">{{ row.salePrice2company }}/{{ row.measurement }}</p>
</template>
</el-table-column>
<el-table-column label="上次企业销售价">
<template slot-scope="{ row }">
<p v-if="row.lastSalePrice2company">
{{ row.lastSalePrice2company }}/{{ row.measurement }}
</p></template
<p v-if="row.lastSalePrice2company">{{ row.lastSalePrice2company }}/{{ row.measurement }}</p></template
>
</el-table-column>
<!-- <el-table-column label="个人销售价">
@ -92,11 +67,7 @@
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
class="record-el-pagination"
:parameter="parameter"
@searchAgain="getByPageRecord"
/>
<pagination class="record-el-pagination" :parameter="parameter" @searchAgain="getByPageRecord" />
</div>
</div>
<div class="footer-buttons">
@ -106,12 +77,12 @@
</template>
<script>
import serve from "api/product.js";
import serve from 'api/product.js'
import pagination from "components/pagination/index.vue";
import pagination from 'components/pagination/index.vue'
export default {
props: {
controlWindows: Object,
controlWindows: Object
},
data() {
return {
@ -124,95 +95,82 @@ export default {
pageSize: 10,
total: 0,
params: {
startCreateTime: "",
endCreateTime: "",
},
},
};
startCreateTime: '',
endCreateTime: ''
}
}
}
},
components: {
pagination,
pagination
},
created() {},
mounted() {},
methods: {
openDrawer() {
let { id } = this.controlWindows.addInfo;
let { id } = this.controlWindows.addInfo
if (id) {
this.$nextTick(() => {
this.heightHandle();
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
});
this.initDateTime();
this.parameter.params.productId = id;
this.getByPageRecord();
this.heightHandle()
window.addEventListener('resize', this.$utils.debounce(this.heightHandle, 500))
})
this.initDateTime()
this.parameter.params.productId = id
this.getByPageRecord()
}
},
initDateTime() {
let now = new Date().getTime();
let beforeDay30 = now - 1000 * 60 * 60 * 24 * 30;
let nowRes = this.$utils.parseTime(now);
let beforeDay30Res = this.$utils.parseTime(beforeDay30);
let { y, M, d } = nowRes;
let { y: beforey, M: beforeM, d: befored } = beforeDay30Res;
this.datetime = [
`${beforey}-${beforeM}-${befored} 00:00:00`,
`${y}-${M}-${d} 23:59:59`,
];
this.changeDateTime(this.datetime);
let now = new Date().getTime()
let beforeDay30 = now - 1000 * 60 * 60 * 24 * 30
let nowRes = this.$utils.parseTime(now)
let beforeDay30Res = this.$utils.parseTime(beforeDay30)
let { y, M, d } = nowRes
let { y: beforey, M: beforeM, d: befored } = beforeDay30Res
this.datetime = [`${beforey}-${beforeM}-${befored} 00:00:00`, `${y}-${M}-${d} 23:59:59`]
this.changeDateTime(this.datetime)
},
changeDateTime(val) {
if (val) {
this.parameter.params.startCreateTime = val[0];
this.parameter.params.endCreateTime = val[1];
this.parameter.params.startCreateTime = val[0]
this.parameter.params.endCreateTime = val[1]
}
},
search() {
this.parameter.currentPage = 1;
this.getByPageRecord();
this.parameter.currentPage = 1
this.getByPageRecord()
},
// table
getByPageRecord() {
serve.getByPageRecord(this.parameter).then((res) => {
this.tableData = res.data.list;
this.parameter.total = res.data.totalCount;
});
serve.getByPageRecord(this.parameter).then(res => {
this.tableData = res.data.list
this.parameter.total = res.data.totalCount
})
},
// table height
heightHandle() {
let bodyHeight = document.body.clientHeight;
let drawerHeaderHeight =
this.obtainElement(".el-drawer__header").clientHeight;
let frameHeight = this.obtainElement(".record-frame").clientHeight;
let paginationHeight = this.obtainElement(
".record-el-pagination"
).clientHeight;
this.tableHeight =
bodyHeight - drawerHeaderHeight - frameHeight - paginationHeight - 230;
let bodyHeight = document.body.clientHeight
let drawerHeaderHeight = this.obtainElement('.el-drawer__header').clientHeight
let frameHeight = this.obtainElement('.record-frame').clientHeight
let paginationHeight = this.obtainElement('.record-el-pagination').clientHeight
this.tableHeight = bodyHeight - drawerHeaderHeight - frameHeight - paginationHeight - 230
},
obtainElement(className) {
return document.documentElement.querySelector(className);
return document.documentElement.querySelector(className)
},
closeWindow() {
window.removeEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
this.$emit("closeWindow");
window.removeEventListener('resize', this.$utils.debounce(this.heightHandle, 500))
this.$emit('closeWindow')
this.parameter = {
currentPage: 1,
pageSize: 10,
total: 0,
params: { startCreateTime: "", endCreateTime: "" },
};
this.controlWindows.addInfo = {};
this.controlWindows.record = false;
},
},
};
params: { startCreateTime: '', endCreateTime: '' }
}
this.controlWindows.addInfo = {}
this.controlWindows.record = false
}
}
}
</script>
<style lang="scss" scoped>

@ -1,37 +1,14 @@
<template>
<div class="order">
<div class="frame">
<el-input
class="mr20"
v-model="parameter.params.productName"
placeholder="产品名称"
clearable
></el-input>
<el-select
v-model="parameter.params.productType"
placeholder="产品类型"
clearable
>
<el-option
v-for="(item, index) in productTypeList"
:key="index"
:label="item"
:value="item"
>
</el-option>
<el-input class="mr20" v-model="parameter.params.productName" placeholder="产品名称" clearable></el-input>
<el-select v-model="parameter.params.productType" placeholder="产品类型" clearable>
<el-option v-for="(item, index) in productTypeList" :key="index" :label="item" :value="item"> </el-option>
</el-select>
<!-- 炼厂名称 -->
<autocomplete :params="parameter.params" :config="configAutocomplete" />
<el-input
v-model="parameter.params.belongLibrary"
placeholder="所处炼厂库"
clearable
></el-input>
<el-select
v-model="parameter.params.enableMark"
placeholder="启用禁用"
clearable
>
<el-input v-model="parameter.params.belongLibrary" placeholder="所处炼厂库" clearable></el-input>
<el-select v-model="parameter.params.enableMark" placeholder="启用禁用" clearable>
<el-option label="启用" value="ENABLE"> </el-option>
<el-option label="禁用" value="DISABLE"> </el-option>
</el-select>
@ -54,32 +31,15 @@
:data="tableData"
style="width: 100%"
@selection-change="handleSelectionChange"
:header-cell-style="$utils.cellStyle"
:cell-style="$utils.cellStyle"
>
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column
prop="productName"
label="产品名称"
show-overflow-tooltip
>
</el-table-column>
<el-table-column prop="productName" label="产品名称" show-overflow-tooltip> </el-table-column>
<el-table-column prop="productType" label="产品类型"> </el-table-column>
<el-table-column
prop="refineryName"
label="炼厂名称"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="belongLibrary"
label="所属炼厂库"
show-overflow-tooltip
>
</el-table-column>
<el-table-column prop="refineryName" label="炼厂名称" show-overflow-tooltip> </el-table-column>
<el-table-column prop="belongLibrary" label="所属炼厂库" show-overflow-tooltip> </el-table-column>
<el-table-column prop="orderSerialNumber" label="启用状态" width="80">
<template slot-scope="{ row }">
<el-switch
@ -89,8 +49,8 @@
active-color="#13ce66"
inactive-color="#ff4949"
@change="
(val) => {
switchTrigger(val, row);
val => {
switchTrigger(val, row)
}
"
>
@ -98,19 +58,13 @@
</template>
</el-table-column>
<el-table-column prop="refineryLevel" label="成本价" width="110">
<template slot-scope="{ row }">
{{ row.floorPrice | toNumberFixed }}/{{ row.measurement }}
</template>
<template slot-scope="{ row }"> {{ row.floorPrice | toNumberFixed }}/{{ row.measurement }} </template>
</el-table-column>
<el-table-column prop="refineryLevel" label="企业销售价" width="110">
<template slot-scope="{ row }">
{{ row.salePrice2company | toNumberFixed }}/{{ row.measurement }}
</template>
<template slot-scope="{ row }"> {{ row.salePrice2company | toNumberFixed }}/{{ row.measurement }} </template>
</el-table-column>
<el-table-column prop="refineryLevel" label="个人销售价" width="110">
<template slot-scope="{ row }">
{{ row.salePrice2personal | toNumberFixed }}/{{ row.measurement }}
</template>
<template slot-scope="{ row }"> {{ row.salePrice2personal | toNumberFixed }}/{{ row.measurement }} </template>
</el-table-column>
<el-table-column label="时间" width="235">
<template slot-scope="{ row }">
@ -118,20 +72,18 @@
创建时间 <span>{{ row.createTime }}</span>
</p>
<p class="gray">
更新时间 <span>{{ row.updateTime || " - -" }}</span>
更新时间 <span>{{ row.updateTime || ' - -' }}</span>
</p>
</template>
</el-table-column>
<el-table-column label="操作" width="210">
<template slot-scope="{ row }">
<span class="el-dropdown-link" @click="detail(row)">详情</span>
<span class="el-dropdown-link special" @click="adjustPrice(row)"
>调价</span
>
<span class="el-dropdown-link special" @click="adjustPrice(row)">调价</span>
<el-dropdown
@command="
(val) => {
commandPrice(val, row);
val => {
commandPrice(val, row)
}
"
>
@ -142,27 +94,18 @@
<el-dropdown-item command="record">调价记录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<span
v-show="row.enableMark == 'ENABLE'"
class="el-dropdown-link"
@click="updateCreate(row)"
>下单</span
>
<span v-show="row.enableMark == 'ENABLE'" class="el-dropdown-link" @click="updateCreate(row)">下单</span>
<el-dropdown
@command="
(val) => {
commandMore(val, row);
val => {
commandMore(val, row)
}
"
>
<span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<span class="el-dropdown-link"> 更多<i class="el-icon-arrow-down el-icon--right"></i> </span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="base">修改基础信息</el-dropdown-item>
<el-dropdown-item command="settle"
>修改结算账户</el-dropdown-item
>
<el-dropdown-item command="settle">修改结算账户</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
@ -174,25 +117,15 @@
<!--新增产品 -->
<add :controlWindows="controlWindows" @closeWindow="search" />
<!-- 下单 -->
<create :controlWindows="controlWindows" @closeWindow="search" />
<create :controlWindows="controlWindows" @closeWindow="search" />
<!-- 调价记录 -->
<record :controlWindows="controlWindows" />
<!-- 批量 -->
<batch
:controlWindows="controlWindows"
:multipleRowList="multipleRowList"
@closeWindow="search"
/>
<batch :controlWindows="controlWindows" :multipleRowList="multipleRowList" @closeWindow="search" />
<!-- 调价 -->
<adjust :controlWindows="controlWindows" @closeWindow="search" />
<!-- 详情 -->
<el-drawer
title="详情"
direction="ltr"
size="60%"
:withHeader="false"
:visible.sync="controlWindows.detail"
>
<el-drawer title="详情" direction="ltr" size="60%" :withHeader="false" :visible.sync="controlWindows.detail">
<general-details
title="详情"
:isHeader="true"
@ -203,7 +136,7 @@
>
<template #enableMark>
<p>
{{ oilCompanyMatch[0].enableMark === "ENABLE" ? "启用" : "禁用" }}
{{ oilCompanyMatch[0].enableMark === 'ENABLE' ? '启用' : '禁用' }}
</p>
</template>
</general-details>
@ -212,18 +145,18 @@
</template>
<script>
import serve from "api/product.js";
import refineryInfoServe from "api/refineryInfo.js";
import serve from 'api/product.js'
import refineryInfoServe from 'api/refineryInfo.js'
import add from "./components/add.vue";
import create from "./components/create.vue";
import record from "./components/record.vue";
import batch from "./components/batch.vue";
import adjust from "./components/adjust.vue";
import add from './components/add.vue'
import create from './components/create.vue'
import record from './components/record.vue'
import batch from './components/batch.vue'
import adjust from './components/adjust.vue'
import autocomplete from "components/autocomplete/index.vue";
import pagination from "components/pagination/index.vue";
import generalDetails from "components/generalDetails/index.vue";
import autocomplete from 'components/autocomplete/index.vue'
import pagination from 'components/pagination/index.vue'
import generalDetails from 'components/generalDetails/index.vue'
export default {
components: {
@ -235,16 +168,16 @@ export default {
pagination,
autocomplete,
generalDetails,
generalDetails
},
filters: {
toNumberFixed(val) {
if (val) {
return Number(val).toFixed(2);
return Number(val).toFixed(2)
} else {
return "暂无";
return '暂无'
}
},
}
},
data() {
return {
@ -255,16 +188,16 @@ export default {
create: false,
record: false,
batch: false,
adjust: false,
adjust: false
},
productTypeList: ["0#柴", "-10#柴", "92#汽", "95#汽"],
productTypeList: ['0#柴', '-10#柴', '92#汽', '95#汽'],
configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity,
autocompleteKey: "refineryName",
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
autocompleteKey: 'refineryName',
labelKey: 'refineryName',
valueKey: 'id',
placeholder: '炼厂名称',
querykey: 'refineryId'
},
refineryList: [],
multipleRowList: [],
@ -274,128 +207,125 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
params: {},
params: {}
},
oilCompanyMatch: {},
mappingData: [
{
carTitle: "",
carTitle: '',
carItems: [
{ label: "炼厂id", value: "refineryId" },
{ label: "炼厂名称", value: "refineryName" },
{ label: "产品名称", value: "productName" },
{ label: "产品类型", value: "productType" },
{ label: "成本价", value: "floorPrice" },
{ label: "企业销售价", value: "salePrice2company" },
{ label: "个人销售价", value: "salePrice2personal" },
{ label: "计量单位", value: "measurement" },
{ label: "启用/禁用", value: "enableMark" },
{ label: "所属炼厂库名", value: "belongLibrary" },
{ label: "创建用户ID", value: "createUser" },
{ label: "创建时间", value: "createTime" },
{ label: "修改用户ID", value: "updateUser" },
{ label: "修改时间", value: "updateTime" },
],
},
],
};
{ label: '炼厂id', value: 'refineryId' },
{ label: '炼厂名称', value: 'refineryName' },
{ label: '产品名称', value: 'productName' },
{ label: '产品类型', value: 'productType' },
{ label: '成本价', value: 'floorPrice' },
{ label: '企业销售价', value: 'salePrice2company' },
{ label: '个人销售价', value: 'salePrice2personal' },
{ label: '计量单位', value: 'measurement' },
{ label: '启用/禁用', value: 'enableMark' },
{ label: '所属炼厂库名', value: 'belongLibrary' },
{ label: '创建用户ID', value: 'createUser' },
{ label: '创建时间', value: 'createTime' },
{ label: '修改用户ID', value: 'updateUser' },
{ label: '修改时间', value: 'updateTime' }
]
}
]
}
},
mounted() {
this.$nextTick(() => {
this.heightHandle();
});
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
this.heightHandle()
})
window.addEventListener('resize', this.$utils.debounce(this.heightHandle, 500))
},
created() {
this.getByPage();
this.getByPage()
},
methods: {
//
handleSelectionChange(val) {
this.multipleRowList = val;
this.multipleRowList = val
},
search() {
this.parameter.currentPage = 1;
this.getByPage();
this.parameter.currentPage = 1
this.getByPage()
},
//table list
getByPage() {
serve.getByPage(this.parameter).then((res) => {
this.tableData = res.data.list;
this.parameter.total = res.data.totalCount;
});
serve.getByPage(this.parameter).then(res => {
this.tableData = res.data.list
this.parameter.total = res.data.totalCount
})
},
//
addition() {
this.controlWindows.addInfo.title = "产品新增";
this.controlWindows.add = true;
this.controlWindows.addInfo.title = '产品新增'
this.controlWindows.add = true
},
//
createOrder(row) {
this.controlWindows.addInfo = {};
this.controlWindows.addInfo.title = "创建订单";
this.controlWindows.create = true;
console.log(this.controlWindows, "新增");
this.controlWindows.addInfo = {}
this.controlWindows.addInfo.title = '创建订单'
this.controlWindows.create = true
console.log(this.controlWindows, '新增')
},
//
updateCreate(row) {
this.controlWindows.addInfo = {
title: "创建订单",
...row,
};
this.controlWindows.create = true;
console.log("修改");
title: '创建订单',
...row
}
this.controlWindows.create = true
console.log('修改')
},
//
detail(row) {
this.oilCompanyMatch = [row];
this.controlWindows.detail = true;
this.oilCompanyMatch = [row]
this.controlWindows.detail = true
},
//
adjustPrice(row) {
this.controlWindows.addInfo = { id: row.id };
this.controlWindows.adjust = true;
this.controlWindows.addInfo = { id: row.id }
this.controlWindows.adjust = true
},
//
commandMore(val, row) {
if (val === "base") {
if (val === 'base') {
this.controlWindows.addInfo = {
title: "产品修改",
...row,
};
this.controlWindows.add = true;
title: '产品修改',
...row
}
this.controlWindows.add = true
}
},
//
commandPrice(val, row) {
if (val === "record") {
this.controlWindows.addInfo = { id: row.id };
this.controlWindows.record = true;
if (val === 'record') {
this.controlWindows.addInfo = { id: row.id }
this.controlWindows.record = true
}
},
//
switchTrigger(val, row) {
row.enableMark = val === "ENABLE" ? "DISENABLE" : "ENABLE";
row.enableMark = val === 'ENABLE' ? 'DISENABLE' : 'ENABLE'
// return;
serve
.updateBatchEnable([
{
id: row.id,
enableMark: val,
},
enableMark: val
}
])
.then((res) => {
.then(res => {
if (res.code === 20000) {
this.getByPage();
this.getByPage()
}
// this.$message.success(res.msg);
// this.closeWindow();
});
})
// serve
// .update({
// id: row.id,
@ -410,33 +340,32 @@ export default {
//
batchHandler() {
if (!this.multipleRowList.length) {
this.$message.warning("请至少选择一条数据");
return;
this.$message.warning('请至少选择一条数据')
return
}
this.controlWindows.batch = true;
this.controlWindows.batch = true
},
//
reset() {
Object.assign(this.parameter, {
currentPage: 1,
pageSize: 10,
params: {},
});
params: {}
})
},
// table height
heightHandle() {
let bodyHeight = document.body.clientHeight;
let frameHeight = this.obtainElement(".frame").clientHeight;
let operationHeight = this.obtainElement(".operation").clientHeight;
let paginationHeight = this.obtainElement(".el-pagination").clientHeight;
this.tableHeight =
bodyHeight - frameHeight - operationHeight - paginationHeight - 145;
let bodyHeight = document.body.clientHeight
let frameHeight = this.obtainElement('.frame').clientHeight
let operationHeight = this.obtainElement('.operation').clientHeight
let paginationHeight = this.obtainElement('.el-pagination').clientHeight
this.tableHeight = bodyHeight - frameHeight - operationHeight - paginationHeight - 145
},
obtainElement(className) {
return document.documentElement.querySelector(className);
},
},
};
return document.documentElement.querySelector(className)
}
}
}
</script>
<style lang="scss" scoped>

@ -1,41 +1,19 @@
<template>
<div class="order">
<div class="frame">
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocomplete"
/>
<autocomplete class="mr20" :params="parameter.params" :config="configAutocomplete" />
<el-select
v-model="parameter.params.refineryType"
placeholder="炼厂类型"
clearable
>
<el-option
v-for="item in refineryTypeEnum"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
<el-select v-model="parameter.params.refineryType" placeholder="炼厂类型" clearable>
<el-option v-for="item in refineryTypeEnum" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
<el-select
v-model="parameter.params.refineryLevel"
placeholder="炼厂等级"
clearable
>
<el-select v-model="parameter.params.refineryLevel" placeholder="炼厂等级" clearable>
<el-option label="A" value="A"></el-option>
<el-option label="B" value="B"></el-option>
<el-option label="C" value="C"></el-option>
<el-option label="D" value="D"></el-option>
<el-option label="E" value="E"></el-option>
</el-select>
<el-select
v-model="parameter.params.enableMark"
placeholder="启用禁用"
clearable
>
<el-select v-model="parameter.params.enableMark" placeholder="启用禁用" clearable>
<el-option label="启用" value="ENABLE"> </el-option>
<el-option label="禁用" value="DISABLE"> </el-option>
</el-select>
@ -48,35 +26,17 @@
<div class="operation">
<el-button @click="addition">炼厂入驻</el-button>
</div>
<el-table
v-if="tableHeight"
ref="multipleTable"
:height="tableHeight"
:data="tableData"
style="width: 100%"
:header-cell-style="$utils.cellStyle"
:cell-style="$utils.cellStyle"
>
<el-table-column
prop="refineryName"
label="炼厂名称"
show-overflow-tooltip
>
</el-table-column>
<el-table v-if="tableHeight" ref="multipleTable" :height="tableHeight" :data="tableData" style="width: 100%">
<el-table-column prop="refineryName" label="炼厂名称" show-overflow-tooltip> </el-table-column>
<el-table-column prop="orderSerialNumber" label="炼厂类型" width="90">
<template slot-scope="{ row }">
<p v-if="row.refineryType">
{{
refineryTypeEnum.find((item) => item.value == row.refineryType)
.label
}}
{{ refineryTypeEnum.find(item => item.value == row.refineryType).label }}
</p>
</template>
</el-table-column>
<el-table-column prop="refineryLevel" label="炼厂等级" width="90">
</el-table-column>
<el-table-column prop="address" label="炼厂地址" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="refineryLevel" label="炼厂等级" width="90"> </el-table-column>
<el-table-column prop="address" label="炼厂地址" show-overflow-tooltip> </el-table-column>
<el-table-column prop="orderSerialNumber" label="启用状态" width="80">
<template slot-scope="{ row }">
<el-switch
@ -86,42 +46,31 @@
active-color="#13ce66"
inactive-color="#ff4949"
@change="
(val) => {
switchTrigger(val, row);
val => {
switchTrigger(val, row)
}
"
>
</el-switch>
</template>
</el-table-column>
<el-table-column prop="productCount" label="启用产品数量" width="120">
</el-table-column>
<el-table-column prop="productCount" label="启用产品数量" width="120"> </el-table-column>
<el-table-column label="时间" width="235">
<template slot-scope="{ row }">
<p class="gray">
创建时间 <span>{{ row.createTime }}</span>
</p>
<p class="gray">
更新时间 <span>{{ row.updateTime || " - -" }}</span>
更新时间 <span>{{ row.updateTime || ' - -' }}</span>
</p>
</template>
</el-table-column>
<el-table-column prop="orderSerialNumber" label="操作" width="150">
<template slot-scope="{ row }">
<el-link type="primary" :underline="false" @click="update(row)"
>修改</el-link
>
<el-link type="primary" :underline="false" @click="detail(row)"
>详情</el-link
>
<el-popconfirm
title="确定删除该条数据吗?"
icon-color="red"
@confirm="deleteRow(row)"
>
<el-link slot="reference" type="primary" :underline="false"
>删除</el-link
>
<el-link type="primary" :underline="false" @click="update(row)">修改</el-link>
<el-link type="primary" :underline="false" @click="detail(row)">详情</el-link>
<el-popconfirm title="确定删除该条数据吗?" icon-color="red" @confirm="deleteRow(row)">
<el-link slot="reference" type="primary" :underline="false">删除</el-link>
</el-popconfirm>
</template>
</el-table-column>
@ -129,19 +78,9 @@
<!-- 分页 -->
<pagination :parameter="parameter" @searchAgain="getByPage" />
</div>
<add
:controlWindows="controlWindows"
:refineryTypeEnum="refineryTypeEnum"
@closeWindow="search"
/>
<add :controlWindows="controlWindows" :refineryTypeEnum="refineryTypeEnum" @closeWindow="search" />
<el-drawer
title="详情"
direction="ltr"
size="60%"
:withHeader="false"
:visible.sync="controlWindows.detail"
>
<el-drawer title="详情" direction="ltr" size="60%" :withHeader="false" :visible.sync="controlWindows.detail">
<general-details
title="详情"
:isHeader="true"
@ -152,16 +91,12 @@
>
<template #refineryType>
<p>
{{
refineryTypeEnum.find(
(item) => item.value == oilCompanyMatch[0].refineryType
).label
}}
{{ refineryTypeEnum.find(item => item.value == oilCompanyMatch[0].refineryType).label }}
</p>
</template>
<template #enableMark>
<p>
{{ oilCompanyMatch[0].enableMark === "ENABLE" ? "启用" : "禁用" }}
{{ oilCompanyMatch[0].enableMark === 'ENABLE' ? '启用' : '禁用' }}
</p>
</template>
</general-details>
@ -170,22 +105,22 @@
</template>
<script>
import serve from "api/refineryInfo.js";
import serve from 'api/refineryInfo.js'
import add from "./components/add.vue";
import add from './components/add.vue'
import pagination from "components/pagination/index.vue";
import autocomplete from "components/autocomplete/index.vue";
import generalDetails from "components/generalDetails/index.vue";
import pagination from 'components/pagination/index.vue'
import autocomplete from 'components/autocomplete/index.vue'
import generalDetails from 'components/generalDetails/index.vue'
import { refineryTypeEnum } from "utils/dataType.js";
import { refineryTypeEnum } from 'utils/dataType.js'
export default {
components: {
add,
pagination,
autocomplete,
generalDetails,
generalDetails
},
data() {
return {
@ -193,15 +128,15 @@ export default {
controlWindows: {
add: false,
addInfo: {},
detail: false,
detail: false
},
configAutocomplete: {
serveTarget: serve.findByEntity,
autocompleteKey: "refineryName",
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "id",
autocompleteKey: 'refineryName',
labelKey: 'refineryName',
valueKey: 'id',
placeholder: '炼厂名称',
querykey: 'id'
},
refineryList: [],
tableHeight: 0,
@ -211,115 +146,111 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
params: {},
params: {}
},
oilCompanyMatch: {},
mappingData: [
{
carTitle: "",
carTitle: '',
carItems: [
{ label: "炼厂名称", value: "refineryName" },
{ label: "炼厂类型", value: "refineryType" },
{ label: "启用状态", value: "enableMark" },
{ label: "炼厂等级", value: "refineryLevel" },
{ label: "炼厂地址", value: "address" },
{ label: "创建用户ID", value: "createUser" },
{ label: "创建时间", value: "createTime" },
{ label: "修改用户ID", value: "updateUser" },
{ label: "修改时间", value: "updateTime" },
],
},
],
};
{ label: '炼厂名称', value: 'refineryName' },
{ label: '炼厂类型', value: 'refineryType' },
{ label: '启用状态', value: 'enableMark' },
{ label: '炼厂等级', value: 'refineryLevel' },
{ label: '炼厂地址', value: 'address' },
{ label: '创建用户ID', value: 'createUser' },
{ label: '创建时间', value: 'createTime' },
{ label: '修改用户ID', value: 'updateUser' },
{ label: '修改时间', value: 'updateTime' }
]
}
]
}
},
mounted() {
this.$nextTick(() => {
this.heightHandle();
});
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
this.heightHandle()
})
window.addEventListener('resize', this.$utils.debounce(this.heightHandle, 500))
},
created() {
this.getByPage();
this.getByPage()
},
methods: {
search() {
this.parameter.currentPage = 1;
this.getByPage();
this.parameter.currentPage = 1
this.getByPage()
},
//table list
getByPage() {
serve.getByPage(this.parameter).then((res) => {
this.tableData = res.data.list;
this.parameter.total = res.data.totalCount;
});
serve.getByPage(this.parameter).then(res => {
this.tableData = res.data.list
this.parameter.total = res.data.totalCount
})
},
//
addition() {
this.controlWindows.addInfo.title = "炼厂入驻";
this.controlWindows.add = true;
this.controlWindows.addInfo.title = '炼厂入驻'
this.controlWindows.add = true
},
//
update(row) {
this.controlWindows.addInfo.title = "炼厂修改";
Object.assign(this.controlWindows.addInfo, row);
this.controlWindows.add = true;
this.controlWindows.addInfo.title = '炼厂修改'
Object.assign(this.controlWindows.addInfo, row)
this.controlWindows.add = true
},
//
detail(row) {
this.oilCompanyMatch = [row];
this.controlWindows.detail = true;
this.oilCompanyMatch = [row]
this.controlWindows.detail = true
},
//
deleteRow(row) {
serve
.deleteRow({
id: row.id,
id: row.id
})
.then(res => {
this.$message.success(res.msg)
this.getByPage()
})
.then((res) => {
this.$message.success(res.msg);
this.getByPage();
});
},
//
switchTrigger(val, row) {
row.enableMark = row.enableMark;
row.enableMark = row.enableMark
serve
.update({
id: row.id,
enableMark: val,
enableMark: val
})
.then((res) => {
.then(res => {
if (res.code === 20000) {
this.getByPage();
} else this.$message.error(res.msg);
});
this.getByPage()
} else this.$message.error(res.msg)
})
},
//
reset() {
Object.assign(this.parameter, {
currentPage: 1,
pageSize: 10,
params: {},
});
params: {}
})
},
// table height
heightHandle() {
let bodyHeight = document.body.clientHeight;
let frameHeight = this.obtainElement(".frame").clientHeight;
let operationHeight = this.obtainElement(".operation").clientHeight;
let paginationHeight = this.obtainElement(".el-pagination").clientHeight;
this.tableHeight =
bodyHeight - frameHeight - operationHeight - paginationHeight - 145;
let bodyHeight = document.body.clientHeight
let frameHeight = this.obtainElement('.frame').clientHeight
let operationHeight = this.obtainElement('.operation').clientHeight
let paginationHeight = this.obtainElement('.el-pagination').clientHeight
this.tableHeight = bodyHeight - frameHeight - operationHeight - paginationHeight - 145
},
obtainElement(className) {
return document.documentElement.querySelector(className);
},
},
};
return document.documentElement.querySelector(className)
}
}
}
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save