|
|
@@ -0,0 +1,403 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-breadcrumb class="heading">
|
|
|
+ <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>大港油田{{cardTitle}}目录</el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ <el-card class="box-card" style="height: calc(100vh - 115px);">
|
|
|
+ <div slot="header">
|
|
|
+ <span>
|
|
|
+ <i class="icon icon-table2"></i> 大港油田{{cardTitle}}目录
|
|
|
+ </span>
|
|
|
+ <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
|
|
|
+ <el-form-item label="时间">
|
|
|
+ <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
|
|
|
+ start-placeholder="有效期" end-placeholder="有效期"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <!--<el-form-item label="准入类型">-->
|
|
|
+ <!--<el-select size="mini" style="width:100px" v-model="searchForm.SupplierTypeName" placeholder="准入类别">-->
|
|
|
+ <!--<el-option label="全部" value=""></el-option>-->
|
|
|
+ <!--<el-option label="物资类" value="物资类"></el-option>-->
|
|
|
+ <!--<el-option label="基建类" value="基建类"></el-option>-->
|
|
|
+ <!--<el-option label="技术服务类" value="技术服务类"></el-option>-->
|
|
|
+ <!--</el-select>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-dropdown split-button type="primary" size="mini" @click="handleSearch" @command="searchCommand">
|
|
|
+ 查询
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="clear">查询重置</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="mini" @click="addOilcatalog">添加</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <el-table :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby" size="mini">
|
|
|
+ <el-table-column label="操作" min-width="100px" align="center" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" size="mini" @click="editOilcatalog(scope.row)" plain>编辑</el-button>
|
|
|
+ <el-popover placement="top" title="提示">
|
|
|
+ <el-alert
|
|
|
+ title=""
|
|
|
+ description="确认要删除吗?"
|
|
|
+ type="warning"
|
|
|
+ :closable="false">
|
|
|
+ </el-alert>
|
|
|
+ <br/>
|
|
|
+ <div style="text-align: right; margin: 0">
|
|
|
+ <el-button type="danger" size="mini" @click="deleteEntity(scope.row)">删除</el-button>
|
|
|
+ </div>
|
|
|
+ <el-button slot="reference" type="danger" title="删除" style="margin-left:10px" size="mini" plain>删除</el-button>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <!--<el-table-column sortable min-width="80" align="center" show-overflow-tooltip prop="SupplierName" label="序号"></el-table-column>-->
|
|
|
+ <el-table-column sortable min-width="120" align="center" show-overflow-tooltip prop="CompanyName" label="企业名称"></el-table-column>
|
|
|
+ <el-table-column sortable min-width="500" align="center" show-overflow-tooltip prop="Business" label="业务范围"></el-table-column>
|
|
|
+ <el-table-column sortable min-width="200" align="center" show-overflow-tooltip label="有效期起止">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{(jstimehandle(scope.row.ValidityFrom))}}--{{(jstimehandle(scope.row.ValidityTo))}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable min-width="120" align="center" show-overflow-tooltip prop="Remark" label="备注"></el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
+ :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
|
|
|
+ </el-pagination>
|
|
|
+ </el-card>
|
|
|
+ <el-dialog :title="addShowTitle"
|
|
|
+ :visible.sync="addshow"
|
|
|
+ width="60%">
|
|
|
+ <el-form label-width="135px" ref="EntityForm" :model="formData">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="供方名称" prop="CompanyName" :rules="{ required: true, message: '供方名称不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-model="formData.CompanyName" :maxlength="255" placeholder="请输入" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="有效期" prop="ValidityDate" >
|
|
|
+ <el-date-picker style="width: 220px" v-model="ValidityDate" type="daterange" range-separator="至"
|
|
|
+ start-placeholder="有效期起" end-placeholder="有效期止"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="营业范围" prop="Business" :rules="{ required: true, message: '营业范围不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-model="formData.Business" type="textarea" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input v-model="formData.Remark" placeholder="请输入" type="textarea" style="width: 100%">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item style="text-align: center;">
|
|
|
+ <el-button type="primary" size="mini" @click="saveOilcatalog">保存</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import { mapGetters } from 'vuex'
|
|
|
+ import api from '@/api/oilsupplier/oilcatalog'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ authUser: 'authUser'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ name: 'oilcatalog',
|
|
|
+
|
|
|
+ data () {
|
|
|
+ var validDate = (rule, value, callback) => {
|
|
|
+ if (!value || !value[0] || !value[1]) {
|
|
|
+ callback(new Error('请选择时间'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ cardTitle: '',
|
|
|
+ catalogType: '',
|
|
|
+ addShowTitle: '添加目录',
|
|
|
+ addshow: false,
|
|
|
+
|
|
|
+ // 分页参数
|
|
|
+ size: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ currentItemCount: 0,
|
|
|
+
|
|
|
+ // 查询时间
|
|
|
+ CreateOn: null,
|
|
|
+ ValidityDate: null,
|
|
|
+
|
|
|
+ // 列表数据
|
|
|
+ entityList: [],
|
|
|
+ // 列表排序
|
|
|
+ Column: {
|
|
|
+ Order: '',
|
|
|
+ Prop: ''
|
|
|
+ },
|
|
|
+ // 查询项
|
|
|
+ searchFormReset: {},
|
|
|
+ searchForm: {
|
|
|
+
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ ValidityDate: [{
|
|
|
+ validator: validDate,
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ Id: '',
|
|
|
+ CatalogType: '',
|
|
|
+ OrderNo: '',
|
|
|
+ CompanyName: '',
|
|
|
+ Business: '',
|
|
|
+ ValidityFrom: null,
|
|
|
+ ValidityTo: null,
|
|
|
+ Remark: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ $route (val) {
|
|
|
+ this.formData.CatalogType = parseInt(val.query.catalogType)
|
|
|
+ if (val.query.catalogType === '1') {
|
|
|
+ this.cardTitle = '自建项目'
|
|
|
+ } else if (val.query.catalogType === '2') {
|
|
|
+ this.cardTitle = '优势项目'
|
|
|
+ } else if (val.query.catalogType === '3') {
|
|
|
+ this.cardTitle = '关联交易'
|
|
|
+ } else if (val.query.catalogType === '4') {
|
|
|
+ this.cardTitle = '战略合作'
|
|
|
+ } else if (val.query.catalogType === '5') {
|
|
|
+ this.cardTitle = '特殊业务'
|
|
|
+ } else if (val.query.catalogType === '6') {
|
|
|
+ this.cardTitle = '创收业务'
|
|
|
+ }
|
|
|
+ this.initDatas()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.formData.CatalogType = parseInt(this.$route.query.catalogType)
|
|
|
+ if (this.$route.query.catalogType === '1') {
|
|
|
+ this.cardTitle = '自建项目'
|
|
|
+ } else if (this.$route.query.catalogType === '2') {
|
|
|
+ this.cardTitle = '优势项目'
|
|
|
+ } else if (this.$route.query.catalogType === '3') {
|
|
|
+ this.cardTitle = '关联交易'
|
|
|
+ } else if (this.$route.query.catalogType === '4') {
|
|
|
+ this.cardTitle = '战略合作'
|
|
|
+ } else if (this.$route.query.catalogType === '5') {
|
|
|
+ this.cardTitle = '特殊业务'
|
|
|
+ } else if (this.$route.query.catalogType === '6') {
|
|
|
+ this.cardTitle = '创收业务'
|
|
|
+ }
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ addOilcatalog () {
|
|
|
+ this.addshow = true
|
|
|
+ this.formData.Id = ''
|
|
|
+ this.formData.CompanyName = ''
|
|
|
+ this.formData.Business = ''
|
|
|
+ this.formData.Remark = ''
|
|
|
+ this.ValidityDate = null
|
|
|
+ },
|
|
|
+ editOilcatalog (row) {
|
|
|
+ this.addshow = true
|
|
|
+ this.formData.Id = row.Id
|
|
|
+ this.formData.CatalogType = row.CatalogType
|
|
|
+ this.formData.CompanyName = row.CompanyName
|
|
|
+ this.formData.Business = row.Business
|
|
|
+ this.formData.Remark = row.Remark
|
|
|
+ this.ValidityDate = [new Date(row.ValidityFrom), new Date(row.ValidityTo)]
|
|
|
+ },
|
|
|
+ saveOilcatalog () {
|
|
|
+ if (this.ValidityDate && this.ValidityDate.length === 2) {
|
|
|
+ this.ValidityDate[1].setHours(23)
|
|
|
+ this.ValidityDate[1].setMinutes(59)
|
|
|
+ this.ValidityDate[1].setSeconds(59)
|
|
|
+ this.formData.ValidityFrom = this.ValidityDate[0]
|
|
|
+ this.formData.ValidityTo = this.ValidityDate[1]
|
|
|
+ }
|
|
|
+ if (this.formData.Id > 0) {
|
|
|
+ this.editEntity()
|
|
|
+ } else {
|
|
|
+ this.addEntity()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editEntity () {
|
|
|
+ this.$refs['EntityForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.addshow = false
|
|
|
+ this.initDatas()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addEntity () {
|
|
|
+ this.$refs['EntityForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ api.addEntity(this.formData, this.$axios).then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.addshow = false
|
|
|
+ this.initDatas()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initDatas () {
|
|
|
+ // 分页及列表条件
|
|
|
+ let params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ Order: this.Column.Order,
|
|
|
+ Prop: this.Column.Prop,
|
|
|
+ CatalogType: this.formData.CatalogType
|
|
|
+ }
|
|
|
+ let myCreateOn = []
|
|
|
+ // 解析时间
|
|
|
+ if (this.CreateOn && this.CreateOn.length === 2) {
|
|
|
+ this.CreateOn[1].setHours(23)
|
|
|
+ this.CreateOn[1].setMinutes(59)
|
|
|
+ this.CreateOn[1].setSeconds(59)
|
|
|
+ myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
|
|
|
+ myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
|
|
|
+ }
|
|
|
+ // 查询条件
|
|
|
+ Object.assign(params, this.searchForm)
|
|
|
+ api.getList(myCreateOn, params, this.$axios).then(res => {
|
|
|
+ this.entityList = res.data.items
|
|
|
+ this.currentItemCount = res.data.currentItemCount
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ searchCommand (command) {
|
|
|
+ if (command === 'search') {
|
|
|
+ this.dialogVisible = true
|
|
|
+ } else if (command === 'clear') {
|
|
|
+ this.clearSearch()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 列表排序功能
|
|
|
+ orderby (column) {
|
|
|
+ if (column.order === 'ascending') {
|
|
|
+ this.Column.Order = 'asc'
|
|
|
+ } else if (column.order === 'descending') {
|
|
|
+ this.Column.Order = 'desc'
|
|
|
+ }
|
|
|
+ this.Column.Prop = column.prop
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+ clearSearch () {
|
|
|
+ Object.assign(this.searchForm, this.searchFormReset)
|
|
|
+ this.CreateOn = ''
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+ handleSearch () {
|
|
|
+ this.currentPage = 1
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+ handleCurrentChange (value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+ handleSizeChange (value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+ deleteEntity (row) {
|
|
|
+ api.deleteEntity(row.Id, this.$axios).then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.initDatas()
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ jstimehandle (val) {
|
|
|
+ if (val === '') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
+ return '永久'
|
|
|
+ } else {
|
|
|
+ val = val.replace('T', ' ')
|
|
|
+ return val.substring(0, 10)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ formatDateTime (date) {
|
|
|
+ var y = date.getFullYear()
|
|
|
+ var m = date.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ var d = date.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ var h = date.getHours()
|
|
|
+ var minute = date.getMinutes()
|
|
|
+ minute = minute < 10 ? ('0' + minute) : minute
|
|
|
+ return y + '-' + m + '-' + d + ' ' + h + ':' + minute
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .el-pagination {
|
|
|
+ margin: 1rem 0 2rem;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+</style>
|