bug
zss
2024-03-20 ddaa8803892b23b99579b5971449826c06b409cb
src/views/plan/productionschedul/index.vue
@@ -1,110 +1,40 @@
<template>
  <div class="mod-config">
    <basic-container>
      <el-row>
        <el-col :span="14">
          <el-row>
            <el-col :span="24">
              <div style="height:40vh;padding: 0px 10px;">
                <span style="position: relative;top:40px;">未完成</span>
                <span style="position: relative;top:30px;left:60%;z-index: 11">
                  <el-button @click="tagFinished" size="mini" round type="primary">标记已完成</el-button>
                  <el-button size="mini" round type="primary"
                  v-if="permissions.plan_productionschedul_edit_line"
                  @click="openEditDialog">编辑时间线</el-button>
      <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>
                <avue-crud
                :data="tableData"
                ref="crud"
                :option="option"
                :span-method="spanMethod"
                @refresh-change="getUnFinishedData"
                @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>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div style="height:40vh;padding: 0px 10px;">
                <span style="position: relative;top:40px">已完成</span>
                <avue-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>
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="10" style="padding-left: 10px">
          <div style="">
            <el-card>
              <div slot="header" class="clearfix">
                <span>调度时间线</span>
              </div>
              <div style="height:70vh;overflow-y: scroll;">
                <el-timeline>
                    <el-timeline-item
                      placement="top"
                      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>
                <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
@@ -122,8 +52,8 @@
                      style="width:100%"
                      v-model="item.planTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      type="datetime"
                      placeholder="选择日期时间">
                      type="datetime"
                      placeholder="选择计划时间">
                    </el-date-picker>
                  </el-col>
                </el-row>
@@ -136,8 +66,8 @@
                      style="width:100%"
                      v-model="item.actualTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      type="datetime"
                      placeholder="选择日期时间">
                      type="datetime"
                      placeholder="选择实际时间">
                    </el-date-picker>
                  </el-col>
                </el-row>
@@ -149,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: 'id', direction: 'asc' },
        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,
@@ -201,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: 200,
        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: 180,
        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: {
@@ -474,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){
@@ -497,17 +396,88 @@
          productionStatus: null,
        }
      }
    },
    multipleSelection(newVal){
      if(newVal.length==0){
        this.scheduleList = []
      }
    }
  },
  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("请选择一条数据")
        this.$message.warning("请至少选择一条数据")
        return
      }
      let ids = this.multipleSelection.map(ele=>{
@@ -516,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);
@@ -545,25 +514,30 @@
    },
    openEditDialog(){
      if(this.multipleSelection.length<1){
        this.$message.error("请至少选择一条数据")
        this.$message.warning("请至少选择一条数据")
        return
      }
      let mIds = this.multipleSelection.map(ele=>{
        return ele.mid
      })
      checkTimeLines(mIds).then(res=>{
        console.log(res);
        if(res.data.code===200){
          this.scheduleEditList = JSON.parse(JSON.stringify(this.scheduleList))
        if(res.data.data.length==1){
          let dataList = this.initTimeLine(res.data.data[0])
          this.scheduleEditList = dataList
          this.dialogVisible = true
        }else{
          this.$message.error("选中数据的调度时间线不一致!")
        }
      }).catch(error=>{
        console.error(error);
      })
    },
    confirmEditSchedul(){
      const _than = this
      let data = this.scheduleEditList
      let orderObj = this.multipleSelection[0]
      let mIds = this.multipleSelection.map(ele=>{
        return ele.mid
      })
      let obj = {
        "documentActualTime": data[0].actualTime,
        "documentPlanTime": data[0].planTime,
@@ -577,32 +551,22 @@
        "checkPlanTime": data[4].planTime,
        "productActualTime": data[5].actualTime,
        "productPlanTime": data[5].planTime,
        "id": orderObj.id,
        "contractNo": orderObj.contractNo,
        "customerName": orderObj.customerName,
        "deliveryDate": orderObj.deliveryDate,
        "orderTime": orderObj.orderTime,
        "productType": orderObj.productType,
        "projectName": orderObj.projectName
        "mids": mIds,
      }
      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.log(error);
        console.error(error);
      })
    },
    handleClose(done){
      done()
    },
    initTimeLine(data){
      this.scheduleList = []
      let scheduleList = []
      if(data){
        let arr = [
          {
@@ -636,39 +600,21 @@
            planTime: data.productPlanTime,
          },
        ]
        this.scheduleList = arr
        scheduleList = arr
        return scheduleList
      }
    },
    getScheduleById(id){
      if(id){
        fetchScheduleById(id).then(res=>{
          this.initTimeLine(res.data.data)
          this.scheduleList = this.initTimeLine(res.data.data)
        }).catch(error=>{
          console.log(error);
          console.error(error);
        })
      }
    },
    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].id)
    },
    selectionFinishedRow(val){
      console.log(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) {
@@ -679,53 +625,14 @@
      }
      return ''
    },
    handleSizeChange(val){
      if(val){
        this.page.pageSize=val
        this.getUnFinishedData()
      }
    },
    handleCurrentChange(val){
      if(val){
        this.page.currentPage=val
        this.getUnFinishedData()
      }
    },
    // 获取数据列表
    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
    getDataList(){
        this.$refs.ttable.getDataList()
    },
    // 删除
    deleteHandle(row,index) {
      const _than = this
      _than.$confirm('是否确认删除', '提示', {
      _than.$confirm('是否确认删除该生产调度信息', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
@@ -733,126 +640,33 @@
        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>
<style>
.avue-crud__tip{
.unfinished-crud .avue-crud__tip{
  display: none;
}
.unfinished-crud .avue-crud__menu{
  display: none;
}
.finished-crud .avue-crud__tip{
  display: none;
}
.finished-crud .avue-crud__menu{
  display: none;
}
.avue-crud__pagination {
    position: relative;
    padding: 5px 0 20px 20px;
    padding: 0px 0 0px 20px;
    text-align: right;
    z-index: 10;
}
.basic-template-table .el-table__body .el-table__row td:first-child .cell {
  padding-left: 0px;
  padding-right: 0px;
}
.basic-template-table .el-table__body .el-table__row:hover {
  cursor: move;
}
.basic-template-table .el-table__body .el-table__row:hover .icon {
  display: inline-block;
}
.basic-template-table .el-table__body .el-table__row .icon {
  color: rgba(0, 0, 0, 0.45);
  font-size: 12px;
  line-height: 18px;
  display: none;
}
.aufontAll {
  font-family: aufontAll !important;
  font-size: 14px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.h-icon-all-drag {
  background: url('/img/tz.png') center center no-repeat;
  background-size: cover;
  font-size: 14px;
}
.h-icon-all-drag:before {
  content: '\E63E';
  font-size: 14px;
  visibility: hidden;
}
</style>