| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" |
| | | :summary-method="summaryMethod" @row-del="rowDel" v-model="form" :permission="permissionList" |
| | | @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" @search-change="searchChange" |
| | | @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" |
| | | @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | <basic-container> |
| | | <div class="search-box"> |
| | | <div class="date-box"> |
| | | <div class="name">检查时间:</div> |
| | | <el-date-picker v-model="dateTime" type="daterange" range-separator="至" start-placeholder="开始日期" |
| | | end-placeholder="结束日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | </div> |
| | | <div class="btn-box"> |
| | | <el-button type="primary" icon="el-icon-search" @click="searchChange">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" @click="searchReset">重置</el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-download" @click="exportAvue">导出</el-button> --> |
| | | </div> |
| | | </div> |
| | | |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel" |
| | | v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" |
| | | @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="warning" size="small" plain icon="el-icon-download" @click="exportAvue">导出 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | import { |
| | | mapGetters |
| | | } from "vuex" |
| | | import { |
| | | } from "vuex" |
| | | import { |
| | | getYHTJList |
| | | } from "@/api/publicSecurity/ninePlaceManage" |
| | | } from "@/api/publicSecurity/ninePlaceManage" |
| | | import { |
| | | export_json_to_excels |
| | | } from "@/util/Export2Excel" |
| | | import { |
| | | timestampToTime |
| | | } from "@/util/timeStamp" |
| | | |
| | | export default { |
| | | data () { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | dateTime: "", |
| | | selectionList: [], |
| | | option: { |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | menu: false, |
| | | border: true, |
| | | index: true, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | addBtn: false, |
| | | excelBtn: false, |
| | | columnBtn: false, |
| | | refreshBtn: false, |
| | | dialogClickModal: false, |
| | | column: [{ |
| | | label: "地区", |
| | | prop: "name", |
| | | align: 'center', |
| | | }, { |
| | | label: "小商店", |
| | | prop: "xsd", |
| | | align: 'center', |
| | | }, |
| | | datetime: "", |
| | | selectionList: [], |
| | | option: { |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | menu: false, |
| | | border: true, |
| | | index: true, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | addBtn: false, |
| | | excelBtn: true, |
| | | columnBtn: false, |
| | | refreshBtn: false, |
| | | dialogClickModal: false, |
| | | showSummary: true, |
| | | column: [ |
| | | { |
| | | label: "地区", |
| | | prop: "name", |
| | | align: 'center', |
| | | }, { |
| | | label: "小商店", |
| | | prop: "xsd", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小旅馆", |
| | | prop: "xlg", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小学校(幼儿园、校外培训机构)", |
| | | align: 'center', |
| | | children: [ |
| | | { |
| | | label: "学校", |
| | | prop: "xxx", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "幼儿园", |
| | | prop: "yey", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "校外培训机构", |
| | | prop: "xwpxjg", |
| | | align: 'center', |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "小医院(诊所、养老院)", |
| | | align: 'center', |
| | | children: [ |
| | | { |
| | | label: "医院", |
| | | prop: "yy", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "诊所", |
| | | prop: "zs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "养老院", |
| | | prop: "yly", |
| | | align: 'center', |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "小网吧", |
| | | prop: "xwb", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小餐饮场所", |
| | | prop: "xcycs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小歌舞娱乐场所", |
| | | prop: "xgwylcs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小美容洗浴场所", |
| | | prop: "xmrxycs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小生产加工企业", |
| | | prop: "xscjgqy", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "总数", |
| | | prop: "count", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "检查时间", |
| | | prop: "daterange", |
| | | type: "daterange", |
| | | format: 'yyyy-MM-DD', |
| | | valueFormat: 'yyyy-MM-DD', |
| | | startPlaceholder: '日期开始范围自定义', |
| | | endPlaceholder: '日期结束范围自定义', |
| | | hide: true, |
| | | search: true, |
| | | searchSpan: 6, |
| | | searchRange: true, |
| | | }], |
| | | { |
| | | label: "小旅馆", |
| | | prop: "xlg", |
| | | align: 'center', |
| | | }, |
| | | data: [] |
| | | } |
| | | { |
| | | label: "小学校(幼儿园、校外培训机构)", |
| | | align: 'center', |
| | | children: [{ |
| | | label: "学校", |
| | | prop: "xxx", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "幼儿园", |
| | | prop: "yey", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "校外培训机构", |
| | | prop: "xwpxjg", |
| | | align: 'center', |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "小医院(诊所、养老院)", |
| | | align: 'center', |
| | | children: [{ |
| | | label: "医院", |
| | | prop: "yy", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "诊所", |
| | | prop: "zs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "养老院", |
| | | prop: "yly", |
| | | align: 'center', |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "小网吧", |
| | | prop: "xwb", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "小餐饮场所", |
| | | prop: "xcycs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | width: 120, |
| | | label: "小歌舞娱乐场所", |
| | | prop: "xgwylcs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | width: 120, |
| | | label: "小美容洗浴场所", |
| | | prop: "xmrxycs", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | width: 120, |
| | | label: "小生产加工企业", |
| | | prop: "xscjgqy", |
| | | align: 'center', |
| | | }, |
| | | { |
| | | label: "总数", |
| | | prop: "count", |
| | | align: 'center', |
| | | }, |
| | | // { |
| | | // label: "检查时间", |
| | | // prop: "dateTime", |
| | | // type: "daterange", |
| | | // format: 'yyyy-MM-DD', |
| | | // valueFormat: 'yyyy-MM-DD', |
| | | // isAdmin: true,//自定义属性 |
| | | // startPlaceholder: '日期开始范围', |
| | | // endPlaceholder: '日期结束范围', |
| | | // hide: true, |
| | | // addDisplay: false, |
| | | // editDisplay: false, |
| | | // viewDisplay: false, |
| | | // search: true, |
| | | // searchSpan: 6, |
| | | // searchRange: true, |
| | | // } |
| | | ], |
| | | }, |
| | | data: [] |
| | | } |
| | | }, |
| | | |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList () { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.place_add, true), |
| | | viewBtn: this.vaildData(this.permission.place_view, true), |
| | | delBtn: this.vaildData(this.permission.place_delete, true), |
| | | editBtn: this.vaildData(this.permission.place_edit, true), |
| | | } |
| | | }, |
| | | ids () { |
| | | let ids = [] |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | }, |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.place_add, true), |
| | | viewBtn: this.vaildData(this.permission.place_view, true), |
| | | delBtn: this.vaildData(this.permission.place_delete, true), |
| | | editBtn: this.vaildData(this.permission.place_edit, true), |
| | | } |
| | | }, |
| | | ids() { |
| | | let ids = [] |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | }, |
| | | |
| | | }, |
| | | |
| | | created() { |
| | | this.dateTime = this.getLastMouth() |
| | | }, |
| | | |
| | | methods: { |
| | | getLastMouth (str = '-') { |
| | | let today = new Date() |
| | | let lastMouth = new Date() |
| | | let nowTime = today.getTime() |
| | | let ms = 24 * 3600 * 1000 * -30 |
| | | today.setTime(parseInt(nowTime)) |
| | | lastMouth.setTime(parseInt(nowTime + ms)) |
| | | let oYear = today.getFullYear() |
| | | let oMoth = (today.getMonth() + 1).toString() |
| | | if (oMoth.length <= 1) oMoth = "0" + oMoth |
| | | let oDay = today.getDate().toString() |
| | | if (oDay.length <= 1) oDay = "0" + oDay |
| | | let mYear = lastMouth.getFullYear() |
| | | let mMoth = (lastMouth.getMonth() + 1).toString() |
| | | if (mMoth.length <= 1) mMoth = "0" + mMoth |
| | | let mDay = lastMouth.getDate().toString() |
| | | if (mDay.length <= 1) mDay = "0" + mDay |
| | | let todayDate = oYear + str + oMoth + str + oDay |
| | | let lastMouthDate = mYear + str + mMoth + str + mDay |
| | | console.log('[todayDate, lastMouthDate]', [todayDate, lastMouthDate]) |
| | | return [todayDate, lastMouthDate] |
| | | }, |
| | | exportAvue() { |
| | | this.$confirm("是否导出隐患统计数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | // this.$refs.crud.rowExcel() |
| | | this.exportBtn() |
| | | }) |
| | | }, |
| | | |
| | | summaryMethod ({ columns, data }) { |
| | | const sums = [] |
| | | if (columns.length > 0) { |
| | | columns.forEach((column, index) => { |
| | | let prop = column.property |
| | | if (prop == 'name') { |
| | | sums[index] = '信州区合计' |
| | | } else { |
| | | let values = this.data.map(item => Number(item[prop] || 0)) |
| | | let all = values.length !== 0 ? sums[index] = values.reduce((a, b) => { |
| | | return a + b |
| | | }) : 0 |
| | | sums[index] = all |
| | | } |
| | | }) |
| | | //json格式化 |
| | | formatJson(filterVal, tableData) { |
| | | return tableData.map((v) => { |
| | | return filterVal.map((j) => { |
| | | return v[j] |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | // 导出 |
| | | exportBtn() { |
| | | const multiHeader = ["序号", "地区", "小商店", "小旅馆", "小学校(幼儿园、校外培训机构)", "", "", "小医院(诊所、养老院)", "", "", "小网吧", "小餐饮场所", |
| | | "小歌舞娱乐场所", "小美容洗浴场所", "小生产加工企业", "总数" |
| | | ] //第一行表头 |
| | | const tHeader = ["", "", "", "", "学校", "幼儿园", "校外培训机构", "医院", "诊所", "养老院", "", "", "", "", "", "", ] //最后一行的表头 |
| | | const filterVal = [ |
| | | "index", |
| | | "name", |
| | | "xsd", |
| | | "xlg", |
| | | "xxx", |
| | | "yey", |
| | | "xwpxjg", |
| | | "yy", |
| | | "zs", |
| | | "yly", |
| | | "xwb", |
| | | "xcycs", |
| | | "xgwylcs", |
| | | "xmrxycs", |
| | | "xscjgqy", |
| | | "count" |
| | | ] |
| | | |
| | | var time = timestampToTime((new Date()).getTime()) |
| | | var filename = '隐患统计' + time |
| | | |
| | | this.data.forEach((item, index) => { |
| | | item.index = index + 1 |
| | | }) |
| | | var data = this.formatJson(filterVal, this.data) |
| | | const merges = [ //合并单元格 |
| | | { |
| | | s: { //开始单元格 |
| | | r: 0, //纵轴坐标(1=0,以此类推) |
| | | c: 0 //横轴坐标(A=0,以此类推) |
| | | }, |
| | | e: { //结束单元格 |
| | | r: 1, |
| | | c: 0 |
| | | } |
| | | return sums |
| | | }, |
| | | |
| | | rowSave (row, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",").filter(item => item != '') |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 1 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 1 |
| | | } |
| | | |
| | | let label = row.label |
| | | |
| | | if (row.smallLabel != '') { |
| | | label = label + ',' + row.smallLabel |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 2 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 2 |
| | | } |
| | | |
| | | delete row.smallLabel |
| | | |
| | | add({ |
| | | ...row, |
| | | label |
| | | }).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ) |
| | | }, |
| | | |
| | | rowUpdate (row, index, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",").filter(item => item != '') |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 3 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 3 |
| | | } |
| | | |
| | | let label = row.label |
| | | |
| | | if (row.smallLabel != '') { |
| | | label = label + ',' + row.smallLabel |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 4 |
| | | }, |
| | | e: { |
| | | r: 0, |
| | | c: 6 |
| | | } |
| | | |
| | | delete row.smallLabel |
| | | |
| | | update({ |
| | | ...row, |
| | | label |
| | | }).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ) |
| | | }, |
| | | |
| | | rowDel (row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | row.isDeleted = 1 |
| | | return removeTask(row) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | searchReset () { |
| | | this.query = {} |
| | | this.onLoad(this.page) |
| | | }, |
| | | |
| | | searchChange (params, done) { |
| | | console.log('searchChange', params) |
| | | |
| | | this.query = params.daterange ? { |
| | | startTime: params.daterange[0], |
| | | endTime: params.daterange[1], |
| | | } : {} |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page) |
| | | done() |
| | | }, |
| | | |
| | | selectionChange (list) { |
| | | this.selectionList = list |
| | | }, |
| | | |
| | | selectionClear () { |
| | | this.selectionList = [] |
| | | this.$nextTick(() => { |
| | | this.$refs.crud && this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | |
| | | handleDelete () { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据") |
| | | return |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 7 |
| | | }, |
| | | e: { |
| | | r: 0, |
| | | c: 9 |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | |
| | | beforeOpen (done, type) { |
| | | // if (["edit", "view"].includes(type)) { |
| | | |
| | | // } else { |
| | | // done() |
| | | // } |
| | | }, |
| | | |
| | | currentChange (currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | |
| | | sizeChange (pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | |
| | | refreshChange () { |
| | | // this.onLoad(this.page, this.query) |
| | | }, |
| | | |
| | | onLoad (page, params = {}) { |
| | | this.loading = true |
| | | if (!this.query.startTime) { |
| | | this.query = { |
| | | startTime: this.getLastMouth[1], |
| | | endTime: this.getLastMouth[0], |
| | | } |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 10 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 10 |
| | | } |
| | | getYHTJList(page.currentPage, page.pageSize, this.query).then(res => { |
| | | console.log('getZGQKList', res.data.data) |
| | | const data = res.data.data |
| | | data.forEach(item => { |
| | | // 统计总数 |
| | | item.count = 0 |
| | | item.nineTypeStatistics.forEach(element => { |
| | | item.count += Number(element.number) |
| | | if (element.dict_value == '小生产加工企业') { |
| | | item.xscjgqy = element.number |
| | | } else if (element.dict_value == '小美容洗浴场所') { |
| | | item.xmrxycs = element.number |
| | | } else if (element.dict_value == '小歌舞娱乐场所') { |
| | | item.xgwylcs = element.number |
| | | } else if (element.dict_value == '小餐饮场所') { |
| | | item.xcycs = element.number |
| | | } else if (element.dict_value == '小网吧') { |
| | | item.xwb = element.number |
| | | } else if (element.dict_value == '小旅馆') { |
| | | item.xlg = element.number |
| | | } else if (element.dict_value == '小商店') { |
| | | item.xsd = element.number |
| | | } else if (element.dict_value == '幼儿园') { |
| | | item.yey = element.number |
| | | } else if (element.dict_value == '养老院') { |
| | | item.yly = element.number |
| | | } else if (element.dict_value == '校外培训机构') { |
| | | item.xwpxjg = element.number |
| | | } else if (element.dict_value == '小学校') { |
| | | item.xxx = element.number |
| | | } else if (element.dict_value == '诊所') { |
| | | item.zs = element.number |
| | | } else if (element.dict_value == '医院') { |
| | | item.yy = element.number |
| | | } |
| | | }) |
| | | }) |
| | | this.data = data |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 11 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 11 |
| | | } |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 12 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 12 |
| | | } |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 13 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 13 |
| | | } |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 14 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 14 |
| | | } |
| | | }, |
| | | { |
| | | s: { |
| | | r: 0, |
| | | c: 15 |
| | | }, |
| | | e: { |
| | | r: 1, |
| | | c: 15 |
| | | } |
| | | } |
| | | ] |
| | | export_json_to_excels({ |
| | | headerOne: multiHeader, |
| | | headerTwo: tHeader, |
| | | merges, |
| | | data, |
| | | filename |
| | | }) |
| | | }, |
| | | |
| | | getLastMouth(str = '-') { |
| | | let today = new Date() |
| | | let lastMouth = new Date() |
| | | let nowTime = today.getTime() |
| | | let ms = 24 * 3600 * 1000 * -30 |
| | | today.setTime(parseInt(nowTime)) |
| | | lastMouth.setTime(parseInt(nowTime + ms)) |
| | | let oYear = today.getFullYear() |
| | | let oMoth = (today.getMonth() + 1).toString() |
| | | if (oMoth.length <= 1) oMoth = "0" + oMoth |
| | | let oDay = today.getDate().toString() |
| | | if (oDay.length <= 1) oDay = "0" + oDay |
| | | let mYear = lastMouth.getFullYear() |
| | | let mMoth = (lastMouth.getMonth() + 1).toString() |
| | | if (mMoth.length <= 1) mMoth = "0" + mMoth |
| | | let mDay = lastMouth.getDate().toString() |
| | | if (mDay.length <= 1) mDay = "0" + mDay |
| | | let todayDate = oYear + str + oMoth + str + oDay |
| | | let lastMouthDate = mYear + str + mMoth + str + mDay //暂时改成2024-01-01 |
| | | return ['2024-01-01', todayDate] |
| | | }, |
| | | |
| | | rowSave(row, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",").filter(item => item != '') |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | |
| | | let label = row.label |
| | | |
| | | if (row.smallLabel != '') { |
| | | label = label + ',' + row.smallLabel |
| | | } |
| | | |
| | | delete row.smallLabel |
| | | |
| | | add({ |
| | | ...row, |
| | | label |
| | | }).then( |
| | | () => { |
| | | this.onLoad() |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ) |
| | | }, |
| | | |
| | | rowUpdate(row, index, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",").filter(item => item != '') |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | |
| | | let label = row.label |
| | | |
| | | if (row.smallLabel != '') { |
| | | label = label + ',' + row.smallLabel |
| | | } |
| | | |
| | | delete row.smallLabel |
| | | |
| | | update({ |
| | | ...row, |
| | | label |
| | | }).then( |
| | | () => { |
| | | this.onLoad() |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ) |
| | | }, |
| | | |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | row.isDeleted = 1 |
| | | return removeTask(row) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad() |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | searchReset() { |
| | | this.query = {} |
| | | this.dateTime = this.getLastMouth() |
| | | this.onLoad() |
| | | }, |
| | | |
| | | searchChange(params) { |
| | | this.query = this.dateTime ? { |
| | | startTime: this.dateTime[0], |
| | | endTime: this.dateTime[1], |
| | | } : {} |
| | | this.page.currentPage = 1 |
| | | this.onLoad() |
| | | }, |
| | | |
| | | selectionChange(list) { |
| | | this.selectionList = list |
| | | }, |
| | | |
| | | selectionClear() { |
| | | this.selectionList = [] |
| | | this.$nextTick(() => { |
| | | this.$refs.crud && this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据") |
| | | return |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad() |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | |
| | | beforeOpen(done, type) { |
| | | // if (["edit", "view"].includes(type)) { |
| | | |
| | | // } else { |
| | | // done() |
| | | // } |
| | | }, |
| | | |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | |
| | | refreshChange() { |
| | | // this.onLoad(this.page, this.query) |
| | | }, |
| | | |
| | | onLoad() { |
| | | this.loading = true |
| | | if (!this.query.startTime) { |
| | | this.query = { |
| | | startTime: this.getLastMouth()[0], |
| | | endTime: this.getLastMouth()[1], |
| | | } |
| | | } |
| | | if ('startTime' in this.query) { |
| | | this.query.startTime += ' 00:00:00' |
| | | } |
| | | if ('endTime' in this.query) { |
| | | this.query.endTime += ' 23:59:59' |
| | | } |
| | | getYHTJList(this.query).then(res => { |
| | | console.log('getZGQKList', res.data.data) |
| | | const data = res.data.data |
| | | // 总合计行 |
| | | let countItem = { |
| | | name: '信州区', |
| | | xscjgqy: 0, |
| | | xmrxycs: 0, |
| | | xgwylcs: 0, |
| | | xcycs: 0, |
| | | xwb: 0, |
| | | xlg: 0, |
| | | xsd: 0, |
| | | yey: 0, |
| | | yly: 0, |
| | | xwpxjg: 0, |
| | | xxx: 0, |
| | | zs: 0, |
| | | xxx: 0, |
| | | yy: 0, |
| | | count: 0 |
| | | } |
| | | data.forEach(item => { |
| | | // 统计总数 |
| | | item.count = 0 |
| | | // 检查时间 |
| | | item.dateTime = '' |
| | | |
| | | item.nineTypeStatistics.forEach(element => { |
| | | item.count += Number(element.number) |
| | | if (element.dict_value == '小生产加工企业') { |
| | | item.xscjgqy = element.number |
| | | countItem.xscjgqy += Number(item.xscjgqy) |
| | | } else if (element.dict_value == '小美容洗浴场所') { |
| | | item.xmrxycs = element.number |
| | | countItem.xmrxycs += Number(item.xmrxycs) |
| | | } else if (element.dict_value == '小歌舞娱乐场所') { |
| | | item.xgwylcs = element.number |
| | | countItem.xgwylcs += Number(item.xgwylcs) |
| | | } else if (element.dict_value == '小餐饮场所') { |
| | | item.xcycs = element.number |
| | | countItem.xcycs += Number(item.xcycs) |
| | | } else if (element.dict_value == '小网吧') { |
| | | item.xwb = element.number |
| | | countItem.xwb += Number(item.xwb) |
| | | } else if (element.dict_value == '小旅馆') { |
| | | item.xlg = element.number |
| | | countItem.xlg += Number(item.xlg) |
| | | } else if (element.dict_value == '小商店') { |
| | | item.xsd = element.number |
| | | countItem.xsd += Number(item.xsd) |
| | | } else if (element.dict_value == '幼儿园') { |
| | | item.yey = element.number |
| | | countItem.yey += Number(item.yey) |
| | | } else if (element.dict_value == '养老院') { |
| | | item.yly = element.number |
| | | countItem.yly += Number(item.yly) |
| | | } else if (element.dict_value == '校外培训机构') { |
| | | item.xwpxjg = element.number |
| | | countItem.xwpxjg += Number(item.xwpxjg) |
| | | } else if (element.dict_value == '学校') { |
| | | item.xxx = element.number |
| | | countItem.xxx += Number(item.xxx) |
| | | } else if (element.dict_value == '诊所') { |
| | | item.zs = element.number |
| | | countItem.zs += Number(item.zs) |
| | | } else if (element.dict_value == '医院') { |
| | | item.yy = element.number |
| | | countItem.yy += Number(item.yy) |
| | | } |
| | | }) |
| | | countItem.count += Number(item.count) |
| | | }) |
| | | data.push(countItem) |
| | | this.data = data |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .avue-upload__icon { |
| | | .avue-upload__icon { |
| | | line-height: 6; |
| | | } |
| | | </style> |
| | | } |
| | | |
| | | .search-box { |
| | | display: flex; |
| | | margin-bottom: 20px; |
| | | |
| | | .date-box { |
| | | display: flex; |
| | | |
| | | .name { |
| | | margin-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | :deep(.el-input__inner) { |
| | | height: 32px; |
| | | } |
| | | |
| | | :deep(.el-date-editor .el-range__icon), |
| | | :deep(.el-date-editor .el-range__close-icon) { |
| | | line-height: 26px; |
| | | } |
| | | } |
| | | |
| | | |
| | | .btn-box { |
| | | margin-left: 20px; |
| | | |
| | | :deep(.el-button) { |
| | | width: 76px; |
| | | height: 32px; |
| | | padding: 0; |
| | | } |
| | | } |
| | | } |
| | | </style> |