shuishen
2024-01-09 ca70eec16d4ae666d2beb560319860d30a1c17cd
src/views/cGovernance/gridWorkLog.vue
@@ -6,6 +6,10 @@
            :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="householdIdType" slot-scope="{item,value,label}">
                <span>{{ showNamePhone(item) }}</span>
            </template>
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.gridWorkLog_delete"
                    @click="handleDelete">删 除
@@ -16,7 +20,10 @@
</template>
<script>
import { getPersonPublicSelect } from "@/api/public"
import { getDetatils as householdDetail } from "@/api/userHouse/list/houseHold"
import { getList, remove, update, add, getGridWorkLog } from "@/api/grid/gridWorkLog"
import { getList as getHouseholdList, getDetatils as getHouseholdDetail } from "@/api/userHouse/list/houseHold"
import { mapGetters } from "vuex"
import website from '@/config/website'
@@ -34,13 +41,16 @@
            datetime: "",
            selectionList: [],
            option: {
                labelWidth: 120,
                searchLabelWidth: 96,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 210,
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 350,
                border: false,
                //stripe:true,
                index: true,
@@ -50,44 +60,145 @@
                dialogClickModal: false,
                column: [
                    {
                        label: "走访人员姓名",
                        prop: "name",
                        width: 120,
                        label: "走访类型",
                        prop: "type",
                        span: 12,
                        labelWidth: 120,
                        searchLabelWidth: 120,
                        searchSpan: 5,
                        searchSpan: 4,
                        search: true,
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=haveType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请输入走访人员姓名",
                                message: "请选择走访类型",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "走访人员电话",
                        prop: "phone",
                        overHidden: true,
                        label: "重点人群",
                        prop: "personType",
                        span: 12,
                        labelWidth: 120,
                        type: "tree",
                        dicUrl: "/api/blade-label/label/getLabelList?parentId=100",
                        props: {
                            label: "name",
                            value: "id"
                        },
                        searchSpan: 4,
                        search: true,
                        change: ({ value, column, item, dic }) => {
                            this.getUserList(value)
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择重点人群",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        width: 110,
                        display: false,
                        label: "被访人姓名",
                        prop: "name",
                        searchLabelWidth: 120,
                        searchSpan: 5,
                        search: true,
                    },
                    {
                        label: "内容",
                        labelWidth: 120,
                        disabled: true,
                        label: "被访人姓名",
                        prop: "householdId",
                        type: 'select',
                        remote: true,
                        hide: true,
                        dicUrl: "",
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        dicData: [],
                        rules: [
                            {
                                required: true,
                                message: '请输入姓名',
                                trigger: 'blur'
                            }
                        ],
                    },
                    {
                        width: 120,
                        label: "联系方式",
                        prop: "phone",
                        span: 12,
                        disabled: true,
                        searchSpan: 4,
                        search: true,
                    },
                    {
                        width: 156,
                        overHidden: true,
                        label: "走访地址",
                        prop: "address",
                        span: 24,
                        disabled: true,
                    },
                    {
                        width: 110,
                        label: "所属街道",
                        display: false,
                        prop: "townName",
                    },
                    {
                        width: 156,
                        overHidden: true,
                        label: "所属社区",
                        display: false,
                        prop: "neiName",
                        search: true,
                        searchSpan: 4
                    },
                    {
                        width: 110,
                        overHidden: true,
                        label: "所属网格",
                        display: false,
                        prop: "gridName",
                    },
                    {
                        overHidden: true,
                        label: "走访内容",
                        prop: "context",
                        type: "textarea",
                        span: 24,
                    },
                    {
                        width: 110,
                        label: "图片",
                        label: "走访取证",
                        prop: "url",
                        type: "upload",
                        labelWidth: 120,
                        listType: "picture-img",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
@@ -96,10 +207,19 @@
                        },
                        span: 24,
                    },
                    {
                        width: 110,
                        label: "录入人",
                        display: false,
                        prop: "createUserName",
                    },
                    {
                        width: 144,
                        label: "走访时间",
                        prop: "workTime",
                        width: 160,
                        searchLabelWidth: 120,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
@@ -110,14 +230,85 @@
                                trigger: "blur",
                            },
                        ],
                    }
                    },
                    {
                        dispaly: false,
                        width: 144,
                        label: "上报时间",
                        prop: "createTime",
                        searchLabelWidth: 120,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        rules: [
                            {
                                required: true,
                                message: "请输入上报时间",
                                trigger: "blur",
                            },
                        ],
                    },
                ],
            },
            data: [],
        }
    },
    watch: {
        "form.householdId": {
            handler (val) {
                if (val) {
                    householdDetail(val).then(res => {
                        let data = res.data.data
                        this.form.phone = data.phoneNumber
                        this.form.address = data.currentAddress
                    })
                }
            }
        },
        'form.personType': {
            handler (newData) {
                let householdIdColumn = this.findObject(
                    this.option.column,
                    'householdId'
                )
                if (newData) {
                    householdIdColumn.disabled = false
                } else {
                    householdIdColumn.disabled = true
                }
            },
        },
        'form.type': {
            handler (newData) {
                let householdIdColumn = this.findObject(
                    this.option.column,
                    'householdId'
                )
                let personTypeColumn = this.findObject(
                    this.option.column,
                    'personType'
                )
                if (newData == 1) {
                    householdIdColumn.disabled = false
                    personTypeColumn.display = false
                } else {
                    householdIdColumn.disabled = true
                    personTypeColumn.display = true
                }
            },
        },
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
@@ -135,8 +326,29 @@
            })
            return ids.join(",")
        },
        showNamePhone () {
            return (data) => {
                if (data.phoneNumber && data.phoneNumber.trim() != '') {
                    return `${data.name}(${data.phoneNumber})`
                }
                return data.name
            }
        }
    },
    created () {
        this.getUserList()
    },
    methods: {
        getUserList (param = '') {
            let dicUrl = `/api/blade-household/household/selectHouseholdList?labelId=${param}&searchKey={{key}}&limit=20`
            const column = this.findObject(this.option.column, "householdId")
            column.dicUrl = dicUrl
        },
        rowSave (row, done, loading) {
            if (row.url.length > 0) {
                var urls = []
@@ -255,6 +467,13 @@
                        })
                        this.form.url = urls.join(",")
                    }
                    getPersonPublicSelect({
                        id: this.form.householdId
                    }).then(res => {
                        const column = this.findObject(this.option.column, "householdId")
                        column.dicData = res.data.data
                    })
                })
            }
            // con