Commit c228969d authored by “yiyousong”'s avatar “yiyousong”

feat:添加批量导入工作人员照片

parent 30f2ebe8
...@@ -30,48 +30,21 @@ ...@@ -30,48 +30,21 @@
<a class="look-more" @click="lookMore(text)">查看详情</a> <a class="look-more" @click="lookMore(text)">查看详情</a>
</template> </template>
<template slot="active" slot-scope="text"> <template slot="active" slot-scope="text">
<a class="edit" @click="handleEdit(text)">编辑</a> <a-space size="middle">
<a class="delete" @click="handleDel(text.id)">删除</a> <a class="edit" @click="handleEdit(text)">编辑</a>
</template> <a class="delete" @click="handleDel(text.id)">删除</a>
</a-table> </a-space>
<!-- 表格 -->
<a-table
bordered
:pagination="false"
:columns="columns"
:data-source="tableData"
>
<template slot="num" slot-scope="text, record, index">
{{ index + 1 }}
</template>
<template slot="more" slot-scope="text">
<a class="look-more" @click="lookMore(text)">查看详情</a>
</template>
<template slot="active" slot-scope="text">
<a class="edit" @click="handleEdit(text)">编辑</a>
<a-popconfirm
title="删除不可恢复,确定要删除吗?"
@confirm="handleDel(text.id)"
>
<a-icon slot="icon" type="question-circle-o" style="color: red" />
<a class="delete">删除</a>
</a-popconfirm>
</template> </template>
</a-table> </a-table>
</div> </div>
<!-- 分页 -->
<a-pagination
@change="handleChange"
v-model="current"
:total="total"
show-less-items
/>
<!-- 新增依据 --> <!-- 新增依据 -->
<add-pursuant <add-pursuant
ref="addPursuant" ref="addPursuant"
:title="title" :title="title"
:addVisible.sync="addVisible" :addVisible.sync="addVisible"
:dict="dict"
@addSuccess="getMattersetbaseData"
></add-pursuant> ></add-pursuant>
<!-- 查看详情 --> <!-- 查看详情 -->
<a-modal v-model="visible" title="依据详情"> <a-modal v-model="visible" title="依据详情">
...@@ -123,6 +96,8 @@ export default { ...@@ -123,6 +96,8 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
pageSizeOptions: ["10", "30", "50", "100"],
columns, columns,
tableData: [], tableData: [],
current: 1, current: 1,
...@@ -132,6 +107,7 @@ export default { ...@@ -132,6 +107,7 @@ export default {
visible: false, visible: false,
details: "", details: "",
total: 0, total: 0,
dict: {}, // 字典
}; };
}, },
created() { created() {
...@@ -141,22 +117,21 @@ export default { ...@@ -141,22 +117,21 @@ export default {
// 获取依据列表 // 获取依据列表
async getMattersetbaseData() { async getMattersetbaseData() {
if (!local.getLocal("matter")) return; if (!local.getLocal("matter")) return;
this.loading = true;
let res = await getMattersetbase({ let res = await getMattersetbase({
page: this.current, page: this.current,
size: this.size, size: this.size,
matterId: local.getLocal("matter").id, matterId: local.getLocal("matter").id,
matterName: local.getLocal("matter").matterName, matterName: local.getLocal("matter").matterName,
}); });
let { total, data } = res.data.data; this.loading = false;
let { total, data, dict } = res.data.data;
if (!data.length && this.current > 1) { if (!data.length && this.current > 1) {
this.current -= 1; this.current -= 1;
this.getMattersetbaseData(); this.getMattersetbaseData();
} }
this.total = total; this.total = total;
data.forEach((v) => { this.dict = dict;
v.key = v.id;
});
this.tableData = data; this.tableData = data;
}, },
// 新增 // 新增
...@@ -170,10 +145,16 @@ export default { ...@@ -170,10 +145,16 @@ export default {
this.$refs.addPursuant.onAdd(); this.$refs.addPursuant.onAdd();
}, },
// 分页 // 分页
handleChange(num) { handlechange(num) {
this.current = num; this.current = num;
this.getMattersetbaseData(); this.getMattersetbaseData();
}, },
// 改变每页显示数量
showSizeChange(cur, size) {
this.current = cur;
this.size = size;
this.getMattersetbaseData();
},
// 查看详情 // 查看详情
lookMore(data) { lookMore(data) {
this.visible = true; this.visible = true;
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
@ok="handleOk" @ok="handleOk"
> >
<template slot="footer"> <template slot="footer">
<a-button @click="handleOk" type="primary">保存</a-button>
<a-button @click="handleInit">重置</a-button> <a-button @click="handleInit">重置</a-button>
<a-button @click="handleOk" type="primary">保存</a-button>
</template> </template>
<a-form-model <a-form-model
:label-col="{ span: 4 }" :label-col="{ span: 4 }"
:wrapper-col="{ span: 17 }" :wrapper-col="{ span: 20 }"
ref="ruleForm" ref="ruleForm"
:rules="rules" :rules="rules"
:model="form" :model="form"
...@@ -22,7 +22,11 @@ ...@@ -22,7 +22,11 @@
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="法规类型" prop="policyType"> <a-form-model-item label="法规类型" prop="policyType">
<a-select v-model="form.policyType" placeholder="请选择法规类型"> <a-select v-model="form.policyType" placeholder="请选择法规类型">
<a-select-option v-for="v in policyTypeItem" :key="v" :value="v"> <a-select-option
v-for="(v, key) in dict.policyType"
:key="v"
:value="key"
>
{{ v }} {{ v }}
</a-select-option> </a-select-option>
</a-select> </a-select>
...@@ -34,7 +38,7 @@ ...@@ -34,7 +38,7 @@
<a-textarea <a-textarea
v-model="form.content" v-model="form.content"
placeholder="请输入条款内容" placeholder="请输入条款内容"
:autosize="{ minRows: 4 }" :auto-size="{ minRows: 4, maxRows: 6 }"
allow-clear allow-clear
/> />
</a-form-model-item> </a-form-model-item>
...@@ -46,30 +50,29 @@ ...@@ -46,30 +50,29 @@
<script> <script>
import { addMattersetbase } from "@/services/matter"; import { addMattersetbase } from "@/services/matter";
import local from "@/utils/local"; import local from "@/utils/local";
const policyTypeItem = [
"法律",
"行政",
"地方法规",
"部门规章",
"其他",
"政府规章",
"规范性文件",
];
export default { export default {
props: { props: {
title: { title: {
required: true,
type: String, type: String,
default: "",
}, },
addVisible: { addVisible: {
required: true,
type: Boolean, type: Boolean,
default: false, default: false,
}, },
dict: {
required: true,
type: Object,
default: () => {
return {};
},
},
}, },
data() { data() {
return { return {
policyTypeItem,
matterList: [], matterList: [],
siteId: "",
form: { form: {
matterId: undefined, matterId: undefined,
matterName: "", matterName: "",
...@@ -123,19 +126,6 @@ export default { ...@@ -123,19 +126,6 @@ export default {
}, },
}, },
methods: { methods: {
// 获取站点事项列表
// async getSiteMatterList() {
// this.siteId = this.$route.query.siteId;
// let res = await getSiteMatterList({ siteId: this.siteId });
// this.matterList = res.data.data.data;
// },
// // 事项下拉选择
// handleSelect(val, node) {
// let { text } = node.componentOptions.children[0];
// this.form.matterName = text;
// },
// 保存 // 保存
handleOk() { handleOk() {
if (!local.getLocal("matter")) return; if (!local.getLocal("matter")) return;
...@@ -150,8 +140,8 @@ export default { ...@@ -150,8 +140,8 @@ export default {
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.Visible = false; this.Visible = false;
this.$parent.getMattersetbaseData();
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.$emit("addSuccess");
} }
} }
}); });
......
...@@ -119,9 +119,11 @@ ...@@ -119,9 +119,11 @@
<a-menu-item key="2"> <a-menu-item key="2">
<a style="color: #1890ff" @click="handleDownload"> 模板下载</a> <a style="color: #1890ff" @click="handleDownload"> 模板下载</a>
</a-menu-item> </a-menu-item>
<!-- <a-menu-item key="3"> <a-menu-item key="3">
<a style="color: #1890ff" @click="changePwd"> 修改密码</a> <a style="color: #1890ff" @click="handleUploadImg">
</a-menu-item> --> 批量导入照片
</a>
</a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> <a-button style="margin-left: 8px">
更多操作 <a-icon type="down" /> 更多操作 <a-icon type="down" />
...@@ -242,6 +244,8 @@ import { ...@@ -242,6 +244,8 @@ import {
getWorkmanList, getWorkmanList,
delWorkman, delWorkman,
downLoadTemplate, downLoadTemplate,
uploadFile,
uploadAllImg,
// editWorkman, // editWorkman,
importData, importData,
} from "@/services/dept"; } from "@/services/dept";
...@@ -541,6 +545,32 @@ export default { ...@@ -541,6 +545,32 @@ export default {
this.getWorkmanData(); this.getWorkmanData();
} }
}, },
// 批量导入照片
handleUploadImg() {
let input = document.createElement("input");
input.setAttribute("type", "file");
input.setAttribute("accept", "application/x-zip-compressed");
input.style.display = "none";
input.addEventListener("change", async () => {
if (input.files && input.files.length > 0) {
let file = input.files[0];
let formData = new FormData();
formData.append("file", file);
let res = await uploadFile(formData);
if (res.data.code == 1) {
let result = await uploadAllImg({
filePath: res.data.url,
});
if (result.data.code === 1) {
this.$message.success(result.data.msg);
}
}
}
});
document.body.appendChild(input);
input.click();
document.body.removeChild(input);
},
// 修改密码弹窗 // 修改密码弹窗
changePwd(row) { changePwd(row) {
this.$refs.EditPwd.getUserInfo(row.loginName); this.$refs.EditPwd.getUserInfo(row.loginName);
......
...@@ -168,6 +168,7 @@ module.exports = { ...@@ -168,6 +168,7 @@ module.exports = {
importData: `${BASE_URL}/base/workman/importData`, importData: `${BASE_URL}/base/workman/importData`,
exportExcel: `${BASE_URL}/base/workman/exportExcel`, exportExcel: `${BASE_URL}/base/workman/exportExcel`,
changePwd: `${BASE_URL}/base/workman/change/password`, changePwd: `${BASE_URL}/base/workman/change/password`,
doImportPic: `${BASE_URL}/base/workman/doImportPic`,
}, },
// 站点业务 // 站点业务
sitebusiness: { sitebusiness: {
......
...@@ -97,6 +97,10 @@ export async function uploadFile(data) { ...@@ -97,6 +97,10 @@ export async function uploadFile(data) {
export function changePwd(data) { export function changePwd(data) {
return request(workman.changePwd, METHOD.POST, data); return request(workman.changePwd, METHOD.POST, data);
} }
// 批量导入工作人员照片
export function uploadAllImg(data) {
return request(workman.doImportPic, METHOD.POST, data);
}
/** /**
* 窗口事项 * 窗口事项
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment