Browse Source

企事业单位巡查完善

shibei_master
dai 3 years ago
parent
commit
49f0aefdda
  1. 487
      src/views/modules/cpts/base/cpts/edit.vue
  2. 50
      src/views/modules/cpts/base/index.vue
  3. 531
      src/views/modules/shequzhili/tuceng/anquan/xuncha/cpts/edit.vue
  4. 536
      src/views/modules/shequzhili/tuceng/anquan/xuncha/cpts/record.vue
  5. 31
      src/views/modules/shequzhili/tuceng/anquan/xuncha/index.vue
  6. 4
      src/views/modules/shequzhili/tuceng/yingji/ziyuan/index.vue

487
src/views/modules/cpts/base/cpts/edit.vue

@ -7,134 +7,265 @@
:model="fmData"
:inline="true"
:disabled="formType === 'watch'"
class="form"
class="m-fm"
:class="editParamsDiv ? 'z-div' : ''"
>
<el-form-item
v-for="item in editParams"
label-width="150px"
style="display: block"
:key="'edit' + item.keyName"
:label="item.field"
:prop="item.keyName"
:rules="item.rules || []"
>
<template v-if="item.type == 'input'">
<el-input
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
class="item_width_1"
size="small"
clearable
show-word-limit
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-input>
<div style="width: 610px" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'textarea'">
<el-input
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
type="textarea"
class="item_width_1"
size="small"
clearable
show-word-limit
:rows="3"
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-input>
<div style="width: 610px" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'number'">
<el-input-number
v-model="fmData[item.keyName]"
type="textarea"
size="small"
clearable
show-word-limit
:rows="3"
:min="item.min || 0"
:max="item.max || 999999999999"
:placeholder="item.placeholder || '请输入'"
>
</el-input-number>
<span v-if="item.unitName">{{ item.unitName }}</span>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="fmData[item.keyName]"
:placeholder="item.placeholder || '请选择'"
size="small"
clearable
class="item_width_2"
>
<el-option
v-for="subItem in item.optionList"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
<div class="list">
<el-form-item
v-for="item in editParams1"
label-width="150px"
style="display: block"
:key="'edit' + item.keyName"
:label="item.field"
:prop="item.keyName"
:rules="item.rules || []"
>
<template v-if="item.type == 'input'">
<el-input
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
class="item-input"
size="small"
clearable
show-word-limit
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-option>
</el-select>
</template>
</el-input>
<template v-else-if="item.type == 'address'">
<div style="width: 500px">
<div class="item-show" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'textarea'">
<el-input
class="item_width_4"
maxlength="100"
style="width: 430px"
show-word-limit
:placeholder="item.placeholder || '请输入所在地址'"
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
type="textarea"
class="item-input"
size="small"
clearable
show-word-limit
:rows="3"
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-input>
<el-button
style="margin-left: 10px"
type="default"
<div class="item-show" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'number'">
<el-input-number
v-model="fmData[item.keyName]"
class="item-number"
size="small"
clearable
show-word-limit
:rows="3"
:min="item.min || 0"
:max="item.max || 999999999999"
:placeholder="item.placeholder || '请输入'"
>
</el-input-number>
<span v-if="item.unitName">{{ item.unitName }}</span>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="fmData[item.keyName]"
:placeholder="item.placeholder || '请选择'"
size="small"
@click="handleSearchMap(item)"
>查询</el-button
clearable
class="item-select"
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-option
v-for="subItem in item.optionList"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type == 'address'">
<div class="address-item">
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="fmData[item.supKeys[0]]"
class="address-item-input"
maxlength="100"
show-word-limit
:placeholder="item.placeholder || '请输入所在地址'"
v-model="fmData[item.keyName]"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-button
style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap(item)"
>查询</el-button
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input
class="address-item-input2"
maxlength="50"
placeholder="请输入经度"
v-model="fmData[item.supKeys[0]]"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="address-item-input2"
maxlength="50"
placeholder="请输入纬度"
v-model="fmData[item.supKeys[1]]"
>
</el-input>
</div>
</div>
</template>
</el-form-item>
</div>
<div class="list" v-if="editParams2.length > 0">
<el-form-item
v-for="item in editParams2"
label-width="150px"
style="display: block"
:key="'edit' + item.keyName"
:label="item.field"
:prop="item.keyName"
:rules="item.rules || []"
>
<template v-if="item.type == 'input'">
<el-input
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
class="item-input"
size="small"
clearable
show-word-limit
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-input>
<div class="item-show" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'textarea'">
<el-input
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
type="textarea"
class="item-input"
size="small"
clearable
show-word-limit
:rows="3"
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
</el-input>
<div class="item-show" v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'number'">
<el-input-number
v-model="fmData[item.keyName]"
class="item-number"
size="small"
clearable
show-word-limit
:rows="3"
:min="item.min || 0"
:max="item.max || 999999999999"
:placeholder="item.placeholder || '请输入'"
>
</el-input-number>
<span v-if="item.unitName">{{ item.unitName }}</span>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="fmData[item.keyName]"
:placeholder="item.placeholder || '请选择'"
size="small"
clearable
class="item-select"
>
<el-option
v-for="subItem in item.optionList"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type == 'address'">
<div class="address-item">
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="fmData[item.supKeys[1]]"
class="address-item-input"
maxlength="100"
show-word-limit
:placeholder="item.placeholder || '请输入所在地址'"
v-model="fmData[item.keyName]"
>
</el-input>
<el-button
style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap(item)"
>查询</el-button
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input
class="address-item-input2"
maxlength="50"
placeholder="请输入经度"
v-model="fmData[item.supKeys[0]]"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="address-item-input2"
maxlength="50"
placeholder="请输入纬度"
v-model="fmData[item.supKeys[1]]"
>
</el-input>
</div>
</div>
</div>
</template>
</el-form-item>
</template>
</el-form-item>
</div>
</el-form>
<slot v-bind:id="formId" v-bind:info="fmData" v-bind:formType="formType"></slot>
</div>
<div class="div_btn resi-btns">
@ -197,6 +328,16 @@ export default {
type: Array,
default: () => [],
},
editFixedParams: {
type: Object,
default: () => {
return {};
},
},
editParamsDiv: {
type: Number,
default: 0,
},
},
data() {
@ -206,6 +347,9 @@ export default {
btnDisable: false,
fmData: {},
editParams1: [],
editParams2: [],
};
},
components: {},
@ -237,7 +381,7 @@ export default {
},
iniFmData() {
const { editParams, fmData } = this;
const { editParams, fmData, editParamsDiv } = this;
editParams.forEach((item, index) => {
fmData[item.keyName] = item.value || "";
if (item.supValues) {
@ -256,13 +400,19 @@ export default {
}
} else if (item.type == "address") {
this.$nextTick(async () => {
await nextTick(500);
await nextTick(300);
this.initMap(item);
});
}
});
this.fmData = { ...fmData };
if (editParamsDiv) {
this.editParams1 = editParams.slice(0, editParamsDiv);
this.editParams2 = editParams.slice(editParamsDiv);
} else {
this.editParams1 = editParams;
}
console.log("------------------------------------", this.fmData);
this.iniLoaded = true;
},
@ -302,8 +452,8 @@ export default {
geocoder = new TMap.service.Geocoder(); //
//
map.on("panend", () => {
this.handleMoveCenter(item);
map.on("panend", (e) => {
this.handleMoveCenter(item, e);
});
this.handleMoveCenter(item);
},
@ -352,7 +502,8 @@ export default {
});
},
handleMoveCenter(item) {
handleMoveCenter(item, e) {
console.log(e);
//
const center = map.getCenter();
const lat = center.getLat();
@ -363,20 +514,26 @@ export default {
this.fmData[item.supKeys[1]] = lat;
this.setMarker(lat, lng);
geocoder
.getAddress({ location: new TMap.LatLng(lat, lng) }) //
.then((result) => {
this.fmData[item.keyName] = result.result.address;
});
if (e && e.originalEvent) {
geocoder
.getAddress({ location: new TMap.LatLng(lat, lng) }) //
.then((result) => {
this.fmData[item.keyName] = result.result.address;
});
}
},
async getInfo() {
const url = this.infoUrl;
let url = this.infoUrl;
if (!url) return;
const { idName } = this;
const { idName, formId } = this;
if (url.endsWith("/")) {
url += formId;
}
const params = {
[idName]: this.formId,
[idName]: formId,
};
const { data, code, msg } = await requestPost(url, params);
@ -387,6 +544,7 @@ export default {
};
console.log("------------------------------------info", this.fmData);
await nextTick(800);
if (map) {
map.setCenter(new TMap.LatLng(data.latitude, data.longitude));
}
@ -419,6 +577,7 @@ export default {
let url = "";
let params = {
...this.fmData,
...this.editFixedParams,
// serviceType: this.fmData.serviceTypeArr.join(","),
};
@ -451,39 +610,57 @@ export default {
</script>
<style lang="scss" scoped>
.item_width_1 {
width: 500px;
}
.item_width_2 {
width: 400px;
}
.item_width_3 {
margin-left: 10px;
width: 200px;
}
.item_width_4 {
width: 200px;
}
.m-fm {
margin-top: 30px;
.div_map {
margin-top: 10px;
}
&.z-div {
display: flex;
.div_btn {
// display: flex;
// justify-content: flex-end;
}
.el-tabs {
margin: 0 20px;
}
.el-upload__tip {
color: rgb(155, 155, 155);
margin: 0;
}
.form {
margin-top: 30px;
}
.item-input {
width: 225px;
}
.item-select {
width: 225px;
}
.item-number {
width: 125px;
}
.address-item {
width: 450px;
.attachement-list {
.address-item-input {
width: 85%;
}
.address-item-input2 {
margin-left: 5px;
width: 40%;
}
}
}
.item-input {
width: 450px;
}
.item-select {
width: 225px;
}
.item-number {
width: 125px;
}
.address-item {
width: 450px;
.address-item-input {
width: 85%;
}
.address-item-input2 {
margin-left: 5px;
width: 40%;
}
}
.div_map {
margin-top: 10px;
}
}
</style>

50
src/views/modules/cpts/base/index.vue

@ -30,7 +30,7 @@
>
<el-option
v-for="item in item.optionList"
:key="item.value"
:key="'serach' + item.keyName + item.value"
:label="item.label"
:value="item.value"
>
@ -148,15 +148,15 @@
>查看</el-button
>
<el-button
v-if="editUrl"
v-if="editUrl && editAuth(scope.row)"
@click="handleEdit(scope.row)"
type="text"
size="small"
class="div-table-button--edit"
>编辑</el-button
>{{ editBtnName(scope.row) }}</el-button
>
<el-popconfirm
v-if="delUrl"
v-if="delUrl && delAuth(scope.row)"
title="删除之后无法回复,确认删除?"
@onConfirm="handleDelete(scope.row, scope.$index)"
@confirm="handleDelete(scope.row, scope.$index)"
@ -196,7 +196,7 @@
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
:width="editParamsDiv ? '1100px' : '850px'"
top="5vh"
class="dialog-h"
@closed="handleClose"
@ -206,13 +206,24 @@
:idName="idName"
:formId="formId"
:formType="formType"
:editParams="editParams"
:infoUrl="infoUrl"
:addUrl="addUrl"
:editUrl="editUrl"
:editParams="editParams"
:editParamsDiv="editParamsDiv"
:editFixedParams="editFixedParams"
@close="handleClose"
@afterEdit="handleEditSuccess"
></edit-form>
>
<template v-slot="{ id, formType, info }">
<slot
name="editElse"
v-bind:id="id"
v-bind:formType="formType"
v-bind:info="info"
></slot>
</template>
</edit-form>
</el-dialog>
</div>
</template>
@ -275,10 +286,33 @@ export default {
default: "",
},
editAuth: {
type: Function,
default: () => true,
},
editBtnName: {
type: Function,
default: () => "编辑",
},
delAuth: {
type: Function,
default: () => true,
},
editParams: {
type: Array,
default: () => [],
},
editFixedParams: {
type: Object,
default: () => {
return {};
},
},
editParamsDiv: {
type: Number,
default: 0,
},
idName: {
type: String,
@ -495,7 +529,7 @@ export default {
const { idName } = this;
this.formType = "edit";
this.formId = row[idName];
this.formTitle = "编辑";
this.formTitle = "修改";
this.formShow = true;
},

531
src/views/modules/shequzhili/tuceng/anquan/xuncha/cpts/edit.vue

@ -1,531 +0,0 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item label="组织名称 "
prop="organizationName"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入组织名称 "
v-model="dataForm.organizationName">
</el-input>
</el-form-item>
<el-form-item label="分类名称 "
prop="categoryCode"
label-width="150px"
style="display: block">
<el-select v-model="dataForm.categoryCode"
placeholder="请选择"
clearable>
<el-option v-for="item in categoryList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="组织人数 "
prop="organizationPersonCount"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="number"
maxlength="50"
show-word-limit
placeholder="请输入组织人数 "
v-model="dataForm.organizationPersonCount">
</el-input>
</el-form-item>
<el-form-item label="组织成员 "
prop="organizationPersonnel"
label-width="150px"
style="display: block">
<div class="m-staffs">
<div class="item"
:key="'staff' + index"
v-for="(item, index) in dataForm.organizationPersonnel">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="成员姓名"
v-model="item.personName" />
<el-input style="margin-left: 10px"
class="item_width_1"
maxlength="50"
show-word-limit
placeholder="联系电话"
v-model="item.personPhone" />
<el-button style="margin-left: 10px"
size="small"
@click="handleDelStaff(index)">删除</el-button>
</div>
<div class="item-add">
<el-button size="small"
@click="handleAddStaff">添加</el-button>
</div>
</div>
</el-form-item>
<el-form-item label="服务事项"
prop="serviceItem"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="1000"
show-word-limit
:rows="3"
placeholder="请输入服务事项,不超过1000字"
v-model="dataForm.serviceItem"></el-input>
</el-form-item>
<el-form-item label="负责人 "
prop="principalName"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入负责人 "
v-model="dataForm.principalName">
</el-input>
</el-form-item>
<el-form-item label="联系电话 "
prop="principalPhone"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入联系电话 "
v-model="dataForm.principalPhone">
</el-input>
</el-form-item>
<el-form-item label="创建时间"
prop="organizationCreatedTime"
label-width="150px"
style="display: block">
<el-date-picker v-model="dataForm.organizationCreatedTime"
placeholder="创建时间"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="位置坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width: 500px">
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="dataForm.address">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="dataForm.latitude">
</el-input>
</div>
</div>
</el-form-item>
<el-form-item label="备注"
prop="remark"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"></el-input>
</el-form-item>
</el-form>
</div>
<div class="div_btn resi-btns">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button v-if="formType != 'detail'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { Loading } from "element-ui"; // Loading
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
var map;
var search;
var markers;
var infoWindowList;
let loading; //
export default {
data () {
return {
formType: "add", // addeditdetail
btnDisable: false,
orgId: "",
dataForm: {
organizationName: "",
categoryCode: "",
serviceItem: "",
organizationPersonCount: "",
principalName: "",
principalPhone: "",
organizationCreatedTime: "",
address: "",
remark: "",
longitude: "",
latitude: "",
organizationPersonnel: [],
},
categoryList: [],
};
},
components: {},
computed: {
dataRule () {
return {
organizationName: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" },
{
min: 1,
max: 50,
message: "组织名称 长度在 1 到 50个字符",
trigger: "blur",
},
],
categoryCode: [
{ required: true, message: "分类名称不能为空", trigger: "blur" },
],
organizationPersonCount: [
{ required: true, message: "组织人数不能为空", trigger: "blur" },
],
serviceItem: [
{ required: true, message: "服务事项不能为空", trigger: "blur" },
],
principalName: [
{ required: true, message: "负责人不能为空", trigger: "blur" },
],
principalPhone: [
{ required: true, message: "联系电话不能为空", trigger: "blur" },
],
longitude: [
{ required: true, message: "位置坐标不能为空", trigger: "blur" },
],
};
},
},
props: {},
watch: {},
async created () {
this.getCategoryList();
},
async mounted () {
this.initMap();
},
methods: {
async getCategoryList () {
const url = "/sys/dict/data/dictlist";
const params = {
dictType: "self_org_category",
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.categoryList = data;
} else {
this.$message.error(msg);
}
},
handleAddStaff () {
this.dataForm.organizationPersonnel = [
...this.dataForm.organizationPersonnel,
{ personName: "", personPhone: "" },
];
},
handleDelStaff (index) {
const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel;
},
// init
initMap () {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("app"), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
//
map.on("panend", () => {
this.handleMoveCenter();
});
this.handleMoveCenter();
},
setMarker (lat, lng) {
markers.setGeometries([]);
markers.add([
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close();
});
infoWindowList.length = 0;
markers.setGeometries([]);
//
search
.searchRectangle({
keyword: this.dataForm.address,
bounds: map.getBounds(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng },
} = data[0];
map.setCenter(new TMap.LatLng(lat, lng));
this.setMarker(lat, lng);
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
});
},
handleMoveCenter () {
//
const center = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
this.setMarker(lat, lng);
},
async initForm (type, row) {
this.$refs.ref_form.resetFields();
this.formType = type;
console.log(row);
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.orgId = this.dataForm.orgId;
map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
}
},
async handleComfirm () {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
}, 10000);
this.$refs["ref_form"].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj);
this.btnDisable = false;
} else {
// if (!formVltHelper.userOrMobile(this.dataForm.principalPhone)) {
// return this.$message({
// type: "error",
// message: "",
// });
// }
const {
dataForm: { organizationPersonnel },
} = this;
let vlt = organizationPersonnel.every((item) => {
return (
item.personName &&
item.personPhone
);
});
if (!vlt) {
return this.$message({
type: "error",
message: "成员姓名/手机号为空",
});
}
this.submit();
}
});
},
async submit () {
let url = "";
if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization";
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd"
} else {
url =
"/heart/iccommunityselforganization/editcommunityselforganization";
this.dataForm.orgId = this.orgId;
}
const { data, code, msg } = await requestPost(url, this.dataForm);
if (code === 0) {
this.$message({
type: "success",
message: "操作成功",
});
this.resetData();
this.$emit("dialogOk");
this.btnDisable = false;
} else {
this.btnDisable = false;
this.$message.error(msg);
}
},
handleCancle () {
this.resetData();
this.$emit("dialogCancle");
},
resetData () {
this.orgId = "";
this.dataForm = {
organizationName: "",
serviceItem: "",
organizationPersonCount: "",
categoryCode: "",
principalName: "",
principalPhone: "",
organizationCreatedTime: "",
address: "",
remark: "",
longitude: "",
latitude: "",
organizationPersonnel: [],
};
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: "正在加载……", //
background: "rgba(0,0,0,.7)", //
});
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close();
}
},
},
};
</script>
<style lang="scss" scoped>
.item_width_1 {
width: 500px;
}
.item_width_2 {
width: 400px;
}
.item_width_3 {
margin-left: 10px;
width: 200px;
}
.item_width_4 {
width: 200px;
}
.div_map {
margin-top: 10px;
}
.div_btn {
// display: flex;
// justify-content: flex-end;
}
.el-tabs {
margin: 0 20px;
}
.el-upload__tip {
color: rgb(155, 155, 155);
margin: 0;
}
.form {
margin-top: 30px;
}
.m-staffs {
width: 468px;
.item {
display: flex;
justify-content: space-around;
margin-bottom: 7px;
}
.item-add {
}
}
</style>

