中扬CRM客户关系管理系统
#
lsh
2024-04-19 30350cae29ec19082a9810080e32fcddd4d9df17
src/main/webapp/views/weekly/weekly.html
@@ -17,6 +17,9 @@
<body>
<div id="app">
    <div>
    </div>
    <div>
        <el-dialog title="周计划" :visible.sync="dialogFormVisible" style="width: 1800px">
            <el-form :model="form" style="width: 100%">
                <el-form-item label="日期" :label-width="formLabelWidth">
@@ -31,21 +34,10 @@
                </el-form-item>
                <el-form-item label="周计划" :label-width="formLabelWidth">
                    <el-button type="primary" @click="addWeekPlan">添加日计划</el-button>
                    <el-table
                            :data="weeklyFormData"
                            border
                            style="width: 100%">
                        <el-table-column
                            fixed
                            :data="addWeekPlanData"
                            prop="weeklyDay"
                            label="星期"
                            width="150">
                    <el-table :data="weeklyFormData" border style="width: 100%">
                        <el-table-column fixed :data="addWeekPlanData" prop="weeklyDay" label="星期" width="150">
                        </el-table-column>
                        <el-table-column
                                prop="cstmrId"
                                label="甲方单位"
                                width="180">
                        <el-table-column prop="cstmrId" label="甲方单位" width="180">
                            <div class="item" slot-scope="scope">
                                <el-select v-model="scope.row.cstmrId" placeholder="甲方单位">
                                    <el-option
@@ -57,43 +49,28 @@
                                </el-select>
                            </div>
                        </el-table-column>
                        <el-table-column
                            prop="workContent"
                            label="工作内容及目的"
                            width="180">
                        <el-table-column prop="workContent" label="工作内容及目的" width="180">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.workContent" placeholder="工作内容及目的"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column
                            prop="weeklyMatter"
                            label="需协助事项"
                            width="120">
                        <el-table-column prop="weeklyMatter" label="需协助事项" width="120">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.weeklyMatter" placeholder="需协助事项"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column
                                prop="addr"
                                label="地址"
                                width="180">
                        <el-table-column prop="addr" label="地址" width="180">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.addr" placeholder="地址"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column
                            prop="memo"
                            label="备注"
                            width="120">
                        <el-table-column prop="memo" label="备注" width="120">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.memo" placeholder="备注"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column  :show="false"  property="weeklyDay$" label="日期"  v-if="false"></el-table-column>
                        <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <el-table-column :show="false" property="weeklyDay$" label="日期" v-if="false"></el-table-column>
                        <el-table-column fixed="right" label="操作" width="100">
                            <template slot-scope="scope">
                                <el-button @click="delWeeklyPlan(scope.row)" type="text" size="del-weekly-plan">删除</el-button>
                            </template>
@@ -102,10 +79,75 @@
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false, weeklyFormData=[]">取 消</el-button>
                <el-button type="primary" @click="dialogFormVisible = false, addWeekly(form,true)">确 定</el-button>
                <el-button @click="dialogFormVisible = false, weeklyFormDataInit()">取消</el-button>
                <el-button type="primary" @click="dialogFormVisible = false, addWeekly(form,true)">确定</el-button>
            </div>
        </el-dialog>
        <el-dialog title="日计划" :visible.sync="updatePlanDialogFormVisible" style="width: 1800px">
            <el-form :model="formPlan" style="width: 100%">
                <el-form-item label="日期" :label-width="formLabelWidth">
                    <el-select v-model="formPlan.name">
                        <el-option
                                v-for="item in addWeekPlanDataWeeklySignPlan"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="周计划" :label-width="formLabelWidth">
                    <el-button type="primary" @click="addWeekPlan">添加日计划</el-button>
                    <el-table :data="weeklyFormDataPlan" border style="width: 100%">
                        <el-table-column fixed :data="addWeekPlanData" prop="weeklyDay" label="星期" width="150">
                        </el-table-column>
                        <el-table-column prop="cstmrId" label="甲方单位" width="180">
                            <div class="item" slot-scope="scope">
                                <el-select v-model="scope.row.cstmrId" placeholder="甲方单位">
                                    <el-option
                                            v-for="item in options"
                                            :key="item.value"
                                            :label="item.name"
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                            </div>
                        </el-table-column>
                        <el-table-column prop="workContent" label="工作内容及目的" width="180">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.workContent" placeholder="工作内容及目的"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column prop="weeklyMatter" label="需协助事项" width="120">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.weeklyMatter" placeholder="需协助事项"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column prop="addr" label="地址" width="180">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.addr" placeholder="地址"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column prop="memo" label="备注" width="120">
                            <div class="item" slot-scope="scope">
                                <el-input v-model="scope.row.memo" placeholder="备注"></el-input>
                            </div>
                        </el-table-column>
                        <el-table-column :show="false" property="weeklyDay$" label="日期" v-if="false"></el-table-column>
                        <el-table-column fixed="right" label="操作" width="100">
                            <template slot-scope="scope">
                                <el-button @click="delWeeklyPlanUpdate(scope.row)" type="text" size="del-weekly-plan">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="updatePlanDialogFormVisible = false, weeklyFormDataPlanInit()">取消</el-button>
                <el-button type="primary" @click="updatePlanDialogFormVisible = false, updatePlanWeekly(formPlan,false)">确定</el-button>
            </div>
        </el-dialog>
        <el-dialog
                title="星期"
