zouyu
2023-12-08 0bbc9152a6c00898593df13a57d26523b2210148
src/views/plan/productionschedul/index.vue
@@ -10,6 +10,7 @@
            @selection-change="selectionRow"
            :table-loading="loading">
            <template #menu="{ row, index }">
              <el-button type="text" icon="el-icon-edit" size="small" @click="editHandle(row, index)">编辑</el-button>
              <el-button type="text" icon="el-icon-delete" size="small" @click="deleteHandle(row, index)">删除</el-button>
            </template>
          </avue-crud>
@@ -97,6 +98,31 @@
        <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>
  </div>
</template>
@@ -104,7 +130,9 @@
import {
  fetchScheduleList,
  fetchScheduleById,
  fillTime
  fillTime,
  deleteSchedul,
  updateSchedul
} from '@/api//plan/productionschedul'
import TableForm from './template-form'
import ttable from '@/views/common/ztt-table.vue'
@@ -112,6 +140,12 @@
export default {
    data() {
    return {
      editForm:{
        id: null,
        productionRoutine: null,
        productionStatus: null,
      },
      editDialogVisible: false,
      dialogVisible: false,
      scheduleList: [],
      scheduleEditList: [],
@@ -129,10 +163,12 @@
        selection: true,
        columnBtn: false,
        index: true,
        rowKey: 'product',
        indexFixed: false,
        selectionFixed: false,
        rowKey: 'mid',
        indexLabel: '序号',
        menuAlign: 'center',
        menuWidth: 100,
        menuWidth: 130,
        editBtn: false,
        delBtn: false,
        addBtn: false,
@@ -272,7 +308,15 @@
    this.rowCalc()
  },
  watch:{
    editDialogVisible(newVal){
      if(!newVal){
        this.editForm = {
          id: null,
          productionRoutine: null,
          productionStatus: null,
        }
      }
    }
  },
  mounted() {
@@ -280,6 +324,26 @@
  beforeDestroy() {
  },
  methods: {
    confirmEdit(){
      const _than = this
      updateSchedul(this.editForm).then(res=>{
        if(res.status===200){
          _than.$message.success("更新成功")
          _than.editDialogVisible = false
          _than.getData()
        }
      }).catch(error=>{
        console.error(error);
      })
    },
    editHandle(row,index){
      if(row){
        this.editForm.id = row.mid
        this.editForm.productionRoutine = row.productionRoutine
        this.editForm.productionStatus = row.productionStatus
        this.editDialogVisible = true
      }
    },
    openEditDialog(){
      this.scheduleEditList = JSON.parse(JSON.stringify(this.scheduleList))
      this.dialogVisible = true
@@ -287,8 +351,6 @@
    confirmEditSchedul(){
      let data = this.scheduleEditList
      let orderObj = this.multipleSelection[0]
      console.log("data---",data)
      console.log("orderObj-----",orderObj)
      let obj = {
        "documentActualTime": data[0].actualTime,
        "documentPlanTime": data[0].planTime,
@@ -310,7 +372,6 @@
        "productType": orderObj.productType,
        "projectName": orderObj.projectName
      }
      console.log("obj----->>>",obj);
      fillTime(obj).then(res=>{
        if(res.status===200){
          this.$message.success("更新成功")
@@ -375,6 +436,7 @@
      }
    },
    selectionRow(val){
      console.log(val);
      if (val.length > 1) {
        const preVal = val.shift();
        this.$refs.crud.toggleRowSelection(preVal, false);
@@ -414,12 +476,20 @@
    },
    // 删除
    deleteHandle(row,index) {
      this.$confirm('是否确认删除', '提示', {
      const _than = this
      _than.$confirm('是否确认删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        deleteSchedul(row.mid).then(res=>{
          if(res.status===200){
            _than.$message.success("删除成功")
            _than.getData()
          }
        }).catch(error=>{
          console.error(error)
        })
      })
    },
    //动态合并方法