From d896d25a2bee6dc9496f102035b2d68d17f3de65 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 05 三月 2024 13:58:13 +0800
Subject: [PATCH] 生产调度变更记录功能

---
 src/views/plan/productionschedul/index.vue |  935 +++++++++++++++++++++++----------------------------------
 1 files changed, 379 insertions(+), 556 deletions(-)

diff --git a/src/views/plan/productionschedul/index.vue b/src/views/plan/productionschedul/index.vue
index 4f05a4f..20ddc6d 100644
--- a/src/views/plan/productionschedul/index.vue
+++ b/src/views/plan/productionschedul/index.vue
@@ -1,117 +1,40 @@
 <template>
   <div class="mod-config">
     <basic-container>
-      <el-row>
-        <el-col :span="16" style="height:100vh">
-          <el-row style="height:65%;padding:0px 10px;">
-            <el-col :span="24" style="margin: 0;">
-              <div style="display:flex;height:36px;justify-content: space-between;align-items:center;">
-                <div><span style="color:#E84738;font-weight: bold;">鏈畬鎴�</span></div>
-                <div>
-                  <el-button @click="tagFinished" size="mini" round type="success">鏍囪宸插畬鎴�</el-button>
-                  <el-button size="mini" round type="primary"
-                  v-if="permissions.plan_productionschedul_edit_line"
-                  @click="openEditDialog">缂栬緫鏃堕棿绾�</el-button>
-                  <el-tooltip content="鍒锋柊">
-                    <el-button circle icon="el-icon-refresh" @click="getDataList"></el-button>
-                  </el-tooltip>
-                </div>
-              </div>
-              <avue-crud
-              class="unfinished-crud"
-              :data="tableData"
-              ref="crud"
-              :option="option"
-              :span-method="spanMethod"
-              @refresh-change="getDataList"
-              @current-change="handleCurrentChange"
-              @size-change="handleSizeChange"
-              :page="page"
-              @selection-change="selectionRow"
-              :table-loading="loading">
-              <template #menu="{ row, index }">
-                <el-button
-                v-if="permissions.plan_productionschedul_edit"
-                type="text"
-                icon="el-icon-edit"
-                size="small"
-                @click="editHandle(row, index)">缂栬緫</el-button>
-                <el-button
-                v-if="permissions.plan_productionschedul_del"
-                type="text"
-                icon="el-icon-delete"
-                size="small"
-                @click="deleteHandle(row, index)">鍒犻櫎</el-button>
-              </template>
-              </avue-crud>
-            </el-col>
-          </el-row>
-          <el-row style="height:35%;padding:0px 10px;">
-            <el-col :span="24" style="margin: 0;">
-              <div style="display:flex;height:36px;justify-content: space-between;align-items:center;">
-                <div><span style="color:#34BD66;font-weight: bold;">宸插畬鎴�</span></div>
-              </div>
-              <avue-crud
-              class="finished-crud"
-              :data="finishedTableData"
-              ref="finished"
-              :option="finishedOption"
-              :span-method="spanMethod"
-              @refresh-change="getFinishedData"
-              @current-change="handleCurrentChange"
-              @size-change="handleSizeChange"
-              :page="finishedPage"
-              @selection-change="selectionFinishedRow">
-              <!-- <template #menu="{ row, index }">
-                <el-button
-                v-if="permissions.plan_productionschedul_del"
-                type="text"
-                icon="el-icon-delete"
-                size="small"
-                @click="deleteHandle(row, index)">鍒犻櫎</el-button>
-              </template> -->
-              </avue-crud>
-            </el-col>
-          </el-row>
-        </el-col>
-        <el-col :span="8" style="padding-left: 10px">
-          <div style="">
-            <el-card>
-              <div slot="header" class="clearfix">
-                <span>璋冨害鏃堕棿绾�</span>
-              </div>
-              <div style="height:100vh;overflow-y: scroll;">
-                <el-timeline>
-                    <el-timeline-item
-                      placement="top"
-                      :color="(item.planTime||item.actualTime) ? '#34BD66' :null"
-                      :icon="(item.planTime||item.actualTime) ? 'el-icon-circle-check' :null"
-                      v-for="(item, index) in scheduleList"
-                      :key="index"
-                      :timestamp="item.title">
-                        <el-card shadow="hover" :body-style="{margin: '0',padding:'0px 20px 0px 20px'}" style="width:90%;">
-                          <p>
-                            <span style="font-weight: bold;">璁″垝鏃堕棿: </span>
-                            {{item.planTime}}
-                          </p>
-                          <p>
-                            <span style="font-weight: bold;">瀹為檯鏃堕棿: </span>
-                            {{ item.actualTime }}</p>
-                        </el-card>
-                    </el-timeline-item>
-                </el-timeline>
-            </div>
-            </el-card>
-          </div>
-        </el-col>
-      </el-row>
+      <ttable
+        :rowKey="'mid'"
+        :table="table"
+        :prelang="prelang"
+        :options="options"
+        @handleSelectionChange="selectionRow"
+        :ajaxFun="ajaxFun"
+        :paramObj="queryParams"
+        :mergeSpanArr="spanArr"
+        :selColValArr="paramSelArr"
+        :selCol="paramSelCol"
+        ref="ttable">
+        <template #toolbar>
+            <el-dropdown @command="changeTable">
+                <span :style="dropdownTitleStyle" class="el-dropdown-link">
+                    {{dropdownTitle}}<i class="el-icon-arrow-down el-icon--right"></i>
+                </span>
+                <el-dropdown-menu slot="dropdown">
+                    <el-dropdown-item command="undone">寰呭畬鎴愯皟搴�</el-dropdown-item>
+                    <el-dropdown-item command="done">宸插畬鎴愯皟搴�</el-dropdown-item>
+                </el-dropdown-menu>
+            </el-dropdown>
+            <el-button v-if="showUnDownTable" @click="tagFinished" type="success">鏍囪宸插畬鎴�</el-button>
+            <el-button v-if="permissions.plan_productionschedul_edit_line && showUnDownTable"
+            @click="openEditDialog" type="primary">缂栬緫鏃堕棿绾�</el-button>
+        </template>
+      </ttable>
     </basic-container>
+    <!-- 缂栬緫鏃堕棿绾� -->
     <el-dialog
     title="缂栬緫鏃堕棿绾�"
     :visible.sync="dialogVisible"
     top="5vh"
-    width="50%"
-    :before-close="handleClose">
+    width="50%">
       <div style="height:60vh;overflow-y: scroll;">
         <el-timeline>
           <el-timeline-item
@@ -130,7 +53,7 @@
                       v-model="item.planTime"
                       value-format="yyyy-MM-dd HH:mm:ss"
                       type="datetime"
-                      placeholder="閫夋嫨鏃ユ湡鏃堕棿">
+                      placeholder="閫夋嫨璁″垝鏃堕棿">
                     </el-date-picker>
                   </el-col>
                 </el-row>
@@ -144,7 +67,7 @@
                       v-model="item.actualTime"
                       value-format="yyyy-MM-dd HH:mm:ss"
                       type="datetime"
-                      placeholder="閫夋嫨鏃ユ湡鏃堕棿">
+                      placeholder="閫夋嫨瀹為檯鏃堕棿">
                     </el-date-picker>
                   </el-col>
                 </el-row>
@@ -156,49 +79,290 @@
         <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
         <el-button type="primary" @click="confirmEditSchedul">纭� 瀹�</el-button>
       </span>
-  </el-dialog>
-  <el-dialog
-    title="缂栬緫"
-    :visible.sync="editDialogVisible"
-    width="50%">
-    <el-form :model="editForm" label-width="120px">
-      <el-row>
-        <el-col :span="24">
-          <el-form-item label="鐢熶骇鎯呭喌:">
-            <el-input style="width:100%" placeholder="璇疯緭鍏ョ敓浜ф儏鍐�" type="textarea" :row="2" v-model="editForm.productionStatus"></el-input>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="24">
-          <el-form-item label="鐢熶骇绋嬪害:">
-            <el-input style="width:100%" placeholder="璇疯緭鍏ョ敓浜х▼搴�" type="textarea" :row="2" v-model="editForm.productionRoutine"></el-input>
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="editDialogVisible = false">鍙� 娑�</el-button>
-      <el-button type="primary" @click="confirmEdit()">纭� 瀹�</el-button>
-    </span>
-  </el-dialog>
+    </el-dialog>
+    <!-- 缂栬緫鐢熶骇杩囩▼鍜岀敓浜ф儏鍐� -->
+    <el-dialog
+        title="缂栬緫"
+        :visible.sync="editDialogVisible"
+        width="50%">
+        <el-form :model="editForm" label-width="120px">
+        <el-row>
+            <el-col :span="24">
+            <el-form-item label="鐢熶骇鎯呭喌:">
+                <el-input style="width:100%" placeholder="璇疯緭鍏ョ敓浜ф儏鍐�" type="textarea" :row="2" v-model="editForm.productionStatus"></el-input>
+            </el-form-item>
+            </el-col>
+        </el-row>
+        <el-row>
+            <el-col :span="24">
+            <el-form-item label="鐢熶骇绋嬪害:">
+                <el-input style="width:100%" placeholder="璇疯緭鍏ョ敓浜х▼搴�" type="textarea" :row="2" v-model="editForm.productionRoutine"></el-input>
+            </el-form-item>
+            </el-col>
+        </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+        <el-button @click="editDialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="confirmEdit()">纭� 瀹�</el-button>
+        </span>
+    </el-dialog>
+    <!-- 鏌ョ湅鏃堕棿绾� -->
+    <el-dialog
+    title="鏌ョ湅璋冨害鏃堕棿绾�"
+    top="5vh"
+    :visible.sync="showTimeLineDialog"
+    width="40%">
+        <el-card>
+            <div style="height:500px;overflow-y: scroll;">
+            <el-timeline>
+                <el-timeline-item
+                    placement="top"
+                    :color="(item.actualTime) ? '#34BD66' :null"
+                    :icon="(item.planTime || item.actualTime) ? 'el-icon-circle-check' :null"
+                    v-for="(item, index) in scheduleList"
+                    :key="index"
+                    :timestamp="item.title">
+                    <el-card shadow="hover" :body-style="{margin: '0',padding:'0px 20px 0px 20px'}" style="width:90%;">
+                        <p>
+                        <span style="font-weight: bold;">璁″垝鏃堕棿: </span>
+                        {{item.planTime}}
+                        </p>
+                        <p>
+                        <span style="font-weight: bold;">瀹為檯鏃堕棿: </span>
+                        {{ item.actualTime }}</p>
+                    </el-card>
+                </el-timeline-item>
+            </el-timeline>
+            </div>
+        </el-card>
+    </el-dialog>
+    <!-- 鏌ョ湅鍙樻洿璁板綍 -->
+    <el-dialog
+    title="鍙樻洿璁板綍"
+    :visible.sync="showRecordsDialog"
+    width="60%">
+        <el-table border :data="recordsList">
+            <el-table-column type="index" width="50" label="搴忓彿" align="center"/>
+            <el-table-column prop="createTime" min-width="120" show-overflow-tooltip label="鎿嶄綔鏃堕棿" align="center"/>
+            <el-table-column prop="createUser" min-width="120" show-overflow-tooltip label="鎿嶄綔浜�" align="center"/>
+            <el-table-column prop="recordType" min-width="120" show-overflow-tooltip label="鎿嶄綔绫诲瀷" align="center"/>
+            <el-table-column prop="oldRecord" min-width="200" show-overflow-tooltip label="鏃у��" align="center"/>
+            <el-table-column prop="newRecord" min-width="200" show-overflow-tooltip label="鏂板��" align="center"/>
+        </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
   fetchScheduleList,
+  fetchRecordsList,
   fetchScheduleById,
   fillTime,
   deleteSchedul,
   updateState,
   checkTimeLines,
+  updateSchedul
 } from '@/api//plan/productionschedul'
 import ttable from '@/views/common/ztt-table.vue'
 import { mapGetters } from 'vuex'
 export default {
     data() {
     return {
+      queryParams: {
+        state: false
+      },
+      showRecordsDialog: false,
+      recordsList: [],
+      paramSelArr: [false],
+      paramSelCol: 'hasEdit',
+      ajaxFun: fetchScheduleList,
+      prelang: 'productSchedul',
+      options: {
+        height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
+        stripe: true, // 鏄惁涓烘枒椹汗 table
+        highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈
+        border: true, // 鏄惁鏈夌旱鍚戣竟妗�
+        lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇
+        fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮�
+        multiSelect: true, //
+        seqNo: true,
+        isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
+        isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳H
+        isSearch: true, // 楂樼骇鏌ヨ鎸夐挳
+        defaultOrderBy: { column: 'time', direction: 'desc' },
+        cancelRunCreated: false,
+        tableCellMerge: true
+      },
+      table: {
+        total: 0,
+        currentPage: 1,
+        pageSize: 20,
+        data: [],
+        // 鏍囬
+        column: [
+            {
+                minWidth: 120,
+                prop: 'projectName',
+                label: '椤圭洰鍚嶇О',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 100,
+                prop: 'contractNo',
+                label: '鍚堝悓鍙�',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 120,
+                prop: 'orderTime',
+                label: '鎺ュ崟鏃ユ湡',
+                sort: true,
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'date',
+                format: (row,columnValue)=> this.formatDate(row,columnValue)
+            },
+            {
+                minWidth: 120,
+                prop: 'customerName',
+                label: '瀹㈡埛鍚嶇О',
+                isTrue: true,
+                searchInfoType: 'text',
+                isSearch: true,
+            },
+            {
+                minWidth: 120,
+                prop: 'deliveryDate',
+                label: '浜よ揣鏃ユ湡',
+                isTrue: true,
+                sort: true,
+                isSearch: true,
+                searchInfoType: 'date',
+                format: (row,columnValue)=> this.formatDate(row,columnValue)
+            },
+            {
+                minWidth: 120,
+                prop: 'productType',
+                label: '浜у搧绫诲瀷',
+                isTrue: true,
+                searchInfoType: 'text',
+                isSearch: true,
+            },
+            {
+                minWidth: 120,
+                prop: 'product',
+                label: '浜у搧鍚�',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+                render: { fun: this.handleClickCell }
+            },
+            {
+                minWidth: 120,
+                prop: 'status',
+                label: '褰撳墠鐘舵��',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'select',
+                optList: ()=>{
+                    return [
+                    { label: '鏂囦欢绛惧彂', value: '鏂囦欢绛惧彂' },
+                    { label: '涓嬭揪鐗╂枡闇�姹�', value: '涓嬭揪鐗╂枡闇�姹�' },
+                    { label: '閲囪喘璇环+鍚堝悓绛捐', value: '閲囪喘璇环+鍚堝悓绛捐' },
+                    { label: '鐗╂枡閲囪喘鍒拌揣', value: '鐗╂枡閲囪喘鍒拌揣' },
+                    { label: '鐗╂枡鍒拌揣妫�楠�', value: '鐗╂枡鍒拌揣妫�楠�' },
+                    { label: '棰嗘枡銆佽绠卞叆搴�', value: '棰嗘枡銆佽绠卞叆搴�' },
+                ]
+                }
+            },
+            {
+                minWidth: 120,
+                prop: 'time',
+                label: '涓存湡鏃堕棿',
+                isTrue: true,
+                sort: true,
+                isSearch: true,
+                searchInfoType: 'date',
+                format: (row,columnValue)=> this.formatDate(row,columnValue)
+            },
+            {
+                minWidth: 120,
+                prop: 'specs',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+                label: '瑙勬牸鍨嬪彿',
+            },
+            {
+                minWidth: 120,
+                prop: 'unit',
+                label: '鍗曚綅',
+                searchInfoType: 'text',
+                isTrue: true,
+                isSearch: true,
+            },
+            {
+                minWidth: 120,
+                prop: 'number',
+                label: '鏁伴噺',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 120,
+                prop: 'productionStatus',
+                label: '鐢熶骇鎯呭喌',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 120,
+                prop: 'productionRoutine',
+                label: '鐢熶骇绋嬪害',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 120,
+                prop: 'projectLeader',
+                label: '椤圭洰璐熻矗浜�',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            },
+            {
+                minWidth: 150,
+                prop: 'remark',
+                label: '澶囨敞',
+                isTrue: true,
+                isSearch: true,
+                searchInfoType: 'text',
+            }
+        ],
+        toolbar: [],
+        operator: null,
+        operatorConfig: {
+            fixed: 'right',
+            label: '鎿嶄綔',
+            width: 150,
+            minWidth: 150
+        }
+      },
+      dropdownTitleStyle: {
+        color: '#E84738',
+        fontWeight: 'bold'
+      },
+      showUnDownTable: true,
+      dropdownTitle: '寰呭畬鎴愯皟搴�',
+      showTimeLineDialog:false,
       editForm:{
         id: null,
         productionRoutine: null,
@@ -208,270 +372,9 @@
       dialogVisible: false,
       scheduleList: [],
       scheduleEditList: [],
-      typeOptions: [],
       multipleSelection: [],
       loading: true,
-      tableData: [],
-      finishedTableData: [],
-      page: {
-        total: 0,
-        currentPage: 1,
-        pageSize: 10,
-        pagerCount: 5
-      },
-      finishedPage: {
-        total: 0,
-        currentPage: 1,
-        pageSize: 10,
-        pagerCount: 5
-      },
-      option: {
-        defaultSort:{
-          prop:'id',
-          order:'descending'
-        },
-        height: 370,
-        selection: true,
-        columnBtn: false,
-        index: true,
-        indexFixed: false,
-        selectionFixed: false,
-        rowKey: 'mid',
-        indexLabel: '搴忓彿',
-        menuAlign: 'center',
-        menuWidth: 130,
-        editBtn: false,
-        delBtn: false,
-        addBtn: false,
-        border: true,
-        align: 'center',
-        column: [
-          {
-            minWidth: 120,
-            prop: 'projectName',
-            label: '椤圭洰鍚嶇О',
-            overHidden: true,
-          },
-          {
-            minWidth: 100,
-            prop: 'contractNo',
-            label: '鍚堝悓鍙�',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'orderTime',
-            label: '鎺ュ崟鏃ユ湡',
-            overHidden: true,
-            formatter: (row,columnValue)=> this.formatDate(row,columnValue)
-          },
-          {
-            minWidth: 120,
-            prop: 'customerName',
-            label: '瀹㈡埛鍚嶇О',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'deliveryDate',
-            label: '浜よ揣鏃ユ湡',
-            overHidden: true,
-            formatter: (row,columnValue)=> this.formatDate(row,columnValue)
-          },
-          {
-            minWidth: 120,
-            prop: 'productType',
-            label: '浜у搧绫诲瀷',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'product',
-            label: '浜у搧鍚�',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'specs',
-            label: '瑙勬牸鍨嬪彿',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'unit',
-            label: '鍗曚綅',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'number',
-            label: '鏁伴噺',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'productionStatus',
-            label: '鐢熶骇鎯呭喌',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'productionRoutine',
-            label: '鐢熶骇绋嬪害',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'projectLeader',
-            label: '椤圭洰璐熻矗浜�',
-            overHidden: true,
-          },
-          {
-            minWidth: 150,
-            prop: 'remark',
-            label: '澶囨敞',
-            overHidden: true,
-          }
-        ],
-      },
-      finishedOption: {
-        refreshBtn: false, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
-        defaultSort:{
-          prop:'id',
-          order:'descending'
-        },
-        height: 230,
-        selection: true,
-        columnBtn: false,
-        index: true,
-        indexFixed: false,
-        selectionFixed: false,
-        rowKey: 'mid',
-        indexLabel: '搴忓彿',
-        menu: false,
-        menuAlign: 'center',
-        menuWidth: 130,
-        editBtn: false,
-        delBtn: false,
-        addBtn: false,
-        border: true,
-        align: 'center',
-        column: [
-          {
-            minWidth: 120,
-            prop: 'projectName',
-            label: '椤圭洰鍚嶇О',
-            overHidden: true,
-          },
-          {
-            minWidth: 100,
-            prop: 'contractNo',
-            label: '鍚堝悓鍙�',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'orderTime',
-            label: '鎺ュ崟鏃ユ湡',
-            overHidden: true,
-            formatter: (row,columnValue)=> this.formatDate(row,columnValue)
-          },
-          {
-            minWidth: 120,
-            prop: 'customerName',
-            label: '瀹㈡埛鍚嶇О',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'deliveryDate',
-            label: '浜よ揣鏃ユ湡',
-            overHidden: true,
-            formatter: (row,columnValue)=> this.formatDate(row,columnValue)
-          },
-          {
-            minWidth: 120,
-            prop: 'productType',
-            label: '浜у搧绫诲瀷',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'product',
-            label: '浜у搧鍚�',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'specs',
-            label: '瑙勬牸鍨嬪彿',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'unit',
-            label: '鍗曚綅',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'number',
-            label: '鏁伴噺',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'productionStatus',
-            label: '鐢熶骇鎯呭喌',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'productionRoutine',
-            label: '鐢熶骇绋嬪害',
-            overHidden: true,
-          },
-          {
-            minWidth: 120,
-            prop: 'projectLeader',
-            label: '椤圭洰璐熻矗浜�',
-            overHidden: true,
-          },
-          {
-            minWidth: 150,
-            prop: 'remark',
-            label: '澶囨敞',
-            overHidden: true,
-          }
-        ],
-      },
-      spanArr: [{
-        prop: 'id',
-        span: []
-      },{
-        prop: 'projectName',
-        span: []
-      }, {
-        prop: 'contractNo',
-        span: []
-      },
-      {
-        prop: 'orderTime',
-        span: []
-      },
-      {
-        prop: 'customerName',
-        span: []
-      },
-      {
-        prop: 'deliveryDate',
-        span: []
-      },
-      {
-        prop: 'productType',
-        span: []
-      },
-    ],
+      spanArr: ['id','projectName', 'contractNo','orderTime','customerName','deliveryDate','productType'],
     }
   },
   components: {
@@ -481,19 +384,8 @@
     ...mapGetters(['permissions']),
   },
   created(){
-    if(!this.permissions.plan_productionschedul_edit && !this.permissions.plan_productionschedul_del){
-      this.option.menu = false
-    }
+    this.showOperator()
     this.loading = true
-    this.getUnFinishedData()
-    this.getFinishedData()
-    this.getParamType()
-    // this.rowSort()
-    this.rowCalc()
-  },
-  beforeUpdate() {
-    // this.rowSort()
-    this.rowCalc()
   },
   watch:{
     editDialogVisible(newVal){
@@ -511,12 +403,78 @@
       }
     }
   },
-  mounted() {
-
-  },
-  beforeDestroy() {
-  },
   methods: {
+    showChangeRecords(row){
+        this.recordsList = []
+        if(row){
+            fetchRecordsList(row.mid).then((res)=>{
+                if(res.status===200){
+                    this.recordsList = res.data.data.records
+                }
+            }).catch((error)=>{
+                console.error(error);
+            })
+        }
+        this.showRecordsDialog = true
+    },
+    showOperator(){
+        this.table.operator = [{
+            text: '鍙樻洿璁板綍',
+            type: 'text',
+            size: 'small',
+            fun: this.showChangeRecords,
+        }]
+        if(this.showUnDownTable){
+            if(this.permissions.plan_productionschedul_edit){
+                this.table.operator.push({
+                    text: '缂栬緫',
+                    type: 'text',
+                    size: 'small',
+                    fun: this.editHandle,
+                    show: {
+                        key: 'hasEdit',
+                        val: [true]
+                    }
+                })
+            }
+            if(this.permissions.plan_productionschedul_del){
+                this.table.operator.push({
+                    text: '鍒犻櫎',
+                    type: 'text',
+                    size: 'small',
+                    fun: this.deleteHandle,
+                    show: {
+                        key: 'hasEdit',
+                        val: [true]
+                    }
+                })
+            }
+        }
+    },
+    handleClickCell(row){
+        this.getScheduleById(row.mid)
+        this.showTimeLineDialog = true
+    },
+    changeTable(command){
+        const _than = this
+        if(command === 'undone'){
+            this.dropdownTitle = '寰呭畬鎴愯皟搴�'
+            this.dropdownTitleStyle = {color:'#E84738',fontWeight: 'bold'}
+            this.showUnDownTable = true
+            this.queryParams.state = false
+
+        }else if(command === 'done'){
+            this.dropdownTitle = '宸插畬鎴愯皟搴�'
+            this.dropdownTitleStyle = {color:'#34BD66',fontWeight: 'bold'}
+            this.showUnDownTable = false
+            this.table.operator = null
+            this.queryParams.state = true
+        }
+        this.$nextTick(()=>{
+            _than.showOperator()
+            _than.getDataList()
+        })
+    },
     tagFinished(){
       if(this.multipleSelection.length < 1){
         this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�")
@@ -528,8 +486,7 @@
       updateState(ids).then(res=>{
         if(res.status===200){
           this.$message.success("鏇存柊鎴愬姛")
-          this.getUnFinishedData()
-          this.getFinishedData()
+          this.getDataList()
         }
       }).catch(error=>{
         console.error(error);
@@ -576,6 +533,7 @@
       })
     },
     confirmEditSchedul(){
+      const _than = this
       let data = this.scheduleEditList
       let mIds = this.multipleSelection.map(ele=>{
         return ele.mid
@@ -594,28 +552,18 @@
         "productActualTime": data[5].actualTime,
         "productPlanTime": data[5].planTime,
         "mids": mIds,
-        // "contractNo": orderObj.contractNo,
-        // "customerName": orderObj.customerName,
-        // "deliveryDate": orderObj.deliveryDate,
-        // "orderTime": orderObj.orderTime,
-        // "productType": orderObj.productType,
-        // "projectName": orderObj.projectName
       }
       fillTime(obj).then(res=>{
         if(res.status===200){
-          this.$message.success("鏇存柊鎴愬姛")
+            _than.$message.success("鏇存柊鎴愬姛")
         }else{
-          this.$message.error("鏇存柊澶辫触")
+            _than.$message.error("鏇存柊澶辫触")
         }
-        this.getScheduleById(orderObj.id)
-        this.dialogVisible = false
+        _than.dialogVisible = false
+        _than.getDataList()
       }).catch(error=>{
         console.error(error);
       })
-
-    },
-    handleClose(done){
-      done()
     },
     initTimeLine(data){
       let scheduleList = []
@@ -666,25 +614,7 @@
       }
     },
     selectionRow(val){
-      if (val.length > 1) {
-        const preVal = val.shift();
-        this.$refs.crud.toggleRowSelection(preVal, false);
-      }
-      else{
-        this.scheduleList=[]
-      }
       this.multipleSelection = val
-      this.getScheduleById(val[0].mid)
-    },
-    selectionFinishedRow(val){
-      if (val.length > 1) {
-        const preVal = val.shift();
-        this.$refs.finished.toggleRowSelection(preVal, false);
-      }
-      else{
-        this.scheduleList=[]
-      }
-      this.getScheduleById(val[0].mid)
     },
     formatDate(row, cellValue){
       if (cellValue) {
@@ -695,52 +625,9 @@
       }
       return ''
     },
-    handleSizeChange(val){
-      if(val){
-        this.page.pageSize=val
-        this.getUnFinishedData()
-      }
-    },
-    handleCurrentChange(val){
-      if(val){
-        this.page.currentPage=val
-        this.getUnFinishedData()
-      }
-    },
     // 鑾峰彇鏁版嵁鍒楄〃
     getDataList(){
-      this.getUnFinishedData()
-      this.getFinishedData()
-    },
-    getUnFinishedData() {
-      this.loading = true
-      let param = {
-        size: this.page.pageSize,
-        current: this.page.currentPage,
-        state: false
-      }
-      fetchScheduleList(param).then((res) => {
-        this.tableData = res.data.data.records
-        this.page.total = res.data.data.total
-        this.page.currentPage = res.data.data.records.pages
-        this.scheduleList = []
-      })
-      this.loading = false
-    },
-    getFinishedData() {
-      this.loading = true
-      let param = {
-        size: this.finishedPage.pageSize,
-        current: this.finishedPage.currentPage,
-        state: true
-      }
-      fetchScheduleList(param).then((res) => {
-        this.finishedTableData = res.data.data.records
-        this.finishedPage.total = res.data.data.total
-        this.finishedPage.currentPage = res.data.data.records.pages
-        this.scheduleList = []
-      })
-      this.loading = false
+        this.$refs.ttable.getDataList()
     },
     // 鍒犻櫎
     deleteHandle(row,index) {
@@ -753,77 +640,13 @@
         deleteSchedul(row.mid).then(res=>{
           if(res.status===200){
             _than.$message.success("鍒犻櫎鎴愬姛")
-            _than.getData()
+            _than.getDataList()
           }
         }).catch(error=>{
           console.error(error)
         })
       })
     },
-    //鍔ㄦ�佸悎骞舵柟娉�
-    rowCalc() {
-      this.spanArr.forEach((ele, index) => {
-        let parent
-        if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span
-        ele.span = this.rowSpan(ele.prop, parent)
-      })
-    },
-    rowSort() {
-      let propList = this.spanArr.map(ele => ele.prop)
-      this.spanArr.forEach((ele, index) => {
-        let key = ele.prop
-        this.tableData = this.tableData.sort((a, b) => {
-          let flag = true;
-          for (let i = 0; i < index; i++) {
-            let prop = this.spanArr[i].prop
-            flag = flag && a[prop] == b[prop]
-          }
-          if (flag) {
-            if (a[key] < b[key]) { return 1; }
-            else if (a[key] > b[key]) { return -1; }
-            return 0;
-          }
-          return 0;
-        })
-      })
-    },
-    rowSpan(key, parent) {
-      let list = [];
-      let position = 0;
-      this.tableData.forEach((item, index) => {
-        if (index === 0) {
-          list.push(1)
-          let position = 0;
-        } else {
-          if (this.tableData[index][key] === this.tableData[index - 1][key]) {
-            if (parent && parent[index] !== 0) {
-              list.push(1)
-              position = index
-            } else {
-              list[position] += 1;
-              list.push(0)
-            }
-          } else {
-            list.push(1)
-            position = index
-          }
-        }
-      })
-      return list
-    },
-    spanMethod({ row, column, rowIndex, columnIndex }) {
-      for (let i = 0; i < this.spanArr.length; i++) {
-        const ele = this.spanArr[i]
-        if (column.property == ele.prop) {
-          const _row = ele.span[rowIndex];
-          const _col = _row > 0 ? 1 : 0;
-          return {
-            rowspan: _row,
-            colspan: _col
-          }
-        }
-      }
-    }
   }
 }
 </script>

--
Gitblit v1.9.3