@@ -128,6 +170,28 @@
        </el-dialog>
        <el-main>
            <el-popover
                    placement="top"
                    width="160"
                    v-model="visible">
                <el-input
                        placeholder="搜索"
                        v-model="filterText">
                </el-input>
                <el-tree
                        class="filter-tree"
                        :data="data1"
                        :props="defaultProps"
                        :default-expand-all="false"
                        :filter-node-method="filterNode"
                        :expand-on-click-node="false"
                        ref="tree"
                        accordion
                        @node-click="handleNodeClick">
                </el-tree>
                <el-button type="primary" slot="reference" plain>{{userNameNow.userName}}</el-button>
            </el-popover>
            <el-button type="primary"  @click="dialogFormVisible = true" icon="el-icon-edit" size="mini" circle></el-button>
            <el-table
                    :data="tableData"
@@ -194,9 +258,11 @@
                        prop="oper"
                        fixed="right"
                        label="操作"
                        width="100">
                        width="180">
                    <template slot-scope="scope">
                        <el-button @click="delWeekly(scope.row)" type="text" size="del-weekly">删除</el-button>
                        <el-button @click="showUpdatePlanWeekly(scope.row)" type="text" size="del-weekly">计划</el-button>
                        <el-button @click="updateRWeekly(scope.row)" type="text" size="del-weekly">结果</el-button>
                    </template>
                </el-table-column>
            </el-table>
@@ -207,20 +273,25 @@
    var app = new Vue({
        el: '#app',
        data: {
            data1: [],
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            visible: false,
            userNameNow: {
                userId : 0,
                userName : '',
                deptId : 0
            },
            filterText: '',
            tableData: [],
            weeklyDailyPlanData: [],
            weeklyDailyRealityData: [],
            dialogFormVisible: false,
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            updatePlanDialogFormVisible: false,
            form: {},
            formPlan: {},
            formLabelWidth: '120px',
            addWeekPlanVisible: false,
            addWeekPlanDataWeeklySign: [
@@ -237,20 +308,27 @@
                    label: '下周'
                }
            ],
            addWeekPlanDataWeeklySignPlan: [],
            addWeekPlanData: [],
            addWeekPlanValue: [],
            weeklyFormData: [],
            weeklyFormDataPlan: [],
            options: [],
            // 需要编辑的属性
            editProp: ['cstmrId','workContent','weeklyMatter','memo']
        },
        created(){
            this.init();
            this.initUser();
            this.weeklyFormDataInit();
            this.getOptionsData();
            this.getAddWeekPlanData();
            this.getUserNameAndId();
        },
        watch: {
            filterText(val) {
                this.$refs.tree.filter(val);
            }
        },
        computed:{
            // cstmrLabel () {
@@ -272,6 +350,67 @@
                        console.log(that.tableData)
                    }
                });
            },
            initUser(){
                let that = this
                $.ajax({
                    url: baseUrl + "/dashboard/user/id/popup/auth2",
                    data:{token : localStorage.getItem('token')},
                    method: 'GET',
                    success: function (res) {
                        if (res.code === 200) {
                            console.log(res)
                            that.userNameNow = res.data;
                        }
                    }
                });
            },
            filterNode(value, data) {
                if (!value) return true;
                return data.label.indexOf(value) !== -1;
            },
            handleNodeClick(data) {
                // console.log("data");
                console.log(data);
                this.userNameNow.userName = data.label
                this.userNameNow.userId = data.userId
                this.userNameNow.deptId = data.deptId
                let that = this
                $.ajax({
                    url: baseUrl + '/weekly/list/auth2',
                    headers: {'token': localStorage.getItem('token')},
                    method: "get",
                    data: {
                        dept_id: Number(that.userNameNow.deptId),
                        user_id: Number(that.userNameNow.userId),
                    },
                    success: (res) => {
                        that.tableData = res.data.records;
                        console.log(that.tableData)
                    }
                });
            },
            weeklyFormDataInit(){
                this.weeklyFormData = [
                    {
                        weeklyDay: 1
                    },{
                        weeklyDay: 2
                    },{
                        weeklyDay: 3
                    },{
                        weeklyDay: 4
                    },{
                        weeklyDay: 5
                    },{
                        weeklyDay: 6
                    }]
                this.form.name = this.addWeekPlanDataWeeklySign[2].value
            },
            weeklyFormDataPlanInit(){
                this.weeklyFormDataPlan = []
                this.formPlan.name = []
                this.updatePlanDialogFormVisible = false
            },
            showWeeklyDailyPlan(id) {
                let that = this;
@@ -311,7 +450,10 @@
            addWeekly(res,isExpAdd){
                let that = this;
                let weeklyFormData = this.weeklyFormData;
                console.log("weeklyFormData")
                console.log(weeklyFormData)
                console.log("res")
                console.log(res)
                $.ajax({
                    url: baseUrl+"/weekly/from/" + (isExpAdd?"add":"modify") + "/auth",
                    headers: {'token': localStorage.getItem('token')},
@@ -333,12 +475,58 @@
                    }
                })
            },
            showUpdatePlanWeekly(res) {
                let that = this;
                that.formPlan.name = res.weeklyDayMonth
                that.formPlan.weeklyId = res.id
                // that.formPlan.weeklyMonth = res.weeklyMonth
                $.ajax({
                    url: baseUrl + '/weeklyDailyPlan/list/auth',
                    headers: {'token': localStorage.getItem('token')},
                    method: "get",
                    data: {
                        weekly_id: res.id
                    },
                    success: (res) => {
                        that.weeklyFormDataPlan = res.data.records;
                    }
                });
                that.updatePlanDialogFormVisible = true
            },
            updatePlanWeekly(res,isExpAdd){
                let that = this;
                that.updatePlanDialogFormVisible = false
                let weeklyFormDataPlan = this.weeklyFormDataPlan;
                $.ajax({
                    url: baseUrl+"/weekly/from/" + (isExpAdd?"add":"modify") + "/auth",
                    headers: {'token': localStorage.getItem('token')},
                    data: JSON.stringify({
                        // weeklyType: Number(that.formPlan.weeklyMonth),
                        weeklyId: that.formPlan.weeklyId,
                        // type: Number(data.field.type),
                        type: Number(1),
                        weeklyDailyPlanList: weeklyFormDataPlan
                    }),
                    contentType:'application/json;charset=UTF-8',
                    method: 'POST',
                    success: (res) => {
                        weeklyFormData=[]
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        // 在这里做错误处理:
                        console.log('Error occurred: ', textStatus, errorThrown);
                    }
                })
                that.weeklyFormDataPlan = []
                that.formPlan.name = []
                that.formPlan.weeklyId = 0
            },
            addWeekPlanConfirm() {
                let list = this.weeklyFormData
                let value = this.addWeekPlanValue
                if (value.length > 0) {
                    value.forEach((item,idx) => {
                        // console.log(item)
                        list.push({
                            weeklyDay: item
                        })
@@ -346,6 +534,7 @@
                }
                this.weeklyFormData = list;
                console.log(list)
                this.addWeekPlanVisible = false;
                this.addWeekPlanValue = [];
            },
@@ -355,6 +544,14 @@
                if (index !== -1) {
                    // 通过splice方法删除该行
                    this.weeklyFormData.splice(index, 1);
                }
            },
            delWeeklyPlanUpdate(row) {
                // 找到要删除的行在数据列表中的索引
                const index = this.weeklyFormDataPlan.findIndex(item => item === row);
                if (index !== -1) {
                    // 通过splice方法删除该行
                    this.weeklyFormDataPlan.splice(index, 1);
                }
            },
            delWeekly(row) {
@@ -413,7 +610,23 @@
                    }
                });
            }
            },
            getUserNameAndId() {
                let that = this;
                $.ajax({
                    url: baseUrl + "/user/id/popup/auth",
                    data:{token : localStorage.getItem('token')},
                    method: 'GET',
                    success: function (res) {
                        that.data1 = res.data.children;
                    }
                });
            },
            defaultProps: {
                children: 'children',
                label: 'label'
            },
        }
    })