<template>
|
<div style="padding: 10px; position: relative;">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="98px" class="searchBox">
|
<el-row>
|
<el-form-item label="项目费用代码" prop="HNumber" style="margin-left: 100px;">
|
<el-input v-model="queryParams.HNumber" placeholder="请输入项目费用代码" @keyup.enter.native="handleQuery" />
|
</el-form-item>
|
<el-form-item label="项目费用名称" prop="HName">
|
<el-input v-model="queryParams.HName" placeholder="请输入项目费用名称" @keyup.enter.native="handleQuery" />
|
</el-form-item>
|
<el-form-item label="组织">
|
<el-select v-model="queryParams.HOrgID" placeholder="请选择">
|
<el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name" :value="item.ID">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label-width="78px">
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">
|
搜索</el-button>
|
<el-button type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-row>
|
<el-collapse v-model="activeSeach">
|
<el-collapse-item title="更多" name="1">
|
<el-card class="box-card">
|
<div slot="header" class="clearfix"><span>过滤</span></div>
|
<div>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName1" placeholder="请选择">
|
<span v-for="(item, index) in btList" :key="index">
|
<el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
|
</span>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px;">
|
<el-select v-model="queryParams.Comparator1" placeholder="请选择">
|
<el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent1" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
<el-row>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName2" placeholder="请选择">
|
<span v-for="(item, index) in btList" :key="index">
|
<el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
|
</span>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px;">
|
<el-select v-model="queryParams.Comparator2" placeholder="请选择">
|
<span v-for="(item, index) in comparatorList" :key="index">
|
<el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
|
</span>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent2" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
</el-row>
|
<el-form-item label-width="0">
|
<el-row>
|
<el-col :span="7">
|
<el-select v-model="queryParams.ColName" placeholder="请选择">
|
<el-option v-for="(item, index) in btList" :key="index" :label="item.field"
|
:value="item.field"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="6" style="padding: 0 10px;">
|
<el-select v-model="queryParams.Comparator" placeholder="请选择">
|
<el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</el-col>
|
<el-col :span="11">
|
<el-input v-model="queryParams.ColContent" placeholder="请输入" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-col>
|
</el-row>
|
</el-form-item>
|
</div>
|
</el-card>
|
</el-collapse-item>
|
</el-collapse>
|
</el-form>
|
<el-row :gutter="10" class="mb8" style="margin-top: 10px;">
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddEdit(OperationType = 1)"
|
id="btn-Add">新增</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
|
@click="handleEdit(row = rowForm, OperationType = 3)">编辑</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-delete" size="mini" :disabled="single" @click="handleDelete">删除
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
|
@click="set_CheckBill(0, form = rowForm)">审核</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
|
@click="set_CheckBill(1, form = rowForm)">反审核</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
|
@click="set_De_Stop(0, form = rowForm)">禁用</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
|
@click="set_De_Stop(1, form = rowForm)">反禁用</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-download" size="mini" @click="handleRowHide">隐藏列设置</el-button>
|
</el-col>
|
</el-row>
|
<div class="tableBox" v-loading="loading">
|
<el-table :data="tableData" ref="tableData" max-height="750" @selection-change="handleSelectionChange" border @row-click="handleRowClick" :row-style="rowStyle"
|
@cell-dblclick="handleDblclick" v-if="tableShow">
|
<template v-for="(item, index) in btList">
|
<el-table-column type="selection" width="55" align="center" :fixed="item.fixed" v-if="item.type == 'checkbox'"
|
:key="index" />
|
<el-table-column :align="item.align" :prop="item.field" :label="item.title" :width="item.width"
|
:key="item.sorderid" v-else-if="!item.hide && item.type != 'checkbox'" :sortable="item.sort"
|
show-overflow-tooltip :fixed="item.fixed">
|
<template slot-scope="{row, column }">
|
<div :style="item.style">
|
<span v-if="column.property.includes('日期')">{{ parseTime(row[column.property], '{y}-{m}-{d}') }}</span>
|
<el-button type="text" @click="handleEdit(row, OperationType = 3)"
|
v-else-if="column.property == '费用项目代码'">{{ row.费用项目代码 }}</el-button>
|
<span v-else>{{ row[column.label] }}</span>
|
</div>
|
</template>
|
</el-table-column>
|
</template>
|
</el-table>
|
<pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes"
|
@pagination="getList" />
|
<el-dialog title="隐藏列设置" :visible.sync="openRowHide" width="816px" append-to-body>
|
<RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="rowSetClose" v-if="rowHideShow" />
|
</el-dialog>
|
<!-- 编辑 -->
|
<el-dialog title="编辑费用项目资料" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox" @close="close">
|
<edit :OperationType=OperationType :linterid=this.rowForm.HItemID :HSouceBillType=this.rowForm.HSourceBillType
|
:copyType="copyType" @editCloseGy="editGyClose" v-if="editShow" />
|
</el-dialog>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import axios from 'axios'
|
import RowSettings from '@/views/component/rowSettings'
|
import Edit from '@/views/basic/gyItemMoney/gyItemMoneyEdit.vue'
|
|
export default {
|
name: 'Gy_ItemMoney',
|
components: { RowSettings, Edit },
|
props: {
|
openPage: { type: String, },
|
},
|
data() {
|
return {
|
activeSeach: '',
|
HModName: 'Gy_ItemMoney',
|
editShow: false,
|
openEdit: false,
|
tableShow: true,
|
openRowHide: false,
|
rowHideShow: false,
|
copyType: 0,
|
comparatorList: [
|
{ label: '=', value: '=' },
|
{ label: '>=', value: '>=' },
|
{ label: '>', value: '>' },
|
{ label: '<=', value: '<=' },
|
{ label: '<', value: '<' },
|
{ label: '<>', value: '<>' },
|
{ label: '包含', value: '7' },
|
{ label: '左包含', value: '8' },
|
{ label: '右包含', value: '9' },
|
{ label: '不包含', value: '10' },
|
],
|
sWhere: '',
|
organizationList: JSON.parse(sessionStorage.getItem('organizationList') || '[]'),
|
OperationType: null,
|
baseURL: process.env.VUE_APP_BASE_API,
|
lastSelectedRowIndex: null,
|
lastSelectedRow: null,
|
selectedRow: null,
|
rowForm: {},
|
activeName: 'first',
|
queryParams: {
|
HOrgID: sessionStorage["OrganizationID"] - 0,
|
HName: null,
|
HNumber: null,
|
Comparator1: '',
|
Comparator2: '',
|
Comparator: '',
|
ColContent1: '',
|
ColContent2: '',
|
ColContent: '',
|
},
|
ids: [],
|
single: true,
|
multiple: true,
|
loading: true,
|
tyResList: [],
|
btList: [],
|
btResList: [],
|
tableData: [],
|
dataList: [],
|
titleData: ["HItemID", "HUSEORGID", "HParentID"],
|
pageSizes: [50, 100, 500, 5000, 50000],
|
page: 1,
|
pageSize: 0,
|
total: 0,
|
form: {},
|
rules: {},
|
};
|
},
|
created() {
|
this.getList()
|
},
|
methods: {
|
handleRowHide() {
|
this.rowHideShow = true
|
this.openRowHide = true
|
},
|
rowSetClose(val) {
|
this.rowHideShow = false
|
this.tableShow = true
|
this.openRowHide = val
|
this.getList()
|
},
|
getList() {
|
this.pageSize = 50
|
this.tableShow = false
|
this.loading = true
|
if (this.pageSize == 0) {
|
this.pageSize = 50
|
}
|
this.sWhere += " and HUSEORGID = '" + this.queryParams.HOrgID + "'"
|
|
axios.get(this.baseURL + '/Gy_BadReason/Gy_ItemMoneyList', {
|
params: {
|
"sWhere": this.sWhere,
|
"user": sessionStorage["HUserName"],
|
},
|
}).then(response => {
|
this.tyResList = response.data.data
|
let data1 = response.data
|
let option = []
|
if (data1.code == 1) {
|
this.btResList = data1.list
|
this.total = data1.count;
|
var data = [];
|
var col = [];
|
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
|
col.push({ type: 'checkbox', fixed: 'left' });
|
for (var i = 0; i < data.length; i++) {
|
if (this.titleData.indexOf(data[i].name) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true });
|
} else if (data[i].name == '费用项目代码') {
|
col.push({
|
field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, event: '费用项目代码',
|
templet: function (d) {
|
return '<span style="color: blue;">' + d.费用项目代码 + '</span>'
|
}, style: 'cursor: pointer;'
|
});
|
} else if (data[i].Type == "Decimal" || data[i].Type == "Int32" || data[i].Type == "Double") {
|
col.push({ field: data[i].id, title: data[i].name, align: 'right', sort: true, width: 120 });
|
} else if (data[i].Type == "DateTime") {
|
col.push({
|
field: data[i].id,
|
title: data[i].name,
|
align: 'center',
|
sort: true,
|
width: 120,
|
formatter: (row, column) => {
|
return row[column.property] ? this.parseTime(row[column.property], '{y}-{m}-{d}') : ''
|
}
|
});
|
} else {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
|
}
|
}
|
|
option.cols = [col]
|
this.dataList = option
|
option.data = data1.data;
|
this.DisPlay_HideColumn(this.HModName, sessionStorage["HUserName"], option, this.dataList);
|
}
|
}).catch(error => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
DisPlay_HideColumn(HModName, user, option, dataOption) {
|
axios.get(this.baseURL + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', {
|
params: {
|
"HModName": HModName,
|
"user": user,
|
},
|
}).then(res => {
|
let data1 = res.data
|
if (data1.data.length != 0) {
|
var dataCol = [];
|
var newCols = [[]];
|
newCols[0].push(option.cols[0][0]);
|
dataCol = data1.data[0].HGridString.split(',');
|
|
if (dataCol.length == option.cols[0].length - 1) {
|
for (var j = 0; j < option.cols[0].length - 1; j++) {
|
for (var i = 0; i < option.cols[0].length - 1; i++) {
|
var dataCols = dataCol[j].split('|');
|
if (option.cols[0][i + 1]["field"] == dataCols[5]) {
|
if (dataCols[1] == 1) {
|
option.cols[0][i + 1]["hide"] = true;
|
}
|
if (dataCols[3] > 0) {
|
option.cols[0][i + 1]["width"] = dataCols[3];
|
}
|
if (data1.data[0].HFontSize != 0) {
|
option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
|
} else {
|
option.cols[0][i + 1]["style"] = "font-size:100%";
|
}
|
if (dataCols[1] == 0 && this.titleData.indexOf(option.cols[0][i + 1]["title"]) == -1) {
|
option.cols[0][i + 1]["hide"] = false;
|
}
|
switch (dataCols[2]) {
|
case "L":
|
option.cols[0][i + 1]["align"] = "left";
|
break;
|
case "M":
|
option.cols[0][i + 1]["align"] = "center";
|
break;
|
case "R":
|
option.cols[0][i + 1]["align"] = "right";
|
break;
|
}
|
if (dataCols[4] != null && dataCols[4] != "") {
|
option.cols[0][i + 1]["title"] = dataCols[4];
|
}
|
if (dataCols[6] == 1) {
|
option.cols[0][i + 1]["totalRow"] = true;
|
} else {
|
option.cols[0][i + 1]["totalRow"] = false;
|
}
|
newCols[0].push(option.cols[0][i + 1]);
|
break;
|
}
|
}
|
}
|
if (dataCol.length == newCols[0].length - 1) {
|
option.cols = newCols;
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
if (option.cols[0][i + 1]["fixed"] != null) {
|
option.cols[0][i + 1]["fixed"] = null;
|
} else {
|
break;
|
}
|
}
|
if (data1.data[0].HFixCols != 0) {
|
for (var i = 0; i < data1.data[0].HFixCols; i++) {
|
if (dataOption.cols[0].indexOf(option.cols[0][i + 1]["title"]) != -1) {
|
data1.data[0].HFixCols += 1;
|
}
|
option.cols[0][i + 1]["fixed"] = "left";
|
}
|
}
|
for (var i = 1; i < option.cols[0].length; i++) {
|
if (data1.data[0].HSortFlag == "是") {
|
option.cols[0][i]["sort"] = true;
|
} else {
|
option.cols[0][i]["sort"] = false;
|
}
|
}
|
}
|
}
|
this.btList = option.cols[0]
|
if (data1.data[0].HPageSize == 0) {
|
this.pageSize = 50
|
} else {
|
this.pageSize = data1.data[0].HPageSize
|
}
|
this.tableData = option.data
|
this.tableShow = true
|
this.loading = false
|
} else {
|
this.btList = dataOption.cols[0]
|
this.tableData = dataOption.data
|
this.tableShow = true
|
this.loading = false
|
}
|
}).catch(error => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
handleRowClick(row, column, event) {
|
this.lastSelectedRow = this.selectedRow;
|
this.selectedRow = row;
|
this.lastSelectedRowIndex = this.tableData.indexOf(row);
|
this.$refs.tableData.toggleRowSelection(row);
|
if (this.openPage) {
|
this.$emit('carTypeEmit', row, 1)
|
}
|
},
|
|
rowStyle({ row, rowIndex }) {
|
if (this.ids.includes(row.HItemID)) {
|
return { "background": "#ecf5ff" }
|
}
|
},
|
|
handleDblclick(row, column, cell, event) {
|
this.OperationType = 3
|
if (this.openPage) {
|
this.$emit('carTypeEmitDb', row, 1)
|
} else {
|
this.handleEdit();
|
}
|
},
|
|
handleSelectionChange(selection) {
|
if (this.openPage) {
|
if (selection.length > 1) {
|
const del_row = selection.shift()
|
this.$refs.tableData.toggleRowSelection(del_row, false)
|
}
|
this.rowForm = {}
|
this.ids = selection.map(item => item.HItemID)
|
this.rowForm = selection[0]
|
} else {
|
this.ids = selection.map(item => item.HItemID)
|
this.single = selection.length != 1
|
this.multiple = !selection.length
|
if (!this.single) {
|
this.rowForm = selection[0]
|
}
|
}
|
},
|
|
handleQuery() {
|
this.sWhere = ''
|
if (this.queryParams.ColName && this.queryParams.Comparator) {
|
var com = "";
|
switch (this.queryParams.Comparator) {
|
case "7":
|
com = "like'%" + this.queryParams.ColContent + "%'";
|
break;
|
case "8":
|
com = "like'%" + this.queryParams.ColContent + "'";
|
break;
|
case "9":
|
com = "like'" + this.queryParams.ColContent + "%'";
|
break;
|
case "10":
|
com = "not like'%" + this.queryParams.ColContent + "%'";
|
break;
|
default:
|
com = "" + this.queryParams.Comparator + "'" + this.queryParams.ColContent + "'";
|
break;
|
}
|
this.sWhere += " and " + this.queryParams.ColName + " " + com;
|
}
|
if (this.queryParams.ColName1 && this.queryParams.Comparator1) {
|
var com1 = "";
|
switch (this.queryParams.Comparator1) {
|
case "7":
|
com1 = "like'%" + this.queryParams.ColContent1 + "%'";
|
break;
|
case "8":
|
com1 = "like'%" + this.queryParams.ColContent1 + "'";
|
break;
|
case "9":
|
com1 = "like'" + this.queryParams.ColContent1 + "%'";
|
break;
|
case "10":
|
com1 = "not like'%" + this.queryParams.ColContent1 + "%'";
|
break;
|
default:
|
com1 = "" + this.queryParams.Comparator1 + "'" + this.queryParams.ColContent1 + "'";
|
break;
|
}
|
this.sWhere += " and " + this.queryParams.ColName1 + " " + com1;
|
}
|
if (this.queryParams.ColName2 && this.queryParams.Comparator2) {
|
var com2 = "";
|
switch (this.queryParams.Comparator2) {
|
case "7":
|
com2 = "like'%" + this.queryParams.ColContent2 + "%'";
|
break;
|
case "8":
|
com2 = "like'%" + this.queryParams.ColContent2 + "'";
|
break;
|
case "9":
|
com2 = "like'" + this.queryParams.ColContent2 + "%'";
|
break;
|
case "10":
|
com2 = "not like'%" + this.queryParams.ColContent2 + "%'";
|
break;
|
default:
|
com2 = "" + this.queryParams.Comparator + "'" + this.queryParams.ColContent + "'";
|
break;
|
}
|
this.sWhere += " and " + this.queryParams.ColName2 + " " + com2;
|
}
|
if (this.queryParams.HNumber) {
|
this.sWhere += " and 费用项目代码 like '%" + this.queryParams.HNumber + "%'";
|
}
|
if (this.queryParams.HName) {
|
this.sWhere += " and 费用项目名称 like '%" + this.queryParams.HName + "%'";
|
}
|
if (this.queryParams.HOrgID) {
|
this.sWhere += " and HUSEORGID = '" + this.queryParams.HOrgID + "'"
|
}
|
this.getList()
|
},
|
|
// 修改 resetQuery 方法
|
resetQuery() {
|
// 保存组织ID
|
const currentOrgID = sessionStorage["OrganizationID"] - 0
|
|
// 完全重置所有查询参数
|
this.queryParams = {
|
HOrgID: currentOrgID,
|
HName: '',
|
HNumber: '',
|
Comparator1: '',
|
Comparator2: '',
|
Comparator: '',
|
ColContent1: '',
|
ColContent2: '',
|
ColContent: '',
|
ColName: '',
|
ColName1: '',
|
ColName2: ''
|
}
|
|
// 清空搜索条件字符串
|
this.sWhere = ''
|
|
// 重置折叠面板(收起更多搜索条件)
|
this.activeSeach = ''
|
|
// 使用 $nextTick 确保 DOM 更新后再重置表单
|
this.$nextTick(() => {
|
// 重置表单字段(包括 el-select)
|
if (this.$refs.queryForm) {
|
this.$refs.queryForm.resetFields()
|
// 手动重新设置组织ID,因为 resetFields 会清空所有
|
this.$set(this.queryParams, 'HOrgID', currentOrgID)
|
}
|
|
// 重置页面为第一页
|
this.page = 1
|
|
// 重新获取数据(不传任何过滤条件)
|
this.getList()
|
|
// 如果有选中行,清除选中状态
|
if (this.$refs.tableData) {
|
this.$refs.tableData.clearSelection()
|
}
|
this.single = true
|
this.multiple = true
|
this.ids = []
|
this.rowForm = {}
|
})
|
|
// 滚动到顶部
|
this.$nextTick(() => {
|
const container = document.querySelector('.el-table__body-wrapper')
|
if (container) {
|
container.scrollTop = 0
|
}
|
})
|
},
|
|
close() {
|
this.tableShow = true
|
this.single = true
|
this.openEdit = false
|
this.editShow = false
|
this.getList()
|
},
|
|
handleAddEdit() {
|
this.rowForm.HItemID = 0
|
this.$nextTick(() => {
|
this.openEdit = true
|
this.editShow = true
|
})
|
},
|
|
handleEdit() {
|
this.$nextTick(() => {
|
// 添加 200ms 的延时(可以根据需要调整时间)
|
setTimeout(() => {
|
this.openEdit = true
|
this.editShow = true
|
}, 200) // 200毫秒延时,可以调整为 100、300 等值
|
})
|
},
|
editGyClose(val) {
|
this.editShow = false
|
this.openEdit = false
|
this.single = true
|
this.multiple = true
|
this.getList()
|
},
|
|
handleDelete() {
|
this.$modal.confirm('确认要删除吗,删除后不能恢复').then(() => {
|
if (!this.rowForm.审核人) {
|
axios.get(this.baseURL + "DeltetGy_ItemMoney", {
|
params: { 'HItemID': this.rowForm.HItemID, 'user': sessionStorage["HUserName"] }
|
}).then(response => {
|
if (response.data.count == 1) {
|
this.getList()
|
this.$modal.msgSuccess("删除成功")
|
} else {
|
this.$modal.msgError("错误:" + result.code + result.Message);
|
}
|
}).catch(error => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
} else {
|
this.$modal.msgError("此条数据不是创建状态,无法删除!");
|
}
|
}).catch(() => { })
|
},
|
|
set_CheckBill(num, form) {
|
var InterID = form.HItemID || form.HInterID
|
axios.get(this.baseURL + "/Gy_BadReason/AuditGy_ProjectMoney", {
|
params: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] }
|
}).then(response => {
|
let result = response.data
|
if (result.code == 1) {
|
this.$modal.msgSuccess('操作成功');
|
this.getList();
|
} else {
|
this.$modal.msgError("错误:" + result.code + result.Message);
|
}
|
}).catch(error => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
set_De_Stop(num, form) {
|
var InterID = form.HItemID || form.HInterID
|
axios.get(this.baseURL + "/Gy_BadReason/StopGy_ItemMoney", {
|
params: { "HInterID": InterID, "IsStop": num, "CurUserName": sessionStorage["HUserName"] }
|
}).then(response => {
|
let result = response.data
|
if (result.code == 1) {
|
this.$modal.msgSuccess('操作成功');
|
this.getList();
|
} else {
|
this.$modal.msgError("错误:" + result.code + result.Message);
|
}
|
}).catch(error => {
|
this.$modal.msgError("接口请求失败!");
|
});
|
},
|
|
handleExport() {
|
const ws = this.$XLSX.utils.json_to_sheet(this.tyResList);
|
const wb = this.$XLSX.utils.book_new();
|
this.$XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
|
this.$XLSX.writeFile(wb, `gyCarType_${new Date().getTime()}.xlsx`);
|
},
|
|
parseTime(time, pattern) {
|
if (!time) {
|
return ''
|
}
|
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
let date
|
if (typeof time === 'object') {
|
date = time
|
} else {
|
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
time = parseInt(time)
|
}
|
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
time = time * 1000
|
}
|
date = new Date(time)
|
}
|
const formatObj = {
|
y: date.getFullYear(),
|
m: date.getMonth() + 1,
|
d: date.getDate(),
|
h: date.getHours(),
|
i: date.getMinutes(),
|
s: date.getSeconds(),
|
a: date.getDay()
|
}
|
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
let value = formatObj[key]
|
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
if (result.length > 0 && value < 10) {
|
|
value = '0' + value
|
}
|
return value || 0
|
})
|
return time_str
|
}
|
}
|
};
|
</script>
|
|
<style>
|
.xsckdBox .el-date-editor.el-input {
|
width: 100%;
|
}
|
</style>
|