From 448ebe0754e006d5a1ad37f87bd8fe961eb58277 Mon Sep 17 00:00:00 2001
From: 安瑾然 <107107765@qq.com>
Date: 星期四, 21 七月 2022 16:57:37 +0800
Subject: [PATCH] login
---
src/api/common.js | 17 ++
src/plugins/filters.js | 2
src/views/common/Audit.vue | 286 +++++++++++++++++++++++++++++++++++++++++++++--
src/plugins/element.js | 7
src/router/index.js | 2
5 files changed, 292 insertions(+), 22 deletions(-)
diff --git a/src/api/common.js b/src/api/common.js
index 28a70b4..3a514a6 100644
--- a/src/api/common.js
+++ b/src/api/common.js
@@ -16,4 +16,19 @@
fileName: val
}
})
-}
\ No newline at end of file
+}
+
+export function report(params) {
+ return request({
+ url: '/report',
+ method: 'post',
+ data: params
+ })
+}
+
+export function getReportById(id) {
+ return request({
+ url: `/report/${id}`,
+ method: 'get',
+ })
+}
diff --git a/src/plugins/element.js b/src/plugins/element.js
index 319f176..b17ba14 100644
--- a/src/plugins/element.js
+++ b/src/plugins/element.js
@@ -4,7 +4,7 @@
Button,
Card,
Col,
- Container, Dialog, Form, FormItem,
+ Container, DatePicker, Dialog, Form, FormItem,
Header,
Icon, Input,
Main,
@@ -13,11 +13,10 @@
Message, Option, Pagination,
Row, Select,
Submenu, Table, TableColumn
- ,Upload
} from 'element-ui'
Vue.use(Button).use(Container).use(Header).use(Aside).use(Menu).use(Submenu).use(MenuItem).use(Main).use(Icon).use(Card)
.use(Col).use(Row).use(Card).use(Table).use(TableColumn).use(Form).use(FormItem).use(Input).use(Select).use(Option)
- .use(Pagination).use(Dialog).use(Upload)
+ .use(Pagination).use(Dialog)
-Vue.prototype.$message = Message
\ No newline at end of file
+Vue.prototype.$message = Message
diff --git a/src/plugins/filters.js b/src/plugins/filters.js
index 297be17..fd4d889 100644
--- a/src/plugins/filters.js
+++ b/src/plugins/filters.js
@@ -5,4 +5,4 @@
getImgUrl(val).then(res => {
return res
})
-}
\ No newline at end of file
+}
diff --git a/src/router/index.js b/src/router/index.js
index de56f0b..670c9b2 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -78,7 +78,7 @@
})
// 鎸傝浇璺敱瀵艰埅瀹堝崼
-router.beforeEach((to, drom, next) => {
+router.beforeEach((to, from, next) => {
// to 灏嗚璁块棶鐨勮矾寰�
// from 浠h〃浠庡摢涓矾寰勮烦杞�
// next 鏄竴涓嚱鏁帮紝琛ㄧず鏀捐
diff --git a/src/views/common/Audit.vue b/src/views/common/Audit.vue
index b246b88..dbac5e6 100644
--- a/src/views/common/Audit.vue
+++ b/src/views/common/Audit.vue
@@ -36,7 +36,7 @@
<el-table-column prop="id" label="搴忓彿" width="60"></el-table-column>
<el-table-column width="80" prop="pic" label="澶村儚">
<template slot-scope="scope">
- <img :src="scope.row.pic | fileNameToPath" style="width: 40px;height: 40px; border-radius: 50%;">
+ <img :src="scope.row.pic" style="width: 40px;height: 40px; border-radius: 50%;">
</template>
</el-table-column>
<el-table-column width="80" prop="reporterName" label="鎶ユ浜�"></el-table-column>
@@ -76,22 +76,160 @@
:total="total"></el-pagination>
</el-card>
<!--娣诲姞浜哄憳寮圭獥-->
- <el-dialog
- title="鎻愮ず"
- :visible.sync="addAduitDialogVisible"
- width="30%"
- :before-close="addAduitClose">
- <span>杩欐槸涓�娈典俊鎭�</span>
+ <el-dialog title="娣诲姞浜哄憳" :visible.sync="addAduitDialogVisible" width="50%" :before-close="addAduitClose">
+ <el-row :gutter="15">
+ <el-form ref="addAduitForm" :model="auditFrom" :rules="rules" size="medium" label-width="100px">
+ <el-col :span="12">
+ <el-form-item label="澶村儚" prop="pic" required>
+ <el-upload ref="pic" action="/api/minio/upload" :show-file-list="false" :on-success="handleAvatarSuccess"
+ list-type="picture-card" accept="image/*">
+ <img v-if="picShow" :src="picShow" style="width: 145px;height: 145px">
+ <i v-else class="el-icon-plus"></i>
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎶ユ浜� " prop="reporterName">
+ <el-input v-model="auditFrom.reporterName" placeholder="璇疯緭鍏ユ姤妗堜汉 " clearable
+ :style="{width: '100%'}"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎵嬫満鍙风爜" prop="mobile">
+ <el-input v-model="auditFrom.mobile" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" clearable :style="{width: '100%'}">
+ </el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="韬唤璇佸彿" prop="idcard">
+ <el-input v-model="auditFrom.idcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" clearable :style="{width: '100%'}">
+ </el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="琚獥鏃堕棿" prop="cheatTime">
+ <el-date-picker v-model="auditFrom.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ :style="{width: '100%'}" format="yyyy-MM-dd HH:mm:ss"
+ :value-format="auditFrom.cheatTime"></el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="娑夋閲戦" prop="amountInvolved">
+ <el-input v-model="auditFrom.amountInvolved" placeholder="璇疯緭鍏ユ秹妗堥噾棰�" clearable
+ :style="{width: '100%'}"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="妗堜欢鎻忚堪" prop="reportDescription">
+ <el-input v-model="auditFrom.reportDescription" placeholder="璇疯緭鍏ユ浠舵弿杩�" clearable
+ :style="{width: '100%'}"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="琛ュ厖淇℃伅" prop="information">
+ <el-input v-model="auditFrom.information" type="textarea" placeholder="璇疯緭鍏ヨˉ鍏呬俊鎭�"
+ :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="涓婁紶" prop="fileList" required>
+ <el-upload ref="reportMaterials" :file-list="auditFrom.fileList"
+ action="/api/minio/upload" list-type="picture" :on-success="handleMaterialSuccess">
+ <el-button size="small" type="primary" icon="el-icon-upload">鐐瑰嚮涓婁紶</el-button>
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="鍏宠仈妗堜欢" prop="causeId">
+ <el-select v-model="auditFrom.causeId" placeholder="璇烽�夋嫨涓嬫媺閫夋嫨" clearable :style="{width: '50%'}">
+ <el-option v-for="item in causeOptions" :key="item.id" :label="item.name"
+ :value="item.id"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-form>
+ </el-row>
<span slot="footer" class="dialog-footer">
- <el-button @click="addAduitDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="addAduitDialogVisible = false">纭� 瀹�</el-button>
- </span>
+ <el-button @click="addAduitDialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addAduit">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ <!--鏌ョ湅璇︽儏寮圭獥-->
+ <el-dialog title="妗堜欢璇︽儏" :visible.sync="infoAduitDialogVisible" width="50%" :before-close="infoAduitClose">
+ <el-row :gutter="15">
+ <el-form ref="infoAduitForm" :model="auditInfo" size="medium" label-width="100px">
+ <el-col :span="12">
+ <el-form-item label="澶村儚" prop="pic" required>
+ <el-image style="width: 145px; height: 145px" :src="picShow" :preview-src-list="new Array(picShow)"></el-image>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎶ユ浜� ">
+ <el-input v-model="auditInfo.reporterName" disabled
+ :style="{width: '100%'}"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎵嬫満鍙风爜">
+ <el-input v-model="auditInfo.mobile" disabled :style="{width: '100%'}">
+ </el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="韬唤璇佸彿">
+ <el-input v-model="auditInfo.idcard" disabled :style="{width: '100%'}">
+ </el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="琚獥鏃堕棿">
+ <el-date-picker v-model="auditInfo.tmpTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ :style="{width: '100%'}" format="yyyy-MM-dd HH:mm:ss"
+ :value-format="auditFrom.cheatTime" disabled></el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="娑夋閲戦">
+ <el-input v-model="auditInfo.amountInvolved" placeholder="璇疯緭鍏ユ秹妗堥噾棰�"
+ :style="{width: '100%'}" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="妗堜欢鎻忚堪">
+ <el-input v-model="auditInfo.reportDescription" placeholder="璇疯緭鍏ユ浠舵弿杩�"
+ :style="{width: '100%'}" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="琛ュ厖淇℃伅">
+ <el-input v-model="auditInfo.information" type="textarea" placeholder="璇疯緭鍏ヨˉ鍏呬俊鎭�"
+ :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="涓婁紶" required>
+ <el-upload ref="reportMaterials" :file-list="auditInfo.fileList"
+ action="/api/minio/upload" list-type="picture" :on-success="handleMaterialSuccess">
+ <el-button size="small" type="primary" icon="el-icon-upload">鐐瑰嚮涓婁紶</el-button>
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="鍏宠仈妗堜欢" prop="causeId">
+ <el-select v-model="auditFrom.causeId" placeholder="璇烽�夋嫨涓嬫媺閫夋嫨" clearable :style="{width: '50%'}" disabled>
+ <el-option v-for="item in causeOptions" :key="item.id" :label="item.name"
+ :value="item.id"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-form>
+ </el-row>
</el-dialog>
</div>
</template>
<script>
-import {getAuditList} from '@/api/common'
+import {getAuditList, getImgUrl, getReportById, report} from '@/api/common'
export default {
name: "Audit",
@@ -103,8 +241,24 @@
isInGroup: '5',
current: 1,
HavaMaterial: '5',
- size: 10
+ size: 10,
},
+ auditFrom: {
+ pic: '',
+ reporterName: '',
+ mobile: '',
+ idcard: '',
+ cheatTime: '',
+ amountInvolved: '',
+ reportDescription: '',
+ information: '',
+ reportMaterials: "",
+ causeId: '',
+ fileList: [],
+ tmpTime: '',
+ },
+ auditInfo: {},
+ picShow: "",
optionsGroup: [
{
value: '5',
@@ -136,14 +290,96 @@
total: 0,
list: [],
addAduitDialogVisible: false,
+ infoAduitDialogVisible: false,
+ causeOptions: [],
+ rules: {
+ reporterName: [{
+ required: true,
+ message: '璇疯緭鍏ユ姤妗堜汉 ',
+ trigger: 'blur'
+ }],
+ mobile: [{
+ required: true,
+ message: '璇疯緭鍏ユ墜鏈哄彿鐮�',
+ trigger: 'blur'
+ }],
+ idcard: [{
+ required: true,
+ message: '璇疯緭鍏ヨ韩浠借瘉鍙�',
+ trigger: 'blur'
+ }],
+ tmpTime: [{
+ required: true,
+ message: '璇疯緭鍏ヨ楠楁椂闂�',
+ trigger: 'blur'
+ }],
+ amountInvolved: [{
+ required: true,
+ message: '璇疯緭鍏ユ秹妗堥噾棰�',
+ trigger: 'blur'
+ }],
+ reportDescription: [{
+ required: true,
+ message: '璇疯緭鍏ユ浠舵弿杩�',
+ trigger: 'blur'
+ }],
+ information: [{
+ required: true,
+ message: '璇疯緭鍏ヨˉ鍏呬俊鎭�',
+ trigger: 'blur'
+ }],
+ causeId: [{
+ required: true,
+ message: '璇烽�夋嫨涓嬫媺閫夋嫨',
+ trigger: 'change'
+ }],
+ },
}
},
created() {
this.getList()
+ this.getCauseOptions()
},
methods: {
+ infoAduitClose() {
+ this.infoAduitDialogVisible = false
+ this.$refs.infoAduitForm.resetFields()
+ },
+ addAduit() {
+ this.$refs.addAduitForm.validate(async (vaild) => {
+ if (!vaild) return this.$message.error('杈撳叆鏈夎')
+ this.auditFrom.reportMaterials = this.auditFrom.fileList.map(i => i.data).join(',')
+ report(this.auditFrom).then(res => {
+ this.$message.success('鎻愪氦鎴愬姛')
+ this.addAduitDialogVisible = false
+ this.getList()
+ }).catch(err => {
+ this.addAduitClose()
+ })
+ })
+ },
+ async getCauseOptions() {
+ const {data: data} = await this.$http.get('/api/cause/getCauseIdAndName');
+ this.causeOptions = data.data;
+ },
+ handleAvatarSuccess(res, file) {
+ this.auditFrom.pic = res.data
+ console.log(res.data)
+ getImgUrl(res.data).then(res => {
+ this.picShow = res
+ })
+ },
+ async handleMaterialSuccess(res, file) {
+ this.auditFrom.fileList.push({
+ name: file.name,
+ url: await getImgUrl(res.data),
+ data: res.data
+ })
+ },
addAduitClose() {
this.addAduitDialogVisible = false
+ this.$refs.addAduitForm.resetFields()
+ this.picShow = ""
},
getList() {
let param = {}
@@ -156,6 +392,15 @@
getAuditList(param).then(res => {
this.total = res.total
this.list = res.records
+ this.list.forEach(x => {
+ if (x.pic === '' || x.pic === null) {
+ x.pic = './logo.png';
+ } else {
+ getImgUrl(x.pic).then(res => {
+ x.pic = res
+ })
+ }
+ })
})
},
search() {
@@ -171,11 +416,17 @@
this.getList();
},
details(id) {
- console.log(id)
+ getReportById(id).then(res => {
+ this.auditInfo = res
+ getImgUrl(res.pic).then(res => {
+ this.picShow = res
+ })
+ this.infoAduitDialogVisible = true
+ })
},
audit(id) {
console.log(id)
- }
+ },
}
}
</script>
@@ -188,4 +439,9 @@
.demo-form-inline .el-select {
width: 100px;
}
-</style>
\ No newline at end of file
+
+.el-form-item {
+ margin-top: 20px;
+}
+
+</style>
--
Gitblit v1.8.0