|
@@ -0,0 +1,197 @@
|
|
|
+<template>
|
|
|
+ <a-card size="small" :bordered="false" class="approveStore-wrap">
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div ref="tableSearch" class="table-page-search-wrapper" v-if="searchData&&Object.keys(searchData).length==0">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="日期">
|
|
|
+ <rangeDate ref="rangeDate" v-model="time" @change="dateChange" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="经销商">
|
|
|
+ <storeList ref="storeList" @change="custChange"></storeList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="车架号">
|
|
|
+ <a-input allowClear v-model.trim="queryParam.vin" placeholder="请输入车架号" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <div>
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="approveStore-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="approveStore-reset">重置</a-button>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable fixPagination"
|
|
|
+ ref="table"
|
|
|
+ :style="{ height:tableHeight+84.5+'px'}"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>
|
|
|
+ <!-- 图标-->
|
|
|
+ <template slot="iconVal" slot-scope="text, record">
|
|
|
+ <img :src="record.carIcon" width="30" height="30" alt="图片走丢了" @click="inited(text)"/>
|
|
|
+ </template>
|
|
|
+ <!-- 配件 -->
|
|
|
+ <template slot="partCode" slot-scope="text, record">
|
|
|
+ <a-tooltip placement="left">
|
|
|
+ <template slot="title">
|
|
|
+ {{ record.partCode }}
|
|
|
+ </template>
|
|
|
+ <span>...</span>
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// 组件
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
+import storeList from '@/views/common/storeList.vue'
|
|
|
+// 接口
|
|
|
+import { vinPartLogRecordList } from '@/api/vinPartLog'
|
|
|
+export default {
|
|
|
+ components: { STable, VSelect, rangeDate, storeList },
|
|
|
+ props: {
|
|
|
+ searchData: { // 弹框显示状态
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ tableHeight: 0, // 表格高度
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ // 查询条件
|
|
|
+ queryParam: {
|
|
|
+ dealerSn: undefined, // 经销商sn
|
|
|
+ beginDate: undefined, // 开始日期
|
|
|
+ endDate: undefined, // 结束日期
|
|
|
+ vin: undefined
|
|
|
+ },
|
|
|
+ time: [], // 查询日期
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
|
|
|
+ { title: '时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '经销商名称', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '车架号', dataIndex: 'vin', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '品牌', dataIndex: 'carBrandName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '车型', dataIndex: 'carModelName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '年款', dataIndex: 'carModelYear', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '排量', dataIndex: 'carDisplacement', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '图标', dataIndex: 'carIcon', width: '8%', align: 'center', scopedSlots: { customRender: 'iconVal' } },
|
|
|
+ { title: '配置', dataIndex: 'carConfLevel', width: '26%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '配件', dataIndex: 'partCode', width: '6%', align: 'center', scopedSlots: { customRender: 'partCode' }, ellipsis: true }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ let parames = Object.assign(parameter, this.queryParam)
|
|
|
+ if (this.searchData && Object.keys(this.searchData).length > 0) {
|
|
|
+ parames = Object.assign(parames, this.searchData)
|
|
|
+ }
|
|
|
+ return vinPartLogRecordList(parames).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 时间 change
|
|
|
+ dateChange (date) {
|
|
|
+ this.queryParam.beginDate = date[0] + ' 00:00:00'
|
|
|
+ this.queryParam.endDate = date[1] + ' 23:59:60'
|
|
|
+ },
|
|
|
+ // 经销商查询
|
|
|
+ custChange (val) {
|
|
|
+ this.queryParam.dealerSn = val ? val.key : undefined
|
|
|
+ },
|
|
|
+ inited (viewer) {
|
|
|
+ if (viewer && viewer.length) {
|
|
|
+ this.$info({
|
|
|
+ title: '图片预览',
|
|
|
+ okText: '关闭',
|
|
|
+ width: '400px',
|
|
|
+ content: (h) => { return h('img', { attrs: { src: viewer }, style: { width: '100%' } }) }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.time = []
|
|
|
+ this.queryParam.delearSn = undefined
|
|
|
+ this.queryParam.beginDate = undefined
|
|
|
+ this.queryParam.endDate = undefined
|
|
|
+ this.queryParam.vin = undefined
|
|
|
+ if (this.searchData && Object.keys(this.searchData).length == 0) {
|
|
|
+ this.$refs.rangeDate.resetDate(this.time)
|
|
|
+ this.$refs.storeList.resetForm()
|
|
|
+ }
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ setTableH () {
|
|
|
+ const tableSearchH = this.searchData && Object.keys(this.searchData).length > 0 ? 120 : this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 330
|
|
|
+ },
|
|
|
+ pageInit () {
|
|
|
+ const _this = this
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ _this.setTableH()
|
|
|
+ _this.resetSearchForm()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
+ this.pageInit()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
+ this.setTableH()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
+ this.pageInit()
|
|
|
+ }
|
|
|
+ // 仅刷新列表,不重置页面
|
|
|
+ if (this.$store.state.app.updateList) {
|
|
|
+ this.setTableH()
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|