This commit is contained in:
许允枞 2025-02-17 13:39:50 +08:00
parent 05477cc06f
commit b1aa6c6324
4 changed files with 581 additions and 437 deletions

View File

@ -777,7 +777,7 @@ export default {
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.$download.excel(response, '员工导入模板.xls');
this.$download.excel(response, '设备导入模板.xls');
});
},
//

View File

@ -34,6 +34,14 @@ export function updateEquInfo(data) {
data: data
})
}
// 修改equInfo
export function importTemplate() {
return request({
url: '/system/equInfo/importTemplate',
method: 'post',
responseType: 'blob'
})
}
// 删除equInfo
export function delEquInfo(id) {

View File

@ -27,7 +27,8 @@
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-select v-model="queryParams.type">
<el-option v-for="item in this.getDictDatas(DICT_TYPE.INS_EQU_TYPE)" :key="item.value" :value="item.value" :label="item.label"/>
<el-option v-for="item in this.getDictDatas(DICT_TYPE.INS_EQU_TYPE)" :key="item.value" :value="item.value"
:label="item.label"/>
</el-select>
</el-form-item>
<el-form-item label="检定时间">
@ -56,30 +57,14 @@
size="mini"
@click="handleAdd"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
v-hasPermi="['system:user:import']">导入
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:equInfo:edit']"-->
<!-- >修改</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-hasPermi="['system:equInfo:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
@ -87,39 +72,46 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="equInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- 1-->
<el-table-column label="设备名称" align="center" prop="equName" />
<el-table-column label="设备型号" align="center" prop="equModel" />
<el-table-column label="设备编号" align="center" prop="equNumber" />
<el-table-column type="selection" width="55" align="center"/>
<!-- 1-->
<el-table-column label="设备名称" align="center" prop="equName"/>
<el-table-column label="设备型号" align="center" prop="equModel"/>
<el-table-column label="设备编号" align="center" prop="equNumber"/>
<el-table-column label="设备类别" align="center" prop="type">
<template slot-scope="scope">
<DictTag :type="DICT_TYPE.INS_EQU_TYPE" :value="scope.row.type" />
<DictTag :type="DICT_TYPE.INS_EQU_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="设备检定周期" align="center" prop="equZq" />
<el-table-column label="校准日期" align="center" prop="equZq"/>
<el-table-column label="有效期" align="center" prop="validTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.validTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="上次检定单位" align="center" prop="lastUnit" />
<el-table-column label="下次检定时间" align="center" prop="nextCheckTime" width="180">
<el-table-column label="校准单位" align="center" prop="lastUnit"/>
<el-table-column label="证书编号" align="center" prop="certificateNumber"/>
<el-table-column label="制造商" align="center" prop="manufacturer"/>
<el-table-column label="电话" align="center" prop="mobile"/>
<el-table-column label="邮编" align="center" prop="postcode"/>
<el-table-column label="地址" align="center" prop="address"/>
<el-table-column label="邮箱" align="center" prop="email"/>
<el-table-column label="复校日期" align="center" prop="nextCheckTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.nextCheckTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="" align="center" prop="createTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -128,14 +120,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -152,21 +146,22 @@
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="设备名称" prop="equName">
<el-input v-model="form.equName" placeholder="请输入设备名称" />
<el-input v-model="form.equName" placeholder="请输入设备名称"/>
</el-form-item>
<el-form-item label="设备型号" prop="equModel">
<el-input v-model="form.equModel" placeholder="请输入设备型号" />
<el-input v-model="form.equModel" placeholder="请输入设备型号"/>
</el-form-item>
<el-form-item label="设备编号" prop="equNumber">
<el-input v-model="form.equNumber" placeholder="请输入设备编号" />
<el-input v-model="form.equNumber" placeholder="请输入设备编号"/>
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类别">
<el-option v-for="item in this.getDictDatas(DICT_TYPE.INS_EQU_TYPE)" :key="item.value" :value="item.value" :label="item.label" />
<el-option v-for="item in this.getDictDatas(DICT_TYPE.INS_EQU_TYPE)" :key="item.value" :value="item.value"
:label="item.label"/>
</el-select>
</el-form-item>
<el-form-item label="设备检定周期" prop="equZq">
<el-input v-model="form.equZq" placeholder="请输入设备检定周期" />
<el-input v-model="form.equZq" placeholder="请输入设备检定周期"/>
</el-form-item>
<el-form-item label="有效期" prop="validTime">
<el-date-picker clearable
@ -177,7 +172,7 @@
</el-date-picker>
</el-form-item>
<el-form-item label="上次检定单位" prop="lastUnit">
<el-input v-model="form.lastUnit" placeholder="请输入上次检定单位" />
<el-input v-model="form.lastUnit" placeholder="请输入上次检定单位"/>
</el-form-item>
<el-form-item label="下次检定时间" prop="nextCheckTime">
<el-date-picker clearable
@ -193,171 +188,314 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 设备导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
:action="upload.url" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport"/>
是否更新已经存在的设备数据
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
@click="importTemplate">下载模板
</el-link>
</div>
</el-upload>
<el-table
v-if="isFail"
:data="failList"
stripe
style="width: 100%">
<el-table-column
prop="equName"
label="设备名称"
width="180">
</el-table-column>
<el-table-column
prop="reason"
label="失败原因">
</el-table-column>
<el-table-column
prop="type"
label="设备类型">
</el-table-column>
<el-table-column
prop="equModel"
label="型号">
</el-table-column>
<el-table-column
prop="equNumber"
label="出厂编号">
</el-table-column>
<el-table-column
prop="validTime"
label="校准日期">
</el-table-column>
<el-table-column
prop="nextCheckTime"
label="复校日期">
</el-table-column>
<el-table-column
prop="certificateNumber"
label="证书编号">
</el-table-column>
<el-table-column
prop="manufacturer"
label="制造商">
</el-table-column>
<el-table-column
prop="lastUnit"
label="校准单位">
</el-table-column>
<el-table-column
prop="mobile"
label="电话">
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
<el-table-column
prop="postcode"
label="邮编">
</el-table-column>
<el-table-column
prop="email"
label="邮箱">
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listEquInfo, getEquInfo, delEquInfo, addEquInfo, updateEquInfo } from "./api/device";
import {DICT_TYPE} from "@/utils/dict";
import {listEquInfo, getEquInfo, delEquInfo, addEquInfo, updateEquInfo, importTemplate} from "./api/device";
import {DICT_TYPE} from "@/utils/dict";
import {getBaseHeader} from "@/utils/request";
export default {
name: "EquInfo",
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// equInfo
equInfoList: [],
//
title: "",
//
export default {
name: "EquInfo",
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
data() {
return {
isFail:false,
failList: [],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// equInfo
equInfoList: [],
//
title: "",
//
open: false,
//
daterangeNextCheckTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
equName: null,
equModel: null,
equNumber: null,
nextCheckTime: null,
type: null
},
//
upload: {
//
open: false,
//
daterangeNextCheckTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
equName: null,
equModel: null,
equNumber: null,
nextCheckTime: null,
type: null
},
//
form: {},
//
rules: {
}
};
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: getBaseHeader(),
//
url: process.env.VUE_APP_BASE_API + '/admin-api/system/equInfo/importEquipment'
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询equInfo列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeNextCheckTime && '' != this.daterangeNextCheckTime) {
this.queryParams.params["beginNextCheckTime"] = this.daterangeNextCheckTime[0];
this.queryParams.params["endNextCheckTime"] = this.daterangeNextCheckTime[1];
}
listEquInfo(this.queryParams).then(response => {
this.equInfoList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
created() {
/** 导入按钮操作 */
handleImport() {
this.upload.title = "设备导入";
this.upload.open = true;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
if (response.code !== 0) {
this.$modal.msgError(response.msg)
return;
}
// this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
if (response.data.failList.length > 0) {
this.isFail = true
this.$set(this, 'failList', response.data.failList); //
console.log(this.failList)
}
this.getList();
},
methods: {
/** 查询equInfo列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeNextCheckTime && '' != this.daterangeNextCheckTime) {
this.queryParams.params["beginNextCheckTime"] = this.daterangeNextCheckTime[0];
this.queryParams.params["endNextCheckTime"] = this.daterangeNextCheckTime[1];
}
listEquInfo(this.queryParams).then(response => {
this.equInfoList = response.data.records;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
equName: null,
equModel: null,
equNumber: null,
equZq: null,
validTime: null,
lastUnit: null,
nextCheckTime: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
type: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeNextCheckTime = [];
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();
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.$download.excel(response, '设备导入模板.xls');
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
equName: null,
equModel: null,
equNumber: null,
equZq: null,
validTime: null,
lastUnit: null,
nextCheckTime: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
type: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeNextCheckTime = [];
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
getEquInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEquInfo(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) {
updateEquInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEquInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
this.title = "修改";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEquInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEquInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除equInfo编号为"' + ids + '"的数据项?').then(function() {
return delEquInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/equInfo/export', {
...this.queryParams
}, `equInfo_${new Date().getTime()}.xlsx`)
}
}
});
},
//
submitFileForm() {
this.$refs.upload.submit();
this.failList = []
this.isFail = false
console.log('执行')
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除equInfo编号为"' + ids + '"的数据项?').then(function () {
return delEquInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/equInfo/export', {
...this.queryParams
}, `equInfo_${new Date().getTime()}.xlsx`)
}
};
}
};
</script>

View File

@ -57,7 +57,7 @@
</el-date-picker>
</el-form-item>
<el-form-item label="金额大于" prop="partnerName">
<el-input-number v-model="queryParams.realPayMoney" :min="1" :max="999" label="描述文字"></el-input-number>
<el-input-number v-model="queryParams.realPayMoney" :min="1" :max="999" label="描述文字"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -65,63 +65,60 @@
</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="['system:info:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:info:edit']"-->
<!-- >修改</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-hasPermi="['system:info:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- </el-row>-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:user:export']">导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:info:edit']"
>修改
</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-hasPermi="['system:info:remove']"
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="订单id" align="center" prop="id" width="80" />
<el-table-column label="订单号" align="center" prop="orderNo" width="300" />
<el-table-column label="商品名称" align="center" prop="goodsTitle" />
<el-table-column label="用户姓名" align="center" prop="realName" />
<el-table-column label="用户手机号" align="center" prop="phonenumber" />
<!-- <el-table-column label="车牌号" align="center" prop="carNo" />-->
<el-table-column label="商品原价 (元)" align="center" prop="goodsPrice" >
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="订单id" align="center" prop="id" width="80"/>
<el-table-column label="订单号" align="center" prop="orderNo" width="300"/>
<el-table-column label="商品名称" align="center" prop="goodsTitle"/>
<el-table-column label="用户姓名" align="center" prop="realName"/>
<el-table-column label="用户手机号" align="center" prop="phonenumber"/>
<!-- <el-table-column label="车牌号" align="center" prop="carNo" />-->
<el-table-column label="商品原价 (元)" align="center" prop="goodsPrice">
<template slot-scope="scope">
<span>{{ scope.row.goodsPrice /100 }}</span>
<span>{{ scope.row.goodsPrice / 100 }}</span>
</template>
</el-table-column>
<el-table-column label="实付金额 (元)" align="center" prop="payMoney" >
<el-table-column label="实付金额 (元)" align="center" prop="payMoney">
<template slot-scope="scope">
<span>{{ scope.row.payMoney /100 }}</span>
<span>{{ scope.row.payMoney / 100 }}</span>
</template>
</el-table-column>
<el-table-column label="使用账户余额(元)" align="center" prop="balance" >
<el-table-column label="使用账户余额(元)" align="center" prop="balance">
<template slot-scope="scope">
<span>{{(scope.row.balance/100) }}</span>
<span>{{ (scope.row.balance / 100) }}</span>
</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
@ -135,7 +132,7 @@
</template>
</el-table-column>
<el-table-column label="评价" align="center">
<el-table-column label="评价星级" align="center" prop="commentStar" >
<el-table-column label="评价星级" align="center" prop="commentStar">
<template slot-scope="scope">
<el-rate
v-model="scope.row.commentStar"
@ -145,7 +142,7 @@
</el-rate>
</template>
</el-table-column>
<el-table-column label="评价内容" align="center" prop="commentDesc" show-overflow-tooltip />
<el-table-column label="评价内容" align="center" prop="commentDesc" show-overflow-tooltip/>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
@ -189,193 +186,194 @@
</template>
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "./api/ordermanagement";
import moment from 'moment';
import request from "@/utils/request";
import DictTag from "@/components/DictTagOld/index.vue";
export default {
name: "Info",
components:{DictTag},
dicts: ['order_status', 'all_order_type'],
data() {
return {
value1: '',
value2: '',
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
orderNo: null,
goodsTitle: null,
realName: null,
orderStatus: null,
orderType: null,
partnerName: null,
DateTimeFormat:null,
JsonFormat:null,
TableField:null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.dict = {type:{}}
for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
method: 'get'
}).then(res=>{
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "./api/ordermanagement";
import moment from 'moment';
import request from "@/utils/request";
import DictTag from "@/components/DictTagOld/index.vue";
export default {
name: "Info",
components: {DictTag},
dicts: ['order_status', 'all_order_type'],
data() {
return {
value1: '',
value2: '',
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
orderNo: null,
goodsTitle: null,
realName: null,
orderStatus: null,
orderType: null,
partnerName: null,
DateTimeFormat: null,
JsonFormat: null,
TableField: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.dict = {type: {}}
for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/' + this.$options.dicts[i],
method: 'get'
}).then(res => {
this.$set(this.dict.type, this.$options.dicts[i], res.data)
})
}
this.getList();
},
methods: {
/** 查询订单列表 */
getList() {
this.loading = true;
if (this.queryParams.startTime) {
this.queryParams.startTime = moment(this.queryParams.startTime).format('YYYY-MM-DD HH:mm');
}
if (this.queryParams.endTime) {
this.queryParams.endTime = moment(this.queryParams.endTime).format('YYYY-MM-DD HH:mm');
}
listInfo(this.queryParams).then(response => {
this.infoList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
orderNo: null,
goodsId: null,
goodsTitle: null,
goodsType: null,
userId: null,
realName: null,
phonenumber: null,
goodsPrice: null,
payMoney: null,
orderTime: null,
balance: null,
payTime: null,
orderStatus: null,
commentDesc: null,
commentStar: null,
orderType: null,
partnerId: null,
partnerName: null,
createTime: null,
createBy: null,
deptId: null,
updateTime: null,
updateBy: null,
validationTime: null,
validationRealName: null,
validationUserId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
methods: {
/** 查询订单列表 */
getList() {
this.loading = true;
if (this.queryParams.startTime){
this.queryParams.startTime = moment(this.queryParams.startTime).format('YYYY-MM-DD HH:mm');
}
if (this.queryParams.endTime){
this.queryParams.endTime = moment(this.queryParams.endTime).format('YYYY-MM-DD HH:mm');
}
listInfo(this.queryParams).then(response => {
this.infoList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
orderNo: null,
goodsId: null,
goodsTitle: null,
goodsType: null,
userId: null,
realName: null,
phonenumber: null,
goodsPrice: null,
payMoney: null,
orderTime: null,
balance: null,
payTime: null,
orderStatus: null,
commentDesc: null,
commentStar: null,
orderType: null,
partnerId: null,
partnerName: null,
createTime: null,
createBy: null,
deptId: null,
updateTime: null,
updateBy: null,
validationTime: null,
validationRealName: null,
validationUserId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.startTime = null
this.queryParams.endTime = null
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.startTime = null
this.queryParams.endTime = null
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
getInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "添加订单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInfo(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) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
this.title = "修改订单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(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 delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除订单编号为"' + ids + '"的数据项?').then(function () {
return delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/inspectionGoods/exportPartnerOrderListSystem', {
...this.queryParams
}, `订单_${new Date().getTime()}.xlsx`)
}
};
}
};
</script>