536
src/views/modules/shequzhili/tuceng/anquan/xuncha/cpts/record.vue

@ -0,0 +1,536 @@
<template>
<div class="m-record" style="padding: 0 20px">
<h3>巡查记录</h3>
<div class="mt10" v-if="formType == 'edit'">
<el-button
size="small"
class="diy-button--add"
:disabled="btnDisabled || disabled"
@click="handleAdd"
>新增</el-button
>
</div>
<el-table
:data="tableData"
row-key="id"
border
style="width: 100%"
class="resi-table"
height="400px"
:header-cell-style="getRowClass"
>
<el-table-column label="序号" type="index" align="center" width="50">
</el-table-column>
<el-table-column
prop="patrolTime"
label="巡查时间"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-date-picker
v-if="scope.row.isEdit"
v-model="scope.row.patrolTime"
type="date"
class="input-width"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
<div v-else class="div-content">{{ scope.row.patrolTime }}</div>
</template>
</el-table-column>
<el-table-column
prop="staffId"
label="巡查人员"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-select
v-if="scope.row.isEdit"
v-model="scope.row.staffId"
placeholder="请选择"
class="input-width"
@change="handleChangeStaff(scope.row)"
clearable
>
<el-option
v-for="subItem in optionStaff"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</el-select>
<div v-else class="div-content">{{ scope.row.staffName }}</div>
</template>
</el-table-column>
<el-table-column
prop="mobile"
label="联系电话"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-input
v-if="scope.row.isEdit"
type="number"
v-model="scope.row.mobile"
placeholder="请输入"
class="input-width"
clearable
disabled
></el-input>
<div v-else class="div-content">{{ scope.row.mobile }}</div>
</template>
</el-table-column>
<el-table-column
prop="result"
label="巡查结果"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-select
v-if="scope.row.isEdit"
v-model="scope.row.result"
placeholder="请选择"
class="input-width"
size="small"
clearable
>
<el-option
v-for="subItem in optionResult"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</el-select>
<div v-else class="div-content">{{ scope.row.resultName }}</div>
</template>
</el-table-column>
<el-table-column
prop="detailed"
label="隐患明细"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-input
v-if="scope.row.isEdit"
type="number"
v-model="scope.row.detailed"
placeholder="请输入"
class="input-width"
maxlength="500"
clearable
></el-input>
<div v-else class="div-content">{{ scope.row.detailed }}</div>
</template>
</el-table-column>
<el-table-column
prop="imgList"
label="图片列表"
align="center"
width="150px"
>
<template slot-scope="scope">
<div v-if="scope.row.isEdit">
<el-upload
class="avatar-uploader"
:action="uploadUrl"
:data="{ customerId: customerId }"
:show-file-list="true"
:limit="3"
:file-list="scope.row.imgShowList"
:on-success="(res) => handleImgSuccess(res, scope.row)"
:on-remove="(res) => handleImgRemove(res, scope.row)"
list-type="picture"
:before-upload="beforeImgUpload"
>
<i class="el-icon-plus avatar-uploader-icon"></i> 最多三张图片
</el-upload>
</div>
<div v-else class="div-content">
<el-image
v-if="scope.row.imgList.length > 0"
style="width: 100px; height: 50px"
:src="scope.row.imgList[0]"
fit="cover"
:preview-src-list="scope.row.imgList"
></el-image>
</div>
</template>
</el-table-column>
<el-table-column
prop="reviewTime"
label="拟复查时间"
align="center"
width="200px"
>
<template slot-scope="scope">
<el-date-picker
v-if="scope.row.isEdit"
v-model="scope.row.reviewTime"
type="date"
class="input-width"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
<div v-else class="div-content">{{ scope.row.patrolTime }}</div>
</template>
</el-table-column>
<el-table-column v-if="!disabled" label="操作" align="center" width="120">
<template slot-scope="scope">
<template v-if="scope.row.isEdit">
<el-button
@click="handleEdit(scope.row)"
type="text"
size="small"
class="btn-color-edit"
>保存</el-button
>
<el-button
@click="handleChange(scope.row, 'cancle')"
type="text"
size="small"
class="btn-color-edit"
>取消</el-button
>
</template>
<template v-else>
<el-button
v-if="formType == 'edit'"
@click="handleChange(scope.row, 'edit')"
type="text"
size="small"
:disabled="disabled"
class="btn-color-edit"
>修改</el-button
>
<el-popconfirm
v-if="formType == 'edit'"
title="删除之后无法恢复,确认删除?"
@onConfirm="del(scope.row)"
>
<el-button
slot="reference"
type="text"
size="small"
class="btn-color-del"
style="margin-left: 10px"
>删除</el-button
>
</el-popconfirm>
</template>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
export default {
props: {
enterpriseId: {
type: String,
default: "",
},
enterpriseInfo: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
formType: {
type: String,
default: "",
},
},
data() {
return {
uploadUrl: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadqrcodeV2",
customerId: localStorage.getItem("customerId"),
btnDisabled: false,
btnType: "cancle",
isEdit: false,
tableData: [],
tempRow: {},
optionResult: [
{
label: "合格",
value: "0",
},
{
label: "不合格",
value: "1",
},
],
optionStaff: [
// {
// label: "",
// value: "staffId",
// },
],
};
},
computed: {
allowOperate() {
const {
enterpriseInfo: { agencyId },
} = this;
return agencyId && agencyId == this.$store.state.user.agencyId;
},
},
watch: {
enterpriseId: {
handler(val) {
console.log("val------points", val);
if (val.length > 0) {
this.btnDisabled = false;
this.getList();
} else this.btnDisabled = true;
},
immediate: true,
},
},
created() {
this.getOptionStaff();
},
methods: {
beforeImgUpload(file) {
console.log(file);
const isLt1M = file.size / 1024 / 1024 < 10;
const srcType = file.type;
const format = file.name.split(".").pop();
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 10MB!");
return false;
}
if (srcType.indexOf("image") == -1) {
this.$message.error("仅限图片格式");
return false;
}
return true;
},
handleImgSuccess(res, row) {
console.log("handleImgSuccess", res);
if (res.code === 0 && res.msg === "success") {
row.imgList.push(res.data.url);
this.computeImgShowList(row);
} else {
this.$message.error(res.msg);
}
},
computeImgShowList(row) {
row.imgShowList = row.imgList.map((url) => {
return { name: "", url };
});
},
handleImgRemove(file, row) {
console.log("handleImgRemove", file);
if (file.response) {
row.imgList = row.imgList.map(
(item) => item !== file.response.data.url
);
this.computeImgShowList(row);
}
},
getRowClass({ rowIndex, columnIndex }) {
if (rowIndex === 0) {
return "background: #2195fe; color: #fff;";
}
},
handleChange(row, type) {
console.log("type----", type);
if (type == "cancle") {
row = { ...this.tempRow };
row.isEdit = false;
if (this.btnType == "add") this.tableData.pop();
this.getList();
console.log("row----", row);
} else {
this.tempRow = { ...row };
row.isEdit = true;
}
this.btnType = type;
this.isEdit = !this.isEdit;
},
handleChangeStaff(row) {
const { staffId } = row;
const { optionStaff } = this;
let item = optionStaff.find((item) => item.value == staffId);
if (item) {
row.staffName = item.name;
row.mobile = item.mobile;
}
},
async getOptionStaff() {
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`;
const { data, code, msg } = await requestPost(url, {});
if (code === 0) {
this.optionStaff = data || [];
} else {
this.$message.error("请求工作人员数据失败!");
}
},
async handleEdit(row) {
if (this.btnType == "add") this.save(row);
else this.edit(row);
},
handleAdd() {
this.btnType = "add";
this.isEdit = true;
const item = {
isEdit: true,
enterpriseId: this.enterpriseId,
patrolTime: "",
staffId: "",
staffName: "",
mobile: "",
result: "",
imgList: [],
reviewTime: "",
};
this.computeImgShowList(item);
this.tableData.push(item);
},
async save(row) {
const params = {
partyMemberId: this.enterpriseId,
...row,
};
await this.$http
.post("/gov/org/enterprise/addorupdate-patrol", params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
this.$message.success("保存成功");
row.isEdit = false;
this.isEdit = false;
this.btnType = "cancle";
this.getList();
}
})
.catch((err) => {
console.log("err", err);
return this.$message.error("网络错误");
});
},
async edit(row) {
const params = {
...row,
};
await this.$http
.post("/gov/org/enterprise/addorupdate-patrol", params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
this.$message.success("保存成功");
row.isEdit = false;
this.isEdit = false;
this.getList();
}
})
.catch((err) => {
console.log("err", err);
return this.$message.error("网络错误");
});
},
async del(row) {
await this.$http
.post(`/gov/org/enterprise/del-patrol/${row.patrolId}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
this.$message.success("删除成功");
this.getList();
}
})
.catch((err) => {
console.log("err", err);
return this.$message.error("网络错误");
});
},
async getList() {
const { enterpriseId } = this;
const params = {};
await this.$http
.post(`/gov/org/enterprise/patrollist/${enterpriseId}`, {
params,
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
this.tableData = res.data.list.map((item) => {
this.computeImgShowList(item);
return {
...item,
isEdit: false,
};
});
}
})
.catch((err) => {
console.log("err", err);
return this.$message.error("网络错误");
});
},
},
};
</script>
<style lang="scss" scoped>
.m-record {
.mt10 {
margin-bottom: 10px;
}
.input-width {
width: 170px;
}
}
</style>

