shuishen
2023-12-25 07f3872b412bde7e7cb0a518ac5910a612bad74f
src/views/place/index.vue
@@ -21,17 +21,18 @@
            <h3>基本信息:</h3>
            <avue-form :option="optionDetail" v-model="placeForm"></avue-form>
            <div style="display: flex; justify-content: center;">
                <el-button size="small" @click="roleBox = false">取 消</el-button>
                <el-button size="small" type="primary" @click="submitRole">提 交</el-button>
            </div>
            <h3>从业人员:</h3>
            <avue-crud :option="placeOption" :search.sync="search" :table-loading="loading" :data="placeExt" ref="crud"
                v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel"
                @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave" :page.sync="holdPage"
                @current-change="currentChange" @size-change="sizeChange">
                @current-change="holdCurrentChange" @size-change="holdSizeChange" @refresh-change="refreshHoldChange"
                @on-load="holdOnLoad">
            </avue-crud>
            <span slot="footer" class="dialog-footer">
                <el-button @click="roleBox = false">取 消</el-button>
                <el-button type="primary" @click="submitRole">提 交</el-button>
            </span>
        </el-dialog>
    </basic-container>
@@ -45,7 +46,11 @@
    add,
    getPlace,
    getPlaceExt,
    updatePlaceExt
    updatePlaceExt,
    holdRemove,
    holdAdd,
    holdUpdate,
    getHoldList
} from "@/api/place/place"
import {
    mapGetters
@@ -62,36 +67,74 @@
            optionDetail: {
                submitBtn: false,
                emptyBtn: false,
                column: [{
                    label: '场所名称',
                    prop: 'placeName',
                },
                {
                    label: '法人信息',
                    prop: 'legalPerson'
                },
                {
                    label: '法人电话',
                    prop: 'legalTel'
                },
                {
                    label: '场所位置',
                    prop: 'localtion'
                }
                column: [
                    {
                        label: '场所名称',
                        prop: 'placeName',
                    },
                    {
                        label: '法人信息',
                        prop: 'legalPerson'
                    },
                    {
                        label: '法人电话',
                        prop: 'legalTel'
                    },
                    {
                        label: '场所位置',
                        prop: 'localtion'
                    },
                    {
                        label: "营业执照",
                        prop: "imageUrls",
                        width: 80,
                        type: "upload",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "场所平面图",
                        prop: "planImageUrls",
                        width: 80,
                        type: "upload",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                ]
            },
            rowPlace: {},
            placeExt: [],
            houseHoldForm: {},
            placeOption: {
                menu: false,
                menu: true,
                height: 300,
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: false,
                addBtn: false,
                delBtn: false,
                editBtn: false,
                addBtn: true,
                delBtn: true,
                editBtn: true,
                border: true,
                index: true,
                dialogClickModal: false,
@@ -112,6 +155,13 @@
                    search: true,
                },]
            },
            holdPage: {
                pageSize: 20,
                currentPage: 1,
                total: 0,
            },
            page: {
                pageSize: 10,
                currentPage: 1,
@@ -356,6 +406,91 @@
        },
    },
    methods: {
        houseHoldRowUpdate (row, index, done, loading) {
            holdUpdate(row).then(
                () => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        houseHoldRowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return holdRemove(row.id)
                })
                .then(() => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        houseHoldRowSave (row, done, loading) {
            holdAdd({
                ...row,
                placeId: this.placeForm.placeId
            }).then(
                () => {
                    this.holdOnLoad(this.holdPage)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        refreshChange () {
            this.holdOnLoad(this.holdPage)
        },
        holdOnLoad (holdPage, params = {}) {
            if (!this.placeForm.placeId) return
            let values = {
                ...params,
                placeId: this.placeForm.placeId
            }
            getHoldList(holdPage.currentPage, holdPage.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.placeExt = data.records
                this.loading = false
            })
        },
        holdCurrentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        holdSizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        ManageTenants (item) {
            this.roleBox = true
@@ -366,6 +501,8 @@
                legalTel: '',
                localtion: '',
                confirmFlag: '',
                imageUrls: '',
                planImageUrls: ''
            }
            this.placeExt = []
            this.onLoadPlaceExt()
@@ -394,9 +531,24 @@
            getPlaceExt(Object.assign(params)).then(res => {
                const data = res.data.data
                if (data) {
                    this.placeForm = data
                    this.placeExt = data.placePractitioner
                    this.loading = false
                    let imageUrls = data.imageUrls
                    let planImageUrls = data.planImageUrls
                    if (imageUrls.length) {
                        imageUrls = imageUrls.split(',').filter(item => item != '').map(item => website.minioUrl + item).join(",")
                    }
                    if (planImageUrls.length) {
                        planImageUrls = planImageUrls.split(',').filter(item => item != '').map(item => website.minioUrl + item).join(",")
                    }
                    this.placeForm = {
                        ...data,
                        imageUrls,
                        planImageUrls
                    }
                    this.holdOnLoad(this.holdPage)
                    this.selectionClear()
                }
            })
@@ -439,6 +591,7 @@
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
@@ -464,6 +617,7 @@
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
@@ -544,8 +698,12 @@
                    }
                    done()
                })
            } else {
                done()
            }
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage