From 30350cae29ec19082a9810080e32fcddd4d9df17 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 19 四月 2024 14:26:54 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/weekly/weekly.html |  317 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 265 insertions(+), 52 deletions(-)

diff --git a/src/main/webapp/views/weekly/weekly.html b/src/main/webapp/views/weekly/weekly.html
index aceb7c8..3fb5b5f 100644
--- a/src/main/webapp/views/weekly/weekly.html
+++ b/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'
+            },
+
         }
     })
 

--
Gitblit v1.9.1