You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
755 lines
22 KiB
755 lines
22 KiB
<template>
|
|
<div class="g-main">
|
|
<div class="m-search">
|
|
<el-form :inline="true"
|
|
:model="workLog"
|
|
ref="ref_searchform"
|
|
:label-width="'100px'">
|
|
<div>
|
|
<el-form-item label="所属网格"
|
|
prop="gridId">
|
|
<el-select v-model="workLog.gridId"
|
|
filterable
|
|
size="small"
|
|
placeholder="请选择"
|
|
clearable>
|
|
<el-option v-for="item in optionsG"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="服务类型"
|
|
prop="serviceType">
|
|
<el-select v-model="workLog.serviceType"
|
|
filterable
|
|
size="small"
|
|
placeholder="请选择"
|
|
clearable>
|
|
<el-option v-for="item in serviceTypeList"
|
|
:key="item.serviceType"
|
|
:label="item.serviceTypeName"
|
|
:value="item.serviceType">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="申请人"
|
|
prop="applicantName">
|
|
<el-input v-model="workLog.applicantName"
|
|
class="item_width_1"
|
|
clearable
|
|
size="small"
|
|
placeholder="请输入内容">
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item label="住址"
|
|
prop="applicantAddress">
|
|
<el-input v-model="workLog.applicantAddress"
|
|
class="item_width_1"
|
|
clearable
|
|
size="small"
|
|
placeholder="请输入内容">
|
|
</el-input>
|
|
</el-form-item>
|
|
</div>
|
|
<div>
|
|
<el-form-item label="服务内容"
|
|
prop="serviceContent">
|
|
<el-input v-model="workLog.serviceContent"
|
|
class="item_width_1"
|
|
clearable
|
|
size="small"
|
|
placeholder="请输入内容">
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item label="联系电话"
|
|
prop="applicantMobile">
|
|
<el-input v-model="workLog.applicantMobile"
|
|
class="item_width_1"
|
|
clearable
|
|
size="small"
|
|
placeholder="请输入内容">
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item label="服务时间"
|
|
prop="serviceTimeArea">
|
|
<el-date-picker v-model="serviceTimeArea"
|
|
clearable
|
|
type="daterange"
|
|
format="yyyy-MM-dd"
|
|
value-format="yyyy-MM-dd"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
<el-button style="margin-left:30px"
|
|
class="diy-button--white"
|
|
size="small"
|
|
@click="resetSearch">重置</el-button>
|
|
<el-button style="margin-left:10px"
|
|
class="diy-button--add"
|
|
size="small"
|
|
@click="handleSearch">查询</el-button>
|
|
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
<div class="m-table">
|
|
<div class="div_btn">
|
|
<el-button class="diy-button--add"
|
|
size="small"
|
|
@click="handleAdd">新增</el-button>
|
|
|
|
<el-button class="diy-button--search"
|
|
style="margin-left:10px"
|
|
size="small"
|
|
@click="handleExportModule('room')">下载模板</el-button>
|
|
<el-upload :headers="$getElUploadHeaders()"
|
|
ref="upload"
|
|
:multiple='false'
|
|
:show-file-list='false'
|
|
:before-upload="beforeUpload"
|
|
action=""
|
|
accept=".xls,.xlsx"
|
|
:limit="1"
|
|
:on-exceed="handleExceed"
|
|
:http-request="uploadFile">
|
|
<el-button style="margin-left:10px"
|
|
class="diy-button--delete"
|
|
size="small">导入</el-button>
|
|
</el-upload>
|
|
<el-button style="float:left;margin-left:10px"
|
|
class="diy-button--reset"
|
|
size="small"
|
|
@click="handleExport">导出</el-button>
|
|
</div>
|
|
|
|
<el-table class="table"
|
|
:data="tableData"
|
|
border
|
|
:height="tableHeight"
|
|
v-loading="tableLoading"
|
|
|
|
style="width: 100%">
|
|
<el-table-column label="序号"
|
|
header-align="center"
|
|
align="center"
|
|
type="index"
|
|
width="50"></el-table-column>
|
|
|
|
<el-table-column prop="gridName"
|
|
header-align="center"
|
|
align="center"
|
|
label="所属网格"
|
|
min-width="100">
|
|
</el-table-column>
|
|
<el-table-column prop="serviceTypeName"
|
|
header-align="center"
|
|
align="center"
|
|
label="服务类型"
|
|
min-width="80">
|
|
</el-table-column>
|
|
<el-table-column prop="applicantName"
|
|
header-align="center"
|
|
align="center"
|
|
label="申请人"
|
|
show-overflow-tooltip
|
|
width="100">
|
|
</el-table-column>
|
|
<el-table-column prop="applicantAddress"
|
|
header-align="center"
|
|
show-overflow-tooltip
|
|
align="center"
|
|
label="住址"
|
|
min-width="130">
|
|
</el-table-column>
|
|
<el-table-column prop="serviceContent"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="服务内容"
|
|
min-width="150">
|
|
</el-table-column>
|
|
<el-table-column prop="applicantMobile"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="联系电话"
|
|
width="110">
|
|
</el-table-column>
|
|
<el-table-column prop="principalName"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="责任人"
|
|
width="100">
|
|
</el-table-column>
|
|
<el-table-column prop="serviceTime"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="服务时间"
|
|
width="130">
|
|
</el-table-column>
|
|
<el-table-column prop="remark"
|
|
header-align="center"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
label="备注"
|
|
width="130">
|
|
</el-table-column>
|
|
<el-table-column label="操作"
|
|
fixed="right"
|
|
width="200"
|
|
header-align="center"
|
|
align="center"
|
|
class="operate">
|
|
<template slot-scope="scope">
|
|
|
|
<el-button type="text"
|
|
class="div-table-button--detail"
|
|
size="small"
|
|
@click="handleDetail(scope.row)">查看</el-button>
|
|
<el-button type="text"
|
|
class="div-table-button--edit"
|
|
size="small"
|
|
@click="handleEdit(scope.row)">修改</el-button>
|
|
<el-button type="text"
|
|
class="div-table-button--delete"
|
|
size="small"
|
|
@click="handleDelete(scope.row)">删除</el-button>
|
|
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div>
|
|
<el-pagination @size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page.sync="pageNo"
|
|
:page-sizes="[10, 20, 50]"
|
|
:page-size="pageSize"
|
|
layout="sizes, prev, pager, next, total"
|
|
:total="total">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 修改弹出框 -->
|
|
<el-dialog :visible.sync="formShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
:title="formTitle"
|
|
:destroy-on-close="true"
|
|
width="950px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="editDiaClose">
|
|
<work-log-form ref="ref_form"
|
|
:typeList="typeList"
|
|
@dialogCancle="addFormCancle"
|
|
@dialogOk="addFormOk"></work-log-form>
|
|
</el-dialog>
|
|
|
|
<el-dialog :visible.sync="detailShow"
|
|
:close-on-click-modal="false"
|
|
:close-on-press-escape="false"
|
|
:title="'详情'"
|
|
width="750px"
|
|
top="5vh"
|
|
class="dialog-h"
|
|
@closed="diaClose">
|
|
<work-log-detail ref="ref_detail"
|
|
@diaDetailClose="diaClose"></work-log-detail>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import workLogForm from './workLogForm'
|
|
import workLogDetail from './workLogDetail'
|
|
|
|
import { requestPost } from "@/js/dai/request";
|
|
import { mapGetters } from 'vuex'
|
|
import { Loading } from 'element-ui' // 引入Loading服务
|
|
|
|
let loading // 加载动画
|
|
export default {
|
|
data () {
|
|
return {
|
|
loading: false,
|
|
serviceTimeArea: '',
|
|
total: 0,
|
|
pageSize: 20,
|
|
pageNo: 0,
|
|
tableLoading: false,
|
|
agencyId: '',
|
|
typeList: [],//分类list
|
|
formData: {
|
|
gridId: '',
|
|
serviceType: '',
|
|
applicantName: '',
|
|
applicantAddress: '',
|
|
applicantMobile: '',
|
|
serviceContent: '',
|
|
serviceTimeStart: '',
|
|
serviceTimeEnd: ''
|
|
},
|
|
tableData: [],
|
|
|
|
//form相关
|
|
formShow: false,
|
|
formTitle: '新增',
|
|
detailShow: false,
|
|
|
|
finishDiaShow: false,
|
|
|
|
scoreDiaShow: false,
|
|
|
|
files: "",
|
|
fileName: "",
|
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/heart/workdiaryService/record/import',
|
|
optionsG: [],
|
|
optionsEditG: [],
|
|
workLog: {
|
|
gridId: '',
|
|
serviceType: '',
|
|
applicantName: '',
|
|
applicantAddress: '',
|
|
applicantMobile: '',
|
|
serviceContent: '',
|
|
serviceTimeStart: '',
|
|
serviceTimeEnd: ''
|
|
},
|
|
serviceTypeList: [],
|
|
|
|
}
|
|
},
|
|
components: {
|
|
workLogDetail, workLogForm
|
|
},
|
|
async created () {
|
|
this.getGridList("query");
|
|
this.getServiceTypeList();
|
|
},
|
|
async mounted () {
|
|
const { user } = this.$store.state
|
|
this.agencyId = user.agencyId
|
|
await this.loadTable()
|
|
},
|
|
|
|
methods: {
|
|
handleSearch () {
|
|
this.loadTable()
|
|
},
|
|
async getGridList (type, agencyId) {
|
|
const { user } = await this.$store.state;
|
|
await this.$http
|
|
.post("/gov/org/customergrid/gridoption", {
|
|
agencyId: agencyId || user.agencyId,
|
|
purpose: type,
|
|
})
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
return this.$message.error(res.msg);
|
|
} else {
|
|
console.log("获取查询详情成功", res.data);
|
|
|
|
if (type === "query") this.optionsG = res.data;
|
|
else this.optionsEditG = res.data;
|
|
}
|
|
})
|
|
.catch(() => {
|
|
return this.$message.error("网络错误");
|
|
});
|
|
},
|
|
async getServiceTypeList () {
|
|
// let url = 'http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/serviceType/page'
|
|
let url = '/heart/workdiaryService/serviceType/page'
|
|
let params = {
|
|
pageNo: 1,
|
|
pageSize: 10000
|
|
}
|
|
await this.$http
|
|
.post(url, params)
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
return this.$message.error(res.msg);
|
|
} else {
|
|
this.serviceTypeList = res.data.list;
|
|
}
|
|
})
|
|
.catch(() => {
|
|
return this.$message.error("网络错误");
|
|
});
|
|
},
|
|
async handleExportModule () {
|
|
let url = "/heart/workdiaryService/record/downloadTemplate";
|
|
// let url = "http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/record/downloadTemplate";
|
|
|
|
let params = {};
|
|
await this.$http({
|
|
method: "POST",
|
|
url,
|
|
responseType: "blob",
|
|
data: params,
|
|
})
|
|
.then((res) => {
|
|
if (res.headers["content-disposition"]) {
|
|
let fileName = window.decodeURI(
|
|
res.headers["content-disposition"].split(";")[1].split("=")[1]
|
|
);
|
|
console.log("filename", fileName);
|
|
let blob = new Blob([res.data], {
|
|
type: "application/vnd.ms-excel",
|
|
});
|
|
var url = window.URL.createObjectURL(blob);
|
|
var aLink = document.createElement("a");
|
|
aLink.style.display = "none";
|
|
aLink.href = url;
|
|
aLink.setAttribute("download", fileName);
|
|
document.body.appendChild(aLink);
|
|
aLink.click();
|
|
document.body.removeChild(aLink); //下载完成移除元素
|
|
window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
} else this.$message.error("下载失败");
|
|
})
|
|
.catch((err) => {
|
|
console.log("err", err);
|
|
return this.$message.error("网络错误");
|
|
});
|
|
},
|
|
|
|
async loadTable () {
|
|
this.tableLoading = true
|
|
|
|
if (Array.isArray(this.serviceTimeArea) && this.serviceTimeArea.length > 0) {
|
|
this.workLog.serviceTimeStart = this.serviceTimeArea[0];
|
|
this.workLog.serviceTimeEnd = this.serviceTimeArea[1];
|
|
} else {
|
|
this.workLog.serviceTimeStart = '';
|
|
this.workLog.serviceTimeEnd = '';
|
|
}
|
|
|
|
const url = "/heart/workdiaryService/record/page"
|
|
// const url = "http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/record/page"
|
|
let params = {
|
|
pageSize: this.pageSize,
|
|
pageNo: this.pageNo,
|
|
...this.workLog
|
|
}
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
if (code === 0) {
|
|
this.total = data.total
|
|
this.tableData = data.list
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
this.tableLoading = false
|
|
},
|
|
|
|
editDiaClose () {
|
|
this.$refs.ref_form.resetData()
|
|
this.formShow = false
|
|
},
|
|
diaClose () {
|
|
this.detailShow = false
|
|
this.finishDiaShow = false
|
|
this.scoreDiaShow = false
|
|
},
|
|
|
|
handleDetail (row) {
|
|
this.detailShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_detail.initForm(row)
|
|
})
|
|
},
|
|
|
|
//完成情况
|
|
handleFinish (row) {
|
|
this.finishDiaShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_finish.initTable(row)
|
|
})
|
|
},
|
|
//积分记录
|
|
handleScore (row) {
|
|
this.scoreDiaShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_score.initForm(row.icPublicServiceId)
|
|
})
|
|
},
|
|
|
|
handleAdd () {
|
|
this.formTitle = '新增'
|
|
this.formShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('add', null)
|
|
})
|
|
},
|
|
|
|
handleEdit (row) {
|
|
this.formTitle = '修改'
|
|
this.formShow = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ref_form.initForm('edit', row)
|
|
})
|
|
},
|
|
|
|
addFormCancle () {
|
|
this.formShow = false
|
|
},
|
|
addFormOk () {
|
|
this.formShow = false
|
|
this.loadTable()
|
|
|
|
},
|
|
|
|
async handleDelete (row) {
|
|
|
|
this.$confirm("确认删除?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
})
|
|
.then(() => {
|
|
this.deleteUnit(row)
|
|
})
|
|
.catch(err => {
|
|
if (err == "cancel") {
|
|
}
|
|
});
|
|
},
|
|
|
|
async deleteUnit (row) {
|
|
const url = "/heart/workdiaryService/record/delete"
|
|
// const url = "http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/record/delete"
|
|
let params = [row.id]
|
|
|
|
const { data, code, msg } = await requestPost(url, params)
|
|
if (code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "删除成功"
|
|
});
|
|
this.loadTable()
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
},
|
|
|
|
//重置搜索条件
|
|
resetSearch () {
|
|
this.optionsG = []
|
|
this.demandUserList = []
|
|
this.workLog = {
|
|
gridId: '',
|
|
serviceType: '',
|
|
applicantName: '',
|
|
applicantAddress: '',
|
|
applicantMobile: '',
|
|
serviceContent: '',
|
|
serviceTimeStart: '',
|
|
serviceTimeEnd: ''
|
|
}
|
|
this.serviceTimeArea = ''
|
|
this.pageSize = 10
|
|
this.pageNo = 0
|
|
this.loadTable()
|
|
},
|
|
|
|
//导出表格
|
|
async handleExport () {
|
|
let title = '工作日志'
|
|
|
|
const url = "/heart/workdiaryService/record/export"
|
|
// const url = "http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/record/export"
|
|
let params = {
|
|
...this.workLog
|
|
}
|
|
|
|
app.ajax.exportFilePost(
|
|
url,
|
|
params,
|
|
(data, rspMsg) => {
|
|
|
|
this.download(data, title + '.xls')
|
|
},
|
|
(rspMsg, data) => {
|
|
this.$message.error(rspMsg);
|
|
}
|
|
);
|
|
|
|
},
|
|
|
|
// 下载文件
|
|
download (data, fileName) {
|
|
if (!data) {
|
|
return
|
|
}
|
|
|
|
var csvData = new Blob([data])
|
|
|
|
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
window.navigator.msSaveOrOpenBlob(csvData, fileName);
|
|
}
|
|
// for Non-IE (chrome, firefox etc.)
|
|
else {
|
|
var a = document.createElement('a');
|
|
document.body.appendChild(a);
|
|
a.style = 'display: none';
|
|
var url = window.URL.createObjectURL(csvData);
|
|
a.href = url;
|
|
a.download = fileName;
|
|
a.click();
|
|
a.remove();
|
|
window.URL.revokeObjectURL(url);
|
|
}
|
|
|
|
},
|
|
|
|
// 上传文件之前的钩子
|
|
beforeUpload (file) {
|
|
this.files = file;
|
|
|
|
const isText = file.type === 'application/vnd.ms-excel'
|
|
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
|
if (!isText && !isTextComputer) {
|
|
this.$message.error('请选择正确格式的文件')
|
|
return false
|
|
} else {
|
|
this.fileName = file.name;
|
|
return true
|
|
}
|
|
|
|
},
|
|
// 上传文件个数超过定义的数量
|
|
handleExceed (files, fileList) {
|
|
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
|
|
},
|
|
|
|
async uploadFile () {
|
|
this.loading = true
|
|
|
|
if (this.fileName == "") {
|
|
this.$message.warning('请选择要上传的文件!')
|
|
return false
|
|
}
|
|
|
|
//清空上传列表
|
|
this.$refs['upload'].clearFiles()
|
|
|
|
var url = '/heart/workdiaryService/record/import'
|
|
// var url = 'http://yapi.elinkservice.cn/mock/245/heart/workdiaryService/record/import'
|
|
let fileFormData = new FormData();
|
|
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名
|
|
|
|
const { data, code, msg } = await requestPost(url, fileFormData)
|
|
if (code === 0) {
|
|
this.$message({
|
|
showClose: true,
|
|
dangerouslyUseHTMLString: true,
|
|
message: "导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度",
|
|
duration: 3000
|
|
});
|
|
let than = this
|
|
document.getElementById('clickA').addEventListener('click',function(){
|
|
than.$router.replace('/main/importRecord-index');
|
|
})
|
|
|
|
this.loadTable()
|
|
} else {
|
|
this.$message.error(msg)
|
|
}
|
|
|
|
|
|
},
|
|
|
|
handleSizeChange (val) {
|
|
this.pageSize = val
|
|
this.pageNo = 1
|
|
this.loadTable()
|
|
},
|
|
handleCurrentChange (val) {
|
|
this.pageNo = val
|
|
this.loadTable()
|
|
},
|
|
|
|
// 开启加载动画
|
|
startLoading () {
|
|
loading = Loading.service({
|
|
lock: true, // 是否锁定
|
|
text: '正在加载……', // 加载中需要显示的文字
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色
|
|
})
|
|
},
|
|
// 结束加载动画
|
|
endLoading () {
|
|
// clearTimeout(timer);
|
|
if (loading) {
|
|
loading.close()
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
tableHeight () {
|
|
|
|
return this.$store.state.inIframe ? this.clientHeight - 350 + this.iframeHeight : this.clientHeight - 350
|
|
|
|
},
|
|
|
|
...mapGetters(['clientHeight', 'iframeHeight'])
|
|
},
|
|
watch: {
|
|
|
|
},
|
|
props: {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped >
|
|
@import "@/assets/scss/buttonstyle.scss";
|
|
@import "@/assets/scss/modules/management/list-main.scss";
|
|
.g-main {
|
|
width: 100%;
|
|
}
|
|
|
|
.m-search {
|
|
background: #ffffff;
|
|
border-radius: 4px;
|
|
padding: 30px 20px 5px;
|
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.item_width_1 {
|
|
width: 260px;
|
|
}
|
|
.item_width_2 {
|
|
width: 620px;
|
|
}
|
|
|
|
.m-table {
|
|
background: #ffffff;
|
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1);
|
|
border-radius: 4px;
|
|
margin-top: 15px;
|
|
// padding: 23px 30px 10px;
|
|
|
|
.table {
|
|
margin-top: 20px;
|
|
}
|
|
}
|
|
|
|
.el-row {
|
|
/* margin-bottom: 20px; */
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
margin-top: 10px;
|
|
margin-right: 50px;
|
|
}
|
|
</style>
|
|
|