文章管理和申报完善

This commit is contained in:
SjS 2025-03-27 18:14:00 +08:00
parent d848faa666
commit 9d4cdf4dd4
6 changed files with 919 additions and 116 deletions

44
src/api/bst/article.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询文章列表
export function listArticle(query) {
return request({
url: '/bst/article/list',
method: 'get',
params: query
})
}
// 查询文章详细
export function getArticle(id) {
return request({
url: '/bst/article/' + id,
method: 'get'
})
}
// 新增文章
export function addArticle(data) {
return request({
url: '/bst/article',
method: 'post',
data: data
})
}
// 修改文章
export function updateArticle(data) {
return request({
url: '/bst/article',
method: 'put',
data: data
})
}
// 删除文章
export function delArticle(id) {
return request({
url: '/bst/article/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询文章分类列表
export function listArticleCategory(query) {
return request({
url: '/bst/articleCategory/list',
method: 'get',
params: query
})
}
// 查询文章分类详细
export function getArticleCategory(id) {
return request({
url: '/bst/articleCategory/' + id,
method: 'get'
})
}
// 新增文章分类
export function addArticleCategory(data) {
return request({
url: '/bst/articleCategory',
method: 'post',
data: data
})
}
// 修改文章分类
export function updateArticleCategory(data) {
return request({
url: '/bst/articleCategory',
method: 'put',
data: data
})
}
// 删除文章分类
export function delArticleCategory(id) {
return request({
url: '/bst/articleCategory/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,342 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文章ID" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请输入文章ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="分类ID" prop="categoryId">
<el-input
v-model="queryParams.categoryId"
placeholder="请输入分类ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="运营区id" prop="areaId">
<el-input
v-model="queryParams.areaId"
placeholder="请输入运营区id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-has-permi="['bst:article:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-has-permi="['bst:article:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-has-permi="['bst:article:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="articleList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
<template slot-scope="d">
<template v-if="column.key === 'id'">
{{d.row[column.key]}}
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-has-permi="['bst:article:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-has-permi="['bst:article:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改文章对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<form-col :span="span" label="分类ID" prop="categoryId">
<el-input v-model="form.categoryId" placeholder="请输入分类ID" />
</form-col>
<form-col :span="span" label="运营区id" prop="areaId">
<el-input v-model="form.areaId" placeholder="请输入运营区id" />
</form-col>
<form-col :span="span" label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" />
</form-col>
<form-col :span="span" label="内容详情">
<editor v-model="form.content" :min-height="192"/>
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listArticle, getArticle, delArticle, addArticle, updateArticle } from "@/api/bst/article";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "Article",
mixins: [$showColumns],
components: {FormCol},
data() {
return {
span: 24,
//
columns: [
{key: 'id', visible: true, label: '文章ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'categoryId', visible: true, label: '分类ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'areaId', visible: true, label: '运营区id', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'title', visible: true, label: '标题', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'content', visible: true, label: '内容详情', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
articleList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
id: null,
categoryId: null,
areaId: null,
title: null,
content: null,
},
//
form: {},
//
rules: {
categoryId: [
{ required: true, message: "分类ID不能为空", trigger: "blur" }
],
areaId: [
{ required: true, message: "运营区id不能为空", trigger: "blur" }
],
title: [
{ required: true, message: "标题不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询文章列表 */
getList() {
this.loading = true;
listArticle(this.queryParams).then(response => {
this.articleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
categoryId: null,
areaId: null,
title: null,
content: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加文章";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getArticle(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改文章";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateArticle(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addArticle(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除文章编号为"' + ids + '"的数据项?').then(function() {
return delArticle(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('bst/article/export', {
...this.queryParams
}, `article_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,323 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="分类ID" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请输入分类ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="分类名称" prop="categoryName">
<el-input
v-model="queryParams.categoryName"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="父分类ID" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入父分类ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态0-禁用 1-启用" prop="categoryStatus">
<el-select v-model="queryParams.categoryStatus" placeholder="请选择状态0-禁用 1-启用" clearable>
<el-option
v-for="dict in dict.type.article_category_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="排序权重" prop="sort">
<el-input
v-model="queryParams.sort"
placeholder="请输入排序权重"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['bst:articleCategory:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="articleCategoryList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="分类名称" prop="categoryName" />
<el-table-column label="父分类ID" align="center" prop="parentId" />
<el-table-column label="状态0-禁用 1-启用" align="center" prop="categoryStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.article_category_status" :value="scope.row.categoryStatus"/>
</template>
</el-table-column>
<el-table-column label="排序权重" align="center" prop="sort" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['bst:articleCategory:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['bst:articleCategory:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['bst:articleCategory:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改文章分类对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
</el-form-item>
<el-form-item label="父分类ID" prop="parentId">
<treeselect v-model="form.parentId" :options="articleCategoryOptions" :normalizer="normalizer" placeholder="请选择父分类ID" />
</el-form-item>
<el-form-item label="状态0-禁用 1-启用" prop="categoryStatus">
<el-radio-group v-model="form.categoryStatus">
<el-radio
v-for="dict in dict.type.article_category_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序权重" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序权重" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getArticleCategory, listArticleCategory} from "@/api/bst/articleCategory.js";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "ArticleCategory",
dicts: ['article_category_status'],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
articleCategoryList: [],
//
articleCategoryOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
id: null,
categoryName: null,
parentId: null,
categoryStatus: null,
sort: null,
},
//
form: {},
//
rules: {
categoryName: [
{ required: true, message: "分类名称不能为空", trigger: "blur" }
],
categoryStatus: [
{ required: true, message: "状态0-禁用 1-启用不能为空", trigger: "change" }
],
sort: [
{ required: true, message: "排序权重不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询文章分类列表 */
getList() {
this.loading = true;
listArticleCategory(this.queryParams).then(response => {
this.articleCategoryList = this.handleTree(response.data, "id", "parentId");
this.loading = false;
});
},
/** 转换文章分类数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.categoryName,
children: node.children
};
},
/** 查询文章分类下拉树结构 */
getTreeselect() {
listArticleCategory().then(response => {
this.articleCategoryOptions = [];
const data = { id: 0, categoryName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "id", "parentId");
this.articleCategoryOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
categoryName: null,
parentId: null,
categoryStatus: null,
sort: null,
createTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.id) {
this.form.parentId = row.id;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加文章分类";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.parentId;
}
getArticleCategory(row.id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改文章分类";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateArticleCategory(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addArticleCategory(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除文章分类编号为"' + row.id + '"的数据项?').then(function() {
return delArticleCategory(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -0,0 +1,117 @@
<template>
<el-dialog
:title="title"
:visible.sync="dialogVisible"
width="800px"
append-to-body
@open="handleOpen"
>
<el-descriptions :column="2" border>
<el-descriptions-item label="MAC">
{{form.mac | dv}}
</el-descriptions-item>
<el-descriptions-item label="SN">
{{form.sn | dv}}
</el-descriptions-item>
<el-descriptions-item label="定位">
<el-link type="primary" size="mini" @click="handleLocation(form)">
{{form.longitude | dv}},{{form.latitude | dv}}
</el-link>
</el-descriptions-item>
<el-descriptions-item label="消息时间">
{{form.at | dv}}
</el-descriptions-item>
<el-descriptions-item label="状态">
<dict-tag :options="dict.type.device_status" :value="form.status" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="电动车">
<dict-tag :options="dict.type.device_iot_status" :value="form.iotStatus" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="锁">
<dict-tag :options="dict.type.device_lock_status" :value="form.lockStatus" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="电门">
<dict-tag :options="dict.type.device_quality" :value="form.quality" size="mini"/>
</el-descriptions-item>
<el-descriptions-item label="电压">
{{form.voltage | fix2 | dv}} V
</el-descriptions-item>
<el-descriptions-item label="信号强度">
{{form.signal | dv}}
</el-descriptions-item>
<el-descriptions-item label="卫星数量" :span="2">
{{form.satellites | dv}}
</el-descriptions-item>
<el-descriptions-item label="消息详情" :span="2">
{{form.onenetMsg | dv}}
</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getLocationLog } from "@/api/bst/locationLog";
import FormCol from "@/components/FormCol/index.vue";
export default {
name: 'LocationLogViewDialog',
components: { FormCol },
dicts: ['device_status', 'device_lock_status', 'device_iot_status', 'device_quality'],
props: {
visible: {
type: Boolean,
default: false
},
id: {
type: [String, Number],
default: null
}
},
data() {
return {
span: 12,
title: '',
form: {},
}
},
computed: {
dialogVisible: {
get() {
return this.visible;
},
set(val) {
this.$emit('update:visible', val);
}
}
},
methods: {
handleLocation(row) {
window.open(`https://ditu.amap.com/regeo?lng=${row.longitude}&lat=${row.latitude}`, '_blank');
},
handleOpen() {
if (this.id == null) {
this.$message.error("请选择一条数据");
} else {
this.getDetail();
this.title = "日志详情";
}
},
getDetail() {
getLocationLog(this.id).then(response => {
this.form = response.data;
});
},
cancel() {
this.dialogVisible = false;
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -1,21 +1,25 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="故障部位" prop="faultSite">
<el-input
v-model="queryParams.faultSite"
placeholder="请选择故障部位"
clearable
@keyup.enter.native="handleQuery"
/>
<el-form-item label="故障部位" prop="faultSiteList">
<el-select v-model="queryParams.faultSiteList" placeholder="请选择故障部位" clearable multiple @change="handleQuery">
<el-option
v-for="dict in dict.type.fault_site"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="报修进度" prop="appealStatus">
<el-input
v-model="queryParams.appealStatus"
placeholder="请选择报修进度"
clearable
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.appealStatus" placeholder="请选择报修进度" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.appeal_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
@ -25,27 +29,6 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-has-permi="['bst:fault:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-has-permi="['bst:fault:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
@ -80,6 +63,16 @@
<template v-else-if="column.key === 'faultSite'">
<dict-tag :options="dict.type.fault_site" :value="d.row[column.key]"/>
</template>
<template v-else-if="column.key === 'picture'">
<image-preview
:src="d.row[column.key]"
alt="故障图片"
:width="50" :height="50"
/>
</template>
<template v-else-if="column.key === 'appealStatus'">
<dict-tag :options="dict.type.appeal_status" :value="d.row[column.key]" />
</template>
<template v-else>
{{d.row[column.key]}}
</template>
@ -91,10 +84,10 @@
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-has-permi="['bst:fault:edit']"
>修改</el-button>
icon="el-icon-view"
@click="handleView(scope.row)"
v-has-permi="['bst:fault:query']"
>详情</el-button>
<el-button
size="mini"
type="text"
@ -114,35 +107,10 @@
@pagination="getList"
/>
<!-- 添加或修改故障对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<form-col :span="span" label="用户" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户" />
</form-col>
<form-col :span="span" label="车辆编码" prop="vehicleCode">
<el-input v-model="form.vehicleCode" placeholder="请输入车辆编码" />
</form-col>
<form-col :span="span" label="图片" prop="picture">
<el-input v-model="form.picture" placeholder="请输入图片" />
</form-col>
<form-col :span="span" label="订单编号" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入订单编号" />
</form-col>
<form-col :span="span" label="故障部位" prop="faultSite">
<el-input v-model="form.faultSite" placeholder="请输入故障部位" />
</form-col>
<form-col :span="span" label="故障详情" prop="faultDetail">
<el-input v-model="form.faultDetail" type="textarea" placeholder="请输入内容" />
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 查看故障详情 -->
<FaultEditDialog>
</FaultEditDialog>
</div>
</template>
@ -150,6 +118,9 @@
import { listFault, getFault, delFault, addFault, updateFault } from "@/api/bst/fault";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import LocationLog from "@/views/bst/locationLog/index.vue";
import LocationLogViewDialog from "@/views/bst/locationLog/components/LocationLogViewDialog.vue";
import FaultEditDialog from "@/views/bst/fault/components/FaultEditDialog.vue";
//
const defaultSort = {
@ -160,8 +131,8 @@ const defaultSort = {
export default {
name: "Fault",
mixins: [$showColumns],
components: {FormCol},
dicts: ['fault_site'],
components: {FaultEditDialog, FormCol},
dicts: ['fault_site','appeal_status'],
data() {
return {
span: 24,
@ -196,7 +167,10 @@ export default {
title: "",
//
open: false,
// ID
selectedId: null,
defaultSort,
//
queryParams: {
pageNum: 1,
@ -207,7 +181,7 @@ export default {
vehicleCode: null,
picture: null,
orderId: null,
faultSite: null,
faultSiteList:[],
faultDetail: null,
appealStatus: null,
},
@ -285,6 +259,10 @@ export default {
this.queryParams.pageNum = 1;
this.getList();
},
/** 查看详情 */
handleView(row){
this.selectedId = row.id
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
@ -296,52 +274,7 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加故障";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getFault(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改故障";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFault(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFault(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除故障编号为"' + ids + '"的数据项?').then(function() {
return delFault(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('bst/fault/export', {