31
src/views/modules/shequzhili/tuceng/anquan/xuncha/index.vue

@ -8,19 +8,30 @@
:editUrl="editUrl"
:delUrl="delUrl"
:infoUrl="infoUrl"
:editAuth="editAuth"
:delAuth="delAuth"
:exportUrl="exportUrl"
:importUrl="importUrl"
:mubanUrl="mubanUrl"
:editParams="editParams"
:editFixedParams="editFixedParams"
:editParamsDiv="5"
:editBtnName="(item) => (item.sourceType == 'import' ? '待完善' : '修改')"
idName="enterpriseId"
></base-page>
>
<template v-slot:editElse="{ id, formType, info }">
<record v-if="formType != 'add' && id" :formType="formType" :enterpriseId="id" :enterpriseInfo="info"></record>
</template>
</base-page>
</div>
</template>
<script>
import basePage from "@/views/modules/cpts/base/index";
import record from "./cpts/record";
export default {
components: { basePage, record },
props: {},
data() {
@ -69,7 +80,7 @@ export default {
label: "合格",
},
{
value: "0",
value: "1",
label: "不合格",
},
],
@ -85,8 +96,8 @@ export default {
{ field: "规模", keyName: "scale", type: "text" },
{ field: "负责人", keyName: "personInCharge", type: "text" },
{ field: "联系电话", keyName: "mobile", type: "text" },
{ field: "最新检查时间", keyName: "remark", type: "text" },
{ field: "最新结果", keyName: "result", type: "text" },
{ field: "最新检查时间", keyName: "latestPatrolTime", type: "text" },
{ field: "最新结果", keyName: "latestResult", type: "text" },
],
tableUrl: "/gov/org/enterprise/list",
mubanUrl: "/gov/org/enterprise/download-tem",
@ -97,6 +108,12 @@ export default {
editUrl: "/gov/org/enterprise/addOrUpdate",
infoUrl: "/gov/org/enterprise/detail/",
delUrl: "/gov/org/enterprise/delete/",
editAuth(item) {
return item.agencyId == this.$store.state.user.agencyId;
},
delAuth(item) {
return item.agencyId == this.$store.state.user.agencyId;
},
editParams: [
{
@ -120,7 +137,7 @@ export default {
optionUrl: "/gov/org/customergrid/gridoption",
optionUrlParams: {
agencyId: this.$store.state.user.agencyId,
purpose: "query",
purpose: "addorupdate",
},
optionList: [],
editDisabled: true,
@ -200,9 +217,11 @@ export default {
],
},
],
editFixedParams: {
agencyId: this.$store.state.user.agencyId,
},
};
},
components: { basePage },
computed: {},
watch: {},

4
src/views/modules/shequzhili/tuceng/yingji/ziyuan/index.vue

@ -29,7 +29,7 @@ export default {
{ field: "场所名称", keyName: "name", type: "input" },
{
field: "场所分类",
keyName: "serviceType",
keyName: "category",
type: "select",
optionUrl: "/gov/org/coverage/dict-select-list/superior_resource",
optionUrlParams: {},
@ -72,7 +72,7 @@ export default {
},
{
field: "场所分类",
keyName: "serviceType",
keyName: "category",
type: "select",
optionUrl: "/gov/org/coverage/dict-select-list/superior_resource",
optionUrlParams: {

Loading…
Cancel
Save