Browse Source

对对接口

feature
dai 3 years ago
parent
commit
1b2b97e6b0
  1. 207
      src/mixins/view-module2.js
  2. 23
      src/views/business/resi-category-map.js
  3. 23
      src/views/modules/home/index.vue
  4. 99
      src/views/modules/plugins/change/changedeath.vue
  5. 56
      src/views/modules/plugins/change/changerelocation.vue

207
src/mixins/view-module2.js

@ -0,0 +1,207 @@
import Cookies from "js-cookie";
import qs from "qs";
export default {
data() {
/* eslint-disable */
return {
// 设置属性
mixinViewModuleOptions: {
createdIsNeed: true, // 此页面是否在创建时,调用查询数据列表接口?
activatedIsNeed: false, // 此页面是否在激活(进入)时,调用查询数据列表接口?
getDataListURL: "", // 数据列表接口,API地址
getDataListIsPage: false, // 数据列表接口,是否需要分页?
deleteURL: "", // 删除接口,API地址
deleteIsBatch: false, // 删除接口,是否需要批量?
deleteIsBatchKey: "id", // 删除接口,批量状态下由那个key进行标记操作?比如:pid,uid...
exportURL: "", // 导出接口,API地址
},
// 默认属性
dataForm: {}, // 查询条件
dataList: [], // 数据列表
order: "", // 排序,asc/desc
orderField: "", // 排序,字段
pageNo: 1, // 当前页码
pageSize: 10, // 每页数
total: 0, // 总条数
dataListLoading: false, // 数据列表,loading状态
dataListSelections: [], // 数据列表,多选项
addOrUpdateVisible: false, // 新增/更新,弹窗visible状态
};
/* eslint-enable */
},
created() {
if (this.mixinViewModuleOptions.createdIsNeed) {
this.query();
}
},
activated() {
if (this.mixinViewModuleOptions.activatedIsNeed) {
this.query();
}
},
methods: {
// 获取数据列表
query() {
this.dataListLoading = true;
this.$http
.post(this.mixinViewModuleOptions.getDataListURL, {
order: this.order,
orderField: this.orderField,
pageNo: this.mixinViewModuleOptions.getDataListIsPage
? this.pageNo
: null,
pageSize: this.mixinViewModuleOptions.getDataListIsPage
? this.pageSize
: null,
...this.dataForm,
})
.then(({ data: res }) => {
this.dataListLoading = false;
if (res.code !== 0) {
this.dataList = [];
this.total = 0;
return this.$message.error(res.msg);
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage
? res.data.list
: res.data;
this.total = this.mixinViewModuleOptions.getDataListIsPage
? res.data.total
: 0;
this.dataList.forEach((item) => {
if (item.gender) {
item.gender =
item.gender == "0"
? "女"
: item.gender == "1"
? "男"
: item.gender;
}
});
})
.catch(() => {
this.dataListLoading = false;
});
},
// 多选
dataListSelectionChangeHandle(val) {
this.dataListSelections = val;
},
// 排序
dataListSortChangeHandle(data) {
if (!data.order || !data.prop) {
this.order = "";
this.orderField = "";
return false;
}
this.order = data.order.replace(/ending$/, "");
this.orderField = data.prop.replace(/([A-Z])/g, "_$1").toLowerCase();
this.query();
},
// 分页, 每页条数
pageSizeChangeHandle(val) {
this.pageNo = 1;
this.pageSize = val;
this.query();
},
// 分页, 当前页
pageCurrentChangeHandle(val) {
this.pageNo = val;
this.query();
},
getDataList: function () {
this.pageNo = 1;
this.query();
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.dataForm.id = id;
this.$refs.addOrUpdate.init();
});
},
// 删除
deleteHandle(id) {
if (
this.mixinViewModuleOptions.deleteIsBatch &&
!id &&
this.dataListSelections.length <= 0
) {
return this.$message({
message: this.$t("prompt.deleteBatch"),
type: "warning",
duration: 500,
});
}
this.$confirm(
this.$t("prompt.info", { handle: this.$t("delete") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
this.$http
.delete(
`${this.mixinViewModuleOptions.deleteURL}${
this.mixinViewModuleOptions.deleteIsBatch ? "" : "/" + id
}`,
this.mixinViewModuleOptions.deleteIsBatch
? {
data: id
? [id]
: this.dataListSelections.map(
(item) =>
item[this.mixinViewModuleOptions.deleteIsBatchKey]
),
}
: {}
)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.query();
},
});
})
.catch(() => {});
})
.catch(() => {});
},
// 导出
exportHandle() {
var params = qs.stringify({
token: localStorage.getItem("token"),
...this.dataForm,
});
window.location.href = `${window.SITE_CONFIG["apiURL"]}${this.mixinViewModuleOptions.exportURL}?${params}`;
},
// 时间段控件取值变化事件-清空一个其他都清空
changeTime(dateValue) {
var startTimeIsNull =
this.dataForm.startTime === "" ||
this.dataForm.startTime === "null" ||
this.dataForm.startTime === null;
var endTimeIsNull =
this.dataForm.endTime === "" ||
this.dataForm.endTime === "null" ||
this.dataForm.endTime === null;
if (dateValue === null || dateValue === "" || dateValue === "null") {
this.dataForm.startTime = "";
this.dataForm.endTime = "";
} else if (startTimeIsNull || endTimeIsNull) {
this.dataForm.startTime = dateValue;
this.dataForm.endTime = dateValue;
}
},
},
};

23
src/views/business/resi-category-map.js

@ -0,0 +1,23 @@
export default {
PARTY_FLAG: "党员",
SUBSISTENCE_ALLOWANCE_FLAG: "低保户",
ENSURE_HOUSE_FLAG: "保障房",
UNEMPLOYED_FLAG: "失业",
FERTILE_WOMAN_FLAG: "育龄妇女",
VETERAN_FLAG: "退役军人",
UNITED_FRONT_FLAG: "统战人员",
PETITION_OFFICER_FLAG: "信访人员",
VOLUNTEER_FLAG: "志愿者",
OLD_PEOPLE_FLAG: "老年人",
EMPTY_NESTER_FLAG: "空巢老人",
BEREAVED_PERSON_FLAG: "失独人员",
DISABLED_FLAG: "失能老人",
DEMENTED_FLAG: "失智老人",
DISABILITY_FLAG: "残疾",
SERIOUS_ILLNESS_FLAG: "大病",
CHRONIC_DISEASE_FLAG: "慢病",
SPECIAL_CROWD_FLAG: "特殊人群",
TENANT_FLAG: "租户",
FLOATING_FLAG: "是流动人口",
LIVE_ALONE_FLAG: "独居老人",
};

23
src/views/modules/home/index.vue

@ -84,9 +84,9 @@
<p class="hint" v-if="resiCategory.list.length > 0">
<i>*</i> 根据数据分析结果建议重点关注
<b
>{{ resiCategory.list[0].categoryName }}{{
resiCategory.list[1].categoryName
}}{{ resiCategory.list[2].categoryName }}</b
>{{ resiCategory.list[0].name }}{{
resiCategory.list[1].name
}}{{ resiCategory.list[2].name }}</b
>
三类群体开展相关的社区服务和活动
</p>
@ -234,7 +234,8 @@
</template>
<script>
import { requestPost } from "@/js/dai/request";
import { requestPost, requestGet } from "@/js/dai/request";
import resiCategoryMap from "@/views/business/resi-category-map";
import { mapGetters } from "vuex";
import nextTick from "dai-js/tools/nextTick";
@ -354,10 +355,12 @@ export default {
// level: "",
};
const { data, code, msg } = await requestPost(url, params);
const { data, code, msg } = await requestGet(url, params);
if (code === 0 && data) {
if (code === 0) {
if (data) {
this.pandectData = data;
}
} else {
this.$message.error(msg);
}
@ -372,20 +375,22 @@ export default {
};
this.resiCategory.loading = true;
const { data, code, msg } = await requestPost(url, params);
const { data, code, msg } = await requestGet(url, params);
this.resiCategory.loading = false;
if (code === 0 && data) {
if (code === 0) {
if (data) {
this.resiCategory.count = data.resiCount;
this.resiCategory.list = data.categoryList.map((item) => {
return {
code: item.categoryName,
name: item.categoryName,
name: resiCategoryMap[item.categoryName] || "",
count: item.categoryCount,
per: parseInt((100 * item.categoryCount) / data.resiCount),
const: "const",
};
});
}
} else {
this.$message.error(msg);
}

99
src/views/modules/plugins/change/changedeath.vue

@ -108,7 +108,7 @@
>
</el-table-column>
<!--<el-table-column prop="id" label="主键" header-align="center" align="center"></el-table-column>-->
<!--<el-table-column prop="userId" label="epmet用户主键" header-align="center" align="center"></el-table-column>-->
<!--<el-table-column prop="resiId" label="epmet用户主键" header-align="center" align="center"></el-table-column>-->
<el-table-column
prop="name"
label="姓名"
@ -209,9 +209,9 @@
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:current-page="pageNo"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@ -225,14 +225,38 @@
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
<people-more
v-if="showedPeopleMoreInfo && lookInfo.userId"
:userId="lookInfo.userId"
:gridName="lookInfo.gridName"
<!-- 修改弹出框 -->
<el-dialog
:visible.sync="showedResiInfo"
:close-on-click-modal="false"
:close-on-press-escape="false"
title="居民详情"
width="986px"
top="5vh"
class="m-dialog"
@closed="showedResiInfo = false"
>
<div class="dialog-h-content scroll-h">
<resi-info
v-if="showedResiInfo && lookInfo.resiId"
:resiId="lookInfo.resiId"
@close="handleCancleLook"
/>
</div>
<div class="resi-btns">
<el-button
size="small"
@click="showedResiInfo = false"
class="diy-button--common"
>关闭</el-button
>
</div>
</el-dialog>
<!-- 变更记录 -->
<el-dialog
v-if="false"
:visible.sync="changeRecordShow"
:close-on-click-modal="false"
:close-on-press-escape="false"
@ -247,12 +271,13 @@
</template>
<script>
import mixinViewModule from "@/mixins/view-module";
import mixinViewModule from "@/mixins/view-module2";
import AddOrUpdate from "./changedeath-add-or-update";
import peopleMore from "@/views/modules/shequ/cpts/people-more";
import nextTick from "dai-js/tools/nextTick";
import resiChangeRecord from "../../../components/resiChangeRecord.vue";
import resiChangeRecord from "@/views/components/resiChangeRecord.vue";
import { requestPost } from "@/js/dai/request";
import resiInfo from "@/views/components/resiInfo.vue";
export default {
mixins: [mixinViewModule],
data() {
@ -275,9 +300,9 @@ export default {
// isWelfare: "",
},
//
showedPeopleMoreInfo: false,
showedResiInfo: false,
lookInfo: {
userId: "",
resiId: "",
gridName: "",
},
isWelfareArr: [
@ -300,7 +325,7 @@ export default {
},
components: {
AddOrUpdate,
peopleMore,
resiInfo,
resiChangeRecord,
},
methods: {
@ -333,10 +358,10 @@ export default {
exportHandle() {
const url = this.mixinViewModuleOptions.exportURL;
this.$http({
method: "GET",
method: "POST",
url,
responseType: "blob",
params: this.dataForm,
data: this.dataForm,
})
.then((res) => {
// this.download(res.data, title + '.xls')
@ -372,27 +397,13 @@ export default {
this.getDataList();
},
async handleLook(row) {
if (row.gridId !== "") {
const url = "/gov/org/grid/griddetail";
let params = {
gridId: row.gridId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.lookInfo.gridName = data.gridName;
} else {
this.$message.error(msg);
}
} else {
this.lookInfo.gridName = "";
}
this.lookInfo.userId = row.userId;
this.showedPeopleMoreInfo = true;
this.lookInfo.resiId = row.resiId;
this.showedResiInfo = true;
},
handleCancleLook() {
this.lookInfo.userId = "";
this.lookInfo.resiId = "";
this.lookInfo.gridName = "";
this.showedPeopleMoreInfo = false;
this.showedResiInfo = false;
},
},
};
@ -470,4 +481,26 @@ export default {
// background: rgba(254, 98, 82, 1);
// }
}
.m-dialog {
.el-dialog__body {
position: relative;
max-height: 83vh;
box-sizing: border-box;
padding: 0 0 20px !important;
.dialog-h-content {
max-height: calc(83vh - 80px);
box-sizing: border-box;
padding: 50px 80px;
overflow: auto;
}
}
.resi-btns {
margin-top: 20px;
text-align: center;
text-align: right;
margin-right: 16px;
}
}
</style>

56
src/views/modules/plugins/change/changerelocation.vue

@ -329,9 +329,9 @@
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:current-page="pageNo"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@ -345,12 +345,35 @@
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
<people-more
v-if="showedPeopleMoreInfo && lookInfo.userId"
:userId="lookInfo.userId"
:gridName="lookInfo.gridName"
<!-- 修改弹出框 -->
<el-dialog
:visible.sync="showedResiInfo"
:close-on-click-modal="false"
:close-on-press-escape="false"
title="居民详情"
width="986px"
top="5vh"
class="m-dialog"
@closed="showedResiInfo = false"
>
<div class="dialog-h-content scroll-h">
<resi-info
v-if="showedResiInfo && lookInfo.resiId"
:resiId="lookInfo.resiId"
@close="handleCancleLook"
/>
</div>
<div class="resi-btns">
<el-button
size="small"
@click="showedResiInfo = false"
class="diy-button--common"
>关闭</el-button
>
</div>
</el-dialog>
<!-- 变更记录 -->
<el-dialog
:visible.sync="changeRecordShow"
@ -367,13 +390,14 @@
</template>
<script>
import mixinViewModule from "@/mixins/view-module";
import mixinViewModule from "@/mixins/view-module2";
import AddOrUpdate from "./changerelocation-add-or-update";
import peopleMore from "@/views/modules/shequ/cpts/people-more";
import nextTick from "dai-js/tools/nextTick";
import resiChangeRecord from "../../../components/resiChangeRecord.vue";
import { requestPost } from "@/js/dai/request";
import { mapGetters } from "vuex";
import resiInfo from "@/views/components/resiInfo.vue";
export default {
mixins: [mixinViewModule],
data() {
@ -406,9 +430,9 @@ export default {
// isWelfare: "",
},
//
showedPeopleMoreInfo: false,
showedResiInfo: false,
lookInfo: {
userId: "",
resiId: "",
gridName: "",
},
isWelfareArr: [
@ -423,7 +447,7 @@ export default {
},
components: {
AddOrUpdate,
peopleMore,
resiInfo,
resiChangeRecord,
},
computed: {
@ -497,7 +521,7 @@ export default {
exportHandle() {
const url = this.mixinViewModuleOptions.exportURL;
this.$http({
method: "GET",
method: "POST",
url,
responseType: "blob",
params: this.dataForm,
@ -543,13 +567,13 @@ export default {
} else {
this.lookInfo.gridName = "";
}
this.lookInfo.userId = row.icUserId;
this.showedPeopleMoreInfo = true;
this.lookInfo.resiId = row.icUserId;
this.showedResiInfo = true;
},
handleCancleLook() {
this.lookInfo.userId = "";
this.lookInfo.resiId = "";
this.lookInfo.gridName = "";
this.showedPeopleMoreInfo = false;
this.showedResiInfo = false;
},
resetForm(formName) {
for (const n in this.dataForm) {

Loading…
Cancel